@spot-flow/checkout-inline-js 0.1.49-dev.8 → 0.1.49-dev.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/checkout-inline.js
CHANGED
|
@@ -642,7 +642,7 @@
|
|
|
642
642
|
}
|
|
643
643
|
|
|
644
644
|
|
|
645
|
-
`,document.head.appendChild(e)}isLoading(){return this.activeSections.size>0||this.loadingElements.size>0}getLoadingSections(){return Array.from(this.activeSections)}clearAll(){this.stopGlobalLoading(),this.activeSections.clear()}}const Hs=new tr({defaultStyle:"skeleton",fadeOpacity:.5}),Re=(()=>{let n=navigator==null?void 0:navigator.language.split("-")[0].toLowerCase(),e=new Map,t=[],i=0,s=[];const o=b=>{n!==b&&(n=b,e.clear(),a())},a=()=>{t.forEach(b=>b(n))},l=()=>{s.forEach(b=>b(i>0))},c=b=>(t.push(b),()=>{t=t.filter(w=>w!==b)}),p=async(b,w=n)=>{if(w==="en")return Array.isArray(b)?b:[b];i+=1,l();const k=Array.isArray(b)?`[${b.join("|")}]:${w}`:`${b}:${w}`;if(e.has(k))return e.get(k);try{const x=await ja({text:b,target:w||"en"});return e.set(k,x.translatedText??(Array.isArray(b)?b:[b])),x.translatedText??(Array.isArray(b)?b:[b])}catch(x){return console.error("Translation failed:",x),Array.isArray(b)?b:[b]}finally{i-=1,l()}};return{setLanguage:o,getLanguage:()=>n,translate:p,translateRecord:async(b,w=n)=>{if(w==="en")return b;const C=Object.keys(b),k=Object.values(b);return(await p(k,w)).reduce((M,
|
|
645
|
+
`,document.head.appendChild(e)}isLoading(){return this.activeSections.size>0||this.loadingElements.size>0}getLoadingSections(){return Array.from(this.activeSections)}clearAll(){this.stopGlobalLoading(),this.activeSections.clear()}}const Hs=new tr({defaultStyle:"skeleton",fadeOpacity:.5}),Re=(()=>{let n=navigator==null?void 0:navigator.language.split("-")[0].toLowerCase(),e=new Map,t=[],i=0,s=[];const o=b=>{n!==b&&(n=b,e.clear(),a())},a=()=>{t.forEach(b=>b(n))},l=()=>{s.forEach(b=>b(i>0))},c=b=>(t.push(b),()=>{t=t.filter(w=>w!==b)}),p=async(b,w=n)=>{if(w==="en")return Array.isArray(b)?b:[b];i+=1,l();const k=Array.isArray(b)?`[${b.join("|")}]:${w}`:`${b}:${w}`;if(e.has(k))return e.get(k);try{const x=await ja({text:b,target:w||"en"});return e.set(k,x.translatedText??(Array.isArray(b)?b:[b])),x.translatedText??(Array.isArray(b)?b:[b])}catch(x){return console.error("Translation failed:",x),Array.isArray(b)?b:[b]}finally{i-=1,l()}};return{setLanguage:o,getLanguage:()=>n,translate:p,translateRecord:async(b,w=n)=>{if(w==="en")return b;const C=Object.keys(b),k=Object.values(b);return(await p(k,w)).reduce((M,P,D)=>(M[C[D]]=P,M),{})},subscribe:c,subscribeToLoading:b=>(s.push(b),()=>{s=s.filter(w=>w!==b)}),getIsLoading:()=>i>0}})(),mn=navigator==null?void 0:navigator.language.split("-")[0].toLowerCase();let Ns=mn;const Ft=n=>{Ns=n},R=()=>Ns,ir=(n,e)=>{const t=Hi(n,e),i=t==null?void 0:t.language;i&&i!==mn?Ft(mn):i&&i===mn?Ft(i):!mn&&!i&&Ft("en")},Z=async(n,e)=>(await Re.translate(n,e))[0];let rn=Ls;const Os=async n=>(rn=await Re.translateRecord(Ls,n),rn);let j=Ms;const Us=async n=>{j=await Re.translateRecord(Ms,n)};let E=Ts;const Vs=async n=>{E=await Re.translateRecord(Ts,n)};let pe=_s;const Fs=async n=>{pe=await Re.translateRecord(_s,n)};let $e=Es;const Ks=async n=>{$e=await Re.translateRecord(Es,n)};let Ve=Ps;const Gs=async n=>{Ve=await Re.translateRecord(Ps,n)};let xe=Is;const js=async n=>{xe=await Re.translateRecord(Is,n)};let An=Ds;const zs=async n=>{An=await Re.translateRecord(Ds,n)};let Fe=Rs;const qs=async n=>{Fe=await Re.translateRecord(Rs,n)};let Mn=Bs;const Ws=async n=>{Mn=await Re.translateRecord(Bs,n)};function Zs(n){if(n in j)return j[n];if(n in E)return E[n];if(n in rn)return rn[n];if(n in pe)return pe[n];if(n in $e)return $e[n];if(n in Ve)return Ve[n];if(n in xe)return xe[n];if(n in An)return An[n];if(n in Mn)return Mn[n];if(n in Fe)return Fe[n]}function Ni(){document.querySelectorAll("[data-translate]").forEach(n=>{const e=n.getAttribute("data-translate");if(!e)return;const t=Zs(e);t&&(n.textContent=t)}),document.querySelectorAll("[data-translate-placeholder]").forEach(n=>{const e=n.getAttribute("data-translate-placeholder");if(!e)return;const t=Zs(e);t&&(n.placeholder=t)})}Re.subscribe(async n=>{Hs.startSmartLoading({});try{await Promise.all([Us(n),Vs(n),Os(n),(()=>{const e=sr();if(e){if(e==="card")return Fs(n);e==="transfer"?Gs(n):e==="mobile_money"?js(n):e==="eft"?zs(n):e==="opay"?Ws(n):e==="test_cards"?Ks(n):e==="stablecoin"&&qs(n)}return Promise.resolve()})()]),Ni()}catch(e){console.error("Translation error:",e),Ni()}finally{Hs.stopGlobalLoading()}Ni()});function sr(){const n=Array.from(document.querySelectorAll("[data-section]")).map(e=>e.dataset.section);for(const e of n)return e;return null}class Qs{constructor(e){d(this,"container");d(this,"onAction");d(this,"cardDetailsValues");d(this,"creditCardTypes");d(this,"merchantName");d(this,"currency");this.container=e.container,this.onAction=e.onAction,this.creditCardTypes=[...xs],this.cardDetailsValues={number:"",expiry:"",cvv:"",name:""},this.merchantName=e.merchantName,this.currency=e.currency}attachListener(){const e=document.querySelector("#pci-dss");e&&e.classList.remove("hidden");const t=document.querySelector('input[name="number"]'),i=document.querySelector('input[name="expiry"]'),s=document.querySelector('input[name="cvv"]'),o=document.querySelector('input[name="name"]'),a=document.querySelector(".details-form-button"),l=document.querySelector("#checkoutcard"),c=this.container.querySelector("#enter-details-text"),p=this.container.querySelector("#certified-text"),m=this.container.querySelector("#card-confirmation-text-one"),g=this.container.querySelector("#card-confirmation-text-two");c&&(c.innerHTML=pe["enter-card-details"]),p&&(p.innerHTML=pe.certified),m&&(m.innerHTML=pe["card-confirmation-one"]),g&&(g.innerHTML=pe["card-confirmation-two"]),t&&(t.setAttribute("placeholder",pe["card-number"]),t.addEventListener("input",f=>this.handleInputChange(f,a))),i&&i.addEventListener("input",f=>this.handleInputChange(f,a)),s&&s.addEventListener("input",f=>this.handleInputChange(f,a)),o&&(o.setAttribute("placeholder",pe["card-holder-name"]),o.addEventListener("input",f=>this.handleInputChange(f,a))),l&&l.addEventListener("submit",f=>{var b,w,C;f.preventDefault(),this.onAction(f)({pan:Qa(this.cardDetailsValues.number),cvv:this.cardDetailsValues.cvv,expiryMonth:(b=this.cardDetailsValues)==null?void 0:b.expiry.split("/")[0].trim(),expiryYear:(w=this.cardDetailsValues)==null?void 0:w.expiry.split("/")[1].trim(),...this.currency==="ZAR"&&{cardHolderName:(C=this.cardDetailsValues)==null?void 0:C.name}})})}validateCreditCard(e){if(e=e.replace(/\D/g,""),!e||e.length===0||e.length<13||e.length>19)return!1;const t=e.split("").map(s=>parseInt(s,10));for(let s=t.length-2;s>=0;s-=2){let o=t[s]*2;o>9&&(o-=9),t[s]=o}return t.reduce((s,o)=>s+o,0)%10===0}handleInputChange(e,t){var l,c,p;const i=e.target,{name:s,value:o}=i;let a=o;if(o.trim()===""){this.emptyCardState(i,s);return}if(s==="number"){a=Ja(o);const m=a.replace(/\s+/g,""),g=this.validateCreditCard(m);this.filterCreditCardType(o);const f=(l=this.creditCardTypes[0])==null?void 0:l.name;f&&xn.map(b=>{if(b.name===this.currency)if(b.cardTypes.includes(f)){const w=er[f];if(w.length>1){const C=w.some(k=>m.length===k);this.checkInputValidity(g,i,C,"card-number-invalid")}else m.length===w[0]&&this.checkInputValidity(g,i,m.length>=14&&m.length<=19,"card-number-invalid")}else this.checkInputValidity(!1,i,o.trim().length>=14&&o.trim().length<=19,"invalid-issue-card")})}else if(s==="expiry"){const m=new Date;a=Xa(o);const g=a.split("/"),f=(c=g[0])==null?void 0:c.trim(),b=(p=g[1])==null?void 0:p.trim(),w=new Date().getFullYear()%100,C=m.getMonth()+1;let k=!0;(parseInt(b)===w&&parseInt(f)<C||parseInt(b)<w)&&(k=!1),(b==null?void 0:b.length)===2&&this.checkInputValidity(k,i,g.join("").length===4,"card-expired")}else s==="cvv"?a=Ya(o):s==="name"&&(a=o);if(this.cardDetailsValues={...this.cardDetailsValues,[s]:a},i.value=a,this.validateCard())t&&t.removeAttribute("disabled");else if(t){if(t.disabled)return;t.setAttribute("disabled","")}}hideCardHolderInput(){const e=document.querySelector("#card-name");this.currency==="ZAR"?e&&(e.style.display="block"):e&&(e.style.display="none")}validateCard(){if(this.cardDetailsValues.expiry.split("/").length===2){const e=this.cardDetailsValues.expiry.split("/")[1].trim();return!!this.cardDetailsValues.number&&this.cardDetailsValues.number.length>15&&!!this.cardDetailsValues.expiry&&this.cardDetailsValues.expiry.length>3&&!!this.cardDetailsValues.cvv&&this.cardDetailsValues.cvv.length>2&&e.length===2&&(this.currency==="ZAR"?this.cardDetailsValues.name.trim()!=="":!0)}}displayCardTypes(){requestAnimationFrame(()=>{const e=this.container.querySelector("#card-type");e.innerHTML="",this.creditCardTypes.length>0?this.creditCardTypes.forEach(t=>{const i=document.createElement("div");i.classList.add("card-type"),i.innerHTML=t.icon,e.appendChild(i)}):e.innerHTML=`<svg width="25" height="16" viewBox="0 0 25 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
646
646
|
<path
|
|
647
647
|
d="M24.5827 6.33333V14.6667C24.5827 14.8877 24.4554 15.0996 24.2288 15.2559C24.0022 15.4122 23.6948 15.5 23.3743 15.5H1.62435C1.30388 15.5 0.996535 15.4122 0.769928 15.2559C0.543322 15.0996 0.416016 14.8877 0.416016 14.6667V6.33333H24.5827ZM24.5827 4.66667H0.416016V1.33333C0.416016 1.11232 0.543322 0.900358 0.769928 0.744078C0.996535 0.587797 1.30388 0.5 1.62435 0.5H23.3743C23.6948 0.5 24.0022 0.587797 24.2288 0.744078C24.4554 0.900358 24.5827 1.11232 24.5827 1.33333V4.66667ZM16.1243 11.3333V13H20.9577V11.3333H16.1243Z"
|
|
648
648
|
fill="#B6B4B9" />
|
|
@@ -668,7 +668,7 @@
|
|
|
668
668
|
</p>
|
|
669
669
|
</div>
|
|
670
670
|
</div>
|
|
671
|
-
</div>`;class Vn{constructor({container:e,amount:t,currency:i,localCurrency:s,rate:o,message:a}){d(this,"container");d(this,"amount");d(this,"currency");d(this,"localCurrency");d(this,"rate");d(this,"message");this.container=e,this.amount=t,this.currency=i,this.localCurrency=s,this.rate=o,this.message=a}renderComponent(){this.container.innerHTML=this.render();const e=document.querySelector("#success-amount"),t=document.querySelector("#payment-success-text"),i=document.querySelector("#processed-text"),s=document.querySelector("#charge-text");t&&(this.message?t.innerHTML=this.message:t.innerHTML=
|
|
671
|
+
</div>`;class Vn{constructor({container:e,amount:t,currency:i,localCurrency:s,rate:o,message:a}){d(this,"container");d(this,"amount");d(this,"currency");d(this,"localCurrency");d(this,"rate");d(this,"message");this.container=e,this.amount=t,this.currency=i,this.localCurrency=s,this.rate=o,this.message=a}renderComponent(){this.container.innerHTML=this.render();const e=document.querySelector("#success-amount"),t=document.querySelector("#payment-success-text"),i=document.querySelector("#processed-text"),s=document.querySelector("#charge-text");t&&(this.message?t.innerHTML=this.message:t.innerHTML=E["payment-success"]),i&&(i.innerHTML=E["we-processed"]),s&&(s.innerHTML=E.charge),e&&(e.innerHTML=`${this.currency!=="USD"?this.localCurrency:this.currency} ${Me(this.amount)}`)}render(){return ar}}const Js=`<div id="paymentWarning">
|
|
672
672
|
<div class="container-center min-h-[30dvh]">
|
|
673
673
|
<div>
|
|
674
674
|
<div class="container-center mb-5">
|
|
@@ -699,7 +699,7 @@
|
|
|
699
699
|
</div> -->
|
|
700
700
|
</div>
|
|
701
701
|
</div>
|
|
702
|
-
</div>`;class en{constructor({container:e,onAction:t,onReportIssue:i}){d(this,"container");d(this,"onAction");d(this,"onReportIssue");this.container=e,this.onAction=t||(()=>null),this.onReportIssue=i||(()=>null)}attachListener(){const e=this.container.querySelector("#try-again"),t=this.container.querySelector("#report-issue");e&&e.addEventListener("click",()=>{this.onAction&&this.onAction()}),t&&t.addEventListener("click",()=>{this.onReportIssue&&this.onReportIssue()})}setPaymentError(e,t,i){const s=this.container.querySelector("#payment-warning-text"),o=this.container.querySelector("#payment-warning-desc"),a=this.container.querySelector("#try-again");s&&(s.textContent=e),o&&t&&(o.textContent=t),a&&(i?a.textContent=i:a.textContent=
|
|
702
|
+
</div>`;class en{constructor({container:e,onAction:t,onReportIssue:i}){d(this,"container");d(this,"onAction");d(this,"onReportIssue");this.container=e,this.onAction=t||(()=>null),this.onReportIssue=i||(()=>null)}attachListener(){const e=this.container.querySelector("#try-again"),t=this.container.querySelector("#report-issue");e&&e.addEventListener("click",()=>{this.onAction&&this.onAction()}),t&&t.addEventListener("click",()=>{this.onReportIssue&&this.onReportIssue()})}setPaymentError(e,t,i){const s=this.container.querySelector("#payment-warning-text"),o=this.container.querySelector("#payment-warning-desc"),a=this.container.querySelector("#try-again");s&&(s.textContent=e),o&&t&&(o.textContent=t),a&&(i?a.textContent=i:a.textContent=E["try-again"]),a&&i&&(a.textContent=i),this.attachListener()}hideReportIssue(){const e=this.container.querySelector("#report-issue");e&&(e.style.display="none")}renderComponent(){this.container.innerHTML=this.render()}render(){return Js}}const rr=`<div id="checkoutcardotp" data-section="card-otp-validation">
|
|
703
703
|
<div class="w-full">
|
|
704
704
|
<div id="otp-content" class=" grid gap-4">
|
|
705
705
|
<h5 class="text-black" id="otp-message">
|
|
@@ -1062,7 +1062,7 @@
|
|
|
1062
1062
|
</div>
|
|
1063
1063
|
</form>
|
|
1064
1064
|
</div>
|
|
1065
|
-
</div>`;class fr{constructor(e){d(this,"container");d(this,"formValues");d(this,"documents");d(this,"paymentResponse");d(this,"uploadEvidenceFile");d(this,"uploadRes");d(this,"onAction");this.container=e.container,this.formValues={reason:""},this.documents=[],this.uploadEvidenceFile=e.uploadEvidenceFile,this.onAction=e.onAction,this.paymentResponse=e.paymentResponse,this.uploadRes={message:"",status:"",url:""}}attachListener(){var k,x;const e=this.container.querySelector("#trans-reference"),t=this.container.querySelector("#full-name"),i=this.container.querySelector("#email"),s=this.container.querySelector("#reason"),o=this.container.querySelector("#debited-select-field"),a=this.container.querySelector("#debited-select-label"),l=this.container.querySelector("#type-select-field"),c=this.container.querySelector("#type-select-label"),p=this.container.querySelector("#filee"),m=this.container.querySelector("#file-label"),g=this.container.querySelector("#file-text"),f=this.container.querySelector("#file-icon"),b=this.container.querySelector("#file-button"),w=this.container.querySelector("#form-button"),C=document.querySelector("#transaction-issues-form");e&&(e.value=((k=this.paymentResponse)==null?void 0:k.reference)||""),t&&t.addEventListener("input",A=>{this.handleInputChange(A,w)}),i&&(i.value=((x=this.paymentResponse.customer)==null?void 0:x.email)||""),s&&s.addEventListener("input",A=>{this.handleInputChange(A,w)}),o&&(o.value||a&&(a.classList.add("top-1/2"),a.classList.remove("inset-y-4")),o==null||o.addEventListener("change",A=>{this.handleInputChange(A,w),o.value?a&&(a.classList.add("inset-y-4"),a.classList.remove("top-1/2")):a&&(a.classList.add("top-1/2"),a.classList.remove("inset-y-4"))})),l&&(l.value||c&&(c.classList.add("top-1/2"),c.classList.remove("inset-y-4")),l==null||l.addEventListener("change",A=>{this.handleInputChange(A,w),l.value?c&&(c.classList.add("inset-y-4"),c.classList.remove("top-1/2")):c&&(c.classList.add("top-1/2"),c.classList.remove("inset-y-4"))})),p&&p.addEventListener("change",A=>{var D;A.preventDefault();const M=p.files,
|
|
1065
|
+
</div>`;class fr{constructor(e){d(this,"container");d(this,"formValues");d(this,"documents");d(this,"paymentResponse");d(this,"uploadEvidenceFile");d(this,"uploadRes");d(this,"onAction");this.container=e.container,this.formValues={reason:""},this.documents=[],this.uploadEvidenceFile=e.uploadEvidenceFile,this.onAction=e.onAction,this.paymentResponse=e.paymentResponse,this.uploadRes={message:"",status:"",url:""}}attachListener(){var k,x;const e=this.container.querySelector("#trans-reference"),t=this.container.querySelector("#full-name"),i=this.container.querySelector("#email"),s=this.container.querySelector("#reason"),o=this.container.querySelector("#debited-select-field"),a=this.container.querySelector("#debited-select-label"),l=this.container.querySelector("#type-select-field"),c=this.container.querySelector("#type-select-label"),p=this.container.querySelector("#filee"),m=this.container.querySelector("#file-label"),g=this.container.querySelector("#file-text"),f=this.container.querySelector("#file-icon"),b=this.container.querySelector("#file-button"),w=this.container.querySelector("#form-button"),C=document.querySelector("#transaction-issues-form");e&&(e.value=((k=this.paymentResponse)==null?void 0:k.reference)||""),t&&t.addEventListener("input",A=>{this.handleInputChange(A,w)}),i&&(i.value=((x=this.paymentResponse.customer)==null?void 0:x.email)||""),s&&s.addEventListener("input",A=>{this.handleInputChange(A,w)}),o&&(o.value||a&&(a.classList.add("top-1/2"),a.classList.remove("inset-y-4")),o==null||o.addEventListener("change",A=>{this.handleInputChange(A,w),o.value?a&&(a.classList.add("inset-y-4"),a.classList.remove("top-1/2")):a&&(a.classList.add("top-1/2"),a.classList.remove("inset-y-4"))})),l&&(l.value||c&&(c.classList.add("top-1/2"),c.classList.remove("inset-y-4")),l==null||l.addEventListener("change",A=>{this.handleInputChange(A,w),l.value?c&&(c.classList.add("inset-y-4"),c.classList.remove("top-1/2")):c&&(c.classList.add("top-1/2"),c.classList.remove("inset-y-4"))})),p&&p.addEventListener("change",A=>{var D;A.preventDefault();const M=p.files,P=/(\.jpg|\.jpeg|\.png|\.pdf)$/i;if(M&&M.length)if(P.exec(M[0].name)){const q=M[0];b&&(b.innerHTML=`<span class="bg-primary text-white text-sm font-semibold py-2 px-3 rounded-md" id="upload-btn-text">
|
|
1066
1066
|
Uploading...
|
|
1067
1067
|
</span>`),setTimeout(async()=>{var Q;this.uploadRes=await this.uploadEvidenceFile(q),(Q=this.uploadRes)!=null&&Q.url&&this.documents.push(this.uploadRes.url),M[0].name&&(m&&(m.textContent=this.uploadRes.message),g&&(g.textContent=`${M[0].name} | ${Math.floor(M[0].size/1024)} KB . ${new Date().toLocaleString("en-us",{day:"numeric",year:"numeric",month:"short"})}`),f&&(this.uploadRes.status==="error"?f.innerHTML=`<svg width="30" height="30" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1068
1068
|
<rect x="10" y="11.6667" width="20" height="18.3333" fill="white"/>
|
|
@@ -1087,7 +1087,7 @@
|
|
|
1087
1087
|
stroke-linejoin="round" />
|
|
1088
1088
|
</svg>`),b.innerHTML=`<span class="bg-primary text-white text-sm font-semibold py-2 px-3 rounded-md" id="upload-btn-text">
|
|
1089
1089
|
Upload
|
|
1090
|
-
</span>`,m&&(m.textContent="Tap to Upload"),g&&(g.textContent="PDF, PNG, JPG | 10MB max."))})}else return}),C&&C.addEventListener("submit",A=>{var
|
|
1090
|
+
</span>`,m&&(m.textContent="Tap to Upload"),g&&(g.textContent="PDF, PNG, JPG | 10MB max."))})}else return}),C&&C.addEventListener("submit",A=>{var P;A.preventDefault();const{reason:M}=this.formValues;this.onAction({transactionReference:(P=this.paymentResponse)==null?void 0:P.reference,reportingReason:M,disputeSource:"CUSTOMER",supportingDocuments:this.documents})})}handleInputChange(e,t){const i=e.target,{name:s,value:o}=i;if(this.formValues={...this.formValues,[s]:o},this.validateForm())t&&t.removeAttribute("disabled");else if(t){if(t.disabled)return;t.setAttribute("disabled","")}}validateForm(){return Object.values(this.formValues).every(t=>!!t)}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return br}}function Ee(n,e,t){const s=e.get("spf-redirect-url")||t;s&&setTimeout(()=>{const o=new URL(s);o.searchParams.append("status",n.status),o.searchParams.append("reference",n.reference),window.location.href=o.toString()},1800)}class it{constructor(e){d(this,"container");d(this,"transactionIssuesForm");d(this,"_currentStep");d(this,"onAction");d(this,"url");d(this,"token");d(this,"rdtCode");d(this,"paymentResponse");d(this,"paymentResponseHeaders");d(this,"callbackUrl");this.container=e.container,this._currentStep=1,this.onAction=e.onAction,this.url=e.url||"",this.token=e.token,this.rdtCode=e.rdtCode||"",this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders,this.callbackUrl=e.callBackUrl}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderTransactionIssuesComponent()}attachListener(){const e=this.container.querySelector("#back"),t=document.querySelector("#main-header"),i=document.querySelector("#main-content"),s=document.querySelector("#main-footer");e&&e.addEventListener("click",()=>{this.onAction(),t.style.display="block",i.classList.add("box-container"),s.style.display="block"})}uploadEvidenceFile(e){const t=new FormData;return t.append("file",e),Va(this.token,t,this.rdtCode,this.url).then(i=>({message:"Upload successfully",status:"success",url:i.data})).catch(i=>({message:"Error uploading file. Please try again",status:"error",url:""}))}submitDisputeForm(e){Fa(this.token,e,this.rdtCode,this.url).then(i=>{this.container.innerHTML=this.renderSuccessComponent();const s=document.querySelector("#go-back-merchant");s&&s.addEventListener("click",()=>{Ee(this.paymentResponse,this.paymentResponseHeaders,this.callbackUrl)})}).catch(i=>{this.container.innerHTML=this.renderErrorComponent();const s=document.querySelector("#go-back-merchant");s&&s.addEventListener("click",()=>{Ee(this.paymentResponse,this.paymentResponseHeaders,this.callbackUrl)})})}renderSuccessComponent(){return`<div id="paymentSuccess">
|
|
1091
1091
|
<div class="container-center min-h-[40dvh]">
|
|
1092
1092
|
<div>
|
|
1093
1093
|
<div class="container-center mb-5">
|
|
@@ -1128,9 +1128,9 @@
|
|
|
1128
1128
|
|
|
1129
1129
|
</div>
|
|
1130
1130
|
</div>
|
|
1131
|
-
</div>`}renderTransactionIssuesComponent(){const e=document.querySelector("#main-header"),t=document.querySelector("#main-content"),i=document.querySelector("#main-footer");switch(e&&(e.style.display="none"),t&&t.classList.remove("box-container"),i&&(i.style.display="none"),this.currentStep){case 1:this.transactionIssuesForm=new fr({container:this.container,uploadEvidenceFile:this.uploadEvidenceFile.bind(this),onAction:this.submitDisputeForm.bind(this),paymentResponse:this.paymentResponse}),this.transactionIssuesForm.renderComponent();break}this.attachListener()}}var ve;(function(n){n[n.Document=0]="Document",n[n.DocumentType=1]="DocumentType",n[n.Element=2]="Element",n[n.Text=3]="Text",n[n.CDATA=4]="CDATA",n[n.Comment=5]="Comment"})(ve||(ve={}));function gr(n){return n.nodeType===n.ELEMENT_NODE}function kt(n){const e=n==null?void 0:n.host;return(e==null?void 0:e.shadowRoot)===n}function St(n){return Object.prototype.toString.call(n)==="[object ShadowRoot]"}function yr(n){return n.includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n}function Cr(n){const{cssText:e}=n;if(e.split('"').length<3)return e;const t=["@import",`url(${JSON.stringify(n.href)})`];return n.layerName===""?t.push("layer"):n.layerName&&t.push(`layer(${n.layerName})`),n.supportsText&&t.push(`supports(${n.supportsText})`),n.media.length&&t.push(n.media.mediaText),t.join(" ")+";"}function Kt(n){try{const e=n.rules||n.cssRules;return e?yr(Array.from(e,Ys).join("")):null}catch{return null}}function Ys(n){let e;if(kr(n))try{e=Kt(n.styleSheet)||Cr(n)}catch{}else if(Sr(n)&&n.selectorText.includes(":"))return wr(n.cssText);return e||n.cssText}function wr(n){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return n.replace(e,"$1\\$2")}function kr(n){return"styleSheet"in n}function Sr(n){return"selectorText"in n}class Xs{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const i=(t=this.getMeta(e))===null||t===void 0?void 0:t.id;return i??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(i=>this.removeNodeFromMap(i))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const i=t.id;this.idNodeMap.set(i,e),this.nodeMetaMap.set(e,t)}replace(e,t){const i=this.getNode(e);if(i){const s=this.nodeMetaMap.get(i);s&&this.nodeMetaMap.set(t,s)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function xr(){return new Xs}function Oi({element:n,maskInputOptions:e,tagName:t,type:i,value:s,maskInputFn:o}){let a=s||"";const l=i&&Fn(i);return(e[t.toLowerCase()]||l&&e[l])&&(o?a=o(a,n):a="*".repeat(a.length)),a}function Fn(n){return n.toLowerCase()}const $s="__rrweb_original__";function Ar(n){const e=n.getContext("2d");if(!e)return!0;const t=50;for(let i=0;i<n.width;i+=t)for(let s=0;s<n.height;s+=t){const o=e.getImageData,a=$s in o?o[$s]:o;if(new Uint32Array(a.call(e,i,s,Math.min(t,n.width-i),Math.min(t,n.height-s)).data.buffer).some(c=>c!==0))return!1}return!0}function Ui(n){const e=n.type;return n.hasAttribute("data-rr-is-password")?"password":e?Fn(e):null}function eo(n,e){var t;let i;try{i=new URL(n,e??window.location.href)}catch{return null}const s=/\.([0-9a-z]+)(?:$)/i,o=i.pathname.match(s);return(t=o==null?void 0:o[1])!==null&&t!==void 0?t:null}let Mr=1;const Lr=new RegExp("[^a-z0-9-_:]"),xt=-2;function no(){return Mr++}function Tr(n){if(n instanceof HTMLFormElement)return"form";const e=Fn(n.tagName);return Lr.test(e)?"div":e}function _r(n){let e="";return n.indexOf("//")>-1?e=n.split("/").slice(0,3).join("/"):e=n.split("/")[0],e=e.split("?")[0],e}let st,to;const Er=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Pr=/^(?:[a-z+]+:)?\/\//i,Ir=/^www\..*/i,Dr=/^(data:)([^,]*),(.*)/i;function Gt(n,e){return(n||"").replace(Er,(t,i,s,o,a,l)=>{const c=s||a||l,p=i||o||"";if(!c)return t;if(Pr.test(c)||Ir.test(c))return`url(${p}${c}${p})`;if(Dr.test(c))return`url(${p}${c}${p})`;if(c[0]==="/")return`url(${p}${_r(e)+c}${p})`;const m=e.split("/"),g=c.split("/");m.pop();for(const f of g)f!=="."&&(f===".."?m.pop():m.push(f));return`url(${p}${m.join("/")}${p})`})}const Br=/^[^ \t\n\r\u000c]+/,Rr=/^[, \t\n\r\u000c]+/;function Hr(n,e){if(e.trim()==="")return e;let t=0;function i(o){let a;const l=o.exec(e.substring(t));return l?(a=l[0],t+=a.length,a):""}const s=[];for(;i(Rr),!(t>=e.length);){let o=i(Br);if(o.slice(-1)===",")o=ot(n,o.substring(0,o.length-1)),s.push(o);else{let a="";o=ot(n,o);let l=!1;for(;;){const c=e.charAt(t);if(c===""){s.push((o+a).trim());break}else if(l)c===")"&&(l=!1);else if(c===","){t+=1,s.push((o+a).trim());break}else c==="("&&(l=!0);a+=c,t+=1}}}return s.join(", ")}function ot(n,e){if(!e||e.trim()==="")return e;const t=n.createElement("a");return t.href=e,t.href}function Nr(n){return!!(n.tagName==="svg"||n.ownerSVGElement)}function Vi(){const n=document.createElement("a");return n.href="",n.href}function io(n,e,t,i){return i&&(t==="src"||t==="href"&&!(e==="use"&&i[0]==="#")||t==="xlink:href"&&i[0]!=="#"||t==="background"&&(e==="table"||e==="td"||e==="th")?ot(n,i):t==="srcset"?Hr(n,i):t==="style"?Gt(i,Vi()):e==="object"&&t==="data"?ot(n,i):i)}function so(n,e,t){return(n==="video"||n==="audio")&&e==="autoplay"}function Or(n,e,t){try{if(typeof e=="string"){if(n.classList.contains(e))return!0}else for(let i=n.classList.length;i--;){const s=n.classList[i];if(e.test(s))return!0}if(t)return n.matches(t)}catch{}return!1}function jt(n,e,t){if(!n)return!1;if(n.nodeType!==n.ELEMENT_NODE)return t?jt(n.parentNode,e,t):!1;for(let i=n.classList.length;i--;){const s=n.classList[i];if(e.test(s))return!0}return t?jt(n.parentNode,e,t):!1}function oo(n,e,t,i){try{const s=n.nodeType===n.ELEMENT_NODE?n:n.parentElement;if(s===null)return!1;if(typeof e=="string"){if(i){if(s.closest(`.${e}`))return!0}else if(s.classList.contains(e))return!0}else if(jt(s,e,i))return!0;if(t){if(i){if(s.closest(t))return!0}else if(s.matches(t))return!0}}catch{}return!1}function Ur(n,e,t){const i=n.contentWindow;if(!i)return;let s=!1,o;try{o=i.document.readyState}catch{return}if(o!=="complete"){const l=setTimeout(()=>{s||(e(),s=!0)},t);n.addEventListener("load",()=>{clearTimeout(l),s=!0,e()});return}const a="about:blank";if(i.location.href!==a||n.src===a||n.src==="")return setTimeout(e,0),n.addEventListener("load",e);n.addEventListener("load",e)}function Vr(n,e,t){let i=!1,s;try{s=n.sheet}catch{return}if(s)return;const o=setTimeout(()=>{i||(e(),i=!0)},t);n.addEventListener("load",()=>{clearTimeout(o),i=!0,e()})}function Fr(n,e){const{doc:t,mirror:i,blockClass:s,blockSelector:o,needsMask:a,inlineStylesheet:l,maskInputOptions:c={},maskTextFn:p,maskInputFn:m,dataURLOptions:g={},inlineImages:f,recordCanvas:b,keepIframeSrcFn:w,newlyAddedElement:C=!1}=e,k=Kr(t,i);switch(n.nodeType){case n.DOCUMENT_NODE:return n.compatMode!=="CSS1Compat"?{type:ve.Document,childNodes:[],compatMode:n.compatMode}:{type:ve.Document,childNodes:[]};case n.DOCUMENT_TYPE_NODE:return{type:ve.DocumentType,name:n.name,publicId:n.publicId,systemId:n.systemId,rootId:k};case n.ELEMENT_NODE:return jr(n,{doc:t,blockClass:s,blockSelector:o,inlineStylesheet:l,maskInputOptions:c,maskInputFn:m,dataURLOptions:g,inlineImages:f,recordCanvas:b,keepIframeSrcFn:w,newlyAddedElement:C,rootId:k});case n.TEXT_NODE:return Gr(n,{needsMask:a,maskTextFn:p,rootId:k});case n.CDATA_SECTION_NODE:return{type:ve.CDATA,textContent:"",rootId:k};case n.COMMENT_NODE:return{type:ve.Comment,textContent:n.textContent||"",rootId:k};default:return!1}}function Kr(n,e){if(!e.hasNode(n))return;const t=e.getId(n);return t===1?void 0:t}function Gr(n,e){var t;const{needsMask:i,maskTextFn:s,rootId:o}=e,a=n.parentNode&&n.parentNode.tagName;let l=n.textContent;const c=a==="STYLE"?!0:void 0,p=a==="SCRIPT"?!0:void 0;if(c&&l){try{n.nextSibling||n.previousSibling||!((t=n.parentNode.sheet)===null||t===void 0)&&t.cssRules&&(l=Kt(n.parentNode.sheet))}catch(m){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${m}`,n)}l=Gt(l,Vi())}return p&&(l="SCRIPT_PLACEHOLDER"),!c&&!p&&l&&i&&(l=s?s(l,n.parentElement):l.replace(/[\S]/g,"*")),{type:ve.Text,textContent:l||"",isStyle:c,rootId:o}}function jr(n,e){const{doc:t,blockClass:i,blockSelector:s,inlineStylesheet:o,maskInputOptions:a={},maskInputFn:l,dataURLOptions:c={},inlineImages:p,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:f=!1,rootId:b}=e,w=Or(n,i,s),C=Tr(n);let k={};const x=n.attributes.length;for(let M=0;M<x;M++){const E=n.attributes[M];so(C,E.name,E.value)||(k[E.name]=io(t,C,Fn(E.name),E.value))}if(C==="link"&&o){const M=Array.from(t.styleSheets).find(D=>D.href===n.href);let E=null;M&&(E=Kt(M)),E&&(delete k.rel,delete k.href,k._cssText=Gt(E,M.href))}if(C==="style"&&n.sheet&&!(n.innerText||n.textContent||"").trim().length){const M=Kt(n.sheet);M&&(k._cssText=Gt(M,Vi()))}if(C==="input"||C==="textarea"||C==="select"){const M=n.value,E=n.checked;k.type!=="radio"&&k.type!=="checkbox"&&k.type!=="submit"&&k.type!=="button"&&M?k.value=Oi({element:n,type:Ui(n),tagName:C,value:M,maskInputOptions:a,maskInputFn:l}):E&&(k.checked=E)}if(C==="option"&&(n.selected&&!a.select?k.selected=!0:delete k.selected),C==="canvas"&&m){if(n.__context==="2d")Ar(n)||(k.rr_dataURL=n.toDataURL(c.type,c.quality));else if(!("__context"in n)){const M=n.toDataURL(c.type,c.quality),E=document.createElement("canvas");E.width=n.width,E.height=n.height;const D=E.toDataURL(c.type,c.quality);M!==D&&(k.rr_dataURL=M)}}if(C==="img"&&p){st||(st=t.createElement("canvas"),to=st.getContext("2d"));const M=n,E=M.crossOrigin;M.crossOrigin="anonymous";const D=()=>{M.removeEventListener("load",D);try{st.width=M.naturalWidth,st.height=M.naturalHeight,to.drawImage(M,0,0),k.rr_dataURL=st.toDataURL(c.type,c.quality)}catch(q){console.warn(`Cannot inline img src=${M.currentSrc}! Error: ${q}`)}E?k.crossOrigin=E:M.removeAttribute("crossorigin")};M.complete&&M.naturalWidth!==0?D():M.addEventListener("load",D)}if(C==="audio"||C==="video"){const M=k;M.rr_mediaState=n.paused?"paused":"played",M.rr_mediaCurrentTime=n.currentTime,M.rr_mediaPlaybackRate=n.playbackRate,M.rr_mediaMuted=n.muted,M.rr_mediaLoop=n.loop,M.rr_mediaVolume=n.volume}if(f||(n.scrollLeft&&(k.rr_scrollLeft=n.scrollLeft),n.scrollTop&&(k.rr_scrollTop=n.scrollTop)),w){const{width:M,height:E}=n.getBoundingClientRect();k={class:k.class,rr_width:`${M}px`,rr_height:`${E}px`}}C==="iframe"&&!g(k.src)&&(n.contentDocument||(k.rr_src=k.src),delete k.src);let A;try{customElements.get(C)&&(A=!0)}catch{}return{type:ve.Element,tagName:C,attributes:k,childNodes:[],isSVG:Nr(n)||void 0,needBlock:w,rootId:b,isCustom:A}}function ae(n){return n==null?"":n.toLowerCase()}function zr(n,e){if(e.comment&&n.type===ve.Comment)return!0;if(n.type===ve.Element){if(e.script&&(n.tagName==="script"||n.tagName==="link"&&(n.attributes.rel==="preload"||n.attributes.rel==="modulepreload")&&n.attributes.as==="script"||n.tagName==="link"&&n.attributes.rel==="prefetch"&&typeof n.attributes.href=="string"&&eo(n.attributes.href)==="js"))return!0;if(e.headFavicon&&(n.tagName==="link"&&n.attributes.rel==="shortcut icon"||n.tagName==="meta"&&(ae(n.attributes.name).match(/^msapplication-tile(image|color)$/)||ae(n.attributes.name)==="application-name"||ae(n.attributes.rel)==="icon"||ae(n.attributes.rel)==="apple-touch-icon"||ae(n.attributes.rel)==="shortcut icon")))return!0;if(n.tagName==="meta"){if(e.headMetaDescKeywords&&ae(n.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ae(n.attributes.property).match(/^(og|twitter|fb):/)||ae(n.attributes.name).match(/^(og|twitter):/)||ae(n.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(ae(n.attributes.name)==="robots"||ae(n.attributes.name)==="googlebot"||ae(n.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&n.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(ae(n.attributes.name)==="author"||ae(n.attributes.name)==="generator"||ae(n.attributes.name)==="framework"||ae(n.attributes.name)==="publisher"||ae(n.attributes.name)==="progid"||ae(n.attributes.property).match(/^article:/)||ae(n.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(ae(n.attributes.name)==="google-site-verification"||ae(n.attributes.name)==="yandex-verification"||ae(n.attributes.name)==="csrf-token"||ae(n.attributes.name)==="p:domain_verify"||ae(n.attributes.name)==="verify-v1"||ae(n.attributes.name)==="verification"||ae(n.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function at(n,e){const{doc:t,mirror:i,blockClass:s,blockSelector:o,maskTextClass:a,maskTextSelector:l,skipChild:c=!1,inlineStylesheet:p=!0,maskInputOptions:m={},maskTextFn:g,maskInputFn:f,slimDOMOptions:b,dataURLOptions:w={},inlineImages:C=!1,recordCanvas:k=!1,onSerialize:x,onIframeLoad:A,iframeLoadTimeout:M=5e3,onStylesheetLoad:E,stylesheetLoadTimeout:D=5e3,keepIframeSrcFn:q=()=>!1,newlyAddedElement:Q=!1}=e;let{needsMask:K}=e,{preserveWhiteSpace:W=!0}=e;!K&&n.childNodes&&(K=oo(n,a,l,K===void 0));const de=Fr(n,{doc:t,mirror:i,blockClass:s,blockSelector:o,needsMask:K,inlineStylesheet:p,maskInputOptions:m,maskTextFn:g,maskInputFn:f,dataURLOptions:w,inlineImages:C,recordCanvas:k,keepIframeSrcFn:q,newlyAddedElement:Q});if(!de)return console.warn(n,"not serialized"),null;let Le;i.hasNode(n)?Le=i.getId(n):zr(de,b)||!W&&de.type===ve.Text&&!de.isStyle&&!de.textContent.replace(/^\s+|\s+$/gm,"").length?Le=xt:Le=no();const G=Object.assign(de,{id:Le});if(i.add(n,G),Le===xt)return null;x&&x(n);let Oe=!c;if(G.type===ve.Element){Oe=Oe&&!G.needBlock,delete G.needBlock;const ge=n.shadowRoot;ge&&St(ge)&&(G.isShadowHost=!0)}if((G.type===ve.Document||G.type===ve.Element)&&Oe){b.headWhitespace&&G.type===ve.Element&&G.tagName==="head"&&(W=!1);const ge={doc:t,mirror:i,blockClass:s,blockSelector:o,needsMask:K,maskTextClass:a,maskTextSelector:l,skipChild:c,inlineStylesheet:p,maskInputOptions:m,maskTextFn:g,maskInputFn:f,slimDOMOptions:b,dataURLOptions:w,inlineImages:C,recordCanvas:k,preserveWhiteSpace:W,onSerialize:x,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:E,stylesheetLoadTimeout:D,keepIframeSrcFn:q};if(!(G.type===ve.Element&&G.tagName==="textarea"&&G.attributes.value!==void 0))for(const Ge of Array.from(n.childNodes)){const Te=at(Ge,ge);Te&&G.childNodes.push(Te)}if(gr(n)&&n.shadowRoot)for(const Ge of Array.from(n.shadowRoot.childNodes)){const Te=at(Ge,ge);Te&&(St(n.shadowRoot)&&(Te.isShadow=!0),G.childNodes.push(Te))}}return n.parentNode&&kt(n.parentNode)&&St(n.parentNode)&&(G.isShadow=!0),G.type===ve.Element&&G.tagName==="iframe"&&Ur(n,()=>{const ge=n.contentDocument;if(ge&&A){const Ge=at(ge,{doc:ge,mirror:i,blockClass:s,blockSelector:o,needsMask:K,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:p,maskInputOptions:m,maskTextFn:g,maskInputFn:f,slimDOMOptions:b,dataURLOptions:w,inlineImages:C,recordCanvas:k,preserveWhiteSpace:W,onSerialize:x,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:E,stylesheetLoadTimeout:D,keepIframeSrcFn:q});Ge&&A(n,Ge)}},M),G.type===ve.Element&&G.tagName==="link"&&typeof G.attributes.rel=="string"&&(G.attributes.rel==="stylesheet"||G.attributes.rel==="preload"&&typeof G.attributes.href=="string"&&eo(G.attributes.href)==="css")&&Vr(n,()=>{if(E){const ge=at(n,{doc:t,mirror:i,blockClass:s,blockSelector:o,needsMask:K,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:p,maskInputOptions:m,maskTextFn:g,maskInputFn:f,slimDOMOptions:b,dataURLOptions:w,inlineImages:C,recordCanvas:k,preserveWhiteSpace:W,onSerialize:x,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:E,stylesheetLoadTimeout:D,keepIframeSrcFn:q});ge&&E(n,ge)}},D),G}function qr(n,e){const{mirror:t=new Xs,blockClass:i="rr-block",blockSelector:s=null,maskTextClass:o="rr-mask",maskTextSelector:a=null,inlineStylesheet:l=!0,inlineImages:c=!1,recordCanvas:p=!1,maskAllInputs:m=!1,maskTextFn:g,maskInputFn:f,slimDOM:b=!1,dataURLOptions:w,preserveWhiteSpace:C,onSerialize:k,onIframeLoad:x,iframeLoadTimeout:A,onStylesheetLoad:M,stylesheetLoadTimeout:E,keepIframeSrcFn:D=()=>!1}=e||{};return at(n,{doc:n,mirror:t,blockClass:i,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:l,maskInputOptions:m===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:m===!1?{password:!0}:m,maskTextFn:g,maskInputFn:f,slimDOMOptions:b===!0||b==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:b==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:b===!1?{}:b,dataURLOptions:w,inlineImages:c,recordCanvas:p,preserveWhiteSpace:C,onSerialize:k,onIframeLoad:x,iframeLoadTimeout:A,onStylesheetLoad:M,stylesheetLoadTimeout:E,keepIframeSrcFn:D,newlyAddedElement:!1})}function He(n,e,t=document){const i={capture:!0,passive:!0};return t.addEventListener(n,e,i),()=>t.removeEventListener(n,e,i)}const rt=`Please stop import mirror directly. Instead of that,\r
|
|
1131
|
+
</div>`}renderTransactionIssuesComponent(){const e=document.querySelector("#main-header"),t=document.querySelector("#main-content"),i=document.querySelector("#main-footer");switch(e&&(e.style.display="none"),t&&t.classList.remove("box-container"),i&&(i.style.display="none"),this.currentStep){case 1:this.transactionIssuesForm=new fr({container:this.container,uploadEvidenceFile:this.uploadEvidenceFile.bind(this),onAction:this.submitDisputeForm.bind(this),paymentResponse:this.paymentResponse}),this.transactionIssuesForm.renderComponent();break}this.attachListener()}}var ve;(function(n){n[n.Document=0]="Document",n[n.DocumentType=1]="DocumentType",n[n.Element=2]="Element",n[n.Text=3]="Text",n[n.CDATA=4]="CDATA",n[n.Comment=5]="Comment"})(ve||(ve={}));function gr(n){return n.nodeType===n.ELEMENT_NODE}function kt(n){const e=n==null?void 0:n.host;return(e==null?void 0:e.shadowRoot)===n}function St(n){return Object.prototype.toString.call(n)==="[object ShadowRoot]"}function yr(n){return n.includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n}function Cr(n){const{cssText:e}=n;if(e.split('"').length<3)return e;const t=["@import",`url(${JSON.stringify(n.href)})`];return n.layerName===""?t.push("layer"):n.layerName&&t.push(`layer(${n.layerName})`),n.supportsText&&t.push(`supports(${n.supportsText})`),n.media.length&&t.push(n.media.mediaText),t.join(" ")+";"}function Kt(n){try{const e=n.rules||n.cssRules;return e?yr(Array.from(e,Ys).join("")):null}catch{return null}}function Ys(n){let e;if(kr(n))try{e=Kt(n.styleSheet)||Cr(n)}catch{}else if(Sr(n)&&n.selectorText.includes(":"))return wr(n.cssText);return e||n.cssText}function wr(n){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return n.replace(e,"$1\\$2")}function kr(n){return"styleSheet"in n}function Sr(n){return"selectorText"in n}class Xs{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const i=(t=this.getMeta(e))===null||t===void 0?void 0:t.id;return i??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(i=>this.removeNodeFromMap(i))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const i=t.id;this.idNodeMap.set(i,e),this.nodeMetaMap.set(e,t)}replace(e,t){const i=this.getNode(e);if(i){const s=this.nodeMetaMap.get(i);s&&this.nodeMetaMap.set(t,s)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function xr(){return new Xs}function Oi({element:n,maskInputOptions:e,tagName:t,type:i,value:s,maskInputFn:o}){let a=s||"";const l=i&&Fn(i);return(e[t.toLowerCase()]||l&&e[l])&&(o?a=o(a,n):a="*".repeat(a.length)),a}function Fn(n){return n.toLowerCase()}const $s="__rrweb_original__";function Ar(n){const e=n.getContext("2d");if(!e)return!0;const t=50;for(let i=0;i<n.width;i+=t)for(let s=0;s<n.height;s+=t){const o=e.getImageData,a=$s in o?o[$s]:o;if(new Uint32Array(a.call(e,i,s,Math.min(t,n.width-i),Math.min(t,n.height-s)).data.buffer).some(c=>c!==0))return!1}return!0}function Ui(n){const e=n.type;return n.hasAttribute("data-rr-is-password")?"password":e?Fn(e):null}function eo(n,e){var t;let i;try{i=new URL(n,e??window.location.href)}catch{return null}const s=/\.([0-9a-z]+)(?:$)/i,o=i.pathname.match(s);return(t=o==null?void 0:o[1])!==null&&t!==void 0?t:null}let Mr=1;const Lr=new RegExp("[^a-z0-9-_:]"),xt=-2;function no(){return Mr++}function Tr(n){if(n instanceof HTMLFormElement)return"form";const e=Fn(n.tagName);return Lr.test(e)?"div":e}function _r(n){let e="";return n.indexOf("//")>-1?e=n.split("/").slice(0,3).join("/"):e=n.split("/")[0],e=e.split("?")[0],e}let st,to;const Er=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Pr=/^(?:[a-z+]+:)?\/\//i,Ir=/^www\..*/i,Dr=/^(data:)([^,]*),(.*)/i;function Gt(n,e){return(n||"").replace(Er,(t,i,s,o,a,l)=>{const c=s||a||l,p=i||o||"";if(!c)return t;if(Pr.test(c)||Ir.test(c))return`url(${p}${c}${p})`;if(Dr.test(c))return`url(${p}${c}${p})`;if(c[0]==="/")return`url(${p}${_r(e)+c}${p})`;const m=e.split("/"),g=c.split("/");m.pop();for(const f of g)f!=="."&&(f===".."?m.pop():m.push(f));return`url(${p}${m.join("/")}${p})`})}const Br=/^[^ \t\n\r\u000c]+/,Rr=/^[, \t\n\r\u000c]+/;function Hr(n,e){if(e.trim()==="")return e;let t=0;function i(o){let a;const l=o.exec(e.substring(t));return l?(a=l[0],t+=a.length,a):""}const s=[];for(;i(Rr),!(t>=e.length);){let o=i(Br);if(o.slice(-1)===",")o=ot(n,o.substring(0,o.length-1)),s.push(o);else{let a="";o=ot(n,o);let l=!1;for(;;){const c=e.charAt(t);if(c===""){s.push((o+a).trim());break}else if(l)c===")"&&(l=!1);else if(c===","){t+=1,s.push((o+a).trim());break}else c==="("&&(l=!0);a+=c,t+=1}}}return s.join(", ")}function ot(n,e){if(!e||e.trim()==="")return e;const t=n.createElement("a");return t.href=e,t.href}function Nr(n){return!!(n.tagName==="svg"||n.ownerSVGElement)}function Vi(){const n=document.createElement("a");return n.href="",n.href}function io(n,e,t,i){return i&&(t==="src"||t==="href"&&!(e==="use"&&i[0]==="#")||t==="xlink:href"&&i[0]!=="#"||t==="background"&&(e==="table"||e==="td"||e==="th")?ot(n,i):t==="srcset"?Hr(n,i):t==="style"?Gt(i,Vi()):e==="object"&&t==="data"?ot(n,i):i)}function so(n,e,t){return(n==="video"||n==="audio")&&e==="autoplay"}function Or(n,e,t){try{if(typeof e=="string"){if(n.classList.contains(e))return!0}else for(let i=n.classList.length;i--;){const s=n.classList[i];if(e.test(s))return!0}if(t)return n.matches(t)}catch{}return!1}function jt(n,e,t){if(!n)return!1;if(n.nodeType!==n.ELEMENT_NODE)return t?jt(n.parentNode,e,t):!1;for(let i=n.classList.length;i--;){const s=n.classList[i];if(e.test(s))return!0}return t?jt(n.parentNode,e,t):!1}function oo(n,e,t,i){try{const s=n.nodeType===n.ELEMENT_NODE?n:n.parentElement;if(s===null)return!1;if(typeof e=="string"){if(i){if(s.closest(`.${e}`))return!0}else if(s.classList.contains(e))return!0}else if(jt(s,e,i))return!0;if(t){if(i){if(s.closest(t))return!0}else if(s.matches(t))return!0}}catch{}return!1}function Ur(n,e,t){const i=n.contentWindow;if(!i)return;let s=!1,o;try{o=i.document.readyState}catch{return}if(o!=="complete"){const l=setTimeout(()=>{s||(e(),s=!0)},t);n.addEventListener("load",()=>{clearTimeout(l),s=!0,e()});return}const a="about:blank";if(i.location.href!==a||n.src===a||n.src==="")return setTimeout(e,0),n.addEventListener("load",e);n.addEventListener("load",e)}function Vr(n,e,t){let i=!1,s;try{s=n.sheet}catch{return}if(s)return;const o=setTimeout(()=>{i||(e(),i=!0)},t);n.addEventListener("load",()=>{clearTimeout(o),i=!0,e()})}function Fr(n,e){const{doc:t,mirror:i,blockClass:s,blockSelector:o,needsMask:a,inlineStylesheet:l,maskInputOptions:c={},maskTextFn:p,maskInputFn:m,dataURLOptions:g={},inlineImages:f,recordCanvas:b,keepIframeSrcFn:w,newlyAddedElement:C=!1}=e,k=Kr(t,i);switch(n.nodeType){case n.DOCUMENT_NODE:return n.compatMode!=="CSS1Compat"?{type:ve.Document,childNodes:[],compatMode:n.compatMode}:{type:ve.Document,childNodes:[]};case n.DOCUMENT_TYPE_NODE:return{type:ve.DocumentType,name:n.name,publicId:n.publicId,systemId:n.systemId,rootId:k};case n.ELEMENT_NODE:return jr(n,{doc:t,blockClass:s,blockSelector:o,inlineStylesheet:l,maskInputOptions:c,maskInputFn:m,dataURLOptions:g,inlineImages:f,recordCanvas:b,keepIframeSrcFn:w,newlyAddedElement:C,rootId:k});case n.TEXT_NODE:return Gr(n,{needsMask:a,maskTextFn:p,rootId:k});case n.CDATA_SECTION_NODE:return{type:ve.CDATA,textContent:"",rootId:k};case n.COMMENT_NODE:return{type:ve.Comment,textContent:n.textContent||"",rootId:k};default:return!1}}function Kr(n,e){if(!e.hasNode(n))return;const t=e.getId(n);return t===1?void 0:t}function Gr(n,e){var t;const{needsMask:i,maskTextFn:s,rootId:o}=e,a=n.parentNode&&n.parentNode.tagName;let l=n.textContent;const c=a==="STYLE"?!0:void 0,p=a==="SCRIPT"?!0:void 0;if(c&&l){try{n.nextSibling||n.previousSibling||!((t=n.parentNode.sheet)===null||t===void 0)&&t.cssRules&&(l=Kt(n.parentNode.sheet))}catch(m){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${m}`,n)}l=Gt(l,Vi())}return p&&(l="SCRIPT_PLACEHOLDER"),!c&&!p&&l&&i&&(l=s?s(l,n.parentElement):l.replace(/[\S]/g,"*")),{type:ve.Text,textContent:l||"",isStyle:c,rootId:o}}function jr(n,e){const{doc:t,blockClass:i,blockSelector:s,inlineStylesheet:o,maskInputOptions:a={},maskInputFn:l,dataURLOptions:c={},inlineImages:p,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:f=!1,rootId:b}=e,w=Or(n,i,s),C=Tr(n);let k={};const x=n.attributes.length;for(let M=0;M<x;M++){const P=n.attributes[M];so(C,P.name,P.value)||(k[P.name]=io(t,C,Fn(P.name),P.value))}if(C==="link"&&o){const M=Array.from(t.styleSheets).find(D=>D.href===n.href);let P=null;M&&(P=Kt(M)),P&&(delete k.rel,delete k.href,k._cssText=Gt(P,M.href))}if(C==="style"&&n.sheet&&!(n.innerText||n.textContent||"").trim().length){const M=Kt(n.sheet);M&&(k._cssText=Gt(M,Vi()))}if(C==="input"||C==="textarea"||C==="select"){const M=n.value,P=n.checked;k.type!=="radio"&&k.type!=="checkbox"&&k.type!=="submit"&&k.type!=="button"&&M?k.value=Oi({element:n,type:Ui(n),tagName:C,value:M,maskInputOptions:a,maskInputFn:l}):P&&(k.checked=P)}if(C==="option"&&(n.selected&&!a.select?k.selected=!0:delete k.selected),C==="canvas"&&m){if(n.__context==="2d")Ar(n)||(k.rr_dataURL=n.toDataURL(c.type,c.quality));else if(!("__context"in n)){const M=n.toDataURL(c.type,c.quality),P=document.createElement("canvas");P.width=n.width,P.height=n.height;const D=P.toDataURL(c.type,c.quality);M!==D&&(k.rr_dataURL=M)}}if(C==="img"&&p){st||(st=t.createElement("canvas"),to=st.getContext("2d"));const M=n,P=M.crossOrigin;M.crossOrigin="anonymous";const D=()=>{M.removeEventListener("load",D);try{st.width=M.naturalWidth,st.height=M.naturalHeight,to.drawImage(M,0,0),k.rr_dataURL=st.toDataURL(c.type,c.quality)}catch(q){console.warn(`Cannot inline img src=${M.currentSrc}! Error: ${q}`)}P?k.crossOrigin=P:M.removeAttribute("crossorigin")};M.complete&&M.naturalWidth!==0?D():M.addEventListener("load",D)}if(C==="audio"||C==="video"){const M=k;M.rr_mediaState=n.paused?"paused":"played",M.rr_mediaCurrentTime=n.currentTime,M.rr_mediaPlaybackRate=n.playbackRate,M.rr_mediaMuted=n.muted,M.rr_mediaLoop=n.loop,M.rr_mediaVolume=n.volume}if(f||(n.scrollLeft&&(k.rr_scrollLeft=n.scrollLeft),n.scrollTop&&(k.rr_scrollTop=n.scrollTop)),w){const{width:M,height:P}=n.getBoundingClientRect();k={class:k.class,rr_width:`${M}px`,rr_height:`${P}px`}}C==="iframe"&&!g(k.src)&&(n.contentDocument||(k.rr_src=k.src),delete k.src);let A;try{customElements.get(C)&&(A=!0)}catch{}return{type:ve.Element,tagName:C,attributes:k,childNodes:[],isSVG:Nr(n)||void 0,needBlock:w,rootId:b,isCustom:A}}function ae(n){return n==null?"":n.toLowerCase()}function zr(n,e){if(e.comment&&n.type===ve.Comment)return!0;if(n.type===ve.Element){if(e.script&&(n.tagName==="script"||n.tagName==="link"&&(n.attributes.rel==="preload"||n.attributes.rel==="modulepreload")&&n.attributes.as==="script"||n.tagName==="link"&&n.attributes.rel==="prefetch"&&typeof n.attributes.href=="string"&&eo(n.attributes.href)==="js"))return!0;if(e.headFavicon&&(n.tagName==="link"&&n.attributes.rel==="shortcut icon"||n.tagName==="meta"&&(ae(n.attributes.name).match(/^msapplication-tile(image|color)$/)||ae(n.attributes.name)==="application-name"||ae(n.attributes.rel)==="icon"||ae(n.attributes.rel)==="apple-touch-icon"||ae(n.attributes.rel)==="shortcut icon")))return!0;if(n.tagName==="meta"){if(e.headMetaDescKeywords&&ae(n.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ae(n.attributes.property).match(/^(og|twitter|fb):/)||ae(n.attributes.name).match(/^(og|twitter):/)||ae(n.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(ae(n.attributes.name)==="robots"||ae(n.attributes.name)==="googlebot"||ae(n.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&n.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(ae(n.attributes.name)==="author"||ae(n.attributes.name)==="generator"||ae(n.attributes.name)==="framework"||ae(n.attributes.name)==="publisher"||ae(n.attributes.name)==="progid"||ae(n.attributes.property).match(/^article:/)||ae(n.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(ae(n.attributes.name)==="google-site-verification"||ae(n.attributes.name)==="yandex-verification"||ae(n.attributes.name)==="csrf-token"||ae(n.attributes.name)==="p:domain_verify"||ae(n.attributes.name)==="verify-v1"||ae(n.attributes.name)==="verification"||ae(n.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function at(n,e){const{doc:t,mirror:i,blockClass:s,blockSelector:o,maskTextClass:a,maskTextSelector:l,skipChild:c=!1,inlineStylesheet:p=!0,maskInputOptions:m={},maskTextFn:g,maskInputFn:f,slimDOMOptions:b,dataURLOptions:w={},inlineImages:C=!1,recordCanvas:k=!1,onSerialize:x,onIframeLoad:A,iframeLoadTimeout:M=5e3,onStylesheetLoad:P,stylesheetLoadTimeout:D=5e3,keepIframeSrcFn:q=()=>!1,newlyAddedElement:Q=!1}=e;let{needsMask:K}=e,{preserveWhiteSpace:W=!0}=e;!K&&n.childNodes&&(K=oo(n,a,l,K===void 0));const de=Fr(n,{doc:t,mirror:i,blockClass:s,blockSelector:o,needsMask:K,inlineStylesheet:p,maskInputOptions:m,maskTextFn:g,maskInputFn:f,dataURLOptions:w,inlineImages:C,recordCanvas:k,keepIframeSrcFn:q,newlyAddedElement:Q});if(!de)return console.warn(n,"not serialized"),null;let Le;i.hasNode(n)?Le=i.getId(n):zr(de,b)||!W&&de.type===ve.Text&&!de.isStyle&&!de.textContent.replace(/^\s+|\s+$/gm,"").length?Le=xt:Le=no();const G=Object.assign(de,{id:Le});if(i.add(n,G),Le===xt)return null;x&&x(n);let Oe=!c;if(G.type===ve.Element){Oe=Oe&&!G.needBlock,delete G.needBlock;const ge=n.shadowRoot;ge&&St(ge)&&(G.isShadowHost=!0)}if((G.type===ve.Document||G.type===ve.Element)&&Oe){b.headWhitespace&&G.type===ve.Element&&G.tagName==="head"&&(W=!1);const ge={doc:t,mirror:i,blockClass:s,blockSelector:o,needsMask:K,maskTextClass:a,maskTextSelector:l,skipChild:c,inlineStylesheet:p,maskInputOptions:m,maskTextFn:g,maskInputFn:f,slimDOMOptions:b,dataURLOptions:w,inlineImages:C,recordCanvas:k,preserveWhiteSpace:W,onSerialize:x,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:P,stylesheetLoadTimeout:D,keepIframeSrcFn:q};if(!(G.type===ve.Element&&G.tagName==="textarea"&&G.attributes.value!==void 0))for(const Ge of Array.from(n.childNodes)){const Te=at(Ge,ge);Te&&G.childNodes.push(Te)}if(gr(n)&&n.shadowRoot)for(const Ge of Array.from(n.shadowRoot.childNodes)){const Te=at(Ge,ge);Te&&(St(n.shadowRoot)&&(Te.isShadow=!0),G.childNodes.push(Te))}}return n.parentNode&&kt(n.parentNode)&&St(n.parentNode)&&(G.isShadow=!0),G.type===ve.Element&&G.tagName==="iframe"&&Ur(n,()=>{const ge=n.contentDocument;if(ge&&A){const Ge=at(ge,{doc:ge,mirror:i,blockClass:s,blockSelector:o,needsMask:K,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:p,maskInputOptions:m,maskTextFn:g,maskInputFn:f,slimDOMOptions:b,dataURLOptions:w,inlineImages:C,recordCanvas:k,preserveWhiteSpace:W,onSerialize:x,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:P,stylesheetLoadTimeout:D,keepIframeSrcFn:q});Ge&&A(n,Ge)}},M),G.type===ve.Element&&G.tagName==="link"&&typeof G.attributes.rel=="string"&&(G.attributes.rel==="stylesheet"||G.attributes.rel==="preload"&&typeof G.attributes.href=="string"&&eo(G.attributes.href)==="css")&&Vr(n,()=>{if(P){const ge=at(n,{doc:t,mirror:i,blockClass:s,blockSelector:o,needsMask:K,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:p,maskInputOptions:m,maskTextFn:g,maskInputFn:f,slimDOMOptions:b,dataURLOptions:w,inlineImages:C,recordCanvas:k,preserveWhiteSpace:W,onSerialize:x,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:P,stylesheetLoadTimeout:D,keepIframeSrcFn:q});ge&&P(n,ge)}},D),G}function qr(n,e){const{mirror:t=new Xs,blockClass:i="rr-block",blockSelector:s=null,maskTextClass:o="rr-mask",maskTextSelector:a=null,inlineStylesheet:l=!0,inlineImages:c=!1,recordCanvas:p=!1,maskAllInputs:m=!1,maskTextFn:g,maskInputFn:f,slimDOM:b=!1,dataURLOptions:w,preserveWhiteSpace:C,onSerialize:k,onIframeLoad:x,iframeLoadTimeout:A,onStylesheetLoad:M,stylesheetLoadTimeout:P,keepIframeSrcFn:D=()=>!1}=e||{};return at(n,{doc:n,mirror:t,blockClass:i,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:l,maskInputOptions:m===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:m===!1?{password:!0}:m,maskTextFn:g,maskInputFn:f,slimDOMOptions:b===!0||b==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:b==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:b===!1?{}:b,dataURLOptions:w,inlineImages:c,recordCanvas:p,preserveWhiteSpace:C,onSerialize:k,onIframeLoad:x,iframeLoadTimeout:A,onStylesheetLoad:M,stylesheetLoadTimeout:P,keepIframeSrcFn:D,newlyAddedElement:!1})}function He(n,e,t=document){const i={capture:!0,passive:!0};return t.addEventListener(n,e,i),()=>t.removeEventListener(n,e,i)}const rt=`Please stop import mirror directly. Instead of that,\r
|
|
1132
1132
|
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
1133
|
-
or you can use record.mirror to access the mirror instance during recording.`;let ao={map:{},getId(){return console.error(rt),-1},getNode(){return console.error(rt),null},removeNodeFromMap(){console.error(rt)},has(){return console.error(rt),!1},reset(){console.error(rt)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(ao=new Proxy(ao,{get(n,e,t){return e==="map"&&console.error(rt),Reflect.get(n,e,t)}}));function At(n,e,t={}){let i=null,s=0;return function(...o){const a=Date.now();!s&&t.leading===!1&&(s=a);const l=e-(a-s),c=this;l<=0||l>e?(i&&(clearTimeout(i),i=null),s=a,n.apply(c,o)):!i&&t.trailing!==!1&&(i=setTimeout(()=>{s=t.leading===!1?0:Date.now(),i=null,n.apply(c,o)},l))}}function zt(n,e,t,i,s=window){const o=s.Object.getOwnPropertyDescriptor(n,e);return s.Object.defineProperty(n,e,i?t:{set(a){setTimeout(()=>{t.set.call(this,a)},0),o&&o.set&&o.set.call(this,a)}}),()=>zt(n,e,o||{},!0)}function lt(n,e,t){try{if(!(e in n))return()=>{};const i=n[e],s=t(i);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i}})),n[e]=s,()=>{n[e]=i}}catch{return()=>{}}}let qt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(qt=()=>new Date().getTime());function ro(n){var e,t,i,s,o,a;const l=n.document;return{left:l.scrollingElement?l.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:(l==null?void 0:l.documentElement.scrollLeft)||((t=(e=l==null?void 0:l.body)===null||e===void 0?void 0:e.parentElement)===null||t===void 0?void 0:t.scrollLeft)||((i=l==null?void 0:l.body)===null||i===void 0?void 0:i.scrollLeft)||0,top:l.scrollingElement?l.scrollingElement.scrollTop:n.pageYOffset!==void 0?n.pageYOffset:(l==null?void 0:l.documentElement.scrollTop)||((o=(s=l==null?void 0:l.body)===null||s===void 0?void 0:s.parentElement)===null||o===void 0?void 0:o.scrollTop)||((a=l==null?void 0:l.body)===null||a===void 0?void 0:a.scrollTop)||0}}function lo(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function co(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function uo(n){return n?n.nodeType===n.ELEMENT_NODE?n:n.parentElement:null}function Ne(n,e,t,i){if(!n)return!1;const s=uo(n);if(!s)return!1;try{if(typeof e=="string"){if(s.classList.contains(e)||i&&s.closest("."+e)!==null)return!0}else if(jt(s,e,i))return!0}catch{}return!!(t&&(s.matches(t)||i&&s.closest(t)!==null))}function Wr(n,e){return e.getId(n)!==-1}function Fi(n,e){return e.getId(n)===xt}function ho(n,e){if(kt(n))return!1;const t=e.getId(n);return e.has(t)?n.parentNode&&n.parentNode.nodeType===n.DOCUMENT_NODE?!1:n.parentNode?ho(n.parentNode,e):!0:!0}function Ki(n){return!!n.changedTouches}function Zr(n=window){"NodeList"in n&&!n.NodeList.prototype.forEach&&(n.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in n&&!n.DOMTokenList.prototype.forEach&&(n.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===t)return!0;while(t=t&&t.parentNode);return!1})}function mo(n,e){return!!(n.nodeName==="IFRAME"&&e.getMeta(n))}function po(n,e){return!!(n.nodeName==="LINK"&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute&&n.getAttribute("rel")==="stylesheet"&&e.getMeta(n))}function Gi(n){return!!(n!=null&&n.shadowRoot)}class Qr{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return(t=this.styleIDMap.get(e))!==null&&t!==void 0?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let i;return t===void 0?i=this.id++:i=t,this.styleIDMap.set(e,i),this.idStyleMap.set(i,e),i}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function vo(n){var e,t;let i=null;return((t=(e=n.getRootNode)===null||e===void 0?void 0:e.call(n))===null||t===void 0?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&n.getRootNode().host&&(i=n.getRootNode().host),i}function Jr(n){let e=n,t;for(;t=vo(e);)e=t;return e}function Yr(n){const e=n.ownerDocument;if(!e)return!1;const t=Jr(n);return e.contains(t)}function bo(n){const e=n.ownerDocument;return e?e.contains(n)||Yr(n):!1}var X=(n=>(n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n))(X||{}),J=(n=>(n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n))(J||{}),Ke=(n=>(n[n.MouseUp=0]="MouseUp",n[n.MouseDown=1]="MouseDown",n[n.Click=2]="Click",n[n.ContextMenu=3]="ContextMenu",n[n.DblClick=4]="DblClick",n[n.Focus=5]="Focus",n[n.Blur=6]="Blur",n[n.TouchStart=7]="TouchStart",n[n.TouchMove_Departed=8]="TouchMove_Departed",n[n.TouchEnd=9]="TouchEnd",n[n.TouchCancel=10]="TouchCancel",n))(Ke||{}),pn=(n=>(n[n.Mouse=0]="Mouse",n[n.Pen=1]="Pen",n[n.Touch=2]="Touch",n))(pn||{}),ct=(n=>(n[n["2D"]=0]="2D",n[n.WebGL=1]="WebGL",n[n.WebGL2=2]="WebGL2",n))(ct||{});function fo(n){return"__ln"in n}class Xr{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let i=0;i<e;i++)t=(t==null?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&fo(e.previousSibling)){const i=e.previousSibling.__ln.next;t.next=i,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,i&&(i.previous=t)}else if(e.nextSibling&&fo(e.nextSibling)&&e.nextSibling.__ln.previous){const i=e.nextSibling.__ln.previous;t.previous=i,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,i&&(i.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const go=(n,e)=>`${n}@${e}`;class $r{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,i=new Xr,s=c=>{let p=c,m=xt;for(;m===xt;)p=p&&p.nextSibling,m=p&&this.mirror.getId(p);return m},o=c=>{if(!c.parentNode||!bo(c)||c.parentNode.tagName==="TEXTAREA")return;const p=kt(c.parentNode)?this.mirror.getId(vo(c)):this.mirror.getId(c.parentNode),m=s(c);if(p===-1||m===-1)return i.addNode(c);const g=at(c,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:f=>{mo(f,this.mirror)&&this.iframeManager.addIframe(f),po(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Gi(c)&&this.shadowDomManager.addShadowRoot(c.shadowRoot,this.doc)},onIframeLoad:(f,b)=>{this.iframeManager.attachIframe(f,b),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,b)=>{this.stylesheetManager.attachLinkElement(f,b)}});g&&(e.push({parentId:p,nextId:m,node:g}),t.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const c of this.movedSet)yo(this.removes,c,this.mirror)&&!this.movedSet.has(c.parentNode)||o(c);for(const c of this.addedSet)!wo(this.droppedSet,c)&&!yo(this.removes,c,this.mirror)||wo(this.movedSet,c)?o(c):this.droppedSet.add(c);let a=null;for(;i.length;){let c=null;if(a){const p=this.mirror.getId(a.value.parentNode),m=s(a.value);p!==-1&&m!==-1&&(c=a)}if(!c){let p=i.tail;for(;p;){const m=p;if(p=p.previous,m){const g=this.mirror.getId(m.value.parentNode);if(s(m.value)===-1)continue;if(g!==-1){c=m;break}else{const b=m.value;if(b.parentNode&&b.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const w=b.parentNode.host;if(this.mirror.getId(w)!==-1){c=m;break}}}}}}if(!c){for(;i.head;)i.removeNode(i.head.value);break}a=c.previous,i.removeNode(c.value),o(c.value)}const l={texts:this.texts.map(c=>{const p=c.node;return p.parentNode&&p.parentNode.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(p.parentNode),{id:this.mirror.getId(p),value:c.value}}).filter(c=>!t.has(c.id)).filter(c=>this.mirror.has(c.id)),attributes:this.attributes.map(c=>{const{attributes:p}=c;if(typeof p.style=="string"){const m=JSON.stringify(c.styleDiff),g=JSON.stringify(c._unchangedStyles);m.length<p.style.length&&(m+g).split("var(").length===p.style.split("var(").length&&(p.style=c.styleDiff)}return{id:this.mirror.getId(c.node),attributes:p}}).filter(c=>!t.has(c.id)).filter(c=>this.mirror.has(c.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(l))},this.genTextAreaValueMutation=e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t)),t.attributes.value=Array.from(e.childNodes,i=>i.textContent||"").join("")},this.processMutation=e=>{if(!Fi(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;!Ne(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:oo(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,uo(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let i=e.attributeName,s=e.target.getAttribute(i);if(i==="value"){const a=Ui(t);s=Oi({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:a,value:s,maskInputFn:this.maskInputFn})}if(Ne(e.target,this.blockClass,this.blockSelector,!1)||s===e.oldValue)return;let o=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&i==="src"&&!this.keepIframeSrcFn(s))if(!t.contentDocument)i="rr_src";else return;if(o||(o={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(e.target,o)),i==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!so(t.tagName,i)&&(o.attributes[i]=io(this.doc,Fn(t.tagName),Fn(i),s),i==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");e.oldValue&&a.setAttribute("style",e.oldValue);for(const l of Array.from(t.style)){const c=t.style.getPropertyValue(l),p=t.style.getPropertyPriority(l);c!==a.style.getPropertyValue(l)||p!==a.style.getPropertyPriority(l)?p===""?o.styleDiff[l]=c:o.styleDiff[l]=[c,p]:o._unchangedStyles[l]=[c,p]}for(const l of Array.from(a.style))t.style.getPropertyValue(l)===""&&(o.styleDiff[l]=!1)}break}case"childList":{if(Ne(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const i=this.mirror.getId(t),s=kt(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);Ne(e.target,this.blockClass,this.blockSelector,!1)||Fi(t,this.mirror)||!Wr(t,this.mirror)||(this.addedSet.has(t)?(ji(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&i===-1||ho(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[go(i,s)]?ji(this.movedSet,t):this.removes.push({parentId:s,id:i,isShadow:kt(e.target)&&St(e.target)?!0:void 0})),this.mapRemoves.push(t))});break}}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Fi(e,this.mirror))return;this.movedSet.add(e);let i=null;t&&this.mirror.hasNode(t)&&(i=this.mirror.getId(t)),i&&i!==-1&&(this.movedMap[go(this.mirror.getId(e),i)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Ne(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach(i=>this.genAdds(i)),Gi(e)&&e.shadowRoot.childNodes.forEach(i=>{this.processedNodeManager.add(i,this),this.genAdds(i,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function ji(n,e){n.delete(e),e.childNodes.forEach(t=>ji(n,t))}function yo(n,e,t){return n.length===0?!1:Co(n,e,t)}function Co(n,e,t){const{parentNode:i}=e;if(!i)return!1;const s=t.getId(i);return n.some(o=>o.id===s)?!0:Co(n,i,t)}function wo(n,e){return n.size===0?!1:ko(n,e)}function ko(n,e){const{parentNode:t}=e;return t?n.has(t)?!0:ko(n,t):!1}let Mt;function el(n){Mt=n}function nl(){Mt=void 0}const Y=n=>Mt?(...t)=>{try{return n(...t)}catch(i){if(Mt&&Mt(i)===!0)return;throw i}}:n,Kn=[];function Lt(n){try{if("composedPath"in n){const e=n.composedPath();if(e.length)return e[0]}else if("path"in n&&n.path.length)return n.path[0]}catch{}return n&&n.target}function So(n,e){var t,i;const s=new $r;Kn.push(s),s.init(n);let o=window.MutationObserver||window.__rrMutationObserver;const a=(i=(t=window==null?void 0:window.Zone)===null||t===void 0?void 0:t.__symbol__)===null||i===void 0?void 0:i.call(t,"MutationObserver");a&&window[a]&&(o=window[a]);const l=new o(Y(s.processMutations.bind(s)));return l.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),l}function tl({mousemoveCb:n,sampling:e,doc:t,mirror:i}){if(e.mousemove===!1)return()=>{};const s=typeof e.mousemove=="number"?e.mousemove:50,o=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let a=[],l;const c=At(Y(g=>{const f=Date.now()-l;n(a.map(b=>(b.timeOffset-=f,b)),g),a=[],l=null}),o),p=Y(At(Y(g=>{const f=Lt(g),{clientX:b,clientY:w}=Ki(g)?g.changedTouches[0]:g;l||(l=qt()),a.push({x:b,y:w,id:i.getId(f),timeOffset:qt()-l}),c(typeof DragEvent<"u"&&g instanceof DragEvent?J.Drag:g instanceof MouseEvent?J.MouseMove:J.TouchMove)}),s,{trailing:!1})),m=[He("mousemove",p,t),He("touchmove",p,t),He("drag",p,t)];return Y(()=>{m.forEach(g=>g())})}function il({mouseInteractionCb:n,doc:e,mirror:t,blockClass:i,blockSelector:s,sampling:o}){if(o.mouseInteraction===!1)return()=>{};const a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,l=[];let c=null;const p=m=>g=>{const f=Lt(g);if(Ne(f,i,s,!0))return;let b=null,w=m;if("pointerType"in g){switch(g.pointerType){case"mouse":b=pn.Mouse;break;case"touch":b=pn.Touch;break;case"pen":b=pn.Pen;break}b===pn.Touch?Ke[m]===Ke.MouseDown?w="TouchStart":Ke[m]===Ke.MouseUp&&(w="TouchEnd"):pn.Pen}else Ki(g)&&(b=pn.Touch);b!==null?(c=b,(w.startsWith("Touch")&&b===pn.Touch||w.startsWith("Mouse")&&b===pn.Mouse)&&(b=null)):Ke[m]===Ke.Click&&(b=c,c=null);const C=Ki(g)?g.changedTouches[0]:g;if(!C)return;const k=t.getId(f),{clientX:x,clientY:A}=C;Y(n)(Object.assign({type:Ke[w],id:k,x,y:A},b!==null&&{pointerType:b}))};return Object.keys(Ke).filter(m=>Number.isNaN(Number(m))&&!m.endsWith("_Departed")&&a[m]!==!1).forEach(m=>{let g=Fn(m);const f=p(m);if(window.PointerEvent)switch(Ke[m]){case Ke.MouseDown:case Ke.MouseUp:g=g.replace("mouse","pointer");break;case Ke.TouchStart:case Ke.TouchEnd:return}l.push(He(g,f,e))}),Y(()=>{l.forEach(m=>m())})}function xo({scrollCb:n,doc:e,mirror:t,blockClass:i,blockSelector:s,sampling:o}){const a=Y(At(Y(l=>{const c=Lt(l);if(!c||Ne(c,i,s,!0))return;const p=t.getId(c);if(c===e&&e.defaultView){const m=ro(e.defaultView);n({id:p,x:m.left,y:m.top})}else n({id:p,x:c.scrollLeft,y:c.scrollTop})}),o.scroll||100));return He("scroll",a,e)}function sl({viewportResizeCb:n},{win:e}){let t=-1,i=-1;const s=Y(At(Y(()=>{const o=lo(),a=co();(t!==o||i!==a)&&(n({width:Number(a),height:Number(o)}),t=o,i=a)}),200));return He("resize",s,e)}const ol=["INPUT","TEXTAREA","SELECT"],Ao=new WeakMap;function al({inputCb:n,doc:e,mirror:t,blockClass:i,blockSelector:s,ignoreClass:o,ignoreSelector:a,maskInputOptions:l,maskInputFn:c,sampling:p,userTriggeredOnInput:m}){function g(A){let M=Lt(A);const E=A.isTrusted,D=M&&M.tagName;if(M&&D==="OPTION"&&(M=M.parentElement),!M||!D||ol.indexOf(D)<0||Ne(M,i,s,!0)||M.classList.contains(o)||a&&M.matches(a))return;let q=M.value,Q=!1;const K=Ui(M)||"";K==="radio"||K==="checkbox"?Q=M.checked:(l[D.toLowerCase()]||l[K])&&(q=Oi({element:M,maskInputOptions:l,tagName:D,type:K,value:q,maskInputFn:c})),f(M,m?{text:q,isChecked:Q,userTriggered:E}:{text:q,isChecked:Q});const W=M.name;K==="radio"&&W&&Q&&e.querySelectorAll(`input[type="radio"][name="${W}"]`).forEach(de=>{if(de!==M){const Le=de.value;f(de,m?{text:Le,isChecked:!Q,userTriggered:!1}:{text:Le,isChecked:!Q})}})}function f(A,M){const E=Ao.get(A);if(!E||E.text!==M.text||E.isChecked!==M.isChecked){Ao.set(A,M);const D=t.getId(A);Y(n)(Object.assign(Object.assign({},M),{id:D}))}}const w=(p.input==="last"?["change"]:["input","change"]).map(A=>He(A,Y(g),e)),C=e.defaultView;if(!C)return()=>{w.forEach(A=>A())};const k=C.Object.getOwnPropertyDescriptor(C.HTMLInputElement.prototype,"value"),x=[[C.HTMLInputElement.prototype,"value"],[C.HTMLInputElement.prototype,"checked"],[C.HTMLSelectElement.prototype,"value"],[C.HTMLTextAreaElement.prototype,"value"],[C.HTMLSelectElement.prototype,"selectedIndex"],[C.HTMLOptionElement.prototype,"selected"]];return k&&k.set&&w.push(...x.map(A=>zt(A[0],A[1],{set(){Y(g)({target:this,isTrusted:!1})}},!1,C))),Y(()=>{w.forEach(A=>A())})}function Wt(n){const e=[];function t(i,s){if(Zt("CSSGroupingRule")&&i.parentRule instanceof CSSGroupingRule||Zt("CSSMediaRule")&&i.parentRule instanceof CSSMediaRule||Zt("CSSSupportsRule")&&i.parentRule instanceof CSSSupportsRule||Zt("CSSConditionRule")&&i.parentRule instanceof CSSConditionRule){const a=Array.from(i.parentRule.cssRules).indexOf(i);s.unshift(a)}else if(i.parentStyleSheet){const a=Array.from(i.parentStyleSheet.cssRules).indexOf(i);s.unshift(a)}return s}return t(n,e)}function Ln(n,e,t){let i,s;return n?(n.ownerNode?i=e.getId(n.ownerNode):s=t.getId(n),{styleId:s,id:i}):{}}function rl({styleSheetRuleCb:n,mirror:e,stylesheetManager:t},{win:i}){if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return()=>{};const s=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:Y((m,g,f)=>{const[b,w]=f,{id:C,styleId:k}=Ln(g,e,t.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,adds:[{rule:b,index:w}]}),m.apply(g,f)})});const o=i.CSSStyleSheet.prototype.deleteRule;i.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:Y((m,g,f)=>{const[b]=f,{id:w,styleId:C}=Ln(g,e,t.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,removes:[{index:b}]}),m.apply(g,f)})});let a;i.CSSStyleSheet.prototype.replace&&(a=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:Y((m,g,f)=>{const[b]=f,{id:w,styleId:C}=Ln(g,e,t.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,replace:b}),m.apply(g,f)})}));let l;i.CSSStyleSheet.prototype.replaceSync&&(l=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Y((m,g,f)=>{const[b]=f,{id:w,styleId:C}=Ln(g,e,t.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,replaceSync:b}),m.apply(g,f)})}));const c={};Qt("CSSGroupingRule")?c.CSSGroupingRule=i.CSSGroupingRule:(Qt("CSSMediaRule")&&(c.CSSMediaRule=i.CSSMediaRule),Qt("CSSConditionRule")&&(c.CSSConditionRule=i.CSSConditionRule),Qt("CSSSupportsRule")&&(c.CSSSupportsRule=i.CSSSupportsRule));const p={};return Object.entries(c).forEach(([m,g])=>{p[m]={insertRule:g.prototype.insertRule,deleteRule:g.prototype.deleteRule},g.prototype.insertRule=new Proxy(p[m].insertRule,{apply:Y((f,b,w)=>{const[C,k]=w,{id:x,styleId:A}=Ln(b.parentStyleSheet,e,t.styleMirror);return(x&&x!==-1||A&&A!==-1)&&n({id:x,styleId:A,adds:[{rule:C,index:[...Wt(b),k||0]}]}),f.apply(b,w)})}),g.prototype.deleteRule=new Proxy(p[m].deleteRule,{apply:Y((f,b,w)=>{const[C]=w,{id:k,styleId:x}=Ln(b.parentStyleSheet,e,t.styleMirror);return(k&&k!==-1||x&&x!==-1)&&n({id:k,styleId:x,removes:[{index:[...Wt(b),C]}]}),f.apply(b,w)})})}),Y(()=>{i.CSSStyleSheet.prototype.insertRule=s,i.CSSStyleSheet.prototype.deleteRule=o,a&&(i.CSSStyleSheet.prototype.replace=a),l&&(i.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach(([m,g])=>{g.prototype.insertRule=p[m].insertRule,g.prototype.deleteRule=p[m].deleteRule})})}function Mo({mirror:n,stylesheetManager:e},t){var i,s,o;let a=null;t.nodeName==="#document"?a=n.getId(t):a=n.getId(t.host);const l=t.nodeName==="#document"?(i=t.defaultView)===null||i===void 0?void 0:i.Document:(o=(s=t.ownerDocument)===null||s===void 0?void 0:s.defaultView)===null||o===void 0?void 0:o.ShadowRoot,c=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!l||!c?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var p;return(p=c.get)===null||p===void 0?void 0:p.call(this)},set(p){var m;const g=(m=c.set)===null||m===void 0?void 0:m.call(this,p);if(a!==null&&a!==-1)try{e.adoptStyleSheets(p,a)}catch{}return g}}),Y(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))}function ll({styleDeclarationCb:n,mirror:e,ignoreCSSAttributes:t,stylesheetManager:i},{win:s}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Y((l,c,p)=>{var m;const[g,f,b]=p;if(t.has(g))return o.apply(c,[g,f,b]);const{id:w,styleId:C}=Ln((m=c.parentRule)===null||m===void 0?void 0:m.parentStyleSheet,e,i.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,set:{property:g,value:f,priority:b},index:Wt(c.parentRule)}),l.apply(c,p)})});const a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:Y((l,c,p)=>{var m;const[g]=p;if(t.has(g))return a.apply(c,[g]);const{id:f,styleId:b}=Ln((m=c.parentRule)===null||m===void 0?void 0:m.parentStyleSheet,e,i.styleMirror);return(f&&f!==-1||b&&b!==-1)&&n({id:f,styleId:b,remove:{property:g},index:Wt(c.parentRule)}),l.apply(c,p)})}),Y(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=a})}function cl({mediaInteractionCb:n,blockClass:e,blockSelector:t,mirror:i,sampling:s,doc:o}){const a=Y(c=>At(Y(p=>{const m=Lt(p);if(!m||Ne(m,e,t,!0))return;const{currentTime:g,volume:f,muted:b,playbackRate:w,loop:C}=m;n({type:c,id:i.getId(m),currentTime:g,volume:f,muted:b,playbackRate:w,loop:C})}),s.media||500)),l=[He("play",a(0),o),He("pause",a(1),o),He("seeked",a(2),o),He("volumechange",a(3),o),He("ratechange",a(4),o)];return Y(()=>{l.forEach(c=>c())})}function dl({fontCb:n,doc:e}){const t=e.defaultView;if(!t)return()=>{};const i=[],s=new WeakMap,o=t.FontFace;t.FontFace=function(c,p,m){const g=new o(c,p,m);return s.set(g,{family:c,buffer:typeof p!="string",descriptors:m,fontSource:typeof p=="string"?p:JSON.stringify(Array.from(new Uint8Array(p)))}),g};const a=lt(e.fonts,"add",function(l){return function(c){return setTimeout(Y(()=>{const p=s.get(c);p&&(n(p),s.delete(c))}),0),l.apply(this,[c])}});return i.push(()=>{t.FontFace=o}),i.push(a),Y(()=>{i.forEach(l=>l())})}function ul(n){const{doc:e,mirror:t,blockClass:i,blockSelector:s,selectionCb:o}=n;let a=!0;const l=Y(()=>{const c=e.getSelection();if(!c||a&&(c!=null&&c.isCollapsed))return;a=c.isCollapsed||!1;const p=[],m=c.rangeCount||0;for(let g=0;g<m;g++){const f=c.getRangeAt(g),{startContainer:b,startOffset:w,endContainer:C,endOffset:k}=f;Ne(b,i,s,!0)||Ne(C,i,s,!0)||p.push({start:t.getId(b),startOffset:w,end:t.getId(C),endOffset:k})}o({ranges:p})});return l(),He("selectionchange",l)}function hl({doc:n,customElementCb:e}){const t=n.defaultView;return!t||!t.customElements?()=>{}:lt(t.customElements,"define",function(s){return function(o,a,l){try{e({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return s.apply(this,[o,a,l])}})}function ml(n,e){const{mutationCb:t,mousemoveCb:i,mouseInteractionCb:s,scrollCb:o,viewportResizeCb:a,inputCb:l,mediaInteractionCb:c,styleSheetRuleCb:p,styleDeclarationCb:m,canvasMutationCb:g,fontCb:f,selectionCb:b,customElementCb:w}=n;n.mutationCb=(...C)=>{e.mutation&&e.mutation(...C),t(...C)},n.mousemoveCb=(...C)=>{e.mousemove&&e.mousemove(...C),i(...C)},n.mouseInteractionCb=(...C)=>{e.mouseInteraction&&e.mouseInteraction(...C),s(...C)},n.scrollCb=(...C)=>{e.scroll&&e.scroll(...C),o(...C)},n.viewportResizeCb=(...C)=>{e.viewportResize&&e.viewportResize(...C),a(...C)},n.inputCb=(...C)=>{e.input&&e.input(...C),l(...C)},n.mediaInteractionCb=(...C)=>{e.mediaInteaction&&e.mediaInteaction(...C),c(...C)},n.styleSheetRuleCb=(...C)=>{e.styleSheetRule&&e.styleSheetRule(...C),p(...C)},n.styleDeclarationCb=(...C)=>{e.styleDeclaration&&e.styleDeclaration(...C),m(...C)},n.canvasMutationCb=(...C)=>{e.canvasMutation&&e.canvasMutation(...C),g(...C)},n.fontCb=(...C)=>{e.font&&e.font(...C),f(...C)},n.selectionCb=(...C)=>{e.selection&&e.selection(...C),b(...C)},n.customElementCb=(...C)=>{e.customElement&&e.customElement(...C),w(...C)}}function pl(n,e={}){const t=n.doc.defaultView;if(!t)return()=>{};ml(n,e);let i;n.recordDOM&&(i=So(n,n.doc));const s=tl(n),o=il(n),a=xo(n),l=sl(n,{win:t}),c=al(n),p=cl(n);let m=()=>{},g=()=>{},f=()=>{},b=()=>{};n.recordDOM&&(m=rl(n,{win:t}),g=Mo(n,n.doc),f=ll(n,{win:t}),n.collectFonts&&(b=dl(n)));const w=ul(n),C=hl(n),k=[];for(const x of n.plugins)k.push(x.observer(x.callback,t,x.options));return Y(()=>{Kn.forEach(x=>x.reset()),i==null||i.disconnect(),s(),o(),a(),l(),c(),p(),m(),g(),f(),b(),w(),C(),k.forEach(x=>x())})}function Zt(n){return typeof window[n]<"u"}function Qt(n){return!!(typeof window[n]<"u"&&window[n].prototype&&"insertRule"in window[n].prototype&&"deleteRule"in window[n].prototype)}class Lo{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,i,s){const o=i||this.getIdToRemoteIdMap(e),a=s||this.getRemoteIdToIdMap(e);let l=o.get(t);return l||(l=this.generateIdFn(),o.set(t,l),a.set(l,t)),l}getIds(e,t){const i=this.getIdToRemoteIdMap(e),s=this.getRemoteIdToIdMap(e);return t.map(o=>this.getId(e,o,i,s))}getRemoteId(e,t,i){const s=i||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;const o=s.get(t);return o||-1}getRemoteIds(e,t){const i=this.getRemoteIdToIdMap(e);return t.map(s=>this.getRemoteId(e,s,i))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class vl{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Lo(no),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Lo(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(i=this.loadListener)===null||i===void 0||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;const s=this.crossOriginIframeMap.get(e.source);if(!s)return;const o=this.transformCrossOriginEvent(s,t.data.event);o&&this.wrappedEmit(o,t.data.isCheckout)}transformCrossOriginEvent(e,t){var i;switch(t.type){case X.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const s=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,s),this.patchRootIdOnNode(t.data.node,s),{timestamp:t.timestamp,type:X.IncrementalSnapshot,data:{source:J.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case X.Meta:case X.Load:case X.DomContentLoaded:return!1;case X.Plugin:return t;case X.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case X.IncrementalSnapshot:switch(t.data.source){case J.Mutation:return t.data.adds.forEach(s=>{this.replaceIds(s,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(s.node,e);const o=this.crossOriginIframeRootIdMap.get(e);o&&this.patchRootIdOnNode(s.node,o)}),t.data.removes.forEach(s=>{this.replaceIds(s,e,["parentId","id"])}),t.data.attributes.forEach(s=>{this.replaceIds(s,e,["id"])}),t.data.texts.forEach(s=>{this.replaceIds(s,e,["id"])}),t;case J.Drag:case J.TouchMove:case J.MouseMove:return t.data.positions.forEach(s=>{this.replaceIds(s,e,["id"])}),t;case J.ViewportResize:return!1;case J.MediaInteraction:case J.MouseInteraction:case J.Scroll:case J.CanvasMutation:case J.Input:return this.replaceIds(t.data,e,["id"]),t;case J.StyleSheetRule:case J.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case J.Font:return t;case J.Selection:return t.data.ranges.forEach(s=>{this.replaceIds(s,e,["start","end"])}),t;case J.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(i=t.data.styles)===null||i===void 0||i.forEach(s=>{this.replaceStyleIds(s,e,["styleId"])}),t}}return!1}replace(e,t,i,s){for(const o of s)!Array.isArray(t[o])&&typeof t[o]!="number"||(Array.isArray(t[o])?t[o]=e.getIds(i,t[o]):t[o]=e.getId(i,t[o]));return t}replaceIds(e,t,i){return this.replace(this.crossOriginIframeMirror,e,t,i)}replaceStyleIds(e,t,i){return this.replace(this.crossOriginIframeStyleMirror,e,t,i)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(i=>{this.replaceIdOnNode(i,t)})}patchRootIdOnNode(e,t){e.type!==ve.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(i=>{this.patchRootIdOnNode(i,t)})}}class bl{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!St(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const i=So(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>i.disconnect()),this.restoreHandlers.push(xo(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(Mo({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const i=this;this.restoreHandlers.push(lt(e.prototype,"attachShadow",function(s){return function(o){const a=s.call(this,o);return this.shadowRoot&&bo(this)&&i.addShadowRoot(this.shadowRoot,t),a}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
|
|
1133
|
+
or you can use record.mirror to access the mirror instance during recording.`;let ao={map:{},getId(){return console.error(rt),-1},getNode(){return console.error(rt),null},removeNodeFromMap(){console.error(rt)},has(){return console.error(rt),!1},reset(){console.error(rt)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(ao=new Proxy(ao,{get(n,e,t){return e==="map"&&console.error(rt),Reflect.get(n,e,t)}}));function At(n,e,t={}){let i=null,s=0;return function(...o){const a=Date.now();!s&&t.leading===!1&&(s=a);const l=e-(a-s),c=this;l<=0||l>e?(i&&(clearTimeout(i),i=null),s=a,n.apply(c,o)):!i&&t.trailing!==!1&&(i=setTimeout(()=>{s=t.leading===!1?0:Date.now(),i=null,n.apply(c,o)},l))}}function zt(n,e,t,i,s=window){const o=s.Object.getOwnPropertyDescriptor(n,e);return s.Object.defineProperty(n,e,i?t:{set(a){setTimeout(()=>{t.set.call(this,a)},0),o&&o.set&&o.set.call(this,a)}}),()=>zt(n,e,o||{},!0)}function lt(n,e,t){try{if(!(e in n))return()=>{};const i=n[e],s=t(i);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i}})),n[e]=s,()=>{n[e]=i}}catch{return()=>{}}}let qt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(qt=()=>new Date().getTime());function ro(n){var e,t,i,s,o,a;const l=n.document;return{left:l.scrollingElement?l.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:(l==null?void 0:l.documentElement.scrollLeft)||((t=(e=l==null?void 0:l.body)===null||e===void 0?void 0:e.parentElement)===null||t===void 0?void 0:t.scrollLeft)||((i=l==null?void 0:l.body)===null||i===void 0?void 0:i.scrollLeft)||0,top:l.scrollingElement?l.scrollingElement.scrollTop:n.pageYOffset!==void 0?n.pageYOffset:(l==null?void 0:l.documentElement.scrollTop)||((o=(s=l==null?void 0:l.body)===null||s===void 0?void 0:s.parentElement)===null||o===void 0?void 0:o.scrollTop)||((a=l==null?void 0:l.body)===null||a===void 0?void 0:a.scrollTop)||0}}function lo(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function co(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function uo(n){return n?n.nodeType===n.ELEMENT_NODE?n:n.parentElement:null}function Ne(n,e,t,i){if(!n)return!1;const s=uo(n);if(!s)return!1;try{if(typeof e=="string"){if(s.classList.contains(e)||i&&s.closest("."+e)!==null)return!0}else if(jt(s,e,i))return!0}catch{}return!!(t&&(s.matches(t)||i&&s.closest(t)!==null))}function Wr(n,e){return e.getId(n)!==-1}function Fi(n,e){return e.getId(n)===xt}function ho(n,e){if(kt(n))return!1;const t=e.getId(n);return e.has(t)?n.parentNode&&n.parentNode.nodeType===n.DOCUMENT_NODE?!1:n.parentNode?ho(n.parentNode,e):!0:!0}function Ki(n){return!!n.changedTouches}function Zr(n=window){"NodeList"in n&&!n.NodeList.prototype.forEach&&(n.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in n&&!n.DOMTokenList.prototype.forEach&&(n.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===t)return!0;while(t=t&&t.parentNode);return!1})}function mo(n,e){return!!(n.nodeName==="IFRAME"&&e.getMeta(n))}function po(n,e){return!!(n.nodeName==="LINK"&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute&&n.getAttribute("rel")==="stylesheet"&&e.getMeta(n))}function Gi(n){return!!(n!=null&&n.shadowRoot)}class Qr{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return(t=this.styleIDMap.get(e))!==null&&t!==void 0?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let i;return t===void 0?i=this.id++:i=t,this.styleIDMap.set(e,i),this.idStyleMap.set(i,e),i}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function vo(n){var e,t;let i=null;return((t=(e=n.getRootNode)===null||e===void 0?void 0:e.call(n))===null||t===void 0?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&n.getRootNode().host&&(i=n.getRootNode().host),i}function Jr(n){let e=n,t;for(;t=vo(e);)e=t;return e}function Yr(n){const e=n.ownerDocument;if(!e)return!1;const t=Jr(n);return e.contains(t)}function bo(n){const e=n.ownerDocument;return e?e.contains(n)||Yr(n):!1}var X=(n=>(n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n))(X||{}),J=(n=>(n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n))(J||{}),Ke=(n=>(n[n.MouseUp=0]="MouseUp",n[n.MouseDown=1]="MouseDown",n[n.Click=2]="Click",n[n.ContextMenu=3]="ContextMenu",n[n.DblClick=4]="DblClick",n[n.Focus=5]="Focus",n[n.Blur=6]="Blur",n[n.TouchStart=7]="TouchStart",n[n.TouchMove_Departed=8]="TouchMove_Departed",n[n.TouchEnd=9]="TouchEnd",n[n.TouchCancel=10]="TouchCancel",n))(Ke||{}),pn=(n=>(n[n.Mouse=0]="Mouse",n[n.Pen=1]="Pen",n[n.Touch=2]="Touch",n))(pn||{}),ct=(n=>(n[n["2D"]=0]="2D",n[n.WebGL=1]="WebGL",n[n.WebGL2=2]="WebGL2",n))(ct||{});function fo(n){return"__ln"in n}class Xr{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let i=0;i<e;i++)t=(t==null?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&fo(e.previousSibling)){const i=e.previousSibling.__ln.next;t.next=i,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,i&&(i.previous=t)}else if(e.nextSibling&&fo(e.nextSibling)&&e.nextSibling.__ln.previous){const i=e.nextSibling.__ln.previous;t.previous=i,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,i&&(i.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const go=(n,e)=>`${n}@${e}`;class $r{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,i=new Xr,s=c=>{let p=c,m=xt;for(;m===xt;)p=p&&p.nextSibling,m=p&&this.mirror.getId(p);return m},o=c=>{if(!c.parentNode||!bo(c)||c.parentNode.tagName==="TEXTAREA")return;const p=kt(c.parentNode)?this.mirror.getId(vo(c)):this.mirror.getId(c.parentNode),m=s(c);if(p===-1||m===-1)return i.addNode(c);const g=at(c,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:f=>{mo(f,this.mirror)&&this.iframeManager.addIframe(f),po(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Gi(c)&&this.shadowDomManager.addShadowRoot(c.shadowRoot,this.doc)},onIframeLoad:(f,b)=>{this.iframeManager.attachIframe(f,b),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,b)=>{this.stylesheetManager.attachLinkElement(f,b)}});g&&(e.push({parentId:p,nextId:m,node:g}),t.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const c of this.movedSet)yo(this.removes,c,this.mirror)&&!this.movedSet.has(c.parentNode)||o(c);for(const c of this.addedSet)!wo(this.droppedSet,c)&&!yo(this.removes,c,this.mirror)||wo(this.movedSet,c)?o(c):this.droppedSet.add(c);let a=null;for(;i.length;){let c=null;if(a){const p=this.mirror.getId(a.value.parentNode),m=s(a.value);p!==-1&&m!==-1&&(c=a)}if(!c){let p=i.tail;for(;p;){const m=p;if(p=p.previous,m){const g=this.mirror.getId(m.value.parentNode);if(s(m.value)===-1)continue;if(g!==-1){c=m;break}else{const b=m.value;if(b.parentNode&&b.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const w=b.parentNode.host;if(this.mirror.getId(w)!==-1){c=m;break}}}}}}if(!c){for(;i.head;)i.removeNode(i.head.value);break}a=c.previous,i.removeNode(c.value),o(c.value)}const l={texts:this.texts.map(c=>{const p=c.node;return p.parentNode&&p.parentNode.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(p.parentNode),{id:this.mirror.getId(p),value:c.value}}).filter(c=>!t.has(c.id)).filter(c=>this.mirror.has(c.id)),attributes:this.attributes.map(c=>{const{attributes:p}=c;if(typeof p.style=="string"){const m=JSON.stringify(c.styleDiff),g=JSON.stringify(c._unchangedStyles);m.length<p.style.length&&(m+g).split("var(").length===p.style.split("var(").length&&(p.style=c.styleDiff)}return{id:this.mirror.getId(c.node),attributes:p}}).filter(c=>!t.has(c.id)).filter(c=>this.mirror.has(c.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(l))},this.genTextAreaValueMutation=e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t)),t.attributes.value=Array.from(e.childNodes,i=>i.textContent||"").join("")},this.processMutation=e=>{if(!Fi(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;!Ne(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:oo(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,uo(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let i=e.attributeName,s=e.target.getAttribute(i);if(i==="value"){const a=Ui(t);s=Oi({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:a,value:s,maskInputFn:this.maskInputFn})}if(Ne(e.target,this.blockClass,this.blockSelector,!1)||s===e.oldValue)return;let o=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&i==="src"&&!this.keepIframeSrcFn(s))if(!t.contentDocument)i="rr_src";else return;if(o||(o={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(e.target,o)),i==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!so(t.tagName,i)&&(o.attributes[i]=io(this.doc,Fn(t.tagName),Fn(i),s),i==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");e.oldValue&&a.setAttribute("style",e.oldValue);for(const l of Array.from(t.style)){const c=t.style.getPropertyValue(l),p=t.style.getPropertyPriority(l);c!==a.style.getPropertyValue(l)||p!==a.style.getPropertyPriority(l)?p===""?o.styleDiff[l]=c:o.styleDiff[l]=[c,p]:o._unchangedStyles[l]=[c,p]}for(const l of Array.from(a.style))t.style.getPropertyValue(l)===""&&(o.styleDiff[l]=!1)}break}case"childList":{if(Ne(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const i=this.mirror.getId(t),s=kt(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);Ne(e.target,this.blockClass,this.blockSelector,!1)||Fi(t,this.mirror)||!Wr(t,this.mirror)||(this.addedSet.has(t)?(ji(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&i===-1||ho(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[go(i,s)]?ji(this.movedSet,t):this.removes.push({parentId:s,id:i,isShadow:kt(e.target)&&St(e.target)?!0:void 0})),this.mapRemoves.push(t))});break}}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Fi(e,this.mirror))return;this.movedSet.add(e);let i=null;t&&this.mirror.hasNode(t)&&(i=this.mirror.getId(t)),i&&i!==-1&&(this.movedMap[go(this.mirror.getId(e),i)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Ne(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach(i=>this.genAdds(i)),Gi(e)&&e.shadowRoot.childNodes.forEach(i=>{this.processedNodeManager.add(i,this),this.genAdds(i,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function ji(n,e){n.delete(e),e.childNodes.forEach(t=>ji(n,t))}function yo(n,e,t){return n.length===0?!1:Co(n,e,t)}function Co(n,e,t){const{parentNode:i}=e;if(!i)return!1;const s=t.getId(i);return n.some(o=>o.id===s)?!0:Co(n,i,t)}function wo(n,e){return n.size===0?!1:ko(n,e)}function ko(n,e){const{parentNode:t}=e;return t?n.has(t)?!0:ko(n,t):!1}let Mt;function el(n){Mt=n}function nl(){Mt=void 0}const Y=n=>Mt?(...t)=>{try{return n(...t)}catch(i){if(Mt&&Mt(i)===!0)return;throw i}}:n,Kn=[];function Lt(n){try{if("composedPath"in n){const e=n.composedPath();if(e.length)return e[0]}else if("path"in n&&n.path.length)return n.path[0]}catch{}return n&&n.target}function So(n,e){var t,i;const s=new $r;Kn.push(s),s.init(n);let o=window.MutationObserver||window.__rrMutationObserver;const a=(i=(t=window==null?void 0:window.Zone)===null||t===void 0?void 0:t.__symbol__)===null||i===void 0?void 0:i.call(t,"MutationObserver");a&&window[a]&&(o=window[a]);const l=new o(Y(s.processMutations.bind(s)));return l.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),l}function tl({mousemoveCb:n,sampling:e,doc:t,mirror:i}){if(e.mousemove===!1)return()=>{};const s=typeof e.mousemove=="number"?e.mousemove:50,o=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let a=[],l;const c=At(Y(g=>{const f=Date.now()-l;n(a.map(b=>(b.timeOffset-=f,b)),g),a=[],l=null}),o),p=Y(At(Y(g=>{const f=Lt(g),{clientX:b,clientY:w}=Ki(g)?g.changedTouches[0]:g;l||(l=qt()),a.push({x:b,y:w,id:i.getId(f),timeOffset:qt()-l}),c(typeof DragEvent<"u"&&g instanceof DragEvent?J.Drag:g instanceof MouseEvent?J.MouseMove:J.TouchMove)}),s,{trailing:!1})),m=[He("mousemove",p,t),He("touchmove",p,t),He("drag",p,t)];return Y(()=>{m.forEach(g=>g())})}function il({mouseInteractionCb:n,doc:e,mirror:t,blockClass:i,blockSelector:s,sampling:o}){if(o.mouseInteraction===!1)return()=>{};const a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,l=[];let c=null;const p=m=>g=>{const f=Lt(g);if(Ne(f,i,s,!0))return;let b=null,w=m;if("pointerType"in g){switch(g.pointerType){case"mouse":b=pn.Mouse;break;case"touch":b=pn.Touch;break;case"pen":b=pn.Pen;break}b===pn.Touch?Ke[m]===Ke.MouseDown?w="TouchStart":Ke[m]===Ke.MouseUp&&(w="TouchEnd"):pn.Pen}else Ki(g)&&(b=pn.Touch);b!==null?(c=b,(w.startsWith("Touch")&&b===pn.Touch||w.startsWith("Mouse")&&b===pn.Mouse)&&(b=null)):Ke[m]===Ke.Click&&(b=c,c=null);const C=Ki(g)?g.changedTouches[0]:g;if(!C)return;const k=t.getId(f),{clientX:x,clientY:A}=C;Y(n)(Object.assign({type:Ke[w],id:k,x,y:A},b!==null&&{pointerType:b}))};return Object.keys(Ke).filter(m=>Number.isNaN(Number(m))&&!m.endsWith("_Departed")&&a[m]!==!1).forEach(m=>{let g=Fn(m);const f=p(m);if(window.PointerEvent)switch(Ke[m]){case Ke.MouseDown:case Ke.MouseUp:g=g.replace("mouse","pointer");break;case Ke.TouchStart:case Ke.TouchEnd:return}l.push(He(g,f,e))}),Y(()=>{l.forEach(m=>m())})}function xo({scrollCb:n,doc:e,mirror:t,blockClass:i,blockSelector:s,sampling:o}){const a=Y(At(Y(l=>{const c=Lt(l);if(!c||Ne(c,i,s,!0))return;const p=t.getId(c);if(c===e&&e.defaultView){const m=ro(e.defaultView);n({id:p,x:m.left,y:m.top})}else n({id:p,x:c.scrollLeft,y:c.scrollTop})}),o.scroll||100));return He("scroll",a,e)}function sl({viewportResizeCb:n},{win:e}){let t=-1,i=-1;const s=Y(At(Y(()=>{const o=lo(),a=co();(t!==o||i!==a)&&(n({width:Number(a),height:Number(o)}),t=o,i=a)}),200));return He("resize",s,e)}const ol=["INPUT","TEXTAREA","SELECT"],Ao=new WeakMap;function al({inputCb:n,doc:e,mirror:t,blockClass:i,blockSelector:s,ignoreClass:o,ignoreSelector:a,maskInputOptions:l,maskInputFn:c,sampling:p,userTriggeredOnInput:m}){function g(A){let M=Lt(A);const P=A.isTrusted,D=M&&M.tagName;if(M&&D==="OPTION"&&(M=M.parentElement),!M||!D||ol.indexOf(D)<0||Ne(M,i,s,!0)||M.classList.contains(o)||a&&M.matches(a))return;let q=M.value,Q=!1;const K=Ui(M)||"";K==="radio"||K==="checkbox"?Q=M.checked:(l[D.toLowerCase()]||l[K])&&(q=Oi({element:M,maskInputOptions:l,tagName:D,type:K,value:q,maskInputFn:c})),f(M,m?{text:q,isChecked:Q,userTriggered:P}:{text:q,isChecked:Q});const W=M.name;K==="radio"&&W&&Q&&e.querySelectorAll(`input[type="radio"][name="${W}"]`).forEach(de=>{if(de!==M){const Le=de.value;f(de,m?{text:Le,isChecked:!Q,userTriggered:!1}:{text:Le,isChecked:!Q})}})}function f(A,M){const P=Ao.get(A);if(!P||P.text!==M.text||P.isChecked!==M.isChecked){Ao.set(A,M);const D=t.getId(A);Y(n)(Object.assign(Object.assign({},M),{id:D}))}}const w=(p.input==="last"?["change"]:["input","change"]).map(A=>He(A,Y(g),e)),C=e.defaultView;if(!C)return()=>{w.forEach(A=>A())};const k=C.Object.getOwnPropertyDescriptor(C.HTMLInputElement.prototype,"value"),x=[[C.HTMLInputElement.prototype,"value"],[C.HTMLInputElement.prototype,"checked"],[C.HTMLSelectElement.prototype,"value"],[C.HTMLTextAreaElement.prototype,"value"],[C.HTMLSelectElement.prototype,"selectedIndex"],[C.HTMLOptionElement.prototype,"selected"]];return k&&k.set&&w.push(...x.map(A=>zt(A[0],A[1],{set(){Y(g)({target:this,isTrusted:!1})}},!1,C))),Y(()=>{w.forEach(A=>A())})}function Wt(n){const e=[];function t(i,s){if(Zt("CSSGroupingRule")&&i.parentRule instanceof CSSGroupingRule||Zt("CSSMediaRule")&&i.parentRule instanceof CSSMediaRule||Zt("CSSSupportsRule")&&i.parentRule instanceof CSSSupportsRule||Zt("CSSConditionRule")&&i.parentRule instanceof CSSConditionRule){const a=Array.from(i.parentRule.cssRules).indexOf(i);s.unshift(a)}else if(i.parentStyleSheet){const a=Array.from(i.parentStyleSheet.cssRules).indexOf(i);s.unshift(a)}return s}return t(n,e)}function Ln(n,e,t){let i,s;return n?(n.ownerNode?i=e.getId(n.ownerNode):s=t.getId(n),{styleId:s,id:i}):{}}function rl({styleSheetRuleCb:n,mirror:e,stylesheetManager:t},{win:i}){if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return()=>{};const s=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:Y((m,g,f)=>{const[b,w]=f,{id:C,styleId:k}=Ln(g,e,t.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,adds:[{rule:b,index:w}]}),m.apply(g,f)})});const o=i.CSSStyleSheet.prototype.deleteRule;i.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:Y((m,g,f)=>{const[b]=f,{id:w,styleId:C}=Ln(g,e,t.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,removes:[{index:b}]}),m.apply(g,f)})});let a;i.CSSStyleSheet.prototype.replace&&(a=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:Y((m,g,f)=>{const[b]=f,{id:w,styleId:C}=Ln(g,e,t.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,replace:b}),m.apply(g,f)})}));let l;i.CSSStyleSheet.prototype.replaceSync&&(l=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Y((m,g,f)=>{const[b]=f,{id:w,styleId:C}=Ln(g,e,t.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,replaceSync:b}),m.apply(g,f)})}));const c={};Qt("CSSGroupingRule")?c.CSSGroupingRule=i.CSSGroupingRule:(Qt("CSSMediaRule")&&(c.CSSMediaRule=i.CSSMediaRule),Qt("CSSConditionRule")&&(c.CSSConditionRule=i.CSSConditionRule),Qt("CSSSupportsRule")&&(c.CSSSupportsRule=i.CSSSupportsRule));const p={};return Object.entries(c).forEach(([m,g])=>{p[m]={insertRule:g.prototype.insertRule,deleteRule:g.prototype.deleteRule},g.prototype.insertRule=new Proxy(p[m].insertRule,{apply:Y((f,b,w)=>{const[C,k]=w,{id:x,styleId:A}=Ln(b.parentStyleSheet,e,t.styleMirror);return(x&&x!==-1||A&&A!==-1)&&n({id:x,styleId:A,adds:[{rule:C,index:[...Wt(b),k||0]}]}),f.apply(b,w)})}),g.prototype.deleteRule=new Proxy(p[m].deleteRule,{apply:Y((f,b,w)=>{const[C]=w,{id:k,styleId:x}=Ln(b.parentStyleSheet,e,t.styleMirror);return(k&&k!==-1||x&&x!==-1)&&n({id:k,styleId:x,removes:[{index:[...Wt(b),C]}]}),f.apply(b,w)})})}),Y(()=>{i.CSSStyleSheet.prototype.insertRule=s,i.CSSStyleSheet.prototype.deleteRule=o,a&&(i.CSSStyleSheet.prototype.replace=a),l&&(i.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach(([m,g])=>{g.prototype.insertRule=p[m].insertRule,g.prototype.deleteRule=p[m].deleteRule})})}function Mo({mirror:n,stylesheetManager:e},t){var i,s,o;let a=null;t.nodeName==="#document"?a=n.getId(t):a=n.getId(t.host);const l=t.nodeName==="#document"?(i=t.defaultView)===null||i===void 0?void 0:i.Document:(o=(s=t.ownerDocument)===null||s===void 0?void 0:s.defaultView)===null||o===void 0?void 0:o.ShadowRoot,c=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!l||!c?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var p;return(p=c.get)===null||p===void 0?void 0:p.call(this)},set(p){var m;const g=(m=c.set)===null||m===void 0?void 0:m.call(this,p);if(a!==null&&a!==-1)try{e.adoptStyleSheets(p,a)}catch{}return g}}),Y(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))}function ll({styleDeclarationCb:n,mirror:e,ignoreCSSAttributes:t,stylesheetManager:i},{win:s}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Y((l,c,p)=>{var m;const[g,f,b]=p;if(t.has(g))return o.apply(c,[g,f,b]);const{id:w,styleId:C}=Ln((m=c.parentRule)===null||m===void 0?void 0:m.parentStyleSheet,e,i.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,set:{property:g,value:f,priority:b},index:Wt(c.parentRule)}),l.apply(c,p)})});const a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:Y((l,c,p)=>{var m;const[g]=p;if(t.has(g))return a.apply(c,[g]);const{id:f,styleId:b}=Ln((m=c.parentRule)===null||m===void 0?void 0:m.parentStyleSheet,e,i.styleMirror);return(f&&f!==-1||b&&b!==-1)&&n({id:f,styleId:b,remove:{property:g},index:Wt(c.parentRule)}),l.apply(c,p)})}),Y(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=a})}function cl({mediaInteractionCb:n,blockClass:e,blockSelector:t,mirror:i,sampling:s,doc:o}){const a=Y(c=>At(Y(p=>{const m=Lt(p);if(!m||Ne(m,e,t,!0))return;const{currentTime:g,volume:f,muted:b,playbackRate:w,loop:C}=m;n({type:c,id:i.getId(m),currentTime:g,volume:f,muted:b,playbackRate:w,loop:C})}),s.media||500)),l=[He("play",a(0),o),He("pause",a(1),o),He("seeked",a(2),o),He("volumechange",a(3),o),He("ratechange",a(4),o)];return Y(()=>{l.forEach(c=>c())})}function dl({fontCb:n,doc:e}){const t=e.defaultView;if(!t)return()=>{};const i=[],s=new WeakMap,o=t.FontFace;t.FontFace=function(c,p,m){const g=new o(c,p,m);return s.set(g,{family:c,buffer:typeof p!="string",descriptors:m,fontSource:typeof p=="string"?p:JSON.stringify(Array.from(new Uint8Array(p)))}),g};const a=lt(e.fonts,"add",function(l){return function(c){return setTimeout(Y(()=>{const p=s.get(c);p&&(n(p),s.delete(c))}),0),l.apply(this,[c])}});return i.push(()=>{t.FontFace=o}),i.push(a),Y(()=>{i.forEach(l=>l())})}function ul(n){const{doc:e,mirror:t,blockClass:i,blockSelector:s,selectionCb:o}=n;let a=!0;const l=Y(()=>{const c=e.getSelection();if(!c||a&&(c!=null&&c.isCollapsed))return;a=c.isCollapsed||!1;const p=[],m=c.rangeCount||0;for(let g=0;g<m;g++){const f=c.getRangeAt(g),{startContainer:b,startOffset:w,endContainer:C,endOffset:k}=f;Ne(b,i,s,!0)||Ne(C,i,s,!0)||p.push({start:t.getId(b),startOffset:w,end:t.getId(C),endOffset:k})}o({ranges:p})});return l(),He("selectionchange",l)}function hl({doc:n,customElementCb:e}){const t=n.defaultView;return!t||!t.customElements?()=>{}:lt(t.customElements,"define",function(s){return function(o,a,l){try{e({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return s.apply(this,[o,a,l])}})}function ml(n,e){const{mutationCb:t,mousemoveCb:i,mouseInteractionCb:s,scrollCb:o,viewportResizeCb:a,inputCb:l,mediaInteractionCb:c,styleSheetRuleCb:p,styleDeclarationCb:m,canvasMutationCb:g,fontCb:f,selectionCb:b,customElementCb:w}=n;n.mutationCb=(...C)=>{e.mutation&&e.mutation(...C),t(...C)},n.mousemoveCb=(...C)=>{e.mousemove&&e.mousemove(...C),i(...C)},n.mouseInteractionCb=(...C)=>{e.mouseInteraction&&e.mouseInteraction(...C),s(...C)},n.scrollCb=(...C)=>{e.scroll&&e.scroll(...C),o(...C)},n.viewportResizeCb=(...C)=>{e.viewportResize&&e.viewportResize(...C),a(...C)},n.inputCb=(...C)=>{e.input&&e.input(...C),l(...C)},n.mediaInteractionCb=(...C)=>{e.mediaInteaction&&e.mediaInteaction(...C),c(...C)},n.styleSheetRuleCb=(...C)=>{e.styleSheetRule&&e.styleSheetRule(...C),p(...C)},n.styleDeclarationCb=(...C)=>{e.styleDeclaration&&e.styleDeclaration(...C),m(...C)},n.canvasMutationCb=(...C)=>{e.canvasMutation&&e.canvasMutation(...C),g(...C)},n.fontCb=(...C)=>{e.font&&e.font(...C),f(...C)},n.selectionCb=(...C)=>{e.selection&&e.selection(...C),b(...C)},n.customElementCb=(...C)=>{e.customElement&&e.customElement(...C),w(...C)}}function pl(n,e={}){const t=n.doc.defaultView;if(!t)return()=>{};ml(n,e);let i;n.recordDOM&&(i=So(n,n.doc));const s=tl(n),o=il(n),a=xo(n),l=sl(n,{win:t}),c=al(n),p=cl(n);let m=()=>{},g=()=>{},f=()=>{},b=()=>{};n.recordDOM&&(m=rl(n,{win:t}),g=Mo(n,n.doc),f=ll(n,{win:t}),n.collectFonts&&(b=dl(n)));const w=ul(n),C=hl(n),k=[];for(const x of n.plugins)k.push(x.observer(x.callback,t,x.options));return Y(()=>{Kn.forEach(x=>x.reset()),i==null||i.disconnect(),s(),o(),a(),l(),c(),p(),m(),g(),f(),b(),w(),C(),k.forEach(x=>x())})}function Zt(n){return typeof window[n]<"u"}function Qt(n){return!!(typeof window[n]<"u"&&window[n].prototype&&"insertRule"in window[n].prototype&&"deleteRule"in window[n].prototype)}class Lo{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,i,s){const o=i||this.getIdToRemoteIdMap(e),a=s||this.getRemoteIdToIdMap(e);let l=o.get(t);return l||(l=this.generateIdFn(),o.set(t,l),a.set(l,t)),l}getIds(e,t){const i=this.getIdToRemoteIdMap(e),s=this.getRemoteIdToIdMap(e);return t.map(o=>this.getId(e,o,i,s))}getRemoteId(e,t,i){const s=i||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;const o=s.get(t);return o||-1}getRemoteIds(e,t){const i=this.getRemoteIdToIdMap(e);return t.map(s=>this.getRemoteId(e,s,i))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class vl{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Lo(no),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Lo(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(i=this.loadListener)===null||i===void 0||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;const s=this.crossOriginIframeMap.get(e.source);if(!s)return;const o=this.transformCrossOriginEvent(s,t.data.event);o&&this.wrappedEmit(o,t.data.isCheckout)}transformCrossOriginEvent(e,t){var i;switch(t.type){case X.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const s=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,s),this.patchRootIdOnNode(t.data.node,s),{timestamp:t.timestamp,type:X.IncrementalSnapshot,data:{source:J.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case X.Meta:case X.Load:case X.DomContentLoaded:return!1;case X.Plugin:return t;case X.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case X.IncrementalSnapshot:switch(t.data.source){case J.Mutation:return t.data.adds.forEach(s=>{this.replaceIds(s,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(s.node,e);const o=this.crossOriginIframeRootIdMap.get(e);o&&this.patchRootIdOnNode(s.node,o)}),t.data.removes.forEach(s=>{this.replaceIds(s,e,["parentId","id"])}),t.data.attributes.forEach(s=>{this.replaceIds(s,e,["id"])}),t.data.texts.forEach(s=>{this.replaceIds(s,e,["id"])}),t;case J.Drag:case J.TouchMove:case J.MouseMove:return t.data.positions.forEach(s=>{this.replaceIds(s,e,["id"])}),t;case J.ViewportResize:return!1;case J.MediaInteraction:case J.MouseInteraction:case J.Scroll:case J.CanvasMutation:case J.Input:return this.replaceIds(t.data,e,["id"]),t;case J.StyleSheetRule:case J.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case J.Font:return t;case J.Selection:return t.data.ranges.forEach(s=>{this.replaceIds(s,e,["start","end"])}),t;case J.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(i=t.data.styles)===null||i===void 0||i.forEach(s=>{this.replaceStyleIds(s,e,["styleId"])}),t}}return!1}replace(e,t,i,s){for(const o of s)!Array.isArray(t[o])&&typeof t[o]!="number"||(Array.isArray(t[o])?t[o]=e.getIds(i,t[o]):t[o]=e.getId(i,t[o]));return t}replaceIds(e,t,i){return this.replace(this.crossOriginIframeMirror,e,t,i)}replaceStyleIds(e,t,i){return this.replace(this.crossOriginIframeStyleMirror,e,t,i)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(i=>{this.replaceIdOnNode(i,t)})}patchRootIdOnNode(e,t){e.type!==ve.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(i=>{this.patchRootIdOnNode(i,t)})}}class bl{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!St(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const i=So(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>i.disconnect()),this.restoreHandlers.push(xo(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(Mo({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const i=this;this.restoreHandlers.push(lt(e.prototype,"attachShadow",function(s){return function(o){const a=s.call(this,o);return this.shadowRoot&&bo(this)&&i.addShadowRoot(this.shadowRoot,t),a}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
|
|
1134
1134
|
Copyright (c) Microsoft Corporation.
|
|
1135
1135
|
|
|
1136
1136
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -1158,13 +1158,13 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1158
1158
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
1159
1159
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1160
1160
|
PERFORMANCE OF THIS SOFTWARE.
|
|
1161
|
-
***************************************************************************** */function n(p,m,g,f){function b(w){return w instanceof g?w:new g(function(C){C(w)})}return new(g||(g=Promise))(function(w,C){function k(M){try{A(f.next(M))}catch(E){C(E)}}function x(M){try{A(f.throw(M))}catch(E){C(E)}}function A(M){M.done?w(M.value):b(M.value).then(k,x)}A((f=f.apply(p,[])).next())})}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=typeof Uint8Array>"u"?[]:new Uint8Array(256),i=0;i<e.length;i++)t[e.charCodeAt(i)]=i;var s=function(p){var m=new Uint8Array(p),g,f=m.length,b="";for(g=0;g<f;g+=3)b+=e[m[g]>>2],b+=e[(m[g]&3)<<4|m[g+1]>>4],b+=e[(m[g+1]&15)<<2|m[g+2]>>6],b+=e[m[g+2]&63];return f%3===2?b=b.substring(0,b.length-1)+"=":f%3===1&&(b=b.substring(0,b.length-2)+"=="),b};const o=new Map,a=new Map;function l(p,m,g){return n(this,void 0,void 0,function*(){const f=`${p}-${m}`;if("OffscreenCanvas"in globalThis){if(a.has(f))return a.get(f);const b=new OffscreenCanvas(p,m);b.getContext("2d");const C=yield(yield b.convertToBlob(g)).arrayBuffer(),k=s(C);return a.set(f,k),k}else return""})}const c=self;c.onmessage=function(p){return n(this,void 0,void 0,function*(){if("OffscreenCanvas"in globalThis){const{id:m,bitmap:g,width:f,height:b,dataURLOptions:w}=p.data,C=l(f,b,w),k=new OffscreenCanvas(f,b);k.getContext("2d").drawImage(g,0,0),g.close();const A=yield k.convertToBlob(w),M=A.type,E=yield A.arrayBuffer(),D=s(E);if(!o.has(m)&&(yield C)===D)return o.set(m,D),c.postMessage({id:m});if(o.get(m)===D)return c.postMessage({id:m});c.postMessage({id:m,type:M,base64:D,width:f,height:b}),o.set(m,D)}else return c.postMessage({id:p.data.id})})}})()});class _l{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(c,p)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(c)||this.pendingCanvasMutations.set(c,[]),this.pendingCanvasMutations.get(c).push(p)};const{sampling:t="all",win:i,blockClass:s,blockSelector:o,recordCanvas:a,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&t==="all"&&this.initCanvasMutationObserver(i,s,o),a&&typeof t=="number"&&this.initCanvasFPSObserver(t,i,s,o,{dataURLOptions:l})}initCanvasFPSObserver(e,t,i,s,o){const a=Io(t,i,s,!0),l=new Map,c=new Tl;c.onmessage=w=>{const{id:C}=w.data;if(l.set(C,!1),!("base64"in w.data))return;const{base64:k,type:x,width:A,height:M}=w.data;this.mutationCb({id:C,type:ct["2D"],commands:[{property:"clearRect",args:[0,0,A,M]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:k}],type:x}]},0,0]}]})};const p=1e3/e;let m=0,g;const f=()=>{const w=[];return t.document.querySelectorAll("canvas").forEach(C=>{Ne(C,i,s,!0)||w.push(C)}),w},b=w=>{if(m&&w-m<p){g=requestAnimationFrame(b);return}m=w,f().forEach(C=>gl(this,void 0,void 0,function*(){var k;const x=this.mirror.getId(C);if(l.get(x)||C.width===0||C.height===0)return;if(l.set(x,!0),["webgl","webgl2"].includes(C.__context)){const M=C.getContext(C.__context);((k=M==null?void 0:M.getContextAttributes())===null||k===void 0?void 0:k.preserveDrawingBuffer)===!1&&M.clear(M.COLOR_BUFFER_BIT)}const A=yield createImageBitmap(C);c.postMessage({id:x,bitmap:A,width:C.width,height:C.height,dataURLOptions:o.dataURLOptions},[A])})),g=requestAnimationFrame(b)};g=requestAnimationFrame(b),this.resetObservers=()=>{a(),cancelAnimationFrame(g)}}initCanvasMutationObserver(e,t,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=Io(e,t,i,!1),o=kl(this.processMutation.bind(this),e,t,i),a=xl(this.processMutation.bind(this),e,t,i,this.mirror);this.resetObservers=()=>{s(),o(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const i=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,i)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(e);if(!i||t===-1)return;const s=i.map(a=>fl(a,["type"])),{type:o}=i[0];this.mutationCb({id:t,type:o,commands:s}),this.pendingCanvasMutations.delete(e)}}class El{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Qr,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;const i={id:t,styleIds:[]},s=[];for(const o of e){let a;this.styleMirror.has(o)?a=this.styleMirror.getId(o):(a=this.styleMirror.add(o),s.push({styleId:a,rules:Array.from(o.rules||CSSRule,(l,c)=>({rule:Ys(l),index:c}))})),i.styleIds.push(a)}s.length>0&&(i.styles=s),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class Pl{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(e,t){const i=this.nodeMap.get(e);return i&&Array.from(i).some(s=>s!==t)}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function be(n){return Object.assign(Object.assign({},n),{timestamp:qt()})}let he,Xt,zi,$t=!1;const nn=xr();function Tt(n={}){const{emit:e,checkoutEveryNms:t,checkoutEveryNth:i,blockClass:s="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:c="rr-mask",maskTextSelector:p=null,inlineStylesheet:m=!0,maskAllInputs:g,maskInputOptions:f,slimDOMOptions:b,maskInputFn:w,maskTextFn:C,hooks:k,packFn:x,sampling:A={},dataURLOptions:M={},mousemoveWait:E,recordDOM:D=!0,recordCanvas:q=!1,recordCrossOriginIframes:Q=!1,recordAfter:K=n.recordAfter==="DOMContentLoaded"?n.recordAfter:"load",userTriggeredOnInput:W=!1,collectFonts:de=!1,inlineImages:Le=!1,plugins:G,keepIframeSrcFn:Oe=()=>!1,ignoreCSSAttributes:ge=new Set([]),errorHandler:Ge}=n;el(Ge);const Te=Q?window.parent===window:!0;let yn=!1;if(!Te)try{window.parent.document&&(yn=!1)}catch{yn=!0}if(Te&&!e)throw new Error("emit function is required");E!==void 0&&A.mousemove===void 0&&(A.mousemove=E),nn.reset();const un=g===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f!==void 0?f:{password:!0},Cn=b===!0||b==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:b==="all",headMetaDescKeywords:b==="all"}:b||{};Zr();let qn,Hn=0;const je=H=>{for(const ye of G||[])ye.eventProcessor&&(H=ye.eventProcessor(H));return x&&!yn&&(H=x(H)),H};he=(H,ye)=>{var te;if(!((te=Kn[0])===null||te===void 0)&&te.isFrozen()&&H.type!==X.FullSnapshot&&!(H.type===X.IncrementalSnapshot&&H.data.source===J.Mutation)&&Kn.forEach(Ce=>Ce.unfreeze()),Te)e==null||e(je(H),ye);else if(yn){const Ce={type:"rrweb",event:je(H),origin:window.location.origin,isCheckout:ye};window.parent.postMessage(Ce,"*")}if(H.type===X.FullSnapshot)qn=H,Hn=0;else if(H.type===X.IncrementalSnapshot){if(H.data.source===J.Mutation&&H.data.isAttachIframe)return;Hn++;const Ce=i&&Hn>=i,qe=t&&H.timestamp-qn.timestamp>t;(Ce||qe)&&Xt(!0)}};const wn=H=>{he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.Mutation},H)}))},Wn=H=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.Scroll},H)})),me=H=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.CanvasMutation},H)})),Se=H=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.AdoptedStyleSheet},H)})),Qe=new El({mutationCb:wn,adoptedStyleSheetCb:Se}),ze=new vl({mirror:nn,mutationCb:wn,stylesheetManager:Qe,recordCrossOriginIframes:Q,wrappedEmit:he});for(const H of G||[])H.getMirror&&H.getMirror({nodeMirror:nn,crossOriginIframeMirror:ze.crossOriginIframeMirror,crossOriginIframeStyleMirror:ze.crossOriginIframeStyleMirror});const Ie=new Pl;zi=new _l({recordCanvas:q,mutationCb:me,win:window,blockClass:s,blockSelector:o,mirror:nn,sampling:A.canvas,dataURLOptions:M});const hn=new bl({mutationCb:wn,scrollCb:Wn,bypassOptions:{blockClass:s,blockSelector:o,maskTextClass:c,maskTextSelector:p,inlineStylesheet:m,maskInputOptions:un,dataURLOptions:M,maskTextFn:C,maskInputFn:w,recordCanvas:q,inlineImages:Le,sampling:A,slimDOMOptions:Cn,iframeManager:ze,stylesheetManager:Qe,canvasManager:zi,keepIframeSrcFn:Oe,processedNodeManager:Ie},mirror:nn});Xt=(H=!1)=>{if(!D)return;he(be({type:X.Meta,data:{href:window.location.href,width:co(),height:lo()}}),H),Qe.reset(),hn.init(),Kn.forEach(te=>te.lock());const ye=qr(document,{mirror:nn,blockClass:s,blockSelector:o,maskTextClass:c,maskTextSelector:p,inlineStylesheet:m,maskAllInputs:un,maskTextFn:C,slimDOM:Cn,dataURLOptions:M,recordCanvas:q,inlineImages:Le,onSerialize:te=>{mo(te,nn)&&ze.addIframe(te),po(te,nn)&&Qe.trackLinkElement(te),Gi(te)&&hn.addShadowRoot(te.shadowRoot,document)},onIframeLoad:(te,Ce)=>{ze.attachIframe(te,Ce),hn.observeAttachShadow(te)},onStylesheetLoad:(te,Ce)=>{Qe.attachLinkElement(te,Ce)},keepIframeSrcFn:Oe});if(!ye)return console.warn("Failed to snapshot the document");he(be({type:X.FullSnapshot,data:{node:ye,initialOffset:ro(window)}}),H),Kn.forEach(te=>te.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Qe.adoptStyleSheets(document.adoptedStyleSheets,nn.getId(document))};try{const H=[],ye=Ce=>{var qe;return Y(pl)({mutationCb:wn,mousemoveCb:(ne,Nn)=>he(be({type:X.IncrementalSnapshot,data:{source:Nn,positions:ne}})),mouseInteractionCb:ne=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.MouseInteraction},ne)})),scrollCb:Wn,viewportResizeCb:ne=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.ViewportResize},ne)})),inputCb:ne=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.Input},ne)})),mediaInteractionCb:ne=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.MediaInteraction},ne)})),styleSheetRuleCb:ne=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.StyleSheetRule},ne)})),styleDeclarationCb:ne=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.StyleDeclaration},ne)})),canvasMutationCb:me,fontCb:ne=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.Font},ne)})),selectionCb:ne=>{he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.Selection},ne)}))},customElementCb:ne=>{he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.CustomElement},ne)}))},blockClass:s,ignoreClass:a,ignoreSelector:l,maskTextClass:c,maskTextSelector:p,maskInputOptions:un,inlineStylesheet:m,sampling:A,recordDOM:D,recordCanvas:q,inlineImages:Le,userTriggeredOnInput:W,collectFonts:de,doc:Ce,maskInputFn:w,maskTextFn:C,keepIframeSrcFn:Oe,blockSelector:o,slimDOMOptions:Cn,dataURLOptions:M,mirror:nn,iframeManager:ze,stylesheetManager:Qe,shadowDomManager:hn,processedNodeManager:Ie,canvasManager:zi,ignoreCSSAttributes:ge,plugins:((qe=G==null?void 0:G.filter(ne=>ne.observer))===null||qe===void 0?void 0:qe.map(ne=>({observer:ne.observer,options:ne.options,callback:Nn=>he(be({type:X.Plugin,data:{plugin:ne.name,payload:Nn}}))})))||[]},k)};ze.addLoadListener(Ce=>{try{H.push(ye(Ce.contentDocument))}catch(qe){console.warn(qe)}});const te=()=>{Xt(),H.push(ye(document)),$t=!0};return document.readyState==="interactive"||document.readyState==="complete"?te():(H.push(He("DOMContentLoaded",()=>{he(be({type:X.DomContentLoaded,data:{}})),K==="DOMContentLoaded"&&te()})),H.push(He("load",()=>{he(be({type:X.Load,data:{}})),K==="load"&&te()},window))),()=>{H.forEach(Ce=>Ce()),Ie.destroy(),$t=!1,nl()}}catch(H){console.warn(H)}}Tt.addCustomEvent=(n,e)=>{if(!$t)throw new Error("please add custom event after start recording");he(be({type:X.Custom,data:{tag:n,payload:e}}))},Tt.freezePage=()=>{Kn.forEach(n=>n.freeze())},Tt.takeFullSnapshot=n=>{if(!$t)throw new Error("please take full snapshot after start recording");Xt(n)},Tt.mirror=nn;var Bo=(n=>(n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n))(Bo||{}),ln=(n=>(n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n))(ln||{}),vn={DEBUG:!1,LIB_VERSION:"2.55.1"},O;if(typeof window>"u"){var Ro={hostname:""};O={navigator:{userAgent:"",onLine:!0},document:{location:Ro,referrer:""},screen:{width:0,height:0},location:Ro}}else O=window;var _t=24*60*60*1e3,qi=8*1e3,ei=Array.prototype,Il=Function.prototype,Ho=Object.prototype,Tn=ei.slice,Et=Ho.toString,ni=Ho.hasOwnProperty,fe=O.console,_n=O.navigator,oe=O.document,ti=O.opera,ii=O.screen,cn=_n.userAgent,Wi=Il.bind,No=ei.forEach,Oo=ei.indexOf,Uo=ei.map,Dl=Array.isArray,Zi={},v={trim:function(n){return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},ee={log:function(){if(vn.DEBUG&&!v.isUndefined(fe)&&fe)try{fe.log.apply(fe,arguments)}catch{v.each(arguments,function(e){fe.log(e)})}},warn:function(){if(vn.DEBUG&&!v.isUndefined(fe)&&fe){var n=["Mixpanel warning:"].concat(v.toArray(arguments));try{fe.warn.apply(fe,n)}catch{v.each(n,function(t){fe.warn(t)})}}},error:function(){if(vn.DEBUG&&!v.isUndefined(fe)&&fe){var n=["Mixpanel error:"].concat(v.toArray(arguments));try{fe.error.apply(fe,n)}catch{v.each(n,function(t){fe.error(t)})}}},critical:function(){if(!v.isUndefined(fe)&&fe){var n=["Mixpanel error:"].concat(v.toArray(arguments));try{fe.error.apply(fe,n)}catch{v.each(n,function(t){fe.error(t)})}}}},Qi=function(n,e){return function(){return arguments[0]="["+e+"] "+arguments[0],n.apply(ee,arguments)}},si=function(n){return{log:Qi(ee.log,n),error:Qi(ee.error,n),critical:Qi(ee.critical,n)}};v.bind=function(n,e){var t,i;if(Wi&&n.bind===Wi)return Wi.apply(n,Tn.call(arguments,1));if(!v.isFunction(n))throw new TypeError;return t=Tn.call(arguments,2),i=function(){if(!(this instanceof i))return n.apply(e,t.concat(Tn.call(arguments)));var s={};s.prototype=n.prototype;var o=new s;s.prototype=null;var a=n.apply(o,t.concat(Tn.call(arguments)));return Object(a)===a?a:o},i},v.each=function(n,e,t){if(n!=null){if(No&&n.forEach===No)n.forEach(e,t);else if(n.length===+n.length){for(var i=0,s=n.length;i<s;i++)if(i in n&&e.call(t,n[i],i,n)===Zi)return}else for(var o in n)if(ni.call(n,o)&&e.call(t,n[o],o,n)===Zi)return}},v.extend=function(n){return v.each(Tn.call(arguments,1),function(e){for(var t in e)e[t]!==void 0&&(n[t]=e[t])}),n},v.isArray=Dl||function(n){return Et.call(n)==="[object Array]"},v.isFunction=function(n){try{return/^\s*\bfunction\b/.test(n)}catch{return!1}},v.isArguments=function(n){return!!(n&&ni.call(n,"callee"))},v.toArray=function(n){return n?n.toArray?n.toArray():v.isArray(n)||v.isArguments(n)?Tn.call(n):v.values(n):[]},v.map=function(n,e,t){if(Uo&&n.map===Uo)return n.map(e,t);var i=[];return v.each(n,function(s){i.push(e.call(t,s))}),i},v.keys=function(n){var e=[];return n===null||v.each(n,function(t,i){e[e.length]=i}),e},v.values=function(n){var e=[];return n===null||v.each(n,function(t){e[e.length]=t}),e},v.include=function(n,e){var t=!1;return n===null?t:Oo&&n.indexOf===Oo?n.indexOf(e)!=-1:(v.each(n,function(i){if(t||(t=i===e))return Zi}),t)},v.includes=function(n,e){return n.indexOf(e)!==-1},v.inherit=function(n,e){return n.prototype=new e,n.prototype.constructor=n,n.superclass=e.prototype,n},v.isObject=function(n){return n===Object(n)&&!v.isArray(n)},v.isEmptyObject=function(n){if(v.isObject(n)){for(var e in n)if(ni.call(n,e))return!1;return!0}return!1},v.isUndefined=function(n){return n===void 0},v.isString=function(n){return Et.call(n)=="[object String]"},v.isDate=function(n){return Et.call(n)=="[object Date]"},v.isNumber=function(n){return Et.call(n)=="[object Number]"},v.isElement=function(n){return!!(n&&n.nodeType===1)},v.encodeDates=function(n){return v.each(n,function(e,t){v.isDate(e)?n[t]=v.formatDate(e):v.isObject(e)&&(n[t]=v.encodeDates(e))}),n},v.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},v.formatDate=function(n){function e(t){return t<10?"0"+t:t}return n.getUTCFullYear()+"-"+e(n.getUTCMonth()+1)+"-"+e(n.getUTCDate())+"T"+e(n.getUTCHours())+":"+e(n.getUTCMinutes())+":"+e(n.getUTCSeconds())},v.strip_empty_properties=function(n){var e={};return v.each(n,function(t,i){v.isString(t)&&t.length>0&&(e[i]=t)}),e},v.truncate=function(n,e){var t;return typeof n=="string"?t=n.slice(0,e):v.isArray(n)?(t=[],v.each(n,function(i){t.push(v.truncate(i,e))})):v.isObject(n)?(t={},v.each(n,function(i,s){t[s]=v.truncate(i,e)})):t=n,t},v.JSONEncode=function(){return function(n){var e=n,t=function(s){var o=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return o.lastIndex=0,o.test(s)?'"'+s.replace(o,function(l){var c=a[l];return typeof c=="string"?c:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+s+'"'},i=function(s,o){var a="",l=" ",c=0,p="",m="",g=0,f=a,b=[],w=o[s];switch(w&&typeof w=="object"&&typeof w.toJSON=="function"&&(w=w.toJSON(s)),typeof w){case"string":return t(w);case"number":return isFinite(w)?String(w):"null";case"boolean":case"null":return String(w);case"object":if(!w)return"null";if(a+=l,b=[],Et.apply(w)==="[object Array]"){for(g=w.length,c=0;c<g;c+=1)b[c]=i(c,w)||"null";return m=b.length===0?"[]":a?`[
|
|
1161
|
+
***************************************************************************** */function n(p,m,g,f){function b(w){return w instanceof g?w:new g(function(C){C(w)})}return new(g||(g=Promise))(function(w,C){function k(M){try{A(f.next(M))}catch(P){C(P)}}function x(M){try{A(f.throw(M))}catch(P){C(P)}}function A(M){M.done?w(M.value):b(M.value).then(k,x)}A((f=f.apply(p,[])).next())})}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=typeof Uint8Array>"u"?[]:new Uint8Array(256),i=0;i<e.length;i++)t[e.charCodeAt(i)]=i;var s=function(p){var m=new Uint8Array(p),g,f=m.length,b="";for(g=0;g<f;g+=3)b+=e[m[g]>>2],b+=e[(m[g]&3)<<4|m[g+1]>>4],b+=e[(m[g+1]&15)<<2|m[g+2]>>6],b+=e[m[g+2]&63];return f%3===2?b=b.substring(0,b.length-1)+"=":f%3===1&&(b=b.substring(0,b.length-2)+"=="),b};const o=new Map,a=new Map;function l(p,m,g){return n(this,void 0,void 0,function*(){const f=`${p}-${m}`;if("OffscreenCanvas"in globalThis){if(a.has(f))return a.get(f);const b=new OffscreenCanvas(p,m);b.getContext("2d");const C=yield(yield b.convertToBlob(g)).arrayBuffer(),k=s(C);return a.set(f,k),k}else return""})}const c=self;c.onmessage=function(p){return n(this,void 0,void 0,function*(){if("OffscreenCanvas"in globalThis){const{id:m,bitmap:g,width:f,height:b,dataURLOptions:w}=p.data,C=l(f,b,w),k=new OffscreenCanvas(f,b);k.getContext("2d").drawImage(g,0,0),g.close();const A=yield k.convertToBlob(w),M=A.type,P=yield A.arrayBuffer(),D=s(P);if(!o.has(m)&&(yield C)===D)return o.set(m,D),c.postMessage({id:m});if(o.get(m)===D)return c.postMessage({id:m});c.postMessage({id:m,type:M,base64:D,width:f,height:b}),o.set(m,D)}else return c.postMessage({id:p.data.id})})}})()});class _l{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(c,p)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(c)||this.pendingCanvasMutations.set(c,[]),this.pendingCanvasMutations.get(c).push(p)};const{sampling:t="all",win:i,blockClass:s,blockSelector:o,recordCanvas:a,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&t==="all"&&this.initCanvasMutationObserver(i,s,o),a&&typeof t=="number"&&this.initCanvasFPSObserver(t,i,s,o,{dataURLOptions:l})}initCanvasFPSObserver(e,t,i,s,o){const a=Io(t,i,s,!0),l=new Map,c=new Tl;c.onmessage=w=>{const{id:C}=w.data;if(l.set(C,!1),!("base64"in w.data))return;const{base64:k,type:x,width:A,height:M}=w.data;this.mutationCb({id:C,type:ct["2D"],commands:[{property:"clearRect",args:[0,0,A,M]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:k}],type:x}]},0,0]}]})};const p=1e3/e;let m=0,g;const f=()=>{const w=[];return t.document.querySelectorAll("canvas").forEach(C=>{Ne(C,i,s,!0)||w.push(C)}),w},b=w=>{if(m&&w-m<p){g=requestAnimationFrame(b);return}m=w,f().forEach(C=>gl(this,void 0,void 0,function*(){var k;const x=this.mirror.getId(C);if(l.get(x)||C.width===0||C.height===0)return;if(l.set(x,!0),["webgl","webgl2"].includes(C.__context)){const M=C.getContext(C.__context);((k=M==null?void 0:M.getContextAttributes())===null||k===void 0?void 0:k.preserveDrawingBuffer)===!1&&M.clear(M.COLOR_BUFFER_BIT)}const A=yield createImageBitmap(C);c.postMessage({id:x,bitmap:A,width:C.width,height:C.height,dataURLOptions:o.dataURLOptions},[A])})),g=requestAnimationFrame(b)};g=requestAnimationFrame(b),this.resetObservers=()=>{a(),cancelAnimationFrame(g)}}initCanvasMutationObserver(e,t,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=Io(e,t,i,!1),o=kl(this.processMutation.bind(this),e,t,i),a=xl(this.processMutation.bind(this),e,t,i,this.mirror);this.resetObservers=()=>{s(),o(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const i=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,i)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(e);if(!i||t===-1)return;const s=i.map(a=>fl(a,["type"])),{type:o}=i[0];this.mutationCb({id:t,type:o,commands:s}),this.pendingCanvasMutations.delete(e)}}class El{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Qr,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;const i={id:t,styleIds:[]},s=[];for(const o of e){let a;this.styleMirror.has(o)?a=this.styleMirror.getId(o):(a=this.styleMirror.add(o),s.push({styleId:a,rules:Array.from(o.rules||CSSRule,(l,c)=>({rule:Ys(l),index:c}))})),i.styleIds.push(a)}s.length>0&&(i.styles=s),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class Pl{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(e,t){const i=this.nodeMap.get(e);return i&&Array.from(i).some(s=>s!==t)}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function be(n){return Object.assign(Object.assign({},n),{timestamp:qt()})}let he,Xt,zi,$t=!1;const nn=xr();function Tt(n={}){const{emit:e,checkoutEveryNms:t,checkoutEveryNth:i,blockClass:s="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:c="rr-mask",maskTextSelector:p=null,inlineStylesheet:m=!0,maskAllInputs:g,maskInputOptions:f,slimDOMOptions:b,maskInputFn:w,maskTextFn:C,hooks:k,packFn:x,sampling:A={},dataURLOptions:M={},mousemoveWait:P,recordDOM:D=!0,recordCanvas:q=!1,recordCrossOriginIframes:Q=!1,recordAfter:K=n.recordAfter==="DOMContentLoaded"?n.recordAfter:"load",userTriggeredOnInput:W=!1,collectFonts:de=!1,inlineImages:Le=!1,plugins:G,keepIframeSrcFn:Oe=()=>!1,ignoreCSSAttributes:ge=new Set([]),errorHandler:Ge}=n;el(Ge);const Te=Q?window.parent===window:!0;let yn=!1;if(!Te)try{window.parent.document&&(yn=!1)}catch{yn=!0}if(Te&&!e)throw new Error("emit function is required");P!==void 0&&A.mousemove===void 0&&(A.mousemove=P),nn.reset();const un=g===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f!==void 0?f:{password:!0},Cn=b===!0||b==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:b==="all",headMetaDescKeywords:b==="all"}:b||{};Zr();let qn,Hn=0;const je=H=>{for(const ye of G||[])ye.eventProcessor&&(H=ye.eventProcessor(H));return x&&!yn&&(H=x(H)),H};he=(H,ye)=>{var te;if(!((te=Kn[0])===null||te===void 0)&&te.isFrozen()&&H.type!==X.FullSnapshot&&!(H.type===X.IncrementalSnapshot&&H.data.source===J.Mutation)&&Kn.forEach(Ce=>Ce.unfreeze()),Te)e==null||e(je(H),ye);else if(yn){const Ce={type:"rrweb",event:je(H),origin:window.location.origin,isCheckout:ye};window.parent.postMessage(Ce,"*")}if(H.type===X.FullSnapshot)qn=H,Hn=0;else if(H.type===X.IncrementalSnapshot){if(H.data.source===J.Mutation&&H.data.isAttachIframe)return;Hn++;const Ce=i&&Hn>=i,qe=t&&H.timestamp-qn.timestamp>t;(Ce||qe)&&Xt(!0)}};const wn=H=>{he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.Mutation},H)}))},Wn=H=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.Scroll},H)})),me=H=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.CanvasMutation},H)})),Se=H=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.AdoptedStyleSheet},H)})),Qe=new El({mutationCb:wn,adoptedStyleSheetCb:Se}),ze=new vl({mirror:nn,mutationCb:wn,stylesheetManager:Qe,recordCrossOriginIframes:Q,wrappedEmit:he});for(const H of G||[])H.getMirror&&H.getMirror({nodeMirror:nn,crossOriginIframeMirror:ze.crossOriginIframeMirror,crossOriginIframeStyleMirror:ze.crossOriginIframeStyleMirror});const Ie=new Pl;zi=new _l({recordCanvas:q,mutationCb:me,win:window,blockClass:s,blockSelector:o,mirror:nn,sampling:A.canvas,dataURLOptions:M});const hn=new bl({mutationCb:wn,scrollCb:Wn,bypassOptions:{blockClass:s,blockSelector:o,maskTextClass:c,maskTextSelector:p,inlineStylesheet:m,maskInputOptions:un,dataURLOptions:M,maskTextFn:C,maskInputFn:w,recordCanvas:q,inlineImages:Le,sampling:A,slimDOMOptions:Cn,iframeManager:ze,stylesheetManager:Qe,canvasManager:zi,keepIframeSrcFn:Oe,processedNodeManager:Ie},mirror:nn});Xt=(H=!1)=>{if(!D)return;he(be({type:X.Meta,data:{href:window.location.href,width:co(),height:lo()}}),H),Qe.reset(),hn.init(),Kn.forEach(te=>te.lock());const ye=qr(document,{mirror:nn,blockClass:s,blockSelector:o,maskTextClass:c,maskTextSelector:p,inlineStylesheet:m,maskAllInputs:un,maskTextFn:C,slimDOM:Cn,dataURLOptions:M,recordCanvas:q,inlineImages:Le,onSerialize:te=>{mo(te,nn)&&ze.addIframe(te),po(te,nn)&&Qe.trackLinkElement(te),Gi(te)&&hn.addShadowRoot(te.shadowRoot,document)},onIframeLoad:(te,Ce)=>{ze.attachIframe(te,Ce),hn.observeAttachShadow(te)},onStylesheetLoad:(te,Ce)=>{Qe.attachLinkElement(te,Ce)},keepIframeSrcFn:Oe});if(!ye)return console.warn("Failed to snapshot the document");he(be({type:X.FullSnapshot,data:{node:ye,initialOffset:ro(window)}}),H),Kn.forEach(te=>te.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Qe.adoptStyleSheets(document.adoptedStyleSheets,nn.getId(document))};try{const H=[],ye=Ce=>{var qe;return Y(pl)({mutationCb:wn,mousemoveCb:(ne,Nn)=>he(be({type:X.IncrementalSnapshot,data:{source:Nn,positions:ne}})),mouseInteractionCb:ne=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.MouseInteraction},ne)})),scrollCb:Wn,viewportResizeCb:ne=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.ViewportResize},ne)})),inputCb:ne=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.Input},ne)})),mediaInteractionCb:ne=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.MediaInteraction},ne)})),styleSheetRuleCb:ne=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.StyleSheetRule},ne)})),styleDeclarationCb:ne=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.StyleDeclaration},ne)})),canvasMutationCb:me,fontCb:ne=>he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.Font},ne)})),selectionCb:ne=>{he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.Selection},ne)}))},customElementCb:ne=>{he(be({type:X.IncrementalSnapshot,data:Object.assign({source:J.CustomElement},ne)}))},blockClass:s,ignoreClass:a,ignoreSelector:l,maskTextClass:c,maskTextSelector:p,maskInputOptions:un,inlineStylesheet:m,sampling:A,recordDOM:D,recordCanvas:q,inlineImages:Le,userTriggeredOnInput:W,collectFonts:de,doc:Ce,maskInputFn:w,maskTextFn:C,keepIframeSrcFn:Oe,blockSelector:o,slimDOMOptions:Cn,dataURLOptions:M,mirror:nn,iframeManager:ze,stylesheetManager:Qe,shadowDomManager:hn,processedNodeManager:Ie,canvasManager:zi,ignoreCSSAttributes:ge,plugins:((qe=G==null?void 0:G.filter(ne=>ne.observer))===null||qe===void 0?void 0:qe.map(ne=>({observer:ne.observer,options:ne.options,callback:Nn=>he(be({type:X.Plugin,data:{plugin:ne.name,payload:Nn}}))})))||[]},k)};ze.addLoadListener(Ce=>{try{H.push(ye(Ce.contentDocument))}catch(qe){console.warn(qe)}});const te=()=>{Xt(),H.push(ye(document)),$t=!0};return document.readyState==="interactive"||document.readyState==="complete"?te():(H.push(He("DOMContentLoaded",()=>{he(be({type:X.DomContentLoaded,data:{}})),K==="DOMContentLoaded"&&te()})),H.push(He("load",()=>{he(be({type:X.Load,data:{}})),K==="load"&&te()},window))),()=>{H.forEach(Ce=>Ce()),Ie.destroy(),$t=!1,nl()}}catch(H){console.warn(H)}}Tt.addCustomEvent=(n,e)=>{if(!$t)throw new Error("please add custom event after start recording");he(be({type:X.Custom,data:{tag:n,payload:e}}))},Tt.freezePage=()=>{Kn.forEach(n=>n.freeze())},Tt.takeFullSnapshot=n=>{if(!$t)throw new Error("please take full snapshot after start recording");Xt(n)},Tt.mirror=nn;var Bo=(n=>(n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n))(Bo||{}),ln=(n=>(n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n))(ln||{}),vn={DEBUG:!1,LIB_VERSION:"2.55.1"},O;if(typeof window>"u"){var Ro={hostname:""};O={navigator:{userAgent:"",onLine:!0},document:{location:Ro,referrer:""},screen:{width:0,height:0},location:Ro}}else O=window;var _t=24*60*60*1e3,qi=8*1e3,ei=Array.prototype,Il=Function.prototype,Ho=Object.prototype,Tn=ei.slice,Et=Ho.toString,ni=Ho.hasOwnProperty,fe=O.console,_n=O.navigator,oe=O.document,ti=O.opera,ii=O.screen,cn=_n.userAgent,Wi=Il.bind,No=ei.forEach,Oo=ei.indexOf,Uo=ei.map,Dl=Array.isArray,Zi={},v={trim:function(n){return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},ee={log:function(){if(vn.DEBUG&&!v.isUndefined(fe)&&fe)try{fe.log.apply(fe,arguments)}catch{v.each(arguments,function(e){fe.log(e)})}},warn:function(){if(vn.DEBUG&&!v.isUndefined(fe)&&fe){var n=["Mixpanel warning:"].concat(v.toArray(arguments));try{fe.warn.apply(fe,n)}catch{v.each(n,function(t){fe.warn(t)})}}},error:function(){if(vn.DEBUG&&!v.isUndefined(fe)&&fe){var n=["Mixpanel error:"].concat(v.toArray(arguments));try{fe.error.apply(fe,n)}catch{v.each(n,function(t){fe.error(t)})}}},critical:function(){if(!v.isUndefined(fe)&&fe){var n=["Mixpanel error:"].concat(v.toArray(arguments));try{fe.error.apply(fe,n)}catch{v.each(n,function(t){fe.error(t)})}}}},Qi=function(n,e){return function(){return arguments[0]="["+e+"] "+arguments[0],n.apply(ee,arguments)}},si=function(n){return{log:Qi(ee.log,n),error:Qi(ee.error,n),critical:Qi(ee.critical,n)}};v.bind=function(n,e){var t,i;if(Wi&&n.bind===Wi)return Wi.apply(n,Tn.call(arguments,1));if(!v.isFunction(n))throw new TypeError;return t=Tn.call(arguments,2),i=function(){if(!(this instanceof i))return n.apply(e,t.concat(Tn.call(arguments)));var s={};s.prototype=n.prototype;var o=new s;s.prototype=null;var a=n.apply(o,t.concat(Tn.call(arguments)));return Object(a)===a?a:o},i},v.each=function(n,e,t){if(n!=null){if(No&&n.forEach===No)n.forEach(e,t);else if(n.length===+n.length){for(var i=0,s=n.length;i<s;i++)if(i in n&&e.call(t,n[i],i,n)===Zi)return}else for(var o in n)if(ni.call(n,o)&&e.call(t,n[o],o,n)===Zi)return}},v.extend=function(n){return v.each(Tn.call(arguments,1),function(e){for(var t in e)e[t]!==void 0&&(n[t]=e[t])}),n},v.isArray=Dl||function(n){return Et.call(n)==="[object Array]"},v.isFunction=function(n){try{return/^\s*\bfunction\b/.test(n)}catch{return!1}},v.isArguments=function(n){return!!(n&&ni.call(n,"callee"))},v.toArray=function(n){return n?n.toArray?n.toArray():v.isArray(n)||v.isArguments(n)?Tn.call(n):v.values(n):[]},v.map=function(n,e,t){if(Uo&&n.map===Uo)return n.map(e,t);var i=[];return v.each(n,function(s){i.push(e.call(t,s))}),i},v.keys=function(n){var e=[];return n===null||v.each(n,function(t,i){e[e.length]=i}),e},v.values=function(n){var e=[];return n===null||v.each(n,function(t){e[e.length]=t}),e},v.include=function(n,e){var t=!1;return n===null?t:Oo&&n.indexOf===Oo?n.indexOf(e)!=-1:(v.each(n,function(i){if(t||(t=i===e))return Zi}),t)},v.includes=function(n,e){return n.indexOf(e)!==-1},v.inherit=function(n,e){return n.prototype=new e,n.prototype.constructor=n,n.superclass=e.prototype,n},v.isObject=function(n){return n===Object(n)&&!v.isArray(n)},v.isEmptyObject=function(n){if(v.isObject(n)){for(var e in n)if(ni.call(n,e))return!1;return!0}return!1},v.isUndefined=function(n){return n===void 0},v.isString=function(n){return Et.call(n)=="[object String]"},v.isDate=function(n){return Et.call(n)=="[object Date]"},v.isNumber=function(n){return Et.call(n)=="[object Number]"},v.isElement=function(n){return!!(n&&n.nodeType===1)},v.encodeDates=function(n){return v.each(n,function(e,t){v.isDate(e)?n[t]=v.formatDate(e):v.isObject(e)&&(n[t]=v.encodeDates(e))}),n},v.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},v.formatDate=function(n){function e(t){return t<10?"0"+t:t}return n.getUTCFullYear()+"-"+e(n.getUTCMonth()+1)+"-"+e(n.getUTCDate())+"T"+e(n.getUTCHours())+":"+e(n.getUTCMinutes())+":"+e(n.getUTCSeconds())},v.strip_empty_properties=function(n){var e={};return v.each(n,function(t,i){v.isString(t)&&t.length>0&&(e[i]=t)}),e},v.truncate=function(n,e){var t;return typeof n=="string"?t=n.slice(0,e):v.isArray(n)?(t=[],v.each(n,function(i){t.push(v.truncate(i,e))})):v.isObject(n)?(t={},v.each(n,function(i,s){t[s]=v.truncate(i,e)})):t=n,t},v.JSONEncode=function(){return function(n){var e=n,t=function(s){var o=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return o.lastIndex=0,o.test(s)?'"'+s.replace(o,function(l){var c=a[l];return typeof c=="string"?c:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+s+'"'},i=function(s,o){var a="",l=" ",c=0,p="",m="",g=0,f=a,b=[],w=o[s];switch(w&&typeof w=="object"&&typeof w.toJSON=="function"&&(w=w.toJSON(s)),typeof w){case"string":return t(w);case"number":return isFinite(w)?String(w):"null";case"boolean":case"null":return String(w);case"object":if(!w)return"null";if(a+=l,b=[],Et.apply(w)==="[object Array]"){for(g=w.length,c=0;c<g;c+=1)b[c]=i(c,w)||"null";return m=b.length===0?"[]":a?`[
|
|
1162
1162
|
`+a+b.join(`,
|
|
1163
1163
|
`+a)+`
|
|
1164
1164
|
`+f+"]":"["+b.join(",")+"]",a=f,m}for(p in w)ni.call(w,p)&&(m=i(p,w),m&&b.push(t(p)+(a?": ":":")+m));return m=b.length===0?"{}":a?"{"+b.join(",")+f+"}":"{"+b.join(",")+"}",a=f,m}};return i("",{"":e})}}(),v.JSONDecode=function(){var n,e,t={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
1165
1165
|
`,r:"\r",t:" "},i,s=function(b){var w=new SyntaxError(b);throw w.at=n,w.text=i,w},o=function(b){return b&&b!==e&&s("Expected '"+b+"' instead of '"+e+"'"),e=i.charAt(n),n+=1,e},a=function(){var b,w="";for(e==="-"&&(w="-",o("-"));e>="0"&&e<="9";)w+=e,o();if(e===".")for(w+=".";o()&&e>="0"&&e<="9";)w+=e;if(e==="e"||e==="E")for(w+=e,o(),(e==="-"||e==="+")&&(w+=e,o());e>="0"&&e<="9";)w+=e,o();if(b=+w,!isFinite(b))s("Bad number");else return b},l=function(){var b,w,C="",k;if(e==='"')for(;o();){if(e==='"')return o(),C;if(e==="\\")if(o(),e==="u"){for(k=0,w=0;w<4&&(b=parseInt(o(),16),!!isFinite(b));w+=1)k=k*16+b;C+=String.fromCharCode(k)}else if(typeof t[e]=="string")C+=t[e];else break;else C+=e}s("Bad string")},c=function(){for(;e&&e<=" ";)o()},p=function(){switch(e){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null}s('Unexpected "'+e+'"')},m,g=function(){var b=[];if(e==="["){if(o("["),c(),e==="]")return o("]"),b;for(;e;){if(b.push(m()),c(),e==="]")return o("]"),b;o(","),c()}}s("Bad array")},f=function(){var b,w={};if(e==="{"){if(o("{"),c(),e==="}")return o("}"),w;for(;e;){if(b=l(),c(),o(":"),Object.hasOwnProperty.call(w,b)&&s('Duplicate key "'+b+'"'),w[b]=m(),c(),e==="}")return o("}"),w;o(","),c()}}s("Bad object")};return m=function(){switch(c(),e){case"{":return f();case"[":return g();case'"':return l();case"-":return a();default:return e>="0"&&e<="9"?a():p()}},function(b){var w;return i=b,n=0,e=" ",w=m(),c(),e&&s("Syntax error"),w}}(),v.base64Encode=function(n){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",t,i,s,o,a,l,c,p,m=0,g=0,f="",b=[];if(!n)return n;n=v.utf8Encode(n);do t=n.charCodeAt(m++),i=n.charCodeAt(m++),s=n.charCodeAt(m++),p=t<<16|i<<8|s,o=p>>18&63,a=p>>12&63,l=p>>6&63,c=p&63,b[g++]=e.charAt(o)+e.charAt(a)+e.charAt(l)+e.charAt(c);while(m<n.length);switch(f=b.join(""),n.length%3){case 1:f=f.slice(0,-2)+"==";break;case 2:f=f.slice(0,-1)+"=";break}return f},v.utf8Encode=function(n){n=(n+"").replace(/\r\n/g,`
|
|
1166
1166
|
`).replace(/\r/g,`
|
|
1167
|
-
`);var e="",t,i,s=0,o;for(t=i=0,s=n.length,o=0;o<s;o++){var a=n.charCodeAt(o),l=null;a<128?i++:a>127&&a<2048?l=String.fromCharCode(a>>6|192,a&63|128):l=String.fromCharCode(a>>12|224,a>>6&63|128,a&63|128),l!==null&&(i>t&&(e+=n.substring(t,i)),e+=l,t=i=o+1)}return i>t&&(e+=n.substring(t,n.length)),e},v.UUID=function(){var n=function(){var i=1*new Date,s;if(O.performance&&O.performance.now)s=O.performance.now();else for(s=0;i==1*new Date;)s++;return i.toString(16)+Math.floor(s).toString(16)},e=function(){return Math.random().toString(16).replace(".","")},t=function(){var i=cn,s,o,a=[],l=0;function c(p,m){var g,f=0;for(g=0;g<m.length;g++)f|=a[g]<<g*8;return p^f}for(s=0;s<i.length;s++)o=i.charCodeAt(s),a.unshift(o&255),a.length>=4&&(l=c(l,a),a=[]);return a.length>0&&(l=c(l,a)),l.toString(16)};return function(){var i=(ii.height*ii.width).toString(16);return n()+"-"+e()+"-"+t()+"-"+i+"-"+n()}}();var Vo=["ahrefsbot","ahrefssiteaudit","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];v.isBlockedUA=function(n){var e;for(n=n.toLowerCase(),e=0;e<Vo.length;e++)if(n.indexOf(Vo[e])!==-1)return!0;return!1},v.HTTPBuildQuery=function(n,e){var t,i,s=[];return v.isUndefined(e)&&(e="&"),v.each(n,function(o,a){t=encodeURIComponent(o.toString()),i=encodeURIComponent(a),s[s.length]=i+"="+t}),s.join(e)},v.getQueryParam=function(n,e){e=e.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var t="[\\?&]"+e+"=([^&#]*)",i=new RegExp(t),s=i.exec(n);if(s===null||s&&typeof s[1]!="string"&&s[1].length)return"";var o=s[1];try{o=decodeURIComponent(o)}catch{ee.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},v.cookie={get:function(n){for(var e=n+"=",t=oe.cookie.split(";"),i=0;i<t.length;i++){for(var s=t[i];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}return null},parse:function(n){var e;try{e=v.JSONDecode(v.cookie.get(n))||{}}catch{}return e},set_seconds:function(n,e,t,i,s,o,a){var l="",c="",p="";if(a)l="; domain="+a;else if(i){var m=Fo(oe.location.hostname);l=m?"; domain=."+m:""}if(t){var g=new Date;g.setTime(g.getTime()+t*1e3),c="; expires="+g.toGMTString()}o&&(s=!0,p="; SameSite=None"),s&&(p+="; secure"),oe.cookie=n+"="+encodeURIComponent(e)+c+"; path=/"+l+p},set:function(n,e,t,i,s,o,a){var l="",c="",p="";if(a)l="; domain="+a;else if(i){var m=Fo(oe.location.hostname);l=m?"; domain=."+m:""}if(t){var g=new Date;g.setTime(g.getTime()+t*24*60*60*1e3),c="; expires="+g.toGMTString()}o&&(s=!0,p="; SameSite=None"),s&&(p+="; secure");var f=n+"="+encodeURIComponent(e)+c+"; path=/"+l+p;return oe.cookie=f,f},remove:function(n,e,t){v.cookie.set(n,"",-1,e,!1,!1,t)}};var Ji=null,oi=function(n,e){if(Ji!==null&&!e)return Ji;var t=!0;try{n=n||window.localStorage;var i="__mplss_"+Yi(8),s="xyz";n.setItem(i,s),n.getItem(i)!==s&&(t=!1),n.removeItem(i)}catch{t=!1}return Ji=t,t};v.localStorage={is_supported:function(n){var e=oi(null,n);return e||ee.error("localStorage unsupported; falling back to cookie store"),e},error:function(n){ee.error("localStorage error: "+n)},get:function(n){try{return window.localStorage.getItem(n)}catch(e){v.localStorage.error(e)}return null},parse:function(n){try{return v.JSONDecode(v.localStorage.get(n))||{}}catch{}return null},set:function(n,e){try{window.localStorage.setItem(n,e)}catch(t){v.localStorage.error(t)}},remove:function(n){try{window.localStorage.removeItem(n)}catch(e){v.localStorage.error(e)}}},v.register_event=function(){var n=function(i,s,o,a,l){if(!i){ee.error("No valid element provided to register_event");return}if(i.addEventListener&&!a)i.addEventListener(s,o,!!l);else{var c="on"+s,p=i[c];i[c]=e(i,o,p)}};function e(i,s,o){var a=function(l){if(l=l||t(window.event),!!l){var c=!0,p,m;return v.isFunction(o)&&(p=o(l)),m=s.call(i,l),(p===!1||m===!1)&&(c=!1),c}};return a}function t(i){return i&&(i.preventDefault=t.preventDefault,i.stopPropagation=t.stopPropagation),i}return t.preventDefault=function(){this.returnValue=!1},t.stopPropagation=function(){this.cancelBubble=!0},n}();var Bl=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');v.dom_query=function(){function n(s){return s.all?s.all:s.getElementsByTagName("*")}var e=/[\t\r\n]/g;function t(s,o){var a=" "+o+" ";return(" "+s.className+" ").replace(e," ").indexOf(a)>=0}function i(s){if(!oe.getElementsByTagName)return[];var o=s.split(" "),a,l,c,p,m,g,f,b,w,C,k=[oe];for(g=0;g<o.length;g++){if(a=o[g].replace(/^\s+/,"").replace(/\s+$/,""),a.indexOf("#")>-1){l=a.split("#"),c=l[0];var x=l[1],A=oe.getElementById(x);if(!A||c&&A.nodeName.toLowerCase()!=c)return[];k=[A];continue}if(a.indexOf(".")>-1){l=a.split("."),c=l[0];var M=l[1];for(c||(c="*"),p=[],m=0,f=0;f<k.length;f++)for(c=="*"?w=n(k[f]):w=k[f].getElementsByTagName(c),b=0;b<w.length;b++)p[m++]=w[b];for(k=[],C=0,f=0;f<p.length;f++)p[f].className&&v.isString(p[f].className)&&t(p[f],M)&&(k[C++]=p[f]);continue}var E=a.match(Bl);if(E){c=E[1];var D=E[2],q=E[3],Q=E[4];for(c||(c="*"),p=[],m=0,f=0;f<k.length;f++)for(c=="*"?w=n(k[f]):w=k[f].getElementsByTagName(c),b=0;b<w.length;b++)p[m++]=w[b];k=[],C=0;var K;switch(q){case"=":K=function(W){return W.getAttribute(D)==Q};break;case"~":K=function(W){return W.getAttribute(D).match(new RegExp("\\b"+Q+"\\b"))};break;case"|":K=function(W){return W.getAttribute(D).match(new RegExp("^"+Q+"-?"))};break;case"^":K=function(W){return W.getAttribute(D).indexOf(Q)===0};break;case"$":K=function(W){return W.getAttribute(D).lastIndexOf(Q)==W.getAttribute(D).length-Q.length};break;case"*":K=function(W){return W.getAttribute(D).indexOf(Q)>-1};break;default:K=function(W){return W.getAttribute(D)}}for(k=[],C=0,f=0;f<p.length;f++)K(p[f])&&(k[C++]=p[f]);continue}for(c=a,p=[],m=0,f=0;f<k.length;f++)for(w=k[f].getElementsByTagName(c),b=0;b<w.length;b++)p[m++]=w[b];k=p}return k}return function(s){return v.isElement(s)?[s]:v.isObject(s)&&!v.isUndefined(s.length)?s:i.call(this,s)}}();var Rl=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],Hl=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];v.info={campaignParams:function(n){var e="",t={};return v.each(Rl,function(i){e=v.getQueryParam(oe.URL,i),e.length?t[i]=e:n!==void 0&&(t[i]=n)}),t},clickParams:function(){var n="",e={};return v.each(Hl,function(t){n=v.getQueryParam(oe.URL,t),n.length&&(e[t]=n)}),e},marketingParams:function(){return v.extend(v.info.campaignParams(),v.info.clickParams())},searchEngine:function(n){return n.search("https?://(.*)google.([^/?]*)")===0?"google":n.search("https?://(.*)bing.com")===0?"bing":n.search("https?://(.*)yahoo.com")===0?"yahoo":n.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(n){var e=v.info.searchEngine(n),t=e!="yahoo"?"q":"p",i={};if(e!==null){i.$search_engine=e;var s=v.getQueryParam(n,t);s.length&&(i.mp_keyword=s)}return i},browser:function(n,e,t){return e=e||"",t||v.includes(n," OPR/")?v.includes(n,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":v.includes(n,"IEMobile")||v.includes(n,"WPDesktop")?"Internet Explorer Mobile":v.includes(n,"SamsungBrowser/")?"Samsung Internet":v.includes(n,"Edge")||v.includes(n,"Edg/")?"Microsoft Edge":v.includes(n,"FBIOS")?"Facebook Mobile":v.includes(n,"Chrome")?"Chrome":v.includes(n,"CriOS")?"Chrome iOS":v.includes(n,"UCWEB")||v.includes(n,"UCBrowser")?"UC Browser":v.includes(n,"FxiOS")?"Firefox iOS":v.includes(e,"Apple")?v.includes(n,"Mobile")?"Mobile Safari":"Safari":v.includes(n,"Android")?"Android Mobile":v.includes(n,"Konqueror")?"Konqueror":v.includes(n,"Firefox")?"Firefox":v.includes(n,"MSIE")||v.includes(n,"Trident/")?"Internet Explorer":v.includes(n,"Gecko")?"Mozilla":""},browserVersion:function(n,e,t){var i=v.info.browser(n,e,t),s={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/},o=s[i];if(o===void 0)return null;var a=n.match(o);return a?parseFloat(a[a.length-2]):null},os:function(){var n=cn;return/Windows/i.test(n)?/Phone/.test(n)||/WPDesktop/.test(n)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(n)?"iOS":/Android/.test(n)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Mac/i.test(n)?"Mac OS X":/Linux/.test(n)?"Linux":/CrOS/.test(n)?"Chrome OS":""},device:function(n){return/Windows Phone/i.test(n)||/WPDesktop/.test(n)?"Windows Phone":/iPad/.test(n)?"iPad":/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Android/.test(n)?"Android":""},referringDomain:function(n){var e=n.split("/");return e.length>=3?e[2]:""},currentUrl:function(){return O.location.href},properties:function(n){return typeof n!="object"&&(n={}),v.extend(v.strip_empty_properties({$os:v.info.os(),$browser:v.info.browser(cn,_n.vendor,ti),$referrer:oe.referrer,$referring_domain:v.info.referringDomain(oe.referrer),$device:v.info.device(cn)}),{$current_url:v.info.currentUrl(),$browser_version:v.info.browserVersion(cn,_n.vendor,ti),$screen_height:ii.height,$screen_width:ii.width,mp_lib:"web",$lib_version:vn.LIB_VERSION,$insert_id:Yi(),time:v.timestamp()/1e3},v.strip_empty_properties(n))},people_properties:function(){return v.extend(v.strip_empty_properties({$os:v.info.os(),$browser:v.info.browser(cn,_n.vendor,ti)}),{$browser_version:v.info.browserVersion(cn,_n.vendor,ti)})},mpPageViewProperties:function(){return v.strip_empty_properties({current_page_title:oe.title,current_domain:O.location.hostname,current_url_path:O.location.pathname,current_url_protocol:O.location.protocol,current_url_search:O.location.search})}};var Yi=function(n){var e=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return n?e.substring(0,n):e},Nl=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,Ol=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,Fo=function(n){var e=Ol,t=n.split("."),i=t[t.length-1];(i.length>4||i==="com"||i==="org")&&(e=Nl);var s=n.match(e);return s?s[0]:""},Ul=function(){var n=O.navigator.onLine;return v.isUndefined(n)||n},ai=null,ri=null;typeof JSON<"u"&&(ai=JSON.stringify,ri=JSON.parse),ai=ai||v.JSONEncode,ri=ri||v.JSONDecode,v.toArray=v.toArray,v.isObject=v.isObject,v.JSONEncode=v.JSONEncode,v.JSONDecode=v.JSONDecode,v.isBlockedUA=v.isBlockedUA,v.isEmptyObject=v.isEmptyObject,v.info=v.info,v.info.device=v.info.device,v.info.browser=v.info.browser,v.info.browserVersion=v.info.browserVersion,v.info.properties=v.info.properties;var Vl="__mp_opt_in_out_";function Fl(n,e){jo(!0,n,e)}function Kl(n,e){jo(!1,n,e)}function Gl(n,e){return Go(n,e)==="1"}function Ko(n,e){if(zl(e))return ee.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var t=Go(n,e)==="0";return t&&ee.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),t}function En(n){return es(n,function(e){return this.get_config(e)})}function Pn(n){return es(n,function(e){return this._get_config(e)})}function ut(n){return es(n,function(e){return this._get_config(e)})}function jl(n,e){e=e||{},Xi(e).remove($i(n,e),!!e.crossSubdomainCookie,e.cookieDomain)}function Xi(n){return n=n||{},n.persistenceType==="localStorage"?v.localStorage:v.cookie}function $i(n,e){return e=e||{},(e.persistencePrefix||Vl)+n}function Go(n,e){return Xi(e).get($i(n,e))}function zl(n){if(n&&n.ignoreDnt)return!1;var e=n&&n.window||O,t=e.navigator||{},i=!1;return v.each([t.doNotTrack,t.msDoNotTrack,e.doNotTrack],function(s){v.includes([!0,1,"1","yes"],s)&&(i=!0)}),i}function jo(n,e,t){if(!v.isString(e)||!e.length){ee.error("gdpr."+(n?"optIn":"optOut")+" called with an invalid token");return}t=t||{},Xi(t).set($i(e,t),n?1:0,v.isNumber(t.cookieExpiration)?t.cookieExpiration:null,!!t.crossSubdomainCookie,!!t.secureCookie,!!t.crossSiteCookie,t.cookieDomain),t.track&&n&&t.track(t.trackEventName||"$opt_in",t.trackProperties,{send_immediately:!0})}function es(n,e){return function(){var t=!1;try{var i=e.call(this,"token"),s=e.call(this,"ignore_dnt"),o=e.call(this,"opt_out_tracking_persistence_type"),a=e.call(this,"opt_out_tracking_cookie_prefix"),l=e.call(this,"window");i&&(t=Ko(i,{ignoreDnt:s,persistenceType:o,persistencePrefix:a,window:l}))}catch(p){ee.error("Unexpected error when checking tracking opt-out status: "+p)}if(!t)return n.apply(this,arguments);var c=arguments[arguments.length-1];typeof c=="function"&&c(0)}}var ql=si("lock"),zo=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3};zo.prototype.withLock=function(n,e,t){!t&&typeof e!="function"&&(t=e,e=null);var i=t||new Date().getTime()+"|"+Math.random(),s=new Date().getTime(),o=this.storageKey,a=this.pollIntervalMS,l=this.timeoutMS,c=this.storage,p=o+":X",m=o+":Y",g=o+":Z",f=function(A){e&&e(A)},b=function(A){if(new Date().getTime()-s>l){ql.error("Timeout waiting for mutex on "+o+"; clearing lock. ["+i+"]"),c.removeItem(g),c.removeItem(m),k();return}setTimeout(function(){try{A()}catch(M){f(M)}},a*(Math.random()+.1))},w=function(A,M){A()?M():b(function(){w(A,M)})},C=function(){var A=c.getItem(m);if(A&&A!==i)return!1;if(c.setItem(m,i),c.getItem(m)===i)return!0;if(!oi(c,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},k=function(){c.setItem(p,i),w(C,function(){if(c.getItem(p)===i){x();return}b(function(){if(c.getItem(m)!==i){k();return}w(function(){return!c.getItem(g)},x)})})},x=function(){c.setItem(g,"1");try{n()}finally{c.removeItem(g),c.getItem(m)===i&&c.removeItem(m),c.getItem(p)===i&&c.removeItem(p)}};try{if(oi(c,!0))k();else throw new Error("localStorage support check failed")}catch(A){f(A)}};var qo=si("batch"),In=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.reportError=e.errorReporter||v.bind(qo.error,qo),this.lock=new zo(n,{storage:this.storage}),this.usePersistence=e.usePersistence,this.pid=e.pid||null,this.memQueue=[]};In.prototype.enqueue=function(n,e,t){var i={id:Yi(),flushAfter:new Date().getTime()+e*2,payload:n};this.usePersistence?this.lock.withLock(v.bind(function(){var o;try{var a=this.readFromStorage();a.push(i),o=this.saveToStorage(a),o&&this.memQueue.push(i)}catch{this.reportError("Error enqueueing item",n),o=!1}t&&t(o)},this),v.bind(function(o){this.reportError("Error acquiring storage lock",o),t&&t(!1)},this),this.pid):(this.memQueue.push(i),t&&t(!0))},In.prototype.fillBatch=function(n){var e=this.memQueue.slice(0,n);if(this.usePersistence&&e.length<n){var t=this.readFromStorage();if(t.length){var i={};v.each(e,function(a){i[a.id]=!0});for(var s=0;s<t.length;s++){var o=t[s];if(new Date().getTime()>o.flushAfter&&!i[o.id]&&(o.orphaned=!0,e.push(o),e.length>=n))break}}}return e};var Wo=function(n,e){var t=[];return v.each(n,function(i){i.id&&!e[i.id]&&t.push(i)}),t};In.prototype.removeItemsByID=function(n,e){var t={};if(v.each(n,function(s){t[s]=!0}),this.memQueue=Wo(this.memQueue,t),!this.usePersistence)e&&e(!0);else{var i=v.bind(function(){var s;try{var o=this.readFromStorage();if(o=Wo(o,t),s=this.saveToStorage(o),s){o=this.readFromStorage();for(var a=0;a<o.length;a++){var l=o[a];if(l.id&&t[l.id])return this.reportError("Item not removed from storage"),!1}}}catch{this.reportError("Error removing items",n),s=!1}return s},this);this.lock.withLock(function(){var o=i();e&&e(o)},v.bind(function(o){var a=!1;if(this.reportError("Error acquiring storage lock",o),!oi(this.storage,!0)&&(a=i(),!a))try{this.storage.removeItem(this.storageKey)}catch(l){this.reportError("Error clearing queue",l)}e&&e(a)},this),this.pid)}};var Zo=function(n,e){var t=[];return v.each(n,function(i){var s=i.id;if(s in e){var o=e[s];o!==null&&(i.payload=o,t.push(i))}else t.push(i)}),t};In.prototype.updatePayloads=function(n,e){this.memQueue=Zo(this.memQueue,n),this.usePersistence?this.lock.withLock(v.bind(function(){var i;try{var s=this.readFromStorage();s=Zo(s,n),i=this.saveToStorage(s)}catch{this.reportError("Error updating items",n),i=!1}e&&e(i)},this),v.bind(function(i){this.reportError("Error acquiring storage lock",i),e&&e(!1)},this),this.pid):e&&e(!0)},In.prototype.readFromStorage=function(){var n;try{n=this.storage.getItem(this.storageKey),n&&(n=ri(n),v.isArray(n)||(this.reportError("Invalid storage entry:",n),n=null))}catch(e){this.reportError("Error retrieving queue",e),n=null}return n||[]},In.prototype.saveToStorage=function(n){try{return this.storage.setItem(this.storageKey,ai(n)),!0}catch(e){return this.reportError("Error saving queue",e),!1}},In.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var Wl=10*60*1e3,Pt=si("batch"),tn=function(n,e){this.errorReporter=e.errorReporter,this.queue=new In(n,{errorReporter:v.bind(this.reportError,this),storage:e.storage,usePersistence:e.usePersistence}),this.libConfig=e.libConfig,this.sendRequest=e.sendRequestFunc,this.beforeSendHook=e.beforeSendHook,this.stopAllBatching=e.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=e.flushOnlyOnInterval||!1};tn.prototype.enqueue=function(n,e){this.queue.enqueue(n,this.flushInterval,e)},tn.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},tn.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},tn.prototype.clear=function(){this.queue.clear()},tn.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},tn.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},tn.prototype.scheduleFlush=function(n){this.flushInterval=n,this.stopped||(this.timeoutID=setTimeout(v.bind(function(){this.stopped||this.flush()},this),this.flushInterval))},tn.prototype.flush=function(n){try{if(this.requestInProgress){Pt.log("Flush: Request already in progress");return}n=n||{};var e=this.libConfig.batch_request_timeout_ms,t=new Date().getTime(),i=this.batchSize,s=this.queue.fillBatch(i),o=s.length===i,a=[],l={};if(v.each(s,function(m){var g=m.payload;if(this.beforeSendHook&&!m.orphaned&&(g=this.beforeSendHook(g)),g){g.event&&g.properties&&(g.properties=v.extend({},g.properties,{mp_sent_by_lib_version:vn.LIB_VERSION}));var f=!0,b=m.id;b?(this.itemIdsSentSuccessfully[b]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:m,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[b]}),f=!1):this.reportError("[dupe] found item with no ID",{item:m}),f&&a.push(g)}l[m.id]=g},this),a.length<1){this.resetFlush();return}this.requestInProgress=!0;var c=v.bind(function(m){this.requestInProgress=!1;try{var g=!1;if(n.unloading)this.queue.updatePayloads(l);else if(v.isObject(m)&&m.error==="timeout"&&new Date().getTime()-t>=e)this.reportError("Network timeout; retrying"),this.flush();else if(v.isObject(m)&&(m.httpStatusCode>=500||m.httpStatusCode===429||m.httpStatusCode<=0&&!Ul()||m.error==="timeout")){var f=this.flushInterval*2;m.retryAfter&&(f=parseInt(m.retryAfter,10)*1e3||f),f=Math.min(Wl,f),this.reportError("Error; retry in "+f+" ms"),this.scheduleFlush(f)}else if(v.isObject(m)&&m.httpStatusCode===413)if(s.length>1){var b=Math.max(1,Math.floor(i/2));this.batchSize=Math.min(this.batchSize,b,s.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",s),this.resetBatchSize(),g=!0;else g=!0;g&&(this.queue.removeItemsByID(v.map(s,function(w){return w.id}),v.bind(function(w){w?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!o?this.resetFlush():this.flush()):(this.reportError("Failed to remove items from queue"),++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush())},this)),v.each(s,v.bind(function(w){var C=w.id;C?(this.itemIdsSentSuccessfully[C]=this.itemIdsSentSuccessfully[C]||0,this.itemIdsSentSuccessfully[C]++,this.itemIdsSentSuccessfully[C]>5&&this.reportError("[dupe] item ID sent too many times",{item:w,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[C]})):this.reportError("[dupe] found item with no ID while removing",{item:w})},this)))}catch(w){this.reportError("Error handling API response",w),this.resetFlush()}},this),p={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};n.unloading&&(p.transport="sendBeacon"),Pt.log("MIXPANEL REQUEST:",a),this.sendRequest(a,p,c)}catch(m){this.reportError("Error flushing request queue",m),this.resetFlush()}},tn.prototype.reportError=function(n,e){if(Pt.error.apply(Pt.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(n)),this.errorReporter(n,e)}catch(t){Pt.error(t)}};var Gn=si("recorder"),Qo=O.CompressionStream,Zl={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},Ql=new Set([ln.MouseMove,ln.MouseInteraction,ln.Scroll,ln.ViewportResize,ln.Input,ln.TouchMove,ln.MediaInteraction,ln.Drag,ln.Selection]);function Jl(n){return n.type===Bo.IncrementalSnapshot&&Ql.has(n.data.source)}var sn=function(n){this._mixpanel=n,this._stopRecording=null,this.recEvents=[],this.seqNo=0,this.replayId=null,this.replayStartTime=null,this.sendBatchId=null,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=_t,this.recordMinMs=0,this._initBatcher()};sn.prototype._initBatcher=function(){this.batcher=new tn("__mprec",{libConfig:Zl,sendRequestFunc:v.bind(this.flushEventsWithOptOut,this),errorReporter:v.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},sn.prototype.get_config=function(n){return this._mixpanel.get_config(n)},sn.prototype.startRecording=function(n){if(this._stopRecording!==null){Gn.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>_t&&(this.recordMaxMs=_t,Gn.critical("record_max_ms cannot be greater than "+_t+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>qi&&(this.recordMinMs=qi,Gn.critical("record_min_ms cannot be greater than "+qi+"ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=new Date().getTime(),this.replayId=v.UUID(),n||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var e=v.bind(function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(v.bind(function(){Gn.log("Idle timeout reached, restarting recording."),this.resetRecording()},this),this.get_config("record_idle_timeout_ms"))},this),t=this.get_config("record_block_selector");(t===""||t===null)&&(t=void 0),this._stopRecording=Tt({emit:v.bind(function(i){this.batcher.enqueue(i),Jl(i)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),e())},this),blockClass:this.get_config("record_block_class"),blockSelector:t,collectFonts:this.get_config("record_collect_fonts"),inlineImages:this.get_config("record_inline_images"),maskAllInputs:!0,maskTextClass:this.get_config("record_mask_text_class"),maskTextSelector:this.get_config("record_mask_text_selector")}),e(),this.maxTimeoutId=setTimeout(v.bind(this.resetRecording,this),this.recordMaxMs)},sn.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},sn.prototype.stopRecording=function(){this._stopRecording!==null&&(this._stopRecording(),this._stopRecording=null),this.batcher.stopped?this.batcher.clear():(this.batcher.flush(),this.batcher.stop()),this.replayId=null,clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId)},sn.prototype.flushEventsWithOptOut=function(n,e,t){this._flushEvents(n,e,t,v.bind(this._onOptOut,this))},sn.prototype._onOptOut=function(n){n===0&&(this.recEvents=[],this.stopRecording())},sn.prototype._sendRequest=function(n,e,t,i){var s=v.bind(function(o,a){o.status===200&&this.replayId===n&&this.seqNo++,i({status:0,httpStatusCode:o.status,responseBody:a,retryAfter:o.headers.get("Retry-After")})},this);O.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(e),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:t}).then(function(o){o.json().then(function(a){s(o,a)}).catch(function(a){i({error:a})})}).catch(function(o){i({error:o,httpStatusCode:0})})},sn.prototype._flushEvents=En(function(n,e,t){const i=n.length;if(i>0){var s=this.replayId,o=n[0].timestamp;(this.seqNo===0||!this.replayStartTime)&&(this.seqNo!==0&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=o);var a=n[i-1].timestamp-this.replayStartTime,l={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:o/1e3,replay_id:s,replay_length_ms:a,replay_start_time:this.replayStartTime/1e3},c=v.JSONEncode(n),p=this._mixpanel.get_property("$device_id");p&&(l.$device_id=p);var m=this._mixpanel.get_property("$user_id");if(m&&(l.$user_id=m),Qo){var g=new Blob([c],{type:"application/json"}).stream(),f=g.pipeThrough(new Qo("gzip"));new Response(f).blob().then(v.bind(function(b){l.format="gzip",this._sendRequest(s,l,b,t)},this))}else l.format="body",this._sendRequest(s,l,c,t)}}),sn.prototype.reportError=function(n,e){Gn.error.apply(Gn.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(t){Gn.error(t)}},O.__mp_recorder=sn;var bn=function(){};bn.prototype.create_properties=function(){},bn.prototype.event_handler=function(){},bn.prototype.after_track_handler=function(){},bn.prototype.init=function(n){return this.mp=n,this},bn.prototype.track=function(n,e,t,i){var s=this,o=v.dom_query(n);if(o.length===0){ee.error("The DOM query ("+n+") returned 0 elements");return}return v.each(o,function(a){v.register_event(a,this.override_event,function(l){var c={},p=s.create_properties(t,this),m=s.mp.get_config("track_links_timeout");s.event_handler(l,this,c),window.setTimeout(s.track_callback(i,p,c,!0),m),s.mp.track(e,p,s.track_callback(i,p,c))})},this),!0},bn.prototype.track_callback=function(n,e,t,i){i=i||!1;var s=this;return function(){t.callback_fired||(t.callback_fired=!0,!(n&&n(i,e)===!1)&&s.after_track_handler(e,t,i))}},bn.prototype.create_properties=function(n,e){var t;return typeof n=="function"?t=n(e):t=v.extend({},n),t};var ht=function(){this.override_event="click"};v.inherit(ht,bn),ht.prototype.create_properties=function(n,e){var t=ht.superclass.create_properties.apply(this,arguments);return e.href&&(t.url=e.href),t},ht.prototype.event_handler=function(n,e,t){t.new_tab=n.which===2||n.metaKey||n.ctrlKey||e.target==="_blank",t.href=e.href,t.new_tab||n.preventDefault()},ht.prototype.after_track_handler=function(n,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var li=function(){this.override_event="submit"};v.inherit(li,bn),li.prototype.event_handler=function(n,e,t){t.element=e,n.preventDefault()},li.prototype.after_track_handler=function(n,e){setTimeout(function(){e.element.submit()},0)};var Dn="$set",mt="$set_once",on="$unset",jn="$add",dn="$append",zn="$union",fn="$remove",Yl="$delete",Jo={set_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(s,o){this._is_reserved_property(o)||(i[o]=s)},this):i[n]=e,t[Dn]=i,t},unset_action:function(n){var e={},t=[];return v.isArray(n)||(n=[n]),v.each(n,function(i){this._is_reserved_property(i)||t.push(i)},this),e[on]=t,e},set_once_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(s,o){this._is_reserved_property(o)||(i[o]=s)},this):i[n]=e,t[mt]=i,t},union_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(s,o){this._is_reserved_property(o)||(i[o]=v.isArray(s)?s:[s])},this):i[n]=v.isArray(e)?e:[e],t[zn]=i,t},append_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(s,o){this._is_reserved_property(o)||(i[o]=s)},this):i[n]=e,t[dn]=i,t},remove_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(s,o){this._is_reserved_property(o)||(i[o]=s)},this):i[n]=e,t[fn]=i,t},delete_action:function(){var n={};return n[Yl]="",n}},le=function(){};v.extend(le.prototype,Jo),le.prototype._init=function(n,e,t){this._mixpanel=n,this._group_key=e,this._group_id=t},le.prototype.set=ut(function(n,e,t){var i=this.set_action(n,e);return v.isObject(n)&&(t=e),this._send_request(i,t)}),le.prototype.set_once=ut(function(n,e,t){var i=this.set_once_action(n,e);return v.isObject(n)&&(t=e),this._send_request(i,t)}),le.prototype.unset=ut(function(n,e){var t=this.unset_action(n);return this._send_request(t,e)}),le.prototype.union=ut(function(n,e,t){v.isObject(n)&&(t=e);var i=this.union_action(n,e);return this._send_request(i,t)}),le.prototype.delete=ut(function(n){var e=this.delete_action();return this._send_request(e,n)}),le.prototype.remove=ut(function(n,e,t){var i=this.remove_action(n,e);return this._send_request(i,t)}),le.prototype._send_request=function(n,e){n.$group_key=this._group_key,n.$group_id=this._group_id,n.$token=this._get_config("token");var t=v.encodeDates(n);return this._mixpanel._track_or_batch({type:"groups",data:t,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},e)},le.prototype._is_reserved_property=function(n){return n==="$group_key"||n==="$group_id"},le.prototype._get_config=function(n){return this._mixpanel.get_config(n)},le.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},le.prototype.remove=le.prototype.remove,le.prototype.set=le.prototype.set,le.prototype.set_once=le.prototype.set_once,le.prototype.union=le.prototype.union,le.prototype.unset=le.prototype.unset,le.prototype.toString=le.prototype.toString;var U=function(){};v.extend(U.prototype,Jo),U.prototype._init=function(n){this._mixpanel=n},U.prototype.set=Pn(function(n,e,t){var i=this.set_action(n,e);return v.isObject(n)&&(t=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),i[Dn]=v.extend({},v.info.people_properties(),i[Dn]),this._send_request(i,t)}),U.prototype.set_once=Pn(function(n,e,t){var i=this.set_once_action(n,e);return v.isObject(n)&&(t=e),this._send_request(i,t)}),U.prototype.unset=Pn(function(n,e){var t=this.unset_action(n);return this._send_request(t,e)}),U.prototype.increment=Pn(function(n,e,t){var i={},s={};return v.isObject(n)?(v.each(n,function(o,a){if(!this._is_reserved_property(a))if(isNaN(parseFloat(o))){ee.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else s[a]=o},this),t=e):(v.isUndefined(e)&&(e=1),s[n]=e),i[jn]=s,this._send_request(i,t)}),U.prototype.append=Pn(function(n,e,t){v.isObject(n)&&(t=e);var i=this.append_action(n,e);return this._send_request(i,t)}),U.prototype.remove=Pn(function(n,e,t){v.isObject(n)&&(t=e);var i=this.remove_action(n,e);return this._send_request(i,t)}),U.prototype.union=Pn(function(n,e,t){v.isObject(n)&&(t=e);var i=this.union_action(n,e);return this._send_request(i,t)}),U.prototype.track_charge=Pn(function(n,e,t){if(!v.isNumber(n)&&(n=parseFloat(n),isNaN(n))){ee.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",v.extend({$amount:n},e),t)}),U.prototype.clear_charges=function(n){return this.set("$transactions",[],n)},U.prototype.delete_user=function(){if(!this._identify_called()){ee.error("mixpanel.people.delete_user() requires you to call identify() first");return}var n={$delete:this._mixpanel.get_distinct_id()};return this._send_request(n)},U.prototype.toString=function(){return this._mixpanel.toString()+".people"},U.prototype._send_request=function(n,e){n.$token=this._get_config("token"),n.$distinct_id=this._mixpanel.get_distinct_id();var t=this._mixpanel.get_property("$device_id"),i=this._mixpanel.get_property("$user_id"),s=this._mixpanel.get_property("$had_persisted_distinct_id");t&&(n.$device_id=t),i&&(n.$user_id=i),s&&(n.$had_persisted_distinct_id=s);var o=v.encodeDates(n);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:o,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},e):(this._enqueue(n),v.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),v.truncate(o,255))},U.prototype._get_config=function(n){return this._mixpanel.get_config(n)},U.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},U.prototype._enqueue=function(n){Dn in n?this._mixpanel.persistence._add_to_people_queue(Dn,n):mt in n?this._mixpanel.persistence._add_to_people_queue(mt,n):on in n?this._mixpanel.persistence._add_to_people_queue(on,n):jn in n?this._mixpanel.persistence._add_to_people_queue(jn,n):dn in n?this._mixpanel.persistence._add_to_people_queue(dn,n):fn in n?this._mixpanel.persistence._add_to_people_queue(fn,n):zn in n?this._mixpanel.persistence._add_to_people_queue(zn,n):ee.error("Invalid call to _enqueue():",n)},U.prototype._flush_one_queue=function(n,e,t,i){var s=this,o=v.extend({},this._mixpanel.persistence.load_queue(n)),a=o;!v.isUndefined(o)&&v.isObject(o)&&!v.isEmptyObject(o)&&(s._mixpanel.persistence._pop_from_people_queue(n,o),s._mixpanel.persistence.save(),i&&(a=i(o)),e.call(s,a,function(l,c){l===0&&s._mixpanel.persistence._add_to_people_queue(n,o),v.isUndefined(t)||t(l,c)}))},U.prototype._flush=function(n,e,t,i,s,o,a){var l=this;this._flush_one_queue(Dn,this.set,n),this._flush_one_queue(mt,this.set_once,i),this._flush_one_queue(on,this.unset,o,function(k){return v.keys(k)}),this._flush_one_queue(jn,this.increment,e),this._flush_one_queue(zn,this.union,s);var c=this._mixpanel.persistence.load_queue(dn);if(!v.isUndefined(c)&&v.isArray(c)&&c.length)for(var p,m=function(k,x){k===0&&l._mixpanel.persistence._add_to_people_queue(dn,p),v.isUndefined(t)||t(k,x)},g=c.length-1;g>=0;g--)c=this._mixpanel.persistence.load_queue(dn),p=c.pop(),l._mixpanel.persistence.save(),v.isEmptyObject(p)||l.append(p,m);var f=this._mixpanel.persistence.load_queue(fn);if(!v.isUndefined(f)&&v.isArray(f)&&f.length)for(var b,w=function(k,x){k===0&&l._mixpanel.persistence._add_to_people_queue(fn,b),v.isUndefined(a)||a(k,x)},C=f.length-1;C>=0;C--)f=this._mixpanel.persistence.load_queue(fn),b=f.pop(),l._mixpanel.persistence.save(),v.isEmptyObject(b)||l.remove(b,w)},U.prototype._is_reserved_property=function(n){return n==="$distinct_id"||n==="$token"||n==="$device_id"||n==="$user_id"||n==="$had_persisted_distinct_id"},U.prototype.set=U.prototype.set,U.prototype.set_once=U.prototype.set_once,U.prototype.unset=U.prototype.unset,U.prototype.increment=U.prototype.increment,U.prototype.append=U.prototype.append,U.prototype.remove=U.prototype.remove,U.prototype.union=U.prototype.union,U.prototype.track_charge=U.prototype.track_charge,U.prototype.clear_charges=U.prototype.clear_charges,U.prototype.delete_user=U.prototype.delete_user,U.prototype.toString=U.prototype.toString;var ns="__mps",ts="__mpso",is="__mpus",ss="__mpa",os="__mpap",as="__mpr",rs="__mpu",Yo="$people_distinct_id",ci="__alias",It="__timers",Xl=[ns,ts,is,ss,os,as,rs,Yo,ci,It],z=function(n){this.props={},this.campaign_params_saved=!1,n.persistence_name?this.name="mp_"+n.persistence_name:this.name="mp_"+n.token+"_mixpanel";var e=n.persistence;e!=="cookie"&&e!=="localStorage"&&(ee.critical("Unknown persistence type "+e+"; falling back to cookie"),e=n.persistence="cookie"),e==="localStorage"&&v.localStorage.is_supported()?this.storage=v.localStorage:this.storage=v.cookie,this.load(),this.update_config(n),this.upgrade(),this.save()};z.prototype.properties=function(){var n={};return this.load(),v.each(this.props,function(e,t){v.include(Xl,t)||(n[t]=e)}),n},z.prototype.load=function(){if(!this.disabled){var n=this.storage.parse(this.name);n&&(this.props=v.extend({},n))}},z.prototype.upgrade=function(){var n,e;this.storage===v.localStorage?(n=v.cookie.parse(this.name),v.cookie.remove(this.name),v.cookie.remove(this.name,!0),n&&this.register_once(n)):this.storage===v.cookie&&(e=v.localStorage.parse(this.name),v.localStorage.remove(this.name),e&&this.register_once(e))},z.prototype.save=function(){this.disabled||this.storage.set(this.name,v.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},z.prototype.load_prop=function(n){return this.load(),this.props[n]},z.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},z.prototype.clear=function(){this.remove(),this.props={}},z.prototype.register_once=function(n,e,t){return v.isObject(n)?(typeof e>"u"&&(e="None"),this.expire_days=typeof t>"u"?this.default_expiry:t,this.load(),v.each(n,function(i,s){(!this.props.hasOwnProperty(s)||this.props[s]===e)&&(this.props[s]=i)},this),this.save(),!0):!1},z.prototype.register=function(n,e){return v.isObject(n)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),v.extend(this.props,n),this.save(),!0):!1},z.prototype.unregister=function(n){this.load(),n in this.props&&(delete this.props[n],this.save())},z.prototype.update_search_keyword=function(n){this.register(v.info.searchInfo(n))},z.prototype.update_referrer_info=function(n){this.register_once({$initial_referrer:n||"$direct",$initial_referring_domain:v.info.referringDomain(n)||"$direct"},"")},z.prototype.get_referrer_info=function(){return v.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},z.prototype.update_config=function(n){this.default_expiry=this.expire_days=n.cookie_expiration,this.set_disabled(n.disable_persistence),this.set_cookie_domain(n.cookie_domain),this.set_cross_site(n.cross_site_cookie),this.set_cross_subdomain(n.cross_subdomain_cookie),this.set_secure(n.secure_cookie)},z.prototype.set_disabled=function(n){this.disabled=n,this.disabled?this.remove():this.save()},z.prototype.set_cookie_domain=function(n){n!==this.cookie_domain&&(this.remove(),this.cookie_domain=n,this.save())},z.prototype.set_cross_site=function(n){n!==this.cross_site&&(this.cross_site=n,this.remove(),this.save())},z.prototype.set_cross_subdomain=function(n){n!==this.cross_subdomain&&(this.cross_subdomain=n,this.remove(),this.save())},z.prototype.get_cross_subdomain=function(){return this.cross_subdomain},z.prototype.set_secure=function(n){n!==this.secure&&(this.secure=!!n,this.remove(),this.save())},z.prototype._add_to_people_queue=function(n,e){var t=this._get_queue_key(n),i=e[n],s=this._get_or_create_queue(Dn),o=this._get_or_create_queue(mt),a=this._get_or_create_queue(on),l=this._get_or_create_queue(jn),c=this._get_or_create_queue(zn),p=this._get_or_create_queue(fn,[]),m=this._get_or_create_queue(dn,[]);t===ns?(v.extend(s,i),this._pop_from_people_queue(jn,i),this._pop_from_people_queue(zn,i),this._pop_from_people_queue(on,i)):t===ts?(v.each(i,function(g,f){f in o||(o[f]=g)}),this._pop_from_people_queue(on,i)):t===is?v.each(i,function(g){v.each([s,o,l,c],function(f){g in f&&delete f[g]}),v.each(m,function(f){g in f&&delete f[g]}),a[g]=!0}):t===ss?(v.each(i,function(g,f){f in s?s[f]+=g:(f in l||(l[f]=0),l[f]+=g)},this),this._pop_from_people_queue(on,i)):t===rs?(v.each(i,function(g,f){v.isArray(g)&&(f in c||(c[f]=[]),c[f]=c[f].concat(g))}),this._pop_from_people_queue(on,i)):t===as?(p.push(i),this._pop_from_people_queue(dn,i)):t===os&&(m.push(i),this._pop_from_people_queue(on,i)),ee.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),ee.log(e),this.save()},z.prototype._pop_from_people_queue=function(n,e){var t=this.props[this._get_queue_key(n)];v.isUndefined(t)||v.each(e,function(i,s){n===dn||n===fn?v.each(t,function(o){o[s]===i&&delete o[s]}):delete t[s]},this)},z.prototype.load_queue=function(n){return this.load_prop(this._get_queue_key(n))},z.prototype._get_queue_key=function(n){if(n===Dn)return ns;if(n===mt)return ts;if(n===on)return is;if(n===jn)return ss;if(n===dn)return os;if(n===fn)return as;if(n===zn)return rs;ee.error("Invalid queue:",n)},z.prototype._get_or_create_queue=function(n,e){var t=this._get_queue_key(n);return e=v.isUndefined(e)?{}:e,this.props[t]||(this.props[t]=e)},z.prototype.set_event_timer=function(n,e){var t=this.load_prop(It)||{};t[n]=e,this.props[It]=t,this.save()},z.prototype.remove_event_timer=function(n){var e=this.load_prop(It)||{},t=e[n];return v.isUndefined(t)||(delete this.props[It][n],this.save()),t};var ls,Xo=function(n,e){throw new Error(n+" not available in this build.")},Pe,$o=0,$l=1,ec=function(n){return n},Dt=function(){},Ze="mixpanel",ea="base64",nc="json",cs="$device:",pt=O.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,na=!pt&&cn.indexOf("MSIE")===-1&&cn.indexOf("Mozilla")===-1,di=null;_n.sendBeacon&&(di=function(){return _n.sendBeacon.apply(_n,arguments)});var ta={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},ia={api_host:"https://api-js.mixpanel.com",api_routes:ta,api_method:"POST",api_transport:"XHR",api_payload_format:ea,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:Dt,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:Dt,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_collect_fonts:!1,record_idle_timeout_ms:30*60*1e3,record_inline_images:!1,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:_t,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},sa=!1,L=function(){},ds=function(n,e,t){var i,s=t===Ze?Pe:Pe[t];if(s&&ls===$o)i=s;else{if(s&&!v.isArray(s)){ee.error("You have already initialized "+t);return}i=new L}if(i._cached_groups={},i._init(n,e,t),i.people=new U,i.people._init(i),!i.get_config("skip_first_touch_marketing")){var o=v.info.campaignParams(null),a={},l=!1;v.each(o,function(c,p){a["initial_"+p]=c,c&&(l=!0)}),l&&i.people.set_once(a)}return vn.DEBUG=vn.DEBUG||i.get_config("debug"),!v.isUndefined(s)&&v.isArray(s)&&(i._execute_array.call(i.people,s.people),i._execute_array(s)),i};L.prototype.init=function(n,e,t){if(v.isUndefined(t)){this.report_error("You must name your new library: init(token, config, name)");return}if(t===Ze){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var i=ds(n,e,t);return Pe[t]=i,i._loaded(),i},L.prototype._init=function(n,e,t){e=e||{},this.__loaded=!0,this.config={};var i={};if(!("api_payload_format"in e)){var s=e.api_host||ia.api_host;s.match(/\.mixpanel\.com/)&&(i.api_payload_format=nc)}if(this.set_config(v.extend({},ia,i,e,{name:t,token:n,callback_fn:(t===Ze?t:Ze+"."+t)+"._jsc"})),this._jsc=Dt,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!v.localStorage.is_supported(!0)||!pt)this._batch_requests=!1,ee.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),v.each(this.get_batcher_configs(),function(c){ee.log("Clearing batch queue "+c.queue_key),v.localStorage.remove(c.queue_key)});else if(this.init_batchers(),di&&O.addEventListener){var o=v.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);O.addEventListener("pagehide",function(c){c.persisted&&o()}),O.addEventListener("visibilitychange",function(){oe.visibilityState==="hidden"&&o()})}}this.persistence=this.cookie=new z(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=v.UUID();this.get_distinct_id()||this.register_once({distinct_id:cs+a,$device_id:a},"");var l=this.get_config("track_pageview");l&&this._init_url_change_tracking(l),this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent")&&this.start_session_recording()},L.prototype.start_session_recording=En(function(){if(!O.MutationObserver){ee.critical("Browser does not support MutationObserver; skipping session recording");return}var n=v.bind(function(){this._recorder=this._recorder||new O.__mp_recorder(this),this._recorder.startRecording()},this);v.isUndefined(O.__mp_recorder)?Xo(this.get_config("recorder_src"),n):n()}),L.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():ee.critical("Session recorder module not loaded")},L.prototype.get_session_recording_properties=function(){var n={};if(this._recorder){var e=this._recorder.replayId;e&&(n.$mp_replay_id=e)}return n},L.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var n=v.info.campaignParams(null);v.each(n,(function(e,t){this.unregister(t)}).bind(this))}},L.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(oe.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(v.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(oe.referrer)},L.prototype._dom_loaded=function(){v.each(this.__dom_loaded_queue,function(n){this._track_dom.apply(this,n)},this),this.has_opted_out_tracking()||v.each(this.__request_queue,function(n){this._send_request.apply(this,n)},this),delete this.__dom_loaded_queue,delete this.__request_queue},L.prototype._track_dom=function(n,e){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!sa)return this.__dom_loaded_queue.push([n,e]),!1;var t=new n().init(this);return t.track.apply(t,e)},L.prototype._init_url_change_tracking=function(n){var e="",t=this.track_pageview();if(t&&(e=v.info.currentUrl()),v.include(["full-url","url-with-path-and-query-string","url-with-path"],n)){O.addEventListener("popstate",function(){O.dispatchEvent(new Event("mp_locationchange"))}),O.addEventListener("hashchange",function(){O.dispatchEvent(new Event("mp_locationchange"))});var i=O.history.pushState;typeof i=="function"&&(O.history.pushState=function(o,a,l){i.call(O.history,o,a,l),O.dispatchEvent(new Event("mp_locationchange"))});var s=O.history.replaceState;typeof s=="function"&&(O.history.replaceState=function(o,a,l){s.call(O.history,o,a,l),O.dispatchEvent(new Event("mp_locationchange"))}),O.addEventListener("mp_locationchange",(function(){var o=v.info.currentUrl(),a=!1;if(n==="full-url"?a=o!==e:n==="url-with-path-and-query-string"?a=o.split("#")[0]!==e.split("#")[0]:n==="url-with-path"&&(a=o.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0]),a){var l=this.track_pageview();l&&(e=o)}}).bind(this))}},L.prototype._prepare_callback=function(n,e){if(v.isUndefined(n))return null;if(pt){var t=function(a){n(a,e)};return t}else{var i=this._jsc,s=""+Math.floor(Math.random()*1e8),o=this.get_config("callback_fn")+"["+s+"]";return i[s]=function(a){delete i[s],n(a,e)},o}},L.prototype._send_request=function(n,e,t,i){var s=!0;if(na)return this.__request_queue.push(arguments),s;var o={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},a=null;!i&&(v.isFunction(t)||typeof t=="string")&&(i=t,t=null),t=v.extend(o,t||{}),pt||(t.method="GET");var l=t.method==="POST",c=di&&l&&t.transport.toLowerCase()==="sendbeacon",p=t.verbose;e.verbose&&(p=!0),this.get_config("test")&&(e.test=1),p&&(e.verbose=1),this.get_config("img")&&(e.img=1),pt||(i?e.callback=i:(p||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),l&&(a="data="+encodeURIComponent(e.data),delete e.data),n+="?"+v.HTTPBuildQuery(e);var m=this;if("img"in e){var g=oe.createElement("img");g.src=n,oe.body.appendChild(g)}else if(c){try{s=di(n,a)}catch(x){m.report_error(x),s=!1}try{i&&i(s?1:0)}catch(x){m.report_error(x)}}else if(pt)try{var f=new XMLHttpRequest;f.open(t.method,n,!0);var b=this.get_config("xhr_headers");if(l&&(b["Content-Type"]="application/x-www-form-urlencoded"),v.each(b,function(x,A){f.setRequestHeader(A,x)}),t.timeout_ms&&typeof f.timeout<"u"){f.timeout=t.timeout_ms;var w=new Date().getTime()}f.withCredentials=!0,f.onreadystatechange=function(){if(f.readyState===4)if(f.status===200){if(i)if(p){var x;try{x=v.JSONDecode(f.responseText)}catch(E){if(m.report_error(E),t.ignore_json_errors)x=f.responseText;else return}i(x)}else i(Number(f.responseText))}else{var A;if(f.timeout&&!f.status&&new Date().getTime()-w>=f.timeout?A="timeout":A="Bad HTTP status: "+f.status+" "+f.statusText,m.report_error(A),i)if(p){var M=f.responseHeaders||{};i({status:0,httpStatusCode:f.status,error:A,retryAfter:M["Retry-After"]})}else i(0)}},f.send(a)}catch(x){m.report_error(x),s=!1}else{var C=oe.createElement("script");C.type="text/javascript",C.async=!0,C.defer=!0,C.src=n;var k=oe.getElementsByTagName("script")[0];k.parentNode.insertBefore(C,k)}return s},L.prototype._execute_array=function(n){var e,t=[],i=[],s=[];v.each(n,function(a){a&&(e=a[0],v.isArray(e)?s.push(a):typeof a=="function"?a.call(this):v.isArray(a)&&e==="alias"?t.push(a):v.isArray(a)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?s.push(a):i.push(a))},this);var o=function(a,l){v.each(a,function(c){if(v.isArray(c[0])){var p=l;v.each(c,function(m){p=p[m[0]].apply(p,m.slice(1))})}else this[c[0]].apply(this,c.slice(1))},l)};o(t,this),o(i,this),o(s,this)},L.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},L.prototype.get_batcher_configs=function(){var n="__mpq_"+this.get_config("token"),e=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+e.track,queue_key:n+"_ev"},people:{type:"people",endpoint:"/"+e.engage,queue_key:n+"_pp"},groups:{type:"groups",endpoint:"/"+e.groups,queue_key:n+"_gr"}},this._batcher_configs},L.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var n=v.bind(function(t){return new tn(t.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:v.bind(function(i,s,o){this._send_request(this.get_config("api_host")+t.endpoint,this._encode_data_for_request(i),s,this._prepare_callback(o,i))},this),beforeSendHook:v.bind(function(i){return this._run_hook("before_send_"+t.type,i)},this),stopAllBatchingFunc:v.bind(this.stop_batch_senders,this),usePersistence:!0})},this),e=this.get_batcher_configs();this.request_batchers={events:n(e.events),people:n(e.people),groups:n(e.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},L.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,v.each(this.request_batchers,function(n){n.start()}))},L.prototype.stop_batch_senders=function(){this._batch_requests=!1,v.each(this.request_batchers,function(n){n.stop(),n.clear()})},L.prototype.push=function(n){this._execute_array([n])},L.prototype.disable=function(n){typeof n>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(n)},L.prototype._encode_data_for_request=function(n){var e=v.JSONEncode(n);return this.get_config("api_payload_format")===ea&&(e=v.base64Encode(e)),{data:e}},L.prototype._track_or_batch=function(n,e){var t=v.truncate(n.data,255),i=n.endpoint,s=n.batcher,o=n.should_send_immediately,a=n.send_request_options||{};e=e||Dt;var l=!0,c=v.bind(function(){return a.skip_hooks||(t=this._run_hook("before_send_"+n.type,t)),t?(ee.log("MIXPANEL REQUEST:"),ee.log(t),this._send_request(i,this._encode_data_for_request(t),a,this._prepare_callback(e,t))):null},this);return this._batch_requests&&!o?s.enqueue(t,function(p){p?e(1,t):c()}):l=c(),l&&t},L.prototype.track=En(function(n,e,t,i){!i&&typeof t=="function"&&(i=t,t=null),t=t||{};var s=t.transport;s&&(t.transport=s);var o=t.send_immediately;if(typeof i!="function"&&(i=Dt),v.isUndefined(n)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(n)){i(0);return}e=v.extend({},e),e.token=this.get_config("token");var a=this.persistence.remove_event_timer(n);if(!v.isUndefined(a)){var l=new Date().getTime()-a;e.$duration=parseFloat((l/1e3).toFixed(3))}this._set_default_superprops();var c=this.get_config("track_marketing")?v.info.marketingParams():{};e=v.extend({},v.info.properties({mp_loader:this.get_config("mp_loader")}),c,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),e);var p=this.get_config("property_blacklist");v.isArray(p)?v.each(p,function(f){delete e[f]}):this.report_error("Invalid value for property_blacklist config: "+p);var m={event:n,properties:e},g=this._track_or_batch({type:"events",data:m,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:o,send_request_options:t},i);return g}),L.prototype.set_group=En(function(n,e,t){v.isArray(e)||(e=[e]);var i={};return i[n]=e,this.register(i),this.people.set(n,e,t)}),L.prototype.add_group=En(function(n,e,t){var i=this.get_property(n),s={};return i===void 0?(s[n]=[e],this.register(s)):i.indexOf(e)===-1&&(i.push(e),s[n]=i,this.register(s)),this.people.union(n,e,t)}),L.prototype.remove_group=En(function(n,e,t){var i=this.get_property(n);if(i!==void 0){var s=i.indexOf(e);s>-1&&(i.splice(s,1),this.register({group_key:i})),i.length===0&&this.unregister(n)}return this.people.remove(n,e,t)}),L.prototype.track_with_groups=En(function(n,e,t,i){var s=v.extend({},e||{});return v.each(t,function(o,a){o!=null&&(s[a]=o)}),this.track(n,s,i)}),L.prototype._create_map_key=function(n,e){return n+"_"+JSON.stringify(e)},L.prototype._remove_group_from_cache=function(n,e){delete this._cached_groups[this._create_map_key(n,e)]},L.prototype.get_group=function(n,e){var t=this._create_map_key(n,e),i=this._cached_groups[t];return(i===void 0||i._group_key!==n||i._group_id!==e)&&(i=new le,i._init(this,n,e),this._cached_groups[t]=i),i},L.prototype.track_pageview=En(function(n,e){typeof n!="object"&&(n={}),e=e||{};var t=e.event_name||"$mp_web_page_view",i=v.extend(v.info.mpPageViewProperties(),v.info.campaignParams(),v.info.clickParams()),s=v.extend({},i,n);return this.track(t,s)}),L.prototype.track_links=function(){return this._track_dom.call(this,ht,arguments)},L.prototype.track_forms=function(){return this._track_dom.call(this,li,arguments)},L.prototype.time_event=function(n){if(v.isUndefined(n)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(n)||this.persistence.set_event_timer(n,new Date().getTime())};var tc={persistent:!0},us=function(n){var e;return v.isObject(n)?e=n:v.isUndefined(n)?e={}:e={days:n},v.extend({},tc,e)};L.prototype.register=function(n,e){var t=us(e);t.persistent?this.persistence.register(n,t.days):v.extend(this.unpersisted_superprops,n)},L.prototype.register_once=function(n,e,t){var i=us(t);i.persistent?this.persistence.register_once(n,e,i.days):(typeof e>"u"&&(e="None"),v.each(n,function(s,o){(!this.unpersisted_superprops.hasOwnProperty(o)||this.unpersisted_superprops[o]===e)&&(this.unpersisted_superprops[o]=s)},this))},L.prototype.unregister=function(n,e){e=us(e),e.persistent?this.persistence.unregister(n):delete this.unpersisted_superprops[n]},L.prototype._register_single=function(n,e){var t={};t[n]=e,this.register(t)},L.prototype.identify=function(n,e,t,i,s,o,a,l){var c=this.get_distinct_id();if(n&&c!==n){if(typeof n=="string"&&n.indexOf(cs)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:n})}if(!this.get_property("$device_id")){var p=c;this.register_once({$had_persisted_distinct_id:!0,$device_id:p},"")}n!==c&&n!==this.get_property(ci)&&(this.unregister(ci),this.register({distinct_id:n})),this._flags.identify_called=!0,this.people._flush(e,t,i,s,o,a,l),n!==c&&this.track("$identify",{distinct_id:n,$anon_distinct_id:c},{skip_hooks:!0})},L.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var n=v.UUID();this.register_once({distinct_id:cs+n,$device_id:n},"")},L.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},L.prototype.alias=function(n,e){if(n===this.get_property(Yo))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var t=this;return v.isUndefined(e)&&(e=this.get_distinct_id()),n!==e?(this._register_single(ci,n),this.track("$create_alias",{alias:n,distinct_id:e},{skip_hooks:!0},function(){t.identify(n)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(n),-1)},L.prototype.name_tag=function(n){this._register_single("mp_name_tag",n)},L.prototype.set_config=function(n){if(v.isObject(n)){v.extend(this.config,n);var e=n.batch_size;e&&v.each(this.request_batchers,function(t){t.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),vn.DEBUG=vn.DEBUG||this.get_config("debug")}},L.prototype.get_config=function(n){return this.config[n]},L.prototype._run_hook=function(n){var e=(this.config.hooks[n]||ec).apply(this,Tn.call(arguments,1));return typeof e>"u"&&(this.report_error(n+" hook did not return a value"),e=null),e},L.prototype.get_property=function(n){return this.persistence.load_prop([n])},L.prototype.toString=function(){var n=this.get_config("name");return n!==Ze&&(n=Ze+"."+n),n},L.prototype._event_is_disabled=function(n){return v.isBlockedUA(cn)||this._flags.disable_all_events||v.include(this.__disabled_events,n)},L.prototype._gdpr_init=function(){var n=this.get_config("opt_out_tracking_persistence_type")==="localStorage";n&&v.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||v.cookie.get("mp_optout"))&&(v.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},L.prototype._gdpr_update_persistence=function(n){var e;if(n&&n.clear_persistence)e=!0;else if(n&&n.enable_persistence)e=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==e&&this.persistence.set_disabled(e),e?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},L.prototype._gdpr_call_func=function(n,e){return e=v.extend({track:v.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},e),v.localStorage.is_supported()||(e.persistence_type="cookie"),n(this.get_config("token"),{track:e.track,trackEventName:e.track_event_name,trackProperties:e.track_properties,persistenceType:e.persistence_type,persistencePrefix:e.cookie_prefix,cookieDomain:e.cookie_domain,cookieExpiration:e.cookie_expiration,crossSiteCookie:e.cross_site_cookie,crossSubdomainCookie:e.cross_subdomain_cookie,secureCookie:e.secure_cookie,ignoreDnt:e.ignore_dnt})},L.prototype.opt_in_tracking=function(n){n=v.extend({enable_persistence:!0},n),this._gdpr_call_func(Fl,n),this._gdpr_update_persistence(n)},L.prototype.opt_out_tracking=function(n){n=v.extend({clear_persistence:!0,delete_user:!0},n),n.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(Kl,n),this._gdpr_update_persistence(n)},L.prototype.has_opted_in_tracking=function(n){return this._gdpr_call_func(Gl,n)},L.prototype.has_opted_out_tracking=function(n){return this._gdpr_call_func(Ko,n)},L.prototype.clear_opt_in_out_tracking=function(n){n=v.extend({enable_persistence:!0},n),this._gdpr_call_func(jl,n),this._gdpr_update_persistence(n)},L.prototype.report_error=function(n,e){ee.error.apply(ee.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(t){ee.error(t)}},L.prototype.init=L.prototype.init,L.prototype.reset=L.prototype.reset,L.prototype.disable=L.prototype.disable,L.prototype.time_event=L.prototype.time_event,L.prototype.track=L.prototype.track,L.prototype.track_links=L.prototype.track_links,L.prototype.track_forms=L.prototype.track_forms,L.prototype.track_pageview=L.prototype.track_pageview,L.prototype.register=L.prototype.register,L.prototype.register_once=L.prototype.register_once,L.prototype.unregister=L.prototype.unregister,L.prototype.identify=L.prototype.identify,L.prototype.alias=L.prototype.alias,L.prototype.name_tag=L.prototype.name_tag,L.prototype.set_config=L.prototype.set_config,L.prototype.get_config=L.prototype.get_config,L.prototype.get_property=L.prototype.get_property,L.prototype.get_distinct_id=L.prototype.get_distinct_id,L.prototype.toString=L.prototype.toString,L.prototype.opt_out_tracking=L.prototype.opt_out_tracking,L.prototype.opt_in_tracking=L.prototype.opt_in_tracking,L.prototype.has_opted_out_tracking=L.prototype.has_opted_out_tracking,L.prototype.has_opted_in_tracking=L.prototype.has_opted_in_tracking,L.prototype.clear_opt_in_out_tracking=L.prototype.clear_opt_in_out_tracking,L.prototype.get_group=L.prototype.get_group,L.prototype.set_group=L.prototype.set_group,L.prototype.add_group=L.prototype.add_group,L.prototype.remove_group=L.prototype.remove_group,L.prototype.track_with_groups=L.prototype.track_with_groups,L.prototype.start_batch_senders=L.prototype.start_batch_senders,L.prototype.stop_batch_senders=L.prototype.stop_batch_senders,L.prototype.start_session_recording=L.prototype.start_session_recording,L.prototype.stop_session_recording=L.prototype.stop_session_recording,L.prototype.get_session_recording_properties=L.prototype.get_session_recording_properties,L.prototype.DEFAULT_API_ROUTES=ta,z.prototype.properties=z.prototype.properties,z.prototype.update_search_keyword=z.prototype.update_search_keyword,z.prototype.update_referrer_info=z.prototype.update_referrer_info,z.prototype.get_cross_subdomain=z.prototype.get_cross_subdomain,z.prototype.clear=z.prototype.clear;var vt={},ic=function(){v.each(vt,function(n,e){e!==Ze&&(Pe[e]=n)}),Pe._=v},sc=function(){Pe.init=function(n,e,t){if(t)return Pe[t]||(Pe[t]=vt[t]=ds(n,e,t),Pe[t]._loaded()),Pe[t];var i=Pe;vt[Ze]?i=vt[Ze]:n&&(i=ds(n,e,Ze),i._loaded(),vt[Ze]=i),Pe=i,ls===$l&&(O[Ze]=Pe),ic()}},oc=function(){function n(){n.done||(n.done=!0,sa=!0,na=!1,v.each(vt,function(i){i._dom_loaded()}))}function e(){try{oe.documentElement.doScroll("left")}catch{setTimeout(e,1);return}n()}if(oe.addEventListener)oe.readyState==="complete"?n():oe.addEventListener("DOMContentLoaded",n,!1);else if(oe.attachEvent){oe.attachEvent("onreadystatechange",n);var t=!1;try{t=O.frameElement===null}catch{}oe.documentElement.doScroll&&t&&e()}v.register_event(O,"load",n,!0)};function ac(n){return Xo=n,ls=$o,Pe=new L,sc(),Pe.init(),oc(),Pe}function rc(n,e){e()}var _=ac(rc);const lc=`<div id="checkoutConfirmationEnd" data-section="transfer">
|
|
1167
|
+
`);var e="",t,i,s=0,o;for(t=i=0,s=n.length,o=0;o<s;o++){var a=n.charCodeAt(o),l=null;a<128?i++:a>127&&a<2048?l=String.fromCharCode(a>>6|192,a&63|128):l=String.fromCharCode(a>>12|224,a>>6&63|128,a&63|128),l!==null&&(i>t&&(e+=n.substring(t,i)),e+=l,t=i=o+1)}return i>t&&(e+=n.substring(t,n.length)),e},v.UUID=function(){var n=function(){var i=1*new Date,s;if(O.performance&&O.performance.now)s=O.performance.now();else for(s=0;i==1*new Date;)s++;return i.toString(16)+Math.floor(s).toString(16)},e=function(){return Math.random().toString(16).replace(".","")},t=function(){var i=cn,s,o,a=[],l=0;function c(p,m){var g,f=0;for(g=0;g<m.length;g++)f|=a[g]<<g*8;return p^f}for(s=0;s<i.length;s++)o=i.charCodeAt(s),a.unshift(o&255),a.length>=4&&(l=c(l,a),a=[]);return a.length>0&&(l=c(l,a)),l.toString(16)};return function(){var i=(ii.height*ii.width).toString(16);return n()+"-"+e()+"-"+t()+"-"+i+"-"+n()}}();var Vo=["ahrefsbot","ahrefssiteaudit","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];v.isBlockedUA=function(n){var e;for(n=n.toLowerCase(),e=0;e<Vo.length;e++)if(n.indexOf(Vo[e])!==-1)return!0;return!1},v.HTTPBuildQuery=function(n,e){var t,i,s=[];return v.isUndefined(e)&&(e="&"),v.each(n,function(o,a){t=encodeURIComponent(o.toString()),i=encodeURIComponent(a),s[s.length]=i+"="+t}),s.join(e)},v.getQueryParam=function(n,e){e=e.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var t="[\\?&]"+e+"=([^&#]*)",i=new RegExp(t),s=i.exec(n);if(s===null||s&&typeof s[1]!="string"&&s[1].length)return"";var o=s[1];try{o=decodeURIComponent(o)}catch{ee.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},v.cookie={get:function(n){for(var e=n+"=",t=oe.cookie.split(";"),i=0;i<t.length;i++){for(var s=t[i];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}return null},parse:function(n){var e;try{e=v.JSONDecode(v.cookie.get(n))||{}}catch{}return e},set_seconds:function(n,e,t,i,s,o,a){var l="",c="",p="";if(a)l="; domain="+a;else if(i){var m=Fo(oe.location.hostname);l=m?"; domain=."+m:""}if(t){var g=new Date;g.setTime(g.getTime()+t*1e3),c="; expires="+g.toGMTString()}o&&(s=!0,p="; SameSite=None"),s&&(p+="; secure"),oe.cookie=n+"="+encodeURIComponent(e)+c+"; path=/"+l+p},set:function(n,e,t,i,s,o,a){var l="",c="",p="";if(a)l="; domain="+a;else if(i){var m=Fo(oe.location.hostname);l=m?"; domain=."+m:""}if(t){var g=new Date;g.setTime(g.getTime()+t*24*60*60*1e3),c="; expires="+g.toGMTString()}o&&(s=!0,p="; SameSite=None"),s&&(p+="; secure");var f=n+"="+encodeURIComponent(e)+c+"; path=/"+l+p;return oe.cookie=f,f},remove:function(n,e,t){v.cookie.set(n,"",-1,e,!1,!1,t)}};var Ji=null,oi=function(n,e){if(Ji!==null&&!e)return Ji;var t=!0;try{n=n||window.localStorage;var i="__mplss_"+Yi(8),s="xyz";n.setItem(i,s),n.getItem(i)!==s&&(t=!1),n.removeItem(i)}catch{t=!1}return Ji=t,t};v.localStorage={is_supported:function(n){var e=oi(null,n);return e||ee.error("localStorage unsupported; falling back to cookie store"),e},error:function(n){ee.error("localStorage error: "+n)},get:function(n){try{return window.localStorage.getItem(n)}catch(e){v.localStorage.error(e)}return null},parse:function(n){try{return v.JSONDecode(v.localStorage.get(n))||{}}catch{}return null},set:function(n,e){try{window.localStorage.setItem(n,e)}catch(t){v.localStorage.error(t)}},remove:function(n){try{window.localStorage.removeItem(n)}catch(e){v.localStorage.error(e)}}},v.register_event=function(){var n=function(i,s,o,a,l){if(!i){ee.error("No valid element provided to register_event");return}if(i.addEventListener&&!a)i.addEventListener(s,o,!!l);else{var c="on"+s,p=i[c];i[c]=e(i,o,p)}};function e(i,s,o){var a=function(l){if(l=l||t(window.event),!!l){var c=!0,p,m;return v.isFunction(o)&&(p=o(l)),m=s.call(i,l),(p===!1||m===!1)&&(c=!1),c}};return a}function t(i){return i&&(i.preventDefault=t.preventDefault,i.stopPropagation=t.stopPropagation),i}return t.preventDefault=function(){this.returnValue=!1},t.stopPropagation=function(){this.cancelBubble=!0},n}();var Bl=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');v.dom_query=function(){function n(s){return s.all?s.all:s.getElementsByTagName("*")}var e=/[\t\r\n]/g;function t(s,o){var a=" "+o+" ";return(" "+s.className+" ").replace(e," ").indexOf(a)>=0}function i(s){if(!oe.getElementsByTagName)return[];var o=s.split(" "),a,l,c,p,m,g,f,b,w,C,k=[oe];for(g=0;g<o.length;g++){if(a=o[g].replace(/^\s+/,"").replace(/\s+$/,""),a.indexOf("#")>-1){l=a.split("#"),c=l[0];var x=l[1],A=oe.getElementById(x);if(!A||c&&A.nodeName.toLowerCase()!=c)return[];k=[A];continue}if(a.indexOf(".")>-1){l=a.split("."),c=l[0];var M=l[1];for(c||(c="*"),p=[],m=0,f=0;f<k.length;f++)for(c=="*"?w=n(k[f]):w=k[f].getElementsByTagName(c),b=0;b<w.length;b++)p[m++]=w[b];for(k=[],C=0,f=0;f<p.length;f++)p[f].className&&v.isString(p[f].className)&&t(p[f],M)&&(k[C++]=p[f]);continue}var P=a.match(Bl);if(P){c=P[1];var D=P[2],q=P[3],Q=P[4];for(c||(c="*"),p=[],m=0,f=0;f<k.length;f++)for(c=="*"?w=n(k[f]):w=k[f].getElementsByTagName(c),b=0;b<w.length;b++)p[m++]=w[b];k=[],C=0;var K;switch(q){case"=":K=function(W){return W.getAttribute(D)==Q};break;case"~":K=function(W){return W.getAttribute(D).match(new RegExp("\\b"+Q+"\\b"))};break;case"|":K=function(W){return W.getAttribute(D).match(new RegExp("^"+Q+"-?"))};break;case"^":K=function(W){return W.getAttribute(D).indexOf(Q)===0};break;case"$":K=function(W){return W.getAttribute(D).lastIndexOf(Q)==W.getAttribute(D).length-Q.length};break;case"*":K=function(W){return W.getAttribute(D).indexOf(Q)>-1};break;default:K=function(W){return W.getAttribute(D)}}for(k=[],C=0,f=0;f<p.length;f++)K(p[f])&&(k[C++]=p[f]);continue}for(c=a,p=[],m=0,f=0;f<k.length;f++)for(w=k[f].getElementsByTagName(c),b=0;b<w.length;b++)p[m++]=w[b];k=p}return k}return function(s){return v.isElement(s)?[s]:v.isObject(s)&&!v.isUndefined(s.length)?s:i.call(this,s)}}();var Rl=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],Hl=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];v.info={campaignParams:function(n){var e="",t={};return v.each(Rl,function(i){e=v.getQueryParam(oe.URL,i),e.length?t[i]=e:n!==void 0&&(t[i]=n)}),t},clickParams:function(){var n="",e={};return v.each(Hl,function(t){n=v.getQueryParam(oe.URL,t),n.length&&(e[t]=n)}),e},marketingParams:function(){return v.extend(v.info.campaignParams(),v.info.clickParams())},searchEngine:function(n){return n.search("https?://(.*)google.([^/?]*)")===0?"google":n.search("https?://(.*)bing.com")===0?"bing":n.search("https?://(.*)yahoo.com")===0?"yahoo":n.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(n){var e=v.info.searchEngine(n),t=e!="yahoo"?"q":"p",i={};if(e!==null){i.$search_engine=e;var s=v.getQueryParam(n,t);s.length&&(i.mp_keyword=s)}return i},browser:function(n,e,t){return e=e||"",t||v.includes(n," OPR/")?v.includes(n,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":v.includes(n,"IEMobile")||v.includes(n,"WPDesktop")?"Internet Explorer Mobile":v.includes(n,"SamsungBrowser/")?"Samsung Internet":v.includes(n,"Edge")||v.includes(n,"Edg/")?"Microsoft Edge":v.includes(n,"FBIOS")?"Facebook Mobile":v.includes(n,"Chrome")?"Chrome":v.includes(n,"CriOS")?"Chrome iOS":v.includes(n,"UCWEB")||v.includes(n,"UCBrowser")?"UC Browser":v.includes(n,"FxiOS")?"Firefox iOS":v.includes(e,"Apple")?v.includes(n,"Mobile")?"Mobile Safari":"Safari":v.includes(n,"Android")?"Android Mobile":v.includes(n,"Konqueror")?"Konqueror":v.includes(n,"Firefox")?"Firefox":v.includes(n,"MSIE")||v.includes(n,"Trident/")?"Internet Explorer":v.includes(n,"Gecko")?"Mozilla":""},browserVersion:function(n,e,t){var i=v.info.browser(n,e,t),s={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/},o=s[i];if(o===void 0)return null;var a=n.match(o);return a?parseFloat(a[a.length-2]):null},os:function(){var n=cn;return/Windows/i.test(n)?/Phone/.test(n)||/WPDesktop/.test(n)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(n)?"iOS":/Android/.test(n)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Mac/i.test(n)?"Mac OS X":/Linux/.test(n)?"Linux":/CrOS/.test(n)?"Chrome OS":""},device:function(n){return/Windows Phone/i.test(n)||/WPDesktop/.test(n)?"Windows Phone":/iPad/.test(n)?"iPad":/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Android/.test(n)?"Android":""},referringDomain:function(n){var e=n.split("/");return e.length>=3?e[2]:""},currentUrl:function(){return O.location.href},properties:function(n){return typeof n!="object"&&(n={}),v.extend(v.strip_empty_properties({$os:v.info.os(),$browser:v.info.browser(cn,_n.vendor,ti),$referrer:oe.referrer,$referring_domain:v.info.referringDomain(oe.referrer),$device:v.info.device(cn)}),{$current_url:v.info.currentUrl(),$browser_version:v.info.browserVersion(cn,_n.vendor,ti),$screen_height:ii.height,$screen_width:ii.width,mp_lib:"web",$lib_version:vn.LIB_VERSION,$insert_id:Yi(),time:v.timestamp()/1e3},v.strip_empty_properties(n))},people_properties:function(){return v.extend(v.strip_empty_properties({$os:v.info.os(),$browser:v.info.browser(cn,_n.vendor,ti)}),{$browser_version:v.info.browserVersion(cn,_n.vendor,ti)})},mpPageViewProperties:function(){return v.strip_empty_properties({current_page_title:oe.title,current_domain:O.location.hostname,current_url_path:O.location.pathname,current_url_protocol:O.location.protocol,current_url_search:O.location.search})}};var Yi=function(n){var e=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return n?e.substring(0,n):e},Nl=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,Ol=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,Fo=function(n){var e=Ol,t=n.split("."),i=t[t.length-1];(i.length>4||i==="com"||i==="org")&&(e=Nl);var s=n.match(e);return s?s[0]:""},Ul=function(){var n=O.navigator.onLine;return v.isUndefined(n)||n},ai=null,ri=null;typeof JSON<"u"&&(ai=JSON.stringify,ri=JSON.parse),ai=ai||v.JSONEncode,ri=ri||v.JSONDecode,v.toArray=v.toArray,v.isObject=v.isObject,v.JSONEncode=v.JSONEncode,v.JSONDecode=v.JSONDecode,v.isBlockedUA=v.isBlockedUA,v.isEmptyObject=v.isEmptyObject,v.info=v.info,v.info.device=v.info.device,v.info.browser=v.info.browser,v.info.browserVersion=v.info.browserVersion,v.info.properties=v.info.properties;var Vl="__mp_opt_in_out_";function Fl(n,e){jo(!0,n,e)}function Kl(n,e){jo(!1,n,e)}function Gl(n,e){return Go(n,e)==="1"}function Ko(n,e){if(zl(e))return ee.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var t=Go(n,e)==="0";return t&&ee.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),t}function En(n){return es(n,function(e){return this.get_config(e)})}function Pn(n){return es(n,function(e){return this._get_config(e)})}function ut(n){return es(n,function(e){return this._get_config(e)})}function jl(n,e){e=e||{},Xi(e).remove($i(n,e),!!e.crossSubdomainCookie,e.cookieDomain)}function Xi(n){return n=n||{},n.persistenceType==="localStorage"?v.localStorage:v.cookie}function $i(n,e){return e=e||{},(e.persistencePrefix||Vl)+n}function Go(n,e){return Xi(e).get($i(n,e))}function zl(n){if(n&&n.ignoreDnt)return!1;var e=n&&n.window||O,t=e.navigator||{},i=!1;return v.each([t.doNotTrack,t.msDoNotTrack,e.doNotTrack],function(s){v.includes([!0,1,"1","yes"],s)&&(i=!0)}),i}function jo(n,e,t){if(!v.isString(e)||!e.length){ee.error("gdpr."+(n?"optIn":"optOut")+" called with an invalid token");return}t=t||{},Xi(t).set($i(e,t),n?1:0,v.isNumber(t.cookieExpiration)?t.cookieExpiration:null,!!t.crossSubdomainCookie,!!t.secureCookie,!!t.crossSiteCookie,t.cookieDomain),t.track&&n&&t.track(t.trackEventName||"$opt_in",t.trackProperties,{send_immediately:!0})}function es(n,e){return function(){var t=!1;try{var i=e.call(this,"token"),s=e.call(this,"ignore_dnt"),o=e.call(this,"opt_out_tracking_persistence_type"),a=e.call(this,"opt_out_tracking_cookie_prefix"),l=e.call(this,"window");i&&(t=Ko(i,{ignoreDnt:s,persistenceType:o,persistencePrefix:a,window:l}))}catch(p){ee.error("Unexpected error when checking tracking opt-out status: "+p)}if(!t)return n.apply(this,arguments);var c=arguments[arguments.length-1];typeof c=="function"&&c(0)}}var ql=si("lock"),zo=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3};zo.prototype.withLock=function(n,e,t){!t&&typeof e!="function"&&(t=e,e=null);var i=t||new Date().getTime()+"|"+Math.random(),s=new Date().getTime(),o=this.storageKey,a=this.pollIntervalMS,l=this.timeoutMS,c=this.storage,p=o+":X",m=o+":Y",g=o+":Z",f=function(A){e&&e(A)},b=function(A){if(new Date().getTime()-s>l){ql.error("Timeout waiting for mutex on "+o+"; clearing lock. ["+i+"]"),c.removeItem(g),c.removeItem(m),k();return}setTimeout(function(){try{A()}catch(M){f(M)}},a*(Math.random()+.1))},w=function(A,M){A()?M():b(function(){w(A,M)})},C=function(){var A=c.getItem(m);if(A&&A!==i)return!1;if(c.setItem(m,i),c.getItem(m)===i)return!0;if(!oi(c,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},k=function(){c.setItem(p,i),w(C,function(){if(c.getItem(p)===i){x();return}b(function(){if(c.getItem(m)!==i){k();return}w(function(){return!c.getItem(g)},x)})})},x=function(){c.setItem(g,"1");try{n()}finally{c.removeItem(g),c.getItem(m)===i&&c.removeItem(m),c.getItem(p)===i&&c.removeItem(p)}};try{if(oi(c,!0))k();else throw new Error("localStorage support check failed")}catch(A){f(A)}};var qo=si("batch"),In=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.reportError=e.errorReporter||v.bind(qo.error,qo),this.lock=new zo(n,{storage:this.storage}),this.usePersistence=e.usePersistence,this.pid=e.pid||null,this.memQueue=[]};In.prototype.enqueue=function(n,e,t){var i={id:Yi(),flushAfter:new Date().getTime()+e*2,payload:n};this.usePersistence?this.lock.withLock(v.bind(function(){var o;try{var a=this.readFromStorage();a.push(i),o=this.saveToStorage(a),o&&this.memQueue.push(i)}catch{this.reportError("Error enqueueing item",n),o=!1}t&&t(o)},this),v.bind(function(o){this.reportError("Error acquiring storage lock",o),t&&t(!1)},this),this.pid):(this.memQueue.push(i),t&&t(!0))},In.prototype.fillBatch=function(n){var e=this.memQueue.slice(0,n);if(this.usePersistence&&e.length<n){var t=this.readFromStorage();if(t.length){var i={};v.each(e,function(a){i[a.id]=!0});for(var s=0;s<t.length;s++){var o=t[s];if(new Date().getTime()>o.flushAfter&&!i[o.id]&&(o.orphaned=!0,e.push(o),e.length>=n))break}}}return e};var Wo=function(n,e){var t=[];return v.each(n,function(i){i.id&&!e[i.id]&&t.push(i)}),t};In.prototype.removeItemsByID=function(n,e){var t={};if(v.each(n,function(s){t[s]=!0}),this.memQueue=Wo(this.memQueue,t),!this.usePersistence)e&&e(!0);else{var i=v.bind(function(){var s;try{var o=this.readFromStorage();if(o=Wo(o,t),s=this.saveToStorage(o),s){o=this.readFromStorage();for(var a=0;a<o.length;a++){var l=o[a];if(l.id&&t[l.id])return this.reportError("Item not removed from storage"),!1}}}catch{this.reportError("Error removing items",n),s=!1}return s},this);this.lock.withLock(function(){var o=i();e&&e(o)},v.bind(function(o){var a=!1;if(this.reportError("Error acquiring storage lock",o),!oi(this.storage,!0)&&(a=i(),!a))try{this.storage.removeItem(this.storageKey)}catch(l){this.reportError("Error clearing queue",l)}e&&e(a)},this),this.pid)}};var Zo=function(n,e){var t=[];return v.each(n,function(i){var s=i.id;if(s in e){var o=e[s];o!==null&&(i.payload=o,t.push(i))}else t.push(i)}),t};In.prototype.updatePayloads=function(n,e){this.memQueue=Zo(this.memQueue,n),this.usePersistence?this.lock.withLock(v.bind(function(){var i;try{var s=this.readFromStorage();s=Zo(s,n),i=this.saveToStorage(s)}catch{this.reportError("Error updating items",n),i=!1}e&&e(i)},this),v.bind(function(i){this.reportError("Error acquiring storage lock",i),e&&e(!1)},this),this.pid):e&&e(!0)},In.prototype.readFromStorage=function(){var n;try{n=this.storage.getItem(this.storageKey),n&&(n=ri(n),v.isArray(n)||(this.reportError("Invalid storage entry:",n),n=null))}catch(e){this.reportError("Error retrieving queue",e),n=null}return n||[]},In.prototype.saveToStorage=function(n){try{return this.storage.setItem(this.storageKey,ai(n)),!0}catch(e){return this.reportError("Error saving queue",e),!1}},In.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var Wl=10*60*1e3,Pt=si("batch"),tn=function(n,e){this.errorReporter=e.errorReporter,this.queue=new In(n,{errorReporter:v.bind(this.reportError,this),storage:e.storage,usePersistence:e.usePersistence}),this.libConfig=e.libConfig,this.sendRequest=e.sendRequestFunc,this.beforeSendHook=e.beforeSendHook,this.stopAllBatching=e.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=e.flushOnlyOnInterval||!1};tn.prototype.enqueue=function(n,e){this.queue.enqueue(n,this.flushInterval,e)},tn.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},tn.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},tn.prototype.clear=function(){this.queue.clear()},tn.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},tn.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},tn.prototype.scheduleFlush=function(n){this.flushInterval=n,this.stopped||(this.timeoutID=setTimeout(v.bind(function(){this.stopped||this.flush()},this),this.flushInterval))},tn.prototype.flush=function(n){try{if(this.requestInProgress){Pt.log("Flush: Request already in progress");return}n=n||{};var e=this.libConfig.batch_request_timeout_ms,t=new Date().getTime(),i=this.batchSize,s=this.queue.fillBatch(i),o=s.length===i,a=[],l={};if(v.each(s,function(m){var g=m.payload;if(this.beforeSendHook&&!m.orphaned&&(g=this.beforeSendHook(g)),g){g.event&&g.properties&&(g.properties=v.extend({},g.properties,{mp_sent_by_lib_version:vn.LIB_VERSION}));var f=!0,b=m.id;b?(this.itemIdsSentSuccessfully[b]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:m,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[b]}),f=!1):this.reportError("[dupe] found item with no ID",{item:m}),f&&a.push(g)}l[m.id]=g},this),a.length<1){this.resetFlush();return}this.requestInProgress=!0;var c=v.bind(function(m){this.requestInProgress=!1;try{var g=!1;if(n.unloading)this.queue.updatePayloads(l);else if(v.isObject(m)&&m.error==="timeout"&&new Date().getTime()-t>=e)this.reportError("Network timeout; retrying"),this.flush();else if(v.isObject(m)&&(m.httpStatusCode>=500||m.httpStatusCode===429||m.httpStatusCode<=0&&!Ul()||m.error==="timeout")){var f=this.flushInterval*2;m.retryAfter&&(f=parseInt(m.retryAfter,10)*1e3||f),f=Math.min(Wl,f),this.reportError("Error; retry in "+f+" ms"),this.scheduleFlush(f)}else if(v.isObject(m)&&m.httpStatusCode===413)if(s.length>1){var b=Math.max(1,Math.floor(i/2));this.batchSize=Math.min(this.batchSize,b,s.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",s),this.resetBatchSize(),g=!0;else g=!0;g&&(this.queue.removeItemsByID(v.map(s,function(w){return w.id}),v.bind(function(w){w?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!o?this.resetFlush():this.flush()):(this.reportError("Failed to remove items from queue"),++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush())},this)),v.each(s,v.bind(function(w){var C=w.id;C?(this.itemIdsSentSuccessfully[C]=this.itemIdsSentSuccessfully[C]||0,this.itemIdsSentSuccessfully[C]++,this.itemIdsSentSuccessfully[C]>5&&this.reportError("[dupe] item ID sent too many times",{item:w,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[C]})):this.reportError("[dupe] found item with no ID while removing",{item:w})},this)))}catch(w){this.reportError("Error handling API response",w),this.resetFlush()}},this),p={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};n.unloading&&(p.transport="sendBeacon"),Pt.log("MIXPANEL REQUEST:",a),this.sendRequest(a,p,c)}catch(m){this.reportError("Error flushing request queue",m),this.resetFlush()}},tn.prototype.reportError=function(n,e){if(Pt.error.apply(Pt.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(n)),this.errorReporter(n,e)}catch(t){Pt.error(t)}};var Gn=si("recorder"),Qo=O.CompressionStream,Zl={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},Ql=new Set([ln.MouseMove,ln.MouseInteraction,ln.Scroll,ln.ViewportResize,ln.Input,ln.TouchMove,ln.MediaInteraction,ln.Drag,ln.Selection]);function Jl(n){return n.type===Bo.IncrementalSnapshot&&Ql.has(n.data.source)}var sn=function(n){this._mixpanel=n,this._stopRecording=null,this.recEvents=[],this.seqNo=0,this.replayId=null,this.replayStartTime=null,this.sendBatchId=null,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=_t,this.recordMinMs=0,this._initBatcher()};sn.prototype._initBatcher=function(){this.batcher=new tn("__mprec",{libConfig:Zl,sendRequestFunc:v.bind(this.flushEventsWithOptOut,this),errorReporter:v.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},sn.prototype.get_config=function(n){return this._mixpanel.get_config(n)},sn.prototype.startRecording=function(n){if(this._stopRecording!==null){Gn.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>_t&&(this.recordMaxMs=_t,Gn.critical("record_max_ms cannot be greater than "+_t+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>qi&&(this.recordMinMs=qi,Gn.critical("record_min_ms cannot be greater than "+qi+"ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=new Date().getTime(),this.replayId=v.UUID(),n||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var e=v.bind(function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(v.bind(function(){Gn.log("Idle timeout reached, restarting recording."),this.resetRecording()},this),this.get_config("record_idle_timeout_ms"))},this),t=this.get_config("record_block_selector");(t===""||t===null)&&(t=void 0),this._stopRecording=Tt({emit:v.bind(function(i){this.batcher.enqueue(i),Jl(i)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),e())},this),blockClass:this.get_config("record_block_class"),blockSelector:t,collectFonts:this.get_config("record_collect_fonts"),inlineImages:this.get_config("record_inline_images"),maskAllInputs:!0,maskTextClass:this.get_config("record_mask_text_class"),maskTextSelector:this.get_config("record_mask_text_selector")}),e(),this.maxTimeoutId=setTimeout(v.bind(this.resetRecording,this),this.recordMaxMs)},sn.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},sn.prototype.stopRecording=function(){this._stopRecording!==null&&(this._stopRecording(),this._stopRecording=null),this.batcher.stopped?this.batcher.clear():(this.batcher.flush(),this.batcher.stop()),this.replayId=null,clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId)},sn.prototype.flushEventsWithOptOut=function(n,e,t){this._flushEvents(n,e,t,v.bind(this._onOptOut,this))},sn.prototype._onOptOut=function(n){n===0&&(this.recEvents=[],this.stopRecording())},sn.prototype._sendRequest=function(n,e,t,i){var s=v.bind(function(o,a){o.status===200&&this.replayId===n&&this.seqNo++,i({status:0,httpStatusCode:o.status,responseBody:a,retryAfter:o.headers.get("Retry-After")})},this);O.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(e),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:t}).then(function(o){o.json().then(function(a){s(o,a)}).catch(function(a){i({error:a})})}).catch(function(o){i({error:o,httpStatusCode:0})})},sn.prototype._flushEvents=En(function(n,e,t){const i=n.length;if(i>0){var s=this.replayId,o=n[0].timestamp;(this.seqNo===0||!this.replayStartTime)&&(this.seqNo!==0&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=o);var a=n[i-1].timestamp-this.replayStartTime,l={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:o/1e3,replay_id:s,replay_length_ms:a,replay_start_time:this.replayStartTime/1e3},c=v.JSONEncode(n),p=this._mixpanel.get_property("$device_id");p&&(l.$device_id=p);var m=this._mixpanel.get_property("$user_id");if(m&&(l.$user_id=m),Qo){var g=new Blob([c],{type:"application/json"}).stream(),f=g.pipeThrough(new Qo("gzip"));new Response(f).blob().then(v.bind(function(b){l.format="gzip",this._sendRequest(s,l,b,t)},this))}else l.format="body",this._sendRequest(s,l,c,t)}}),sn.prototype.reportError=function(n,e){Gn.error.apply(Gn.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(t){Gn.error(t)}},O.__mp_recorder=sn;var bn=function(){};bn.prototype.create_properties=function(){},bn.prototype.event_handler=function(){},bn.prototype.after_track_handler=function(){},bn.prototype.init=function(n){return this.mp=n,this},bn.prototype.track=function(n,e,t,i){var s=this,o=v.dom_query(n);if(o.length===0){ee.error("The DOM query ("+n+") returned 0 elements");return}return v.each(o,function(a){v.register_event(a,this.override_event,function(l){var c={},p=s.create_properties(t,this),m=s.mp.get_config("track_links_timeout");s.event_handler(l,this,c),window.setTimeout(s.track_callback(i,p,c,!0),m),s.mp.track(e,p,s.track_callback(i,p,c))})},this),!0},bn.prototype.track_callback=function(n,e,t,i){i=i||!1;var s=this;return function(){t.callback_fired||(t.callback_fired=!0,!(n&&n(i,e)===!1)&&s.after_track_handler(e,t,i))}},bn.prototype.create_properties=function(n,e){var t;return typeof n=="function"?t=n(e):t=v.extend({},n),t};var ht=function(){this.override_event="click"};v.inherit(ht,bn),ht.prototype.create_properties=function(n,e){var t=ht.superclass.create_properties.apply(this,arguments);return e.href&&(t.url=e.href),t},ht.prototype.event_handler=function(n,e,t){t.new_tab=n.which===2||n.metaKey||n.ctrlKey||e.target==="_blank",t.href=e.href,t.new_tab||n.preventDefault()},ht.prototype.after_track_handler=function(n,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var li=function(){this.override_event="submit"};v.inherit(li,bn),li.prototype.event_handler=function(n,e,t){t.element=e,n.preventDefault()},li.prototype.after_track_handler=function(n,e){setTimeout(function(){e.element.submit()},0)};var Dn="$set",mt="$set_once",on="$unset",jn="$add",dn="$append",zn="$union",fn="$remove",Yl="$delete",Jo={set_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(s,o){this._is_reserved_property(o)||(i[o]=s)},this):i[n]=e,t[Dn]=i,t},unset_action:function(n){var e={},t=[];return v.isArray(n)||(n=[n]),v.each(n,function(i){this._is_reserved_property(i)||t.push(i)},this),e[on]=t,e},set_once_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(s,o){this._is_reserved_property(o)||(i[o]=s)},this):i[n]=e,t[mt]=i,t},union_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(s,o){this._is_reserved_property(o)||(i[o]=v.isArray(s)?s:[s])},this):i[n]=v.isArray(e)?e:[e],t[zn]=i,t},append_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(s,o){this._is_reserved_property(o)||(i[o]=s)},this):i[n]=e,t[dn]=i,t},remove_action:function(n,e){var t={},i={};return v.isObject(n)?v.each(n,function(s,o){this._is_reserved_property(o)||(i[o]=s)},this):i[n]=e,t[fn]=i,t},delete_action:function(){var n={};return n[Yl]="",n}},le=function(){};v.extend(le.prototype,Jo),le.prototype._init=function(n,e,t){this._mixpanel=n,this._group_key=e,this._group_id=t},le.prototype.set=ut(function(n,e,t){var i=this.set_action(n,e);return v.isObject(n)&&(t=e),this._send_request(i,t)}),le.prototype.set_once=ut(function(n,e,t){var i=this.set_once_action(n,e);return v.isObject(n)&&(t=e),this._send_request(i,t)}),le.prototype.unset=ut(function(n,e){var t=this.unset_action(n);return this._send_request(t,e)}),le.prototype.union=ut(function(n,e,t){v.isObject(n)&&(t=e);var i=this.union_action(n,e);return this._send_request(i,t)}),le.prototype.delete=ut(function(n){var e=this.delete_action();return this._send_request(e,n)}),le.prototype.remove=ut(function(n,e,t){var i=this.remove_action(n,e);return this._send_request(i,t)}),le.prototype._send_request=function(n,e){n.$group_key=this._group_key,n.$group_id=this._group_id,n.$token=this._get_config("token");var t=v.encodeDates(n);return this._mixpanel._track_or_batch({type:"groups",data:t,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},e)},le.prototype._is_reserved_property=function(n){return n==="$group_key"||n==="$group_id"},le.prototype._get_config=function(n){return this._mixpanel.get_config(n)},le.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},le.prototype.remove=le.prototype.remove,le.prototype.set=le.prototype.set,le.prototype.set_once=le.prototype.set_once,le.prototype.union=le.prototype.union,le.prototype.unset=le.prototype.unset,le.prototype.toString=le.prototype.toString;var U=function(){};v.extend(U.prototype,Jo),U.prototype._init=function(n){this._mixpanel=n},U.prototype.set=Pn(function(n,e,t){var i=this.set_action(n,e);return v.isObject(n)&&(t=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),i[Dn]=v.extend({},v.info.people_properties(),i[Dn]),this._send_request(i,t)}),U.prototype.set_once=Pn(function(n,e,t){var i=this.set_once_action(n,e);return v.isObject(n)&&(t=e),this._send_request(i,t)}),U.prototype.unset=Pn(function(n,e){var t=this.unset_action(n);return this._send_request(t,e)}),U.prototype.increment=Pn(function(n,e,t){var i={},s={};return v.isObject(n)?(v.each(n,function(o,a){if(!this._is_reserved_property(a))if(isNaN(parseFloat(o))){ee.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else s[a]=o},this),t=e):(v.isUndefined(e)&&(e=1),s[n]=e),i[jn]=s,this._send_request(i,t)}),U.prototype.append=Pn(function(n,e,t){v.isObject(n)&&(t=e);var i=this.append_action(n,e);return this._send_request(i,t)}),U.prototype.remove=Pn(function(n,e,t){v.isObject(n)&&(t=e);var i=this.remove_action(n,e);return this._send_request(i,t)}),U.prototype.union=Pn(function(n,e,t){v.isObject(n)&&(t=e);var i=this.union_action(n,e);return this._send_request(i,t)}),U.prototype.track_charge=Pn(function(n,e,t){if(!v.isNumber(n)&&(n=parseFloat(n),isNaN(n))){ee.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",v.extend({$amount:n},e),t)}),U.prototype.clear_charges=function(n){return this.set("$transactions",[],n)},U.prototype.delete_user=function(){if(!this._identify_called()){ee.error("mixpanel.people.delete_user() requires you to call identify() first");return}var n={$delete:this._mixpanel.get_distinct_id()};return this._send_request(n)},U.prototype.toString=function(){return this._mixpanel.toString()+".people"},U.prototype._send_request=function(n,e){n.$token=this._get_config("token"),n.$distinct_id=this._mixpanel.get_distinct_id();var t=this._mixpanel.get_property("$device_id"),i=this._mixpanel.get_property("$user_id"),s=this._mixpanel.get_property("$had_persisted_distinct_id");t&&(n.$device_id=t),i&&(n.$user_id=i),s&&(n.$had_persisted_distinct_id=s);var o=v.encodeDates(n);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:o,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},e):(this._enqueue(n),v.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),v.truncate(o,255))},U.prototype._get_config=function(n){return this._mixpanel.get_config(n)},U.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},U.prototype._enqueue=function(n){Dn in n?this._mixpanel.persistence._add_to_people_queue(Dn,n):mt in n?this._mixpanel.persistence._add_to_people_queue(mt,n):on in n?this._mixpanel.persistence._add_to_people_queue(on,n):jn in n?this._mixpanel.persistence._add_to_people_queue(jn,n):dn in n?this._mixpanel.persistence._add_to_people_queue(dn,n):fn in n?this._mixpanel.persistence._add_to_people_queue(fn,n):zn in n?this._mixpanel.persistence._add_to_people_queue(zn,n):ee.error("Invalid call to _enqueue():",n)},U.prototype._flush_one_queue=function(n,e,t,i){var s=this,o=v.extend({},this._mixpanel.persistence.load_queue(n)),a=o;!v.isUndefined(o)&&v.isObject(o)&&!v.isEmptyObject(o)&&(s._mixpanel.persistence._pop_from_people_queue(n,o),s._mixpanel.persistence.save(),i&&(a=i(o)),e.call(s,a,function(l,c){l===0&&s._mixpanel.persistence._add_to_people_queue(n,o),v.isUndefined(t)||t(l,c)}))},U.prototype._flush=function(n,e,t,i,s,o,a){var l=this;this._flush_one_queue(Dn,this.set,n),this._flush_one_queue(mt,this.set_once,i),this._flush_one_queue(on,this.unset,o,function(k){return v.keys(k)}),this._flush_one_queue(jn,this.increment,e),this._flush_one_queue(zn,this.union,s);var c=this._mixpanel.persistence.load_queue(dn);if(!v.isUndefined(c)&&v.isArray(c)&&c.length)for(var p,m=function(k,x){k===0&&l._mixpanel.persistence._add_to_people_queue(dn,p),v.isUndefined(t)||t(k,x)},g=c.length-1;g>=0;g--)c=this._mixpanel.persistence.load_queue(dn),p=c.pop(),l._mixpanel.persistence.save(),v.isEmptyObject(p)||l.append(p,m);var f=this._mixpanel.persistence.load_queue(fn);if(!v.isUndefined(f)&&v.isArray(f)&&f.length)for(var b,w=function(k,x){k===0&&l._mixpanel.persistence._add_to_people_queue(fn,b),v.isUndefined(a)||a(k,x)},C=f.length-1;C>=0;C--)f=this._mixpanel.persistence.load_queue(fn),b=f.pop(),l._mixpanel.persistence.save(),v.isEmptyObject(b)||l.remove(b,w)},U.prototype._is_reserved_property=function(n){return n==="$distinct_id"||n==="$token"||n==="$device_id"||n==="$user_id"||n==="$had_persisted_distinct_id"},U.prototype.set=U.prototype.set,U.prototype.set_once=U.prototype.set_once,U.prototype.unset=U.prototype.unset,U.prototype.increment=U.prototype.increment,U.prototype.append=U.prototype.append,U.prototype.remove=U.prototype.remove,U.prototype.union=U.prototype.union,U.prototype.track_charge=U.prototype.track_charge,U.prototype.clear_charges=U.prototype.clear_charges,U.prototype.delete_user=U.prototype.delete_user,U.prototype.toString=U.prototype.toString;var ns="__mps",ts="__mpso",is="__mpus",ss="__mpa",os="__mpap",as="__mpr",rs="__mpu",Yo="$people_distinct_id",ci="__alias",It="__timers",Xl=[ns,ts,is,ss,os,as,rs,Yo,ci,It],z=function(n){this.props={},this.campaign_params_saved=!1,n.persistence_name?this.name="mp_"+n.persistence_name:this.name="mp_"+n.token+"_mixpanel";var e=n.persistence;e!=="cookie"&&e!=="localStorage"&&(ee.critical("Unknown persistence type "+e+"; falling back to cookie"),e=n.persistence="cookie"),e==="localStorage"&&v.localStorage.is_supported()?this.storage=v.localStorage:this.storage=v.cookie,this.load(),this.update_config(n),this.upgrade(),this.save()};z.prototype.properties=function(){var n={};return this.load(),v.each(this.props,function(e,t){v.include(Xl,t)||(n[t]=e)}),n},z.prototype.load=function(){if(!this.disabled){var n=this.storage.parse(this.name);n&&(this.props=v.extend({},n))}},z.prototype.upgrade=function(){var n,e;this.storage===v.localStorage?(n=v.cookie.parse(this.name),v.cookie.remove(this.name),v.cookie.remove(this.name,!0),n&&this.register_once(n)):this.storage===v.cookie&&(e=v.localStorage.parse(this.name),v.localStorage.remove(this.name),e&&this.register_once(e))},z.prototype.save=function(){this.disabled||this.storage.set(this.name,v.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},z.prototype.load_prop=function(n){return this.load(),this.props[n]},z.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},z.prototype.clear=function(){this.remove(),this.props={}},z.prototype.register_once=function(n,e,t){return v.isObject(n)?(typeof e>"u"&&(e="None"),this.expire_days=typeof t>"u"?this.default_expiry:t,this.load(),v.each(n,function(i,s){(!this.props.hasOwnProperty(s)||this.props[s]===e)&&(this.props[s]=i)},this),this.save(),!0):!1},z.prototype.register=function(n,e){return v.isObject(n)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),v.extend(this.props,n),this.save(),!0):!1},z.prototype.unregister=function(n){this.load(),n in this.props&&(delete this.props[n],this.save())},z.prototype.update_search_keyword=function(n){this.register(v.info.searchInfo(n))},z.prototype.update_referrer_info=function(n){this.register_once({$initial_referrer:n||"$direct",$initial_referring_domain:v.info.referringDomain(n)||"$direct"},"")},z.prototype.get_referrer_info=function(){return v.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},z.prototype.update_config=function(n){this.default_expiry=this.expire_days=n.cookie_expiration,this.set_disabled(n.disable_persistence),this.set_cookie_domain(n.cookie_domain),this.set_cross_site(n.cross_site_cookie),this.set_cross_subdomain(n.cross_subdomain_cookie),this.set_secure(n.secure_cookie)},z.prototype.set_disabled=function(n){this.disabled=n,this.disabled?this.remove():this.save()},z.prototype.set_cookie_domain=function(n){n!==this.cookie_domain&&(this.remove(),this.cookie_domain=n,this.save())},z.prototype.set_cross_site=function(n){n!==this.cross_site&&(this.cross_site=n,this.remove(),this.save())},z.prototype.set_cross_subdomain=function(n){n!==this.cross_subdomain&&(this.cross_subdomain=n,this.remove(),this.save())},z.prototype.get_cross_subdomain=function(){return this.cross_subdomain},z.prototype.set_secure=function(n){n!==this.secure&&(this.secure=!!n,this.remove(),this.save())},z.prototype._add_to_people_queue=function(n,e){var t=this._get_queue_key(n),i=e[n],s=this._get_or_create_queue(Dn),o=this._get_or_create_queue(mt),a=this._get_or_create_queue(on),l=this._get_or_create_queue(jn),c=this._get_or_create_queue(zn),p=this._get_or_create_queue(fn,[]),m=this._get_or_create_queue(dn,[]);t===ns?(v.extend(s,i),this._pop_from_people_queue(jn,i),this._pop_from_people_queue(zn,i),this._pop_from_people_queue(on,i)):t===ts?(v.each(i,function(g,f){f in o||(o[f]=g)}),this._pop_from_people_queue(on,i)):t===is?v.each(i,function(g){v.each([s,o,l,c],function(f){g in f&&delete f[g]}),v.each(m,function(f){g in f&&delete f[g]}),a[g]=!0}):t===ss?(v.each(i,function(g,f){f in s?s[f]+=g:(f in l||(l[f]=0),l[f]+=g)},this),this._pop_from_people_queue(on,i)):t===rs?(v.each(i,function(g,f){v.isArray(g)&&(f in c||(c[f]=[]),c[f]=c[f].concat(g))}),this._pop_from_people_queue(on,i)):t===as?(p.push(i),this._pop_from_people_queue(dn,i)):t===os&&(m.push(i),this._pop_from_people_queue(on,i)),ee.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),ee.log(e),this.save()},z.prototype._pop_from_people_queue=function(n,e){var t=this.props[this._get_queue_key(n)];v.isUndefined(t)||v.each(e,function(i,s){n===dn||n===fn?v.each(t,function(o){o[s]===i&&delete o[s]}):delete t[s]},this)},z.prototype.load_queue=function(n){return this.load_prop(this._get_queue_key(n))},z.prototype._get_queue_key=function(n){if(n===Dn)return ns;if(n===mt)return ts;if(n===on)return is;if(n===jn)return ss;if(n===dn)return os;if(n===fn)return as;if(n===zn)return rs;ee.error("Invalid queue:",n)},z.prototype._get_or_create_queue=function(n,e){var t=this._get_queue_key(n);return e=v.isUndefined(e)?{}:e,this.props[t]||(this.props[t]=e)},z.prototype.set_event_timer=function(n,e){var t=this.load_prop(It)||{};t[n]=e,this.props[It]=t,this.save()},z.prototype.remove_event_timer=function(n){var e=this.load_prop(It)||{},t=e[n];return v.isUndefined(t)||(delete this.props[It][n],this.save()),t};var ls,Xo=function(n,e){throw new Error(n+" not available in this build.")},Pe,$o=0,$l=1,ec=function(n){return n},Dt=function(){},Ze="mixpanel",ea="base64",nc="json",cs="$device:",pt=O.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,na=!pt&&cn.indexOf("MSIE")===-1&&cn.indexOf("Mozilla")===-1,di=null;_n.sendBeacon&&(di=function(){return _n.sendBeacon.apply(_n,arguments)});var ta={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},ia={api_host:"https://api-js.mixpanel.com",api_routes:ta,api_method:"POST",api_transport:"XHR",api_payload_format:ea,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:Dt,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:Dt,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_collect_fonts:!1,record_idle_timeout_ms:30*60*1e3,record_inline_images:!1,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:_t,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},sa=!1,L=function(){},ds=function(n,e,t){var i,s=t===Ze?Pe:Pe[t];if(s&&ls===$o)i=s;else{if(s&&!v.isArray(s)){ee.error("You have already initialized "+t);return}i=new L}if(i._cached_groups={},i._init(n,e,t),i.people=new U,i.people._init(i),!i.get_config("skip_first_touch_marketing")){var o=v.info.campaignParams(null),a={},l=!1;v.each(o,function(c,p){a["initial_"+p]=c,c&&(l=!0)}),l&&i.people.set_once(a)}return vn.DEBUG=vn.DEBUG||i.get_config("debug"),!v.isUndefined(s)&&v.isArray(s)&&(i._execute_array.call(i.people,s.people),i._execute_array(s)),i};L.prototype.init=function(n,e,t){if(v.isUndefined(t)){this.report_error("You must name your new library: init(token, config, name)");return}if(t===Ze){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var i=ds(n,e,t);return Pe[t]=i,i._loaded(),i},L.prototype._init=function(n,e,t){e=e||{},this.__loaded=!0,this.config={};var i={};if(!("api_payload_format"in e)){var s=e.api_host||ia.api_host;s.match(/\.mixpanel\.com/)&&(i.api_payload_format=nc)}if(this.set_config(v.extend({},ia,i,e,{name:t,token:n,callback_fn:(t===Ze?t:Ze+"."+t)+"._jsc"})),this._jsc=Dt,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!v.localStorage.is_supported(!0)||!pt)this._batch_requests=!1,ee.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),v.each(this.get_batcher_configs(),function(c){ee.log("Clearing batch queue "+c.queue_key),v.localStorage.remove(c.queue_key)});else if(this.init_batchers(),di&&O.addEventListener){var o=v.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);O.addEventListener("pagehide",function(c){c.persisted&&o()}),O.addEventListener("visibilitychange",function(){oe.visibilityState==="hidden"&&o()})}}this.persistence=this.cookie=new z(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=v.UUID();this.get_distinct_id()||this.register_once({distinct_id:cs+a,$device_id:a},"");var l=this.get_config("track_pageview");l&&this._init_url_change_tracking(l),this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent")&&this.start_session_recording()},L.prototype.start_session_recording=En(function(){if(!O.MutationObserver){ee.critical("Browser does not support MutationObserver; skipping session recording");return}var n=v.bind(function(){this._recorder=this._recorder||new O.__mp_recorder(this),this._recorder.startRecording()},this);v.isUndefined(O.__mp_recorder)?Xo(this.get_config("recorder_src"),n):n()}),L.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():ee.critical("Session recorder module not loaded")},L.prototype.get_session_recording_properties=function(){var n={};if(this._recorder){var e=this._recorder.replayId;e&&(n.$mp_replay_id=e)}return n},L.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var n=v.info.campaignParams(null);v.each(n,(function(e,t){this.unregister(t)}).bind(this))}},L.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(oe.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(v.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(oe.referrer)},L.prototype._dom_loaded=function(){v.each(this.__dom_loaded_queue,function(n){this._track_dom.apply(this,n)},this),this.has_opted_out_tracking()||v.each(this.__request_queue,function(n){this._send_request.apply(this,n)},this),delete this.__dom_loaded_queue,delete this.__request_queue},L.prototype._track_dom=function(n,e){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!sa)return this.__dom_loaded_queue.push([n,e]),!1;var t=new n().init(this);return t.track.apply(t,e)},L.prototype._init_url_change_tracking=function(n){var e="",t=this.track_pageview();if(t&&(e=v.info.currentUrl()),v.include(["full-url","url-with-path-and-query-string","url-with-path"],n)){O.addEventListener("popstate",function(){O.dispatchEvent(new Event("mp_locationchange"))}),O.addEventListener("hashchange",function(){O.dispatchEvent(new Event("mp_locationchange"))});var i=O.history.pushState;typeof i=="function"&&(O.history.pushState=function(o,a,l){i.call(O.history,o,a,l),O.dispatchEvent(new Event("mp_locationchange"))});var s=O.history.replaceState;typeof s=="function"&&(O.history.replaceState=function(o,a,l){s.call(O.history,o,a,l),O.dispatchEvent(new Event("mp_locationchange"))}),O.addEventListener("mp_locationchange",(function(){var o=v.info.currentUrl(),a=!1;if(n==="full-url"?a=o!==e:n==="url-with-path-and-query-string"?a=o.split("#")[0]!==e.split("#")[0]:n==="url-with-path"&&(a=o.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0]),a){var l=this.track_pageview();l&&(e=o)}}).bind(this))}},L.prototype._prepare_callback=function(n,e){if(v.isUndefined(n))return null;if(pt){var t=function(a){n(a,e)};return t}else{var i=this._jsc,s=""+Math.floor(Math.random()*1e8),o=this.get_config("callback_fn")+"["+s+"]";return i[s]=function(a){delete i[s],n(a,e)},o}},L.prototype._send_request=function(n,e,t,i){var s=!0;if(na)return this.__request_queue.push(arguments),s;var o={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},a=null;!i&&(v.isFunction(t)||typeof t=="string")&&(i=t,t=null),t=v.extend(o,t||{}),pt||(t.method="GET");var l=t.method==="POST",c=di&&l&&t.transport.toLowerCase()==="sendbeacon",p=t.verbose;e.verbose&&(p=!0),this.get_config("test")&&(e.test=1),p&&(e.verbose=1),this.get_config("img")&&(e.img=1),pt||(i?e.callback=i:(p||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),l&&(a="data="+encodeURIComponent(e.data),delete e.data),n+="?"+v.HTTPBuildQuery(e);var m=this;if("img"in e){var g=oe.createElement("img");g.src=n,oe.body.appendChild(g)}else if(c){try{s=di(n,a)}catch(x){m.report_error(x),s=!1}try{i&&i(s?1:0)}catch(x){m.report_error(x)}}else if(pt)try{var f=new XMLHttpRequest;f.open(t.method,n,!0);var b=this.get_config("xhr_headers");if(l&&(b["Content-Type"]="application/x-www-form-urlencoded"),v.each(b,function(x,A){f.setRequestHeader(A,x)}),t.timeout_ms&&typeof f.timeout<"u"){f.timeout=t.timeout_ms;var w=new Date().getTime()}f.withCredentials=!0,f.onreadystatechange=function(){if(f.readyState===4)if(f.status===200){if(i)if(p){var x;try{x=v.JSONDecode(f.responseText)}catch(P){if(m.report_error(P),t.ignore_json_errors)x=f.responseText;else return}i(x)}else i(Number(f.responseText))}else{var A;if(f.timeout&&!f.status&&new Date().getTime()-w>=f.timeout?A="timeout":A="Bad HTTP status: "+f.status+" "+f.statusText,m.report_error(A),i)if(p){var M=f.responseHeaders||{};i({status:0,httpStatusCode:f.status,error:A,retryAfter:M["Retry-After"]})}else i(0)}},f.send(a)}catch(x){m.report_error(x),s=!1}else{var C=oe.createElement("script");C.type="text/javascript",C.async=!0,C.defer=!0,C.src=n;var k=oe.getElementsByTagName("script")[0];k.parentNode.insertBefore(C,k)}return s},L.prototype._execute_array=function(n){var e,t=[],i=[],s=[];v.each(n,function(a){a&&(e=a[0],v.isArray(e)?s.push(a):typeof a=="function"?a.call(this):v.isArray(a)&&e==="alias"?t.push(a):v.isArray(a)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?s.push(a):i.push(a))},this);var o=function(a,l){v.each(a,function(c){if(v.isArray(c[0])){var p=l;v.each(c,function(m){p=p[m[0]].apply(p,m.slice(1))})}else this[c[0]].apply(this,c.slice(1))},l)};o(t,this),o(i,this),o(s,this)},L.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},L.prototype.get_batcher_configs=function(){var n="__mpq_"+this.get_config("token"),e=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+e.track,queue_key:n+"_ev"},people:{type:"people",endpoint:"/"+e.engage,queue_key:n+"_pp"},groups:{type:"groups",endpoint:"/"+e.groups,queue_key:n+"_gr"}},this._batcher_configs},L.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var n=v.bind(function(t){return new tn(t.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:v.bind(function(i,s,o){this._send_request(this.get_config("api_host")+t.endpoint,this._encode_data_for_request(i),s,this._prepare_callback(o,i))},this),beforeSendHook:v.bind(function(i){return this._run_hook("before_send_"+t.type,i)},this),stopAllBatchingFunc:v.bind(this.stop_batch_senders,this),usePersistence:!0})},this),e=this.get_batcher_configs();this.request_batchers={events:n(e.events),people:n(e.people),groups:n(e.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},L.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,v.each(this.request_batchers,function(n){n.start()}))},L.prototype.stop_batch_senders=function(){this._batch_requests=!1,v.each(this.request_batchers,function(n){n.stop(),n.clear()})},L.prototype.push=function(n){this._execute_array([n])},L.prototype.disable=function(n){typeof n>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(n)},L.prototype._encode_data_for_request=function(n){var e=v.JSONEncode(n);return this.get_config("api_payload_format")===ea&&(e=v.base64Encode(e)),{data:e}},L.prototype._track_or_batch=function(n,e){var t=v.truncate(n.data,255),i=n.endpoint,s=n.batcher,o=n.should_send_immediately,a=n.send_request_options||{};e=e||Dt;var l=!0,c=v.bind(function(){return a.skip_hooks||(t=this._run_hook("before_send_"+n.type,t)),t?(ee.log("MIXPANEL REQUEST:"),ee.log(t),this._send_request(i,this._encode_data_for_request(t),a,this._prepare_callback(e,t))):null},this);return this._batch_requests&&!o?s.enqueue(t,function(p){p?e(1,t):c()}):l=c(),l&&t},L.prototype.track=En(function(n,e,t,i){!i&&typeof t=="function"&&(i=t,t=null),t=t||{};var s=t.transport;s&&(t.transport=s);var o=t.send_immediately;if(typeof i!="function"&&(i=Dt),v.isUndefined(n)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(n)){i(0);return}e=v.extend({},e),e.token=this.get_config("token");var a=this.persistence.remove_event_timer(n);if(!v.isUndefined(a)){var l=new Date().getTime()-a;e.$duration=parseFloat((l/1e3).toFixed(3))}this._set_default_superprops();var c=this.get_config("track_marketing")?v.info.marketingParams():{};e=v.extend({},v.info.properties({mp_loader:this.get_config("mp_loader")}),c,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),e);var p=this.get_config("property_blacklist");v.isArray(p)?v.each(p,function(f){delete e[f]}):this.report_error("Invalid value for property_blacklist config: "+p);var m={event:n,properties:e},g=this._track_or_batch({type:"events",data:m,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:o,send_request_options:t},i);return g}),L.prototype.set_group=En(function(n,e,t){v.isArray(e)||(e=[e]);var i={};return i[n]=e,this.register(i),this.people.set(n,e,t)}),L.prototype.add_group=En(function(n,e,t){var i=this.get_property(n),s={};return i===void 0?(s[n]=[e],this.register(s)):i.indexOf(e)===-1&&(i.push(e),s[n]=i,this.register(s)),this.people.union(n,e,t)}),L.prototype.remove_group=En(function(n,e,t){var i=this.get_property(n);if(i!==void 0){var s=i.indexOf(e);s>-1&&(i.splice(s,1),this.register({group_key:i})),i.length===0&&this.unregister(n)}return this.people.remove(n,e,t)}),L.prototype.track_with_groups=En(function(n,e,t,i){var s=v.extend({},e||{});return v.each(t,function(o,a){o!=null&&(s[a]=o)}),this.track(n,s,i)}),L.prototype._create_map_key=function(n,e){return n+"_"+JSON.stringify(e)},L.prototype._remove_group_from_cache=function(n,e){delete this._cached_groups[this._create_map_key(n,e)]},L.prototype.get_group=function(n,e){var t=this._create_map_key(n,e),i=this._cached_groups[t];return(i===void 0||i._group_key!==n||i._group_id!==e)&&(i=new le,i._init(this,n,e),this._cached_groups[t]=i),i},L.prototype.track_pageview=En(function(n,e){typeof n!="object"&&(n={}),e=e||{};var t=e.event_name||"$mp_web_page_view",i=v.extend(v.info.mpPageViewProperties(),v.info.campaignParams(),v.info.clickParams()),s=v.extend({},i,n);return this.track(t,s)}),L.prototype.track_links=function(){return this._track_dom.call(this,ht,arguments)},L.prototype.track_forms=function(){return this._track_dom.call(this,li,arguments)},L.prototype.time_event=function(n){if(v.isUndefined(n)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(n)||this.persistence.set_event_timer(n,new Date().getTime())};var tc={persistent:!0},us=function(n){var e;return v.isObject(n)?e=n:v.isUndefined(n)?e={}:e={days:n},v.extend({},tc,e)};L.prototype.register=function(n,e){var t=us(e);t.persistent?this.persistence.register(n,t.days):v.extend(this.unpersisted_superprops,n)},L.prototype.register_once=function(n,e,t){var i=us(t);i.persistent?this.persistence.register_once(n,e,i.days):(typeof e>"u"&&(e="None"),v.each(n,function(s,o){(!this.unpersisted_superprops.hasOwnProperty(o)||this.unpersisted_superprops[o]===e)&&(this.unpersisted_superprops[o]=s)},this))},L.prototype.unregister=function(n,e){e=us(e),e.persistent?this.persistence.unregister(n):delete this.unpersisted_superprops[n]},L.prototype._register_single=function(n,e){var t={};t[n]=e,this.register(t)},L.prototype.identify=function(n,e,t,i,s,o,a,l){var c=this.get_distinct_id();if(n&&c!==n){if(typeof n=="string"&&n.indexOf(cs)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:n})}if(!this.get_property("$device_id")){var p=c;this.register_once({$had_persisted_distinct_id:!0,$device_id:p},"")}n!==c&&n!==this.get_property(ci)&&(this.unregister(ci),this.register({distinct_id:n})),this._flags.identify_called=!0,this.people._flush(e,t,i,s,o,a,l),n!==c&&this.track("$identify",{distinct_id:n,$anon_distinct_id:c},{skip_hooks:!0})},L.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var n=v.UUID();this.register_once({distinct_id:cs+n,$device_id:n},"")},L.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},L.prototype.alias=function(n,e){if(n===this.get_property(Yo))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var t=this;return v.isUndefined(e)&&(e=this.get_distinct_id()),n!==e?(this._register_single(ci,n),this.track("$create_alias",{alias:n,distinct_id:e},{skip_hooks:!0},function(){t.identify(n)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(n),-1)},L.prototype.name_tag=function(n){this._register_single("mp_name_tag",n)},L.prototype.set_config=function(n){if(v.isObject(n)){v.extend(this.config,n);var e=n.batch_size;e&&v.each(this.request_batchers,function(t){t.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),vn.DEBUG=vn.DEBUG||this.get_config("debug")}},L.prototype.get_config=function(n){return this.config[n]},L.prototype._run_hook=function(n){var e=(this.config.hooks[n]||ec).apply(this,Tn.call(arguments,1));return typeof e>"u"&&(this.report_error(n+" hook did not return a value"),e=null),e},L.prototype.get_property=function(n){return this.persistence.load_prop([n])},L.prototype.toString=function(){var n=this.get_config("name");return n!==Ze&&(n=Ze+"."+n),n},L.prototype._event_is_disabled=function(n){return v.isBlockedUA(cn)||this._flags.disable_all_events||v.include(this.__disabled_events,n)},L.prototype._gdpr_init=function(){var n=this.get_config("opt_out_tracking_persistence_type")==="localStorage";n&&v.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||v.cookie.get("mp_optout"))&&(v.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},L.prototype._gdpr_update_persistence=function(n){var e;if(n&&n.clear_persistence)e=!0;else if(n&&n.enable_persistence)e=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==e&&this.persistence.set_disabled(e),e?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},L.prototype._gdpr_call_func=function(n,e){return e=v.extend({track:v.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},e),v.localStorage.is_supported()||(e.persistence_type="cookie"),n(this.get_config("token"),{track:e.track,trackEventName:e.track_event_name,trackProperties:e.track_properties,persistenceType:e.persistence_type,persistencePrefix:e.cookie_prefix,cookieDomain:e.cookie_domain,cookieExpiration:e.cookie_expiration,crossSiteCookie:e.cross_site_cookie,crossSubdomainCookie:e.cross_subdomain_cookie,secureCookie:e.secure_cookie,ignoreDnt:e.ignore_dnt})},L.prototype.opt_in_tracking=function(n){n=v.extend({enable_persistence:!0},n),this._gdpr_call_func(Fl,n),this._gdpr_update_persistence(n)},L.prototype.opt_out_tracking=function(n){n=v.extend({clear_persistence:!0,delete_user:!0},n),n.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(Kl,n),this._gdpr_update_persistence(n)},L.prototype.has_opted_in_tracking=function(n){return this._gdpr_call_func(Gl,n)},L.prototype.has_opted_out_tracking=function(n){return this._gdpr_call_func(Ko,n)},L.prototype.clear_opt_in_out_tracking=function(n){n=v.extend({enable_persistence:!0},n),this._gdpr_call_func(jl,n),this._gdpr_update_persistence(n)},L.prototype.report_error=function(n,e){ee.error.apply(ee.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(t){ee.error(t)}},L.prototype.init=L.prototype.init,L.prototype.reset=L.prototype.reset,L.prototype.disable=L.prototype.disable,L.prototype.time_event=L.prototype.time_event,L.prototype.track=L.prototype.track,L.prototype.track_links=L.prototype.track_links,L.prototype.track_forms=L.prototype.track_forms,L.prototype.track_pageview=L.prototype.track_pageview,L.prototype.register=L.prototype.register,L.prototype.register_once=L.prototype.register_once,L.prototype.unregister=L.prototype.unregister,L.prototype.identify=L.prototype.identify,L.prototype.alias=L.prototype.alias,L.prototype.name_tag=L.prototype.name_tag,L.prototype.set_config=L.prototype.set_config,L.prototype.get_config=L.prototype.get_config,L.prototype.get_property=L.prototype.get_property,L.prototype.get_distinct_id=L.prototype.get_distinct_id,L.prototype.toString=L.prototype.toString,L.prototype.opt_out_tracking=L.prototype.opt_out_tracking,L.prototype.opt_in_tracking=L.prototype.opt_in_tracking,L.prototype.has_opted_out_tracking=L.prototype.has_opted_out_tracking,L.prototype.has_opted_in_tracking=L.prototype.has_opted_in_tracking,L.prototype.clear_opt_in_out_tracking=L.prototype.clear_opt_in_out_tracking,L.prototype.get_group=L.prototype.get_group,L.prototype.set_group=L.prototype.set_group,L.prototype.add_group=L.prototype.add_group,L.prototype.remove_group=L.prototype.remove_group,L.prototype.track_with_groups=L.prototype.track_with_groups,L.prototype.start_batch_senders=L.prototype.start_batch_senders,L.prototype.stop_batch_senders=L.prototype.stop_batch_senders,L.prototype.start_session_recording=L.prototype.start_session_recording,L.prototype.stop_session_recording=L.prototype.stop_session_recording,L.prototype.get_session_recording_properties=L.prototype.get_session_recording_properties,L.prototype.DEFAULT_API_ROUTES=ta,z.prototype.properties=z.prototype.properties,z.prototype.update_search_keyword=z.prototype.update_search_keyword,z.prototype.update_referrer_info=z.prototype.update_referrer_info,z.prototype.get_cross_subdomain=z.prototype.get_cross_subdomain,z.prototype.clear=z.prototype.clear;var vt={},ic=function(){v.each(vt,function(n,e){e!==Ze&&(Pe[e]=n)}),Pe._=v},sc=function(){Pe.init=function(n,e,t){if(t)return Pe[t]||(Pe[t]=vt[t]=ds(n,e,t),Pe[t]._loaded()),Pe[t];var i=Pe;vt[Ze]?i=vt[Ze]:n&&(i=ds(n,e,Ze),i._loaded(),vt[Ze]=i),Pe=i,ls===$l&&(O[Ze]=Pe),ic()}},oc=function(){function n(){n.done||(n.done=!0,sa=!0,na=!1,v.each(vt,function(i){i._dom_loaded()}))}function e(){try{oe.documentElement.doScroll("left")}catch{setTimeout(e,1);return}n()}if(oe.addEventListener)oe.readyState==="complete"?n():oe.addEventListener("DOMContentLoaded",n,!1);else if(oe.attachEvent){oe.attachEvent("onreadystatechange",n);var t=!1;try{t=O.frameElement===null}catch{}oe.documentElement.doScroll&&t&&e()}v.register_event(O,"load",n,!0)};function ac(n){return Xo=n,ls=$o,Pe=new L,sc(),Pe.init(),oc(),Pe}function rc(n,e){e()}var _=ac(rc);const lc=`<div id="checkoutConfirmationEnd" data-section="transfer">
|
|
1168
1168
|
<div class="w-full">
|
|
1169
1169
|
<div id="otp-content" class=" grid gap-4">
|
|
1170
1170
|
<h5 class="text-black" id="otp-message">
|
|
@@ -1190,7 +1190,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1190
1190
|
</div>
|
|
1191
1191
|
</div>
|
|
1192
1192
|
</div>
|
|
1193
|
-
</div>`;class oa{constructor(e){d(this,"container");d(this,"onAction");d(this,"callBackUrl");d(this,"paymentResponse");d(this,"paymentResponseHeaders");d(this,"paymentMethod");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders,this.paymentMethod=e.paymentMethod}attachListeners(){const e=this.container.querySelector("#goback-to-merchant"),t=this.container.querySelector("#transfer-button-text"),i=this.container.querySelector("#long-processing-text"),s=this.container.querySelector("#confirmed-text");i&&(i.innerHTML=
|
|
1193
|
+
</div>`;class oa{constructor(e){d(this,"container");d(this,"onAction");d(this,"callBackUrl");d(this,"paymentResponse");d(this,"paymentResponseHeaders");d(this,"paymentMethod");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders,this.paymentMethod=e.paymentMethod}attachListeners(){const e=this.container.querySelector("#goback-to-merchant"),t=this.container.querySelector("#transfer-button-text"),i=this.container.querySelector("#long-processing-text"),s=this.container.querySelector("#confirmed-text");i&&(i.innerHTML=E["long-processing"]),s&&(s.innerHTML=E["once-confirmed"]),t&&(t.innerHTML=j["merchant-back"]),e&&e.addEventListener("click",()=>{var o;_.track("redirect_to_merchant",{payment_method:this.paymentMethod,status:(o=this.paymentResponse)==null?void 0:o.status}),Ee(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){var e;this.container.innerHTML=this.render(),_.track("payment_timeout",{payment_method:this.paymentMethod,status:(e=this.paymentResponse)==null?void 0:e.status}),this.attachListeners()}render(){return lc}}const cc=`<div id="confirmationProgress">
|
|
1194
1194
|
<div class="min-h-[20dvh]">
|
|
1195
1195
|
<div>
|
|
1196
1196
|
<div class="grid grid-rows-[auto_1fr] gap-4 mx-5">
|
|
@@ -1219,7 +1219,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1219
1219
|
|
|
1220
1220
|
</div>
|
|
1221
1221
|
</div>
|
|
1222
|
-
</div>`;class dc{constructor(e){d(this,"container");d(this,"onAction");d(this,"onSuccess");d(this,"ref");d(this,"token");d(this,"initialTime",300);d(this,"abortController");d(this,"timeLeft");d(this,"timer");d(this,"timerId",null);d(this,"rdtCode");d(this,"url");d(this,"callBackUrl");d(this,"setPaymentResponses");d(this,"step");d(this,"paymentMethod");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.onSuccess=e.onSuccess,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses,this.step=e.step,this.paymentMethod=e.paymentMethod}attachListeners(){const e=this.container.querySelector("#confirming-txn-status"),t=this.container.querySelector("#confirming-txn-status-end-text"),i=this.container.querySelector("#please-wait-text"),s=this.container.querySelector("#minutes-text");e&&(e.innerHTML=
|
|
1222
|
+
</div>`;class dc{constructor(e){d(this,"container");d(this,"onAction");d(this,"onSuccess");d(this,"ref");d(this,"token");d(this,"initialTime",300);d(this,"abortController");d(this,"timeLeft");d(this,"timer");d(this,"timerId",null);d(this,"rdtCode");d(this,"url");d(this,"callBackUrl");d(this,"setPaymentResponses");d(this,"step");d(this,"paymentMethod");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.onSuccess=e.onSuccess,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses,this.step=e.step,this.paymentMethod=e.paymentMethod}attachListeners(){const e=this.container.querySelector("#confirming-txn-status"),t=this.container.querySelector("#confirming-txn-status-end-text"),i=this.container.querySelector("#please-wait-text"),s=this.container.querySelector("#minutes-text");e&&(e.innerHTML=E["confirming-txn-status"]),t&&(t.innerHTML=E["few-minutes"]),i&&(i.innerHTML=E["please-wait-for"]),s&&(s.innerHTML=E.minutes),this.initialTime=300,this.timeLeft=this.initialTime;const o=3e4;this.abortController=new AbortController,setTimeout(()=>{this.verifyCardPayment(this.token,o,({data:a,headers:l})=>{this.onAction(this.step.success),this.redirectTo(a,l,"success")},()=>{this.onAction(this.step.failed)})},5e3),this.startTimer()}async verifyCardPayment(e,t,i,s){let o=0,a=t,l=!0,c;this.abortController&&(c=this.abortController.signal);const p=async()=>{if(this.timeLeft<=0){l=!1,this.onAction(this.step.end);return}o+=1;try{const m=await Xe(e,this.ref,c,this.rdtCode,this.url);m.data.status==="failed"&&(l=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),this.setPaymentResponses(m.data,m.headers),_.track("verify_payment",{payment_method:this.paymentMethod,verification_status:"Failed"}),s(m)),m.data.status==="inProgress"&&(l&&(a=t*(o+1),this.timer=setTimeout(p,a)),this.setPaymentResponses(m.data,m.headers)),(m.data.status==="success"||m.data.status==="successful")&&(this.setPaymentResponses(m.data,m.headers),l=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),_.track("verify_payment",{payment_method:this.paymentMethod,verification_status:"Success"}),i(m))}catch{l&&(a=t*(o+1),this.timer=setTimeout(p,a))}};p()}redirectTo(e,t,i){const s=t.get("spf-redirect-url");this.callBackUrl=s||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const o=new URL(this.callBackUrl);o.searchParams.append("status",e.status),o.searchParams.append("reference",e.reference),window.location.href=o.toString()},1800):i==="success"&&this.onSuccess(e)}startTimer(){const e=this.container.querySelector("#ctd-timer");this.stopTimer(),this.timerId=window.setInterval(()=>{this.timeLeft>0?(this.timeLeft-=1,e&&(e.innerHTML=tt(this.timeLeft),this.startTimer())):(this.stopTimer(),this.onAction(this.step.end))},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return cc}}const uc=`<div class="flex items-center justify-center md:justify-between w-full text-xxs mt-5">
|
|
1223
1223
|
<div class="text-tone-60"><span id="powered-by-text" data-translate="powered"></span> <span class="font-bold">Spotflow</span></div>
|
|
1224
1224
|
<div class="align-center text-tone-60 hidden md:flex gap-4">
|
|
1225
1225
|
<span id="test-cards-link" data-translate="test-card" class="hover:font-bold"></span>
|
|
@@ -1565,11 +1565,11 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1565
1565
|
<path
|
|
1566
1566
|
d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
|
|
1567
1567
|
fill="#0D0716" />
|
|
1568
|
-
</svg>`},1e3))})})}renderComponent(e){R()!=="en"&&e===1?(this.mainLoader=new ke(this.container),this.mainLoader.mountLoader("15dvh"),this.renderTranslatedText().then(()=>{this.mainLoader.unmountLoader(),this.container.innerHTML=this.render(),this.attachListener()})):(this.container.innerHTML=this.render(),this.attachListener())}async renderTranslatedText(){await Ks(R())}}function mc(n){n.classList.remove("hidden"),requestAnimationFrame(()=>{n.classList.remove("opacity-0","scale-95")})}function ui(n){n.classList.add("opacity-0","scale-95"),n.addEventListener("transitionend",()=>n.classList.add("hidden"),{once:!0})}class ra{constructor({container:e,testCardContainer:t,keyEnvironment:i}){d(this,"container");d(this,"testCardContainer");d(this,"testCardInstance",null);d(this,"keyEnvironment",null);d(this,"isVisible",!1);d(this,"mainLoader");d(this,"testCardClicks");this.container=e,this.testCardContainer=t,this.keyEnvironment=i,this.isVisible=!1,this.testCardClicks=0}attachListener(){const e=this.container.querySelector("#test-cards-link"),t=this.container.querySelector("#terms-text"),i=this.container.querySelector("#privacy-text"),s=this.container.querySelector("#contact-text"),o=this.container.querySelector("#powered-by-text");if(t&&(t.innerHTML=j.terms),i&&(i.innerHTML=j.privacy),s&&(s.innerHTML=j.contact),o&&(o.innerHTML=j.powered),!!e){if(e.innerHTML=j["test-card"],this.keyEnvironment!=="test"){e.classList.add("hidden");return}e.addEventListener("click",async()=>{this.testCardClicks=this.testCardClicks+1,this.testCardInstance||(this.testCardInstance=new aa({container:this.testCardContainer,closeCallback:()=>{this.testCardContainer.innerHTML="",ui(this.testCardContainer),e.classList.remove("text-tone-100","font-bold"),this.isVisible=!1}})),this.testCardInstance.renderComponent(this.testCardClicks),mc(this.testCardContainer),e.classList.add("text-tone-100","font-bold"),this.isVisible=!0})}}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return uc}}function bt(){return{httpBrowserLanguage:navigator.language||"en-US",httpBrowserJavaEnabled:!1,httpBrowserJavaScriptEnabled:!0,httpBrowserColorDepth:window.screen.colorDepth.toString(),httpBrowserScreenHeight:window.screen.height.toString(),httpBrowserScreenWidth:window.screen.width.toString(),httpBrowserTimeDifference:(-new Date().getTimezoneOffset()).toString(),userAgentBrowserValue:navigator.userAgent,deviceChannel:"Browser"}}function Bn(n,e){return e&&e!==n?e:n}class pc{constructor({amount:e,totalAmount:t,container:i,customer:s,encryption:o,planId:a,token:l,currency:c,rdtCode:p,url:m,reference:g,onSuccess:f,callBackUrl:b,metadata:w,localCurrency:C,hidePaymentMethods:k,showPaymentMethods:x,onClose:A,restartTransactionProcess:M,retryingPayment:
|
|
1568
|
+
</svg>`},1e3))})})}renderComponent(e){R()!=="en"&&e===1?(this.mainLoader=new ke(this.container),this.mainLoader.mountLoader("15dvh"),this.renderTranslatedText().then(()=>{this.mainLoader.unmountLoader(),this.container.innerHTML=this.render(),this.attachListener()})):(this.container.innerHTML=this.render(),this.attachListener())}async renderTranslatedText(){await Ks(R())}}function mc(n){n.classList.remove("hidden"),requestAnimationFrame(()=>{n.classList.remove("opacity-0","scale-95")})}function ui(n){n.classList.add("opacity-0","scale-95"),n.addEventListener("transitionend",()=>n.classList.add("hidden"),{once:!0})}class ra{constructor({container:e,testCardContainer:t,keyEnvironment:i}){d(this,"container");d(this,"testCardContainer");d(this,"testCardInstance",null);d(this,"keyEnvironment",null);d(this,"isVisible",!1);d(this,"mainLoader");d(this,"testCardClicks");this.container=e,this.testCardContainer=t,this.keyEnvironment=i,this.isVisible=!1,this.testCardClicks=0}attachListener(){const e=this.container.querySelector("#test-cards-link"),t=this.container.querySelector("#terms-text"),i=this.container.querySelector("#privacy-text"),s=this.container.querySelector("#contact-text"),o=this.container.querySelector("#powered-by-text");if(t&&(t.innerHTML=j.terms),i&&(i.innerHTML=j.privacy),s&&(s.innerHTML=j.contact),o&&(o.innerHTML=j.powered),!!e){if(e.innerHTML=j["test-card"],this.keyEnvironment!=="test"){e.classList.add("hidden");return}e.addEventListener("click",async()=>{this.testCardClicks=this.testCardClicks+1,this.testCardInstance||(this.testCardInstance=new aa({container:this.testCardContainer,closeCallback:()=>{this.testCardContainer.innerHTML="",ui(this.testCardContainer),e.classList.remove("text-tone-100","font-bold"),this.isVisible=!1}})),this.testCardInstance.renderComponent(this.testCardClicks),mc(this.testCardContainer),e.classList.add("text-tone-100","font-bold"),this.isVisible=!0})}}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return uc}}function bt(){return{httpBrowserLanguage:navigator.language||"en-US",httpBrowserJavaEnabled:!1,httpBrowserJavaScriptEnabled:!0,httpBrowserColorDepth:window.screen.colorDepth.toString(),httpBrowserScreenHeight:window.screen.height.toString(),httpBrowserScreenWidth:window.screen.width.toString(),httpBrowserTimeDifference:(-new Date().getTimezoneOffset()).toString(),userAgentBrowserValue:navigator.userAgent,deviceChannel:"Browser"}}function Bn(n,e){return e&&e!==n?e:n}class pc{constructor({amount:e,totalAmount:t,container:i,customer:s,encryption:o,planId:a,token:l,currency:c,rdtCode:p,url:m,reference:g,onSuccess:f,callBackUrl:b,metadata:w,localCurrency:C,hidePaymentMethods:k,showPaymentMethods:x,onClose:A,restartTransactionProcess:M,retryingPayment:P,keys:D,testcardIsVisible:q}){d(this,"contents");d(this,"cardDetailForm");d(this,"cardOtpValidationForm");d(this,"merchantPlanDetail",{});d(this,"cardPinForm");d(this,"avsForm");d(this,"isw3dsForm");d(this,"successScreen");d(this,"pageLoader");d(this,"warningScreen");d(this,"transactionIssuesScreen");d(this,"container");d(this,"onSuccess");d(this,"planId","");d(this,"customer");d(this,"token");d(this,"amount");d(this,"totalAmount");d(this,"encryption");d(this,"currency");d(this,"_currentStep");d(this,"activeRef");d(this,"rdtCode");d(this,"url");d(this,"reference");d(this,"callBackUrl");d(this,"metadata");d(this,"localCurrency");d(this,"hidePaymentMethods");d(this,"showPaymentMethods");d(this,"onClose");d(this,"cardResponse");d(this,"cardResponseHeader");d(this,"confirmationEnd");d(this,"confirmationProgress");d(this,"restartTransactionProcess");d(this,"retryingPayment");d(this,"isMaxRetriesReached");d(this,"isCancelledPlan");d(this,"isMobile",!1);d(this,"keys");d(this,"testcardIsVisible",!1);d(this,"errorText");d(this,"otpMessage");d(this,"rawAvsData");d(this,"translatedAvsData");this.currency=c,this.onSuccess=f||(()=>null),this.keys=D,this.testcardIsVisible=q,this.container=i,this.encryption=o,this.token=l,this.customer=s,this.planId=a,this.amount=e,this.totalAmount=t,this.rdtCode=p,this.url=m,this.reference=g,this.callBackUrl=b,this.metadata=w,this.localCurrency=C,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.cardResponse={},this.cardResponseHeader={},this.hidePaymentMethods=k,this.showPaymentMethods=x,this.onClose=A,this.restartTransactionProcess=M,this.retryingPayment=P,this.isMaxRetriesReached=!1,this.isCancelledPlan=!1,this.errorText="",this.otpMessage="",this.renderCardContent(),this.rawAvsData={"billing-address":"Billing address",address:"Address",city:"City",state:"State",country:"Country","zip-code":"Zip code",submit:"Submit"},this.translatedAvsData=this.rawAvsData,_.track("card_opens",{payment_method:"Card"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderCardContent()}fetchCurrentRegionDetails(){const e=this.localCurrency?this.localCurrency!==this.currency?this.localCurrency:this.currency:this.currency;return Hi(e)}cancellledPlanAction(){if(this.rdtCode)window.history.back();else{const e=document.getElementById("checkout-modal");e&&e.remove()}}async renderTranslatedText(e){if(Array.isArray(e))this.translatedAvsData=await Re.translateRecord(this.rawAvsData,R());else if(e){const t=await Z(e,R());this.otpMessage=t}else this.otpMessage=""}showLoader(){this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader()}async submitCardDetails(e,t){e.preventDefault(),_.track("input_cardDetails",{payment_method:"Card",authentication_type:"None"});const i=this.container.querySelector(".spinner"),s=this.container.querySelector("#details-form-button-text"),o=await or(JSON.stringify(t),this.encryption);i&&s&&(i.classList.remove("hidden"),s.classList.add("hidden"));const a=bt();(()=>{var c,p,m,g,f;if(this.retryingPayment){const b={channel:"card",reference:this.reference,encryptedCard:o};return et(this.token,b,this.rdtCode,this.url)}else{const b={amount:((g=(m=(p=(c=this.merchantPlanDetail)==null?void 0:c.plan)==null?void 0:p.trial)==null?void 0:m.pricingList[0])==null?void 0:g.amount)??this.amount,channel:"card",applyDiscount:!0,currency:this.currency,planId:this.planId,customer:this.customer,reference:this.reference,encryptedCard:o,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((f=this.merchantPlanDetail)==null?void 0:f.taxQuoteId)&&{taxQuoteId:this.merchantPlanDetail.taxQuoteId},deviceInformation:a};return Ra(this.token,b,this.rdtCode,this.url)}})().then(async({data:c,headers:p})=>{var m,g,f,b,w,C,k,x;if(c.providerMessage){const A=await Z(c.providerMessage,R());this.errorText=A}if(c.status==="failed")this.currentStep=4,this.reference=c.reference,_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"None"}),this.cardResponse=c,this.cardResponseHeader=p,c.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(E["payment-failed"]),this.warningScreen.hideReportIssue();else if(!["success","successful"].includes(c.status)&&c.status!=="failed")if(this.cardResponse=c,this.cardResponseHeader=p,c!=null&&c.authorization){if(this.activeRef=c.reference,((m=c==null?void 0:c.authorization)==null?void 0:m.mode)==="pin"){this.currentStep=2;return}if(((g=c==null?void 0:c.authorization)==null?void 0:g.mode)==="3DS"){(f=c==null?void 0:c.authorization)!=null&&f.redirectUrl&&this.redirectTo3DS((b=c==null?void 0:c.authorization)==null?void 0:b.redirectUrl),(w=c==null?void 0:c.authorization)!=null&&w.embeddedHtml&&this.redirectToPreciumDoc((C=c==null?void 0:c.authorization)==null?void 0:C.embeddedHtml);return}if(((k=c==null?void 0:c.authorization)==null?void 0:k.mode)==="otp"){this.cardResponse=c,this.currentStep=3;return}if(((x=c==null?void 0:c.authorization)==null?void 0:x.mode)==="avs"){if(R()!=="en"){this.showLoader();const A=Object.values(this.rawAvsData);this.renderTranslatedText(A).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=7})}else this.currentStep=7;return}}else this.currentStep=4,c.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(E["error-with-payment"]),this.warningScreen.hideReportIssue();else["success","successful"].includes(c.status)&&(this.currentStep=5,this.cardResponse=c,this.cardResponseHeader=p,_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"None"}),this.redirectTo(c,p,"success"))}).catch(async c=>{if(_.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"None"}),c.code==="payment_max_retry_attempts")this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,_.track("max_retries_reached",{payment_method:"Card"}),this.warningScreen.setPaymentError(E["maximum-retries"],E["maximum-retries-desc"],j["merchant-back"]);else{if(c.message){const p=await Z(c.message,R());this.errorText=p,c.code==="7137"?(this.isCancelledPlan=!0,this.currentStep=4,_.track("cancelled_plan",{payment_method:"Card"}),this.warningScreen.setPaymentError(this.errorText,"",j["merchant-back"])):(this.currentStep=4,this.warningScreen.setPaymentError(this.errorText))}else this.currentStep=4,this.warningScreen.setPaymentError(E["payment-failed"]);this.warningScreen.hideReportIssue()}}).finally(()=>{i&&s&&(i.classList.add("hidden"),s.classList.remove("hidden"))})}handlePinRequest(e){if(e.length===4){const t={authorization:{pin:e},reference:this.activeRef};_.track("input_cardPin",{payment_method:"Card",authentication_type:"PIN"}),setTimeout(()=>{const i=this.container.querySelector("#pin-loader"),s=this.container.querySelector("#cancel-payment");i&&(i.innerHTML=`<svg class="animate-spin" width="40" height="40" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1569
1569
|
<path
|
|
1570
1570
|
d="M62 32C62 38.6156 59.8132 45.0457 55.78 50.2897C51.7468 55.5336 46.0932 59.2974 39.6992 60.9952C33.3052 62.693 26.5293 62.2297 20.4258 59.6774C14.3224 57.1251 9.2338 52.6268 5.95186 46.8827C2.66993 41.1385 1.37873 34.4707 2.2792 27.9166C3.17967 21.3626 6.22129 15.29 10.9308 10.6438C15.6402 5.9976 21.7534 3.0384 28.3191 2.22668C34.8847 1.41496 41.5345 2.79623 47.2337 6.15557"
|
|
1571
1571
|
stroke="black" stroke-width="4" stroke-linejoin="round" />
|
|
1572
|
-
</svg>`),s&&s.classList.add("hidden"),Ot(this.token,t,this.rdtCode,this.url).then(async({data:a,headers:l})=>{var c,p,m,g,f,b,w,C,k,x;if(a.providerMessage){const A=await Z(a.providerMessage,R());this.errorText=A}if(a.status==="failed")_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.currentStep=4,a.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(a.status))this.currentStep=5,this.redirectTo(a,l,"success"),_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"});else{if(((c=a==null?void 0:a.authorization)==null?void 0:c.mode)==="3DS"){(p=a==null?void 0:a.authorization)!=null&&p.redirectUrl&&this.redirectTo3DS((m=a==null?void 0:a.authorization)==null?void 0:m.redirectUrl),(g=a==null?void 0:a.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=a==null?void 0:a.authorization)==null?void 0:f.embeddedHtml),(b=a==null?void 0:a.authorization)!=null&&b.jwt&&((w=a==null?void 0:a.authorization)!=null&&w.acsUrl)&&((C=a==null?void 0:a.authorization)!=null&&C.md)&&(this.cardResponse=a,this.currentStep=11);return}if(((k=a==null?void 0:a.authorization)==null?void 0:k.mode)==="otp"){this.cardResponse=a,R()!=="en"?(this.showLoader(),this.renderTranslatedText(a==null?void 0:a.providerMessage).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=3})):this.currentStep=3;return}if(((x=a==null?void 0:a.authorization)==null?void 0:x.mode)==="avs"){if(R()!=="en"){this.showLoader();const A=Object.values(this.rawAvsData);this.renderTranslatedText(A).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=7})}else this.currentStep=7;return}this.currentStep=10}}).catch(async a=>{if(_.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),a.message){const l=await Z(a.message,R());this.errorText=l,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(P["payment-failed"]);this.warningScreen.hideReportIssue()})},300)}}validatedAVS(e,t){e.stopPropagation(),e.preventDefault();const i=this.container.querySelector(".spinner"),s=this.container.querySelector("#avs-form-button-text"),o={authorization:{avs:{state:t==null?void 0:t.state,city:t==null?void 0:t.city,country:t==null?void 0:t.country,address:t==null?void 0:t.address,zipCode:(t==null?void 0:t.code)||"-"}},reference:this.activeRef};_.track("input_address",{payment_method:"Card",authentication_type:"AVS"}),i&&s&&(i.classList.remove("hidden"),s.classList.add("hidden")),Ot(this.token,o,this.rdtCode,this.url).then(async({data:l,headers:c})=>{var p,m,g,f,b,w,C;if(l.providerMessage){const k=await Z(l.providerMessage,R());this.errorText=k}if(l.status==="failed")this.currentStep=4,_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"AVS"}),l.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(l.status))["success","successful"].includes(l.status)&&(this.currentStep=5,this.redirectTo(l,c,"success"),_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"AVS"}));else{if(((p=l==null?void 0:l.authorization)==null?void 0:p.mode)==="pin"){this.currentStep=2;return}if(((m=l==null?void 0:l.authorization)==null?void 0:m.mode)==="3DS"){(g=l==null?void 0:l.authorization)!=null&&g.redirectUrl&&this.redirectTo3DS((f=l==null?void 0:l.authorization)==null?void 0:f.redirectUrl),(b=l==null?void 0:l.authorization)!=null&&b.embeddedHtml&&this.redirectToPreciumDoc((w=l==null?void 0:l.authorization)==null?void 0:w.embeddedHtml);return}if(((C=l==null?void 0:l.authorization)==null?void 0:C.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}this.currentStep=10}}).catch(async l=>{if(_.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"AVS"}),l.message){const c=await Z(l.message,R());this.errorText=c,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(P["payment-failed"]);this.warningScreen.hideReportIssue()}).finally(()=>{i&&s&&(i.classList.add("hidden"),s.classList.remove("hidden"))})}submitOtp(e,t){e.preventDefault();const i={authorization:{otp:t},reference:this.activeRef};this.currentStep=6,this.showLoader(),_.track("input_cardOTP",{payment_method:"Card",authentication_type:"PIN+0TP"}),Ot(this.token,i,this.rdtCode,this.url).then(async({data:o,headers:a})=>{var l,c,p,m,g,f,b;if(o.providerMessage){const w=await Z(o.providerMessage,R());this.errorText=w}if(o.status==="failed")this.currentStep=4,_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),o.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(o.status))["success","successful"].includes(o.status)&&(this.currentStep=5,this.redirectTo(o,a,"success"),_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN+0TP"}));else{if(this.activeRef=o.reference,((l=o==null?void 0:o.authorization)==null?void 0:l.mode)==="pin"){this.currentStep=2;return}if(((c=o==null?void 0:o.authorization)==null?void 0:c.mode)==="3DS"){(p=o==null?void 0:o.authorization)!=null&&p.redirectUrl&&this.redirectTo3DS((m=o==null?void 0:o.authorization)==null?void 0:m.redirectUrl),(g=o==null?void 0:o.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=o==null?void 0:o.authorization)==null?void 0:f.embeddedHtml);return}if(((b=o==null?void 0:o.authorization)==null?void 0:b.mode)==="avs"){if(R()!=="en"){this.showLoader();const w=Object.values(this.rawAvsData);this.renderTranslatedText(w).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=7})}else this.currentStep=7;return}this.currentStep=10}}).catch(async o=>{if(_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),o!=null&&o.message){const a=await Z(o.message,R());this.errorText=a,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(P["payment-failed"]);this.warningScreen.hideReportIssue()})}redirectTo3DS(e){const t=window.open("","_blank");if(!t){alert(pe["enable-popup"]);return}t.location.href=e,_.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const i=setInterval(()=>{t.closed&&(clearInterval(i),this.verifyPayment(({data:s,headers:o})=>{this.currentStep=5,_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(s,o,"success")},async({data:s})=>{if(s.providerMessage){const o=await Z(s.providerMessage,R());this.errorText=o}this.currentStep=4,s.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue(),_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}redirectToPreciumDoc(e){const t=atob(e),i=new Blob([t],{type:"text/html"}),s=URL.createObjectURL(i),o=window.open(s,"_blank");if(o){o.document.close(),_.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const a=setInterval(()=>{o.closed&&(clearInterval(a),this.verifyPayment(({data:l,headers:c})=>{this.currentStep=5,_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(l,c,"success")},async({data:l})=>{if(l.providerMessage){const c=await Z(l.providerMessage,R());this.errorText=c}this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue(),_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}else alert(pe["enable-popup"])}async verifyPayment(e,t){try{const i=await Xe(this.token,this.activeRef,void 0,this.rdtCode,this.url);i.data.status==="failed"?t(i):(["success","successful"].includes(i.data.status)&&e(i),i.data.status==="inProgress"&&(this.currentStep=10))}catch{this.currentStep=4,_.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"3DS"}),this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue()}}async verifyPaymentProcess(){try{const e=await Xe(this.token,this.reference,void 0,this.rdtCode,this.url);this.cardResponse=e.data,this.cardResponseHeader=e.headers}catch{this.currentStep=4}}charge3DSPayment(){const e=Ga(this.token,this.reference,this.rdtCode,this.url);_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS"}),e.then(async({data:t,headers:i})=>{if(this.cardResponse=t,this.cardResponseHeader=i,t.providerMessage){const s=await Z(t.providerMessage,R());this.errorText=s}t.status==="failed"?(this.currentStep=4,_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Failed"}),t.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue()):["success","successful"].includes(t.status)?(this.currentStep=5,_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Success"}),this.redirectTo(t,i,"success")):t.status==="inProgress"?this.currentStep=10:(this.currentStep=4,_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Null"}),t.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue())}).catch(async t=>{if(_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Null"}),t.message){const i=await Z(t.message,R());this.errorText=i,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(P["payment-failed"]);this.warningScreen.hideReportIssue()})}goBackToMerchant(){if(this.isCancelledPlan){this.cancellledPlanAction();return}this.redirectTo(this.cardResponse,this.cardResponseHeader,this.callBackUrl)}renderCardContent(e){var o,a,l,c,p,m,g,f,b,w,C;e&&(this.merchantPlanDetail=e);const t=document.getElementById("test-container"),i=this.container.querySelector("#test-cards-link"),s=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),s==null||s.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.cardDetailForm=new Qs({container:this.contents,onAction:x=>A=>this.submitCardDetails.bind(this)(x,A),merchantName:this.merchantPlanDetail.merchantName,currency:Bn(this.currency,this.localCurrency)}),this.cardDetailForm.renderContent();break;case 2:this.cardPinForm=new dr({container:this.contents,onClose:this.onClose,onAction:x=>this.handlePinRequest.bind(this)(x)}),this.cardPinForm.renderComponent();break;case 3:this.cardOtpValidationForm=new lr({container:this.contents,onClose:this.onClose,onAction:x=>A=>this.submitOtp.bind(this)(x,A),otpMessage:this.otpMessage||P["Payment failed"]}),this.cardOtpValidationForm.renderComponent();break;case 4:this.warningScreen=new en({container:this.contents,onAction:this.isMaxRetriesReached||this.isCancelledPlan?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=8}),this.testcardIsVisible&&(ui(t),i.classList.remove("text-tone-100","font-bold")),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.successScreen=new Vn({container:this.contents,amount:((c=(l=(a=(o=this.merchantPlanDetail)==null?void 0:o.plan)==null?void 0:a.trial)==null?void 0:l.pricingList[0])==null?void 0:c.amount)??this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(p=this.merchantPlanDetail)==null?void 0:p.rate.rate}),this.testcardIsVisible&&(ui(t),i.classList.remove("text-tone-100","font-bold")),this.successScreen.renderComponent();break;case 6:this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 7:this.avsForm=new mr({container:this.contents,onAction:x=>A=>this.validatedAVS.bind(this)(x,A),translatedTexts:this.translatedAvsData}),this.avsForm.renderComponent();break;case 8:this.transactionIssuesScreen=new it({container:this.contents,onAction:async()=>{var x,A;if((x=this.cardResponse)!=null&&x.providerMessage){const M=await Z((A=this.cardResponse)==null?void 0:A.providerMessage,R());this.errorText=M}this.currentStep=4,this.warningScreen.setPaymentError(this.errorText||P["payment-failed"])},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"card",callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;case 9:this.confirmationEnd=new oa({container:this.contents,onAction:x=>{this.currentStep=x},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader,paymentMethod:"Card"}),this.confirmationEnd.renderComponent();break;case 10:this.confirmationProgress=new dc({container:this.contents,onAction:x=>{this.currentStep=x},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(x,A)=>{this.cardResponse=x,this.cardResponseHeader=A},step:{failed:4,success:5,end:9},paymentMethod:"Card"}),this.testcardIsVisible&&(ui(t),i.classList.remove("text-tone-100","font-bold")),this.confirmationProgress.renderComponent();break;case 11:this.isw3dsForm=new pr({container:this.contents,threeDSecureDetails:{jwt:((g=(m=this.cardResponse)==null?void 0:m.authorization)==null?void 0:g.jwt)||"",md:((b=(f=this.cardResponse)==null?void 0:f.authorization)==null?void 0:b.md)||"",acsUrl:((C=(w=this.cardResponse)==null?void 0:w.authorization)==null?void 0:C.acsUrl)||""},onAction:x=>{this.currentStep=x,x===6&&this.showLoader()},onSuccess:this.charge3DSPayment.bind(this)}),this.isw3dsForm.renderComponent();break;default:this.cardDetailForm=new Qs({container:this.contents,onAction:x=>A=>this.submitCardDetails.bind(this)(x,A),merchantName:this.merchantPlanDetail.merchantName,currency:Bn(this.currency,this.localCurrency)}),this.cardDetailForm.renderContent();break}this.displayButtonText();const k=this.container.querySelector("#card-currency");k&&(k.textContent=`${Bn(this.currency,this.localCurrency)} ${pe.card}`)}}redirectTo(e,t,i){const s=t.get("spf-redirect-url");this.callBackUrl=s||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const o=new URL(this.callBackUrl);o.searchParams.append("status",e.status),o.searchParams.append("reference",e.reference),window.location.href=o.toString()},1800):i==="success"&&this.onSuccess(e)}displayButtonText(e){var i,s,o,a,l,c,p,m,g,f;const t=this.container.querySelector("#details-form-button-text");if(t){const b=(s=(i=this==null?void 0:this.merchantPlanDetail)==null?void 0:i.plan)==null?void 0:s.trial,w=(c=(l=(a=(o=this==null?void 0:this.merchantPlanDetail)==null?void 0:o.plan)==null?void 0:a.trial)==null?void 0:l.pricingList[0])==null?void 0:c.amount,C=Bn(this.currency,this.localCurrency),k=C==="USD"?(m=(p=this.merchantPlanDetail)==null?void 0:p.rate)==null?void 0:m.from:C;e?t.textContent=e:t.textContent=`${pe["continue-to"]} ${k} ${Me(b&&w!=null?w:this.totalAmount!==this.amount?this.totalAmount:(this.amount||0)*(this.currency==="USD"?(f=(g=this.merchantPlanDetail)==null?void 0:g.rate)==null?void 0:f.rate:1),2)}`}}}const vc=`<div data-section="transfer" data-section="transfer">
|
|
1572
|
+
</svg>`),s&&s.classList.add("hidden"),Ot(this.token,t,this.rdtCode,this.url).then(async({data:a,headers:l})=>{var c,p,m,g,f,b,w,C,k,x;if(a.providerMessage){const A=await Z(a.providerMessage,R());this.errorText=A}if(a.status==="failed")_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.currentStep=4,a.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(E["payment-failed"]),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(a.status))this.currentStep=5,this.redirectTo(a,l,"success"),_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"});else{if(((c=a==null?void 0:a.authorization)==null?void 0:c.mode)==="3DS"){(p=a==null?void 0:a.authorization)!=null&&p.redirectUrl&&this.redirectTo3DS((m=a==null?void 0:a.authorization)==null?void 0:m.redirectUrl),(g=a==null?void 0:a.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=a==null?void 0:a.authorization)==null?void 0:f.embeddedHtml),(b=a==null?void 0:a.authorization)!=null&&b.jwt&&((w=a==null?void 0:a.authorization)!=null&&w.acsUrl)&&((C=a==null?void 0:a.authorization)!=null&&C.md)&&(this.cardResponse=a,this.currentStep=11);return}if(((k=a==null?void 0:a.authorization)==null?void 0:k.mode)==="otp"){this.cardResponse=a,R()!=="en"?(this.showLoader(),this.renderTranslatedText(a==null?void 0:a.providerMessage).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=3})):this.currentStep=3;return}if(((x=a==null?void 0:a.authorization)==null?void 0:x.mode)==="avs"){if(R()!=="en"){this.showLoader();const A=Object.values(this.rawAvsData);this.renderTranslatedText(A).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=7})}else this.currentStep=7;return}this.currentStep=10}}).catch(async a=>{if(_.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),a.message){const l=await Z(a.message,R());this.errorText=l,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(E["payment-failed"]);this.warningScreen.hideReportIssue()})},300)}}validatedAVS(e,t){e.stopPropagation(),e.preventDefault();const i=this.container.querySelector(".spinner"),s=this.container.querySelector("#avs-form-button-text"),o={authorization:{avs:{state:t==null?void 0:t.state,city:t==null?void 0:t.city,country:t==null?void 0:t.country,address:t==null?void 0:t.address,zipCode:(t==null?void 0:t.code)||"-"}},reference:this.activeRef};_.track("input_address",{payment_method:"Card",authentication_type:"AVS"}),i&&s&&(i.classList.remove("hidden"),s.classList.add("hidden")),Ot(this.token,o,this.rdtCode,this.url).then(async({data:l,headers:c})=>{var p,m,g,f,b,w,C;if(l.providerMessage){const k=await Z(l.providerMessage,R());this.errorText=k}if(l.status==="failed")this.currentStep=4,_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"AVS"}),l.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(E["payment-failed"]),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(l.status))["success","successful"].includes(l.status)&&(this.currentStep=5,this.redirectTo(l,c,"success"),_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"AVS"}));else{if(((p=l==null?void 0:l.authorization)==null?void 0:p.mode)==="pin"){this.currentStep=2;return}if(((m=l==null?void 0:l.authorization)==null?void 0:m.mode)==="3DS"){(g=l==null?void 0:l.authorization)!=null&&g.redirectUrl&&this.redirectTo3DS((f=l==null?void 0:l.authorization)==null?void 0:f.redirectUrl),(b=l==null?void 0:l.authorization)!=null&&b.embeddedHtml&&this.redirectToPreciumDoc((w=l==null?void 0:l.authorization)==null?void 0:w.embeddedHtml);return}if(((C=l==null?void 0:l.authorization)==null?void 0:C.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}this.currentStep=10}}).catch(async l=>{if(_.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"AVS"}),l.message){const c=await Z(l.message,R());this.errorText=c,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(E["payment-failed"]);this.warningScreen.hideReportIssue()}).finally(()=>{i&&s&&(i.classList.add("hidden"),s.classList.remove("hidden"))})}submitOtp(e,t){e.preventDefault();const i={authorization:{otp:t},reference:this.activeRef};this.currentStep=6,this.showLoader(),_.track("input_cardOTP",{payment_method:"Card",authentication_type:"PIN+0TP"}),Ot(this.token,i,this.rdtCode,this.url).then(async({data:o,headers:a})=>{var l,c,p,m,g,f,b;if(o.providerMessage){const w=await Z(o.providerMessage,R());this.errorText=w}if(o.status==="failed")this.currentStep=4,_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),o.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(E["payment-failed"]),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(o.status))["success","successful"].includes(o.status)&&(this.currentStep=5,this.redirectTo(o,a,"success"),_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN+0TP"}));else{if(this.activeRef=o.reference,((l=o==null?void 0:o.authorization)==null?void 0:l.mode)==="pin"){this.currentStep=2;return}if(((c=o==null?void 0:o.authorization)==null?void 0:c.mode)==="3DS"){(p=o==null?void 0:o.authorization)!=null&&p.redirectUrl&&this.redirectTo3DS((m=o==null?void 0:o.authorization)==null?void 0:m.redirectUrl),(g=o==null?void 0:o.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=o==null?void 0:o.authorization)==null?void 0:f.embeddedHtml);return}if(((b=o==null?void 0:o.authorization)==null?void 0:b.mode)==="avs"){if(R()!=="en"){this.showLoader();const w=Object.values(this.rawAvsData);this.renderTranslatedText(w).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=7})}else this.currentStep=7;return}this.currentStep=10}}).catch(async o=>{if(_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),o!=null&&o.message){const a=await Z(o.message,R());this.errorText=a,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(E["payment-failed"]);this.warningScreen.hideReportIssue()})}redirectTo3DS(e){const t=window.open("","_blank");if(!t){alert(pe["enable-popup"]);return}t.location.href=e,_.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const i=setInterval(()=>{t.closed&&(clearInterval(i),this.verifyPayment(({data:s,headers:o})=>{this.currentStep=5,_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(s,o,"success")},async({data:s})=>{if(s.providerMessage){const o=await Z(s.providerMessage,R());this.errorText=o}this.currentStep=4,s.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(E["payment-failed"]),this.warningScreen.hideReportIssue(),_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}redirectToPreciumDoc(e){const t=atob(e),i=new Blob([t],{type:"text/html"}),s=URL.createObjectURL(i),o=window.open(s,"_blank");if(o){o.document.close(),_.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const a=setInterval(()=>{o.closed&&(clearInterval(a),this.verifyPayment(({data:l,headers:c})=>{this.currentStep=5,_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(l,c,"success")},async({data:l})=>{if(l.providerMessage){const c=await Z(l.providerMessage,R());this.errorText=c}this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(E["payment-failed"]),this.warningScreen.hideReportIssue(),_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}else alert(pe["enable-popup"])}async verifyPayment(e,t){try{const i=await Xe(this.token,this.activeRef,void 0,this.rdtCode,this.url);i.data.status==="failed"?t(i):(["success","successful"].includes(i.data.status)&&e(i),i.data.status==="inProgress"&&(this.currentStep=10))}catch{this.currentStep=4,_.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"3DS"}),this.warningScreen.setPaymentError(E["payment-failed"]),this.warningScreen.hideReportIssue()}}async verifyPaymentProcess(){try{const e=await Xe(this.token,this.reference,void 0,this.rdtCode,this.url);this.cardResponse=e.data,this.cardResponseHeader=e.headers}catch{this.currentStep=4}}charge3DSPayment(){const e=Ga(this.token,this.reference,this.rdtCode,this.url);_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS"}),e.then(async({data:t,headers:i})=>{if(this.cardResponse=t,this.cardResponseHeader=i,t.providerMessage){const s=await Z(t.providerMessage,R());this.errorText=s}t.status==="failed"?(this.currentStep=4,_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Failed"}),t.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(E["payment-failed"]),this.warningScreen.hideReportIssue()):["success","successful"].includes(t.status)?(this.currentStep=5,_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Success"}),this.redirectTo(t,i,"success")):t.status==="inProgress"?this.currentStep=10:(this.currentStep=4,_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Null"}),t.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(E["payment-failed"]),this.warningScreen.hideReportIssue())}).catch(async t=>{if(_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Null"}),t.message){const i=await Z(t.message,R());this.errorText=i,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(E["payment-failed"]);this.warningScreen.hideReportIssue()})}goBackToMerchant(){if(this.isCancelledPlan){this.cancellledPlanAction();return}this.redirectTo(this.cardResponse,this.cardResponseHeader,this.callBackUrl)}renderCardContent(e){var o,a,l,c,p,m,g,f,b,w,C;e&&(this.merchantPlanDetail=e);const t=document.getElementById("test-container"),i=this.container.querySelector("#test-cards-link"),s=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),s==null||s.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.cardDetailForm=new Qs({container:this.contents,onAction:x=>A=>this.submitCardDetails.bind(this)(x,A),merchantName:this.merchantPlanDetail.merchantName,currency:Bn(this.currency,this.localCurrency)}),this.cardDetailForm.renderContent();break;case 2:this.cardPinForm=new dr({container:this.contents,onClose:this.onClose,onAction:x=>this.handlePinRequest.bind(this)(x)}),this.cardPinForm.renderComponent();break;case 3:this.cardOtpValidationForm=new lr({container:this.contents,onClose:this.onClose,onAction:x=>A=>this.submitOtp.bind(this)(x,A),otpMessage:this.otpMessage||E["Payment failed"]}),this.cardOtpValidationForm.renderComponent();break;case 4:this.warningScreen=new en({container:this.contents,onAction:this.isMaxRetriesReached||this.isCancelledPlan?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=8}),this.testcardIsVisible&&(ui(t),i.classList.remove("text-tone-100","font-bold")),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.successScreen=new Vn({container:this.contents,amount:((c=(l=(a=(o=this.merchantPlanDetail)==null?void 0:o.plan)==null?void 0:a.trial)==null?void 0:l.pricingList[0])==null?void 0:c.amount)??this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(p=this.merchantPlanDetail)==null?void 0:p.rate.rate}),this.testcardIsVisible&&(ui(t),i.classList.remove("text-tone-100","font-bold")),this.successScreen.renderComponent();break;case 6:this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 7:this.avsForm=new mr({container:this.contents,onAction:x=>A=>this.validatedAVS.bind(this)(x,A),translatedTexts:this.translatedAvsData}),this.avsForm.renderComponent();break;case 8:this.transactionIssuesScreen=new it({container:this.contents,onAction:async()=>{var x,A;if((x=this.cardResponse)!=null&&x.providerMessage){const M=await Z((A=this.cardResponse)==null?void 0:A.providerMessage,R());this.errorText=M}this.currentStep=4,this.warningScreen.setPaymentError(this.errorText||E["payment-failed"])},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"card",callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;case 9:this.confirmationEnd=new oa({container:this.contents,onAction:x=>{this.currentStep=x},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader,paymentMethod:"Card"}),this.confirmationEnd.renderComponent();break;case 10:this.confirmationProgress=new dc({container:this.contents,onAction:x=>{this.currentStep=x},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(x,A)=>{this.cardResponse=x,this.cardResponseHeader=A},step:{failed:4,success:5,end:9},paymentMethod:"Card"}),this.testcardIsVisible&&(ui(t),i.classList.remove("text-tone-100","font-bold")),this.confirmationProgress.renderComponent();break;case 11:this.isw3dsForm=new pr({container:this.contents,threeDSecureDetails:{jwt:((g=(m=this.cardResponse)==null?void 0:m.authorization)==null?void 0:g.jwt)||"",md:((b=(f=this.cardResponse)==null?void 0:f.authorization)==null?void 0:b.md)||"",acsUrl:((C=(w=this.cardResponse)==null?void 0:w.authorization)==null?void 0:C.acsUrl)||""},onAction:x=>{this.currentStep=x,x===6&&this.showLoader()},onSuccess:this.charge3DSPayment.bind(this)}),this.isw3dsForm.renderComponent();break;default:this.cardDetailForm=new Qs({container:this.contents,onAction:x=>A=>this.submitCardDetails.bind(this)(x,A),merchantName:this.merchantPlanDetail.merchantName,currency:Bn(this.currency,this.localCurrency)}),this.cardDetailForm.renderContent();break}this.displayButtonText();const k=this.container.querySelector("#card-currency");k&&(k.textContent=`${Bn(this.currency,this.localCurrency)} ${pe.card}`)}}redirectTo(e,t,i){const s=t.get("spf-redirect-url");this.callBackUrl=s||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const o=new URL(this.callBackUrl);o.searchParams.append("status",e.status),o.searchParams.append("reference",e.reference),window.location.href=o.toString()},1800):i==="success"&&this.onSuccess(e)}displayButtonText(e){var i,s,o,a,l,c,p,m,g,f;const t=this.container.querySelector("#details-form-button-text");if(t){const b=(s=(i=this==null?void 0:this.merchantPlanDetail)==null?void 0:i.plan)==null?void 0:s.trial,w=(c=(l=(a=(o=this==null?void 0:this.merchantPlanDetail)==null?void 0:o.plan)==null?void 0:a.trial)==null?void 0:l.pricingList[0])==null?void 0:c.amount,C=Bn(this.currency,this.localCurrency),k=C==="USD"?(m=(p=this.merchantPlanDetail)==null?void 0:p.rate)==null?void 0:m.from:C;e?t.textContent=e:t.textContent=`${pe["continue-to"]} ${k} ${Me(b&&w!=null?w:this.totalAmount!==this.amount?this.totalAmount:(this.amount||0)*(this.currency==="USD"?(f=(g=this.merchantPlanDetail)==null?void 0:g.rate)==null?void 0:f.rate:1),2)}`}}}const vc=`<div data-section="transfer" data-section="transfer">
|
|
1573
1573
|
<div class="container-center h-[40vh] hidden" id="loader">
|
|
1574
1574
|
<img src="" alt="loader gif" />
|
|
1575
1575
|
</div>
|
|
@@ -1664,8 +1664,8 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1664
1664
|
*
|
|
1665
1665
|
* Copyright 2020, Pusher
|
|
1666
1666
|
* Released under the MIT licence.
|
|
1667
|
-
*/(function(n,e){(function(i,s){n.exports=s()})(window,function(){return function(t){var i={};function s(o){if(i[o])return i[o].exports;var a=i[o]={i:o,l:!1,exports:{}};return t[o].call(a.exports,a,a.exports,s),a.l=!0,a.exports}return s.m=t,s.c=i,s.d=function(o,a,l){s.o(o,a)||Object.defineProperty(o,a,{enumerable:!0,get:l})},s.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},s.t=function(o,a){if(a&1&&(o=s(o)),a&8||a&4&&typeof o=="object"&&o&&o.__esModule)return o;var l=Object.create(null);if(s.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:o}),a&2&&typeof o!="string")for(var c in o)s.d(l,c,(function(p){return o[p]}).bind(null,c));return l},s.n=function(o){var a=o&&o.__esModule?function(){return o.default}:function(){return o};return s.d(a,"a",a),a},s.o=function(o,a){return Object.prototype.hasOwnProperty.call(o,a)},s.p="",s(s.s=2)}([function(t,i,s){var o=this&&this.__extends||function(){var C=function(k,x){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,M){A.__proto__=M}||function(A,M){for(var E in M)M.hasOwnProperty(E)&&(A[E]=M[E])},C(k,x)};return function(k,x){C(k,x);function A(){this.constructor=k}k.prototype=x===null?Object.create(x):(A.prototype=x.prototype,new A)}}();Object.defineProperty(i,"__esModule",{value:!0});var a=256,l=function(){function C(k){k===void 0&&(k="="),this._paddingCharacter=k}return C.prototype.encodedLength=function(k){return this._paddingCharacter?(k+2)/3*4|0:(k*8+5)/6|0},C.prototype.encode=function(k){for(var x="",A=0;A<k.length-2;A+=3){var M=k[A]<<16|k[A+1]<<8|k[A+2];x+=this._encodeByte(M>>>3*6&63),x+=this._encodeByte(M>>>2*6&63),x+=this._encodeByte(M>>>1*6&63),x+=this._encodeByte(M>>>0*6&63)}var E=k.length-A;if(E>0){var M=k[A]<<16|(E===2?k[A+1]<<8:0);x+=this._encodeByte(M>>>3*6&63),x+=this._encodeByte(M>>>2*6&63),E===2?x+=this._encodeByte(M>>>1*6&63):x+=this._paddingCharacter||"",x+=this._paddingCharacter||""}return x},C.prototype.maxDecodedLength=function(k){return this._paddingCharacter?k/4*3|0:(k*6+7)/8|0},C.prototype.decodedLength=function(k){return this.maxDecodedLength(k.length-this._getPaddingLength(k))},C.prototype.decode=function(k){if(k.length===0)return new Uint8Array(0);for(var x=this._getPaddingLength(k),A=k.length-x,M=new Uint8Array(this.maxDecodedLength(A)),E=0,D=0,q=0,Q=0,K=0,W=0,de=0;D<A-4;D+=4)Q=this._decodeChar(k.charCodeAt(D+0)),K=this._decodeChar(k.charCodeAt(D+1)),W=this._decodeChar(k.charCodeAt(D+2)),de=this._decodeChar(k.charCodeAt(D+3)),M[E++]=Q<<2|K>>>4,M[E++]=K<<4|W>>>2,M[E++]=W<<6|de,q|=Q&a,q|=K&a,q|=W&a,q|=de&a;if(D<A-1&&(Q=this._decodeChar(k.charCodeAt(D)),K=this._decodeChar(k.charCodeAt(D+1)),M[E++]=Q<<2|K>>>4,q|=Q&a,q|=K&a),D<A-2&&(W=this._decodeChar(k.charCodeAt(D+2)),M[E++]=K<<4|W>>>2,q|=W&a),D<A-3&&(de=this._decodeChar(k.charCodeAt(D+3)),M[E++]=W<<6|de,q|=de&a),q!==0)throw new Error("Base64Coder: incorrect characters for decoding");return M},C.prototype._encodeByte=function(k){var x=k;return x+=65,x+=25-k>>>8&6,x+=51-k>>>8&-75,x+=61-k>>>8&-15,x+=62-k>>>8&3,String.fromCharCode(x)},C.prototype._decodeChar=function(k){var x=a;return x+=(42-k&k-44)>>>8&-a+k-43+62,x+=(46-k&k-48)>>>8&-a+k-47+63,x+=(47-k&k-58)>>>8&-a+k-48+52,x+=(64-k&k-91)>>>8&-a+k-65+0,x+=(96-k&k-123)>>>8&-a+k-97+26,x},C.prototype._getPaddingLength=function(k){var x=0;if(this._paddingCharacter){for(var A=k.length-1;A>=0&&k[A]===this._paddingCharacter;A--)x++;if(k.length<4||x>2)throw new Error("Base64Coder: incorrect padding")}return x},C}();i.Coder=l;var c=new l;function p(C){return c.encode(C)}i.encode=p;function m(C){return c.decode(C)}i.decode=m;var g=function(C){o(k,C);function k(){return C!==null&&C.apply(this,arguments)||this}return k.prototype._encodeByte=function(x){var A=x;return A+=65,A+=25-x>>>8&6,A+=51-x>>>8&-75,A+=61-x>>>8&-13,A+=62-x>>>8&49,String.fromCharCode(A)},k.prototype._decodeChar=function(x){var A=a;return A+=(44-x&x-46)>>>8&-a+x-45+62,A+=(94-x&x-96)>>>8&-a+x-95+63,A+=(47-x&x-58)>>>8&-a+x-48+52,A+=(64-x&x-91)>>>8&-a+x-65+0,A+=(96-x&x-123)>>>8&-a+x-97+26,A},k}(l);i.URLSafeCoder=g;var f=new g;function b(C){return f.encode(C)}i.encodeURLSafe=b;function w(C){return f.decode(C)}i.decodeURLSafe=w,i.encodedLength=function(C){return c.encodedLength(C)},i.maxDecodedLength=function(C){return c.maxDecodedLength(C)},i.decodedLength=function(C){return c.decodedLength(C)}},function(t,i,s){Object.defineProperty(i,"__esModule",{value:!0});var o="utf8: invalid string",a="utf8: invalid source encoding";function l(m){for(var g=new Uint8Array(c(m)),f=0,b=0;b<m.length;b++){var w=m.charCodeAt(b);w<128?g[f++]=w:w<2048?(g[f++]=192|w>>6,g[f++]=128|w&63):w<55296?(g[f++]=224|w>>12,g[f++]=128|w>>6&63,g[f++]=128|w&63):(b++,w=(w&1023)<<10,w|=m.charCodeAt(b)&1023,w+=65536,g[f++]=240|w>>18,g[f++]=128|w>>12&63,g[f++]=128|w>>6&63,g[f++]=128|w&63)}return g}i.encode=l;function c(m){for(var g=0,f=0;f<m.length;f++){var b=m.charCodeAt(f);if(b<128)g+=1;else if(b<2048)g+=2;else if(b<55296)g+=3;else if(b<=57343){if(f>=m.length-1)throw new Error(o);f++,g+=4}else throw new Error(o)}return g}i.encodedLength=c;function p(m){for(var g=[],f=0;f<m.length;f++){var b=m[f];if(b&128){var w=void 0;if(b<224){if(f>=m.length)throw new Error(a);var C=m[++f];if((C&192)!==128)throw new Error(a);b=(b&31)<<6|C&63,w=128}else if(b<240){if(f>=m.length-1)throw new Error(a);var C=m[++f],k=m[++f];if((C&192)!==128||(k&192)!==128)throw new Error(a);b=(b&15)<<12|(C&63)<<6|k&63,w=2048}else if(b<248){if(f>=m.length-2)throw new Error(a);var C=m[++f],k=m[++f],x=m[++f];if((C&192)!==128||(k&192)!==128||(x&192)!==128)throw new Error(a);b=(b&15)<<18|(C&63)<<12|(k&63)<<6|x&63,w=65536}else throw new Error(a);if(b<w||b>=55296&&b<=57343)throw new Error(a);if(b>=65536){if(b>1114111)throw new Error(a);b-=65536,g.push(String.fromCharCode(55296|b>>10)),b=56320|b&1023}}g.push(String.fromCharCode(b))}return g.join("")}i.decode=p},function(t,i,s){t.exports=s(3).default},function(t,i,s){s.r(i);class o{constructor(r,u){this.lastId=0,this.prefix=r,this.name=u}create(r){this.lastId++;var u=this.lastId,y=this.prefix+u,S=this.name+"["+u+"]",T=!1,I=function(){T||(r.apply(null,arguments),T=!0)};return this[u]=I,{number:u,id:y,name:S,callback:I}}remove(r){delete this[r.number]}}var a=new o("_pusher_script_","Pusher.ScriptReceivers"),l={VERSION:"8.4.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""},c=l;class p{constructor(r){this.options=r,this.receivers=r.receivers||a,this.loading={}}load(r,u,y){var S=this;if(S.loading[r]&&S.loading[r].length>0)S.loading[r].push(y);else{S.loading[r]=[y];var T=F.createScriptRequest(S.getPath(r,u)),I=S.receivers.create(function(B){if(S.receivers.remove(I),S.loading[r]){var V=S.loading[r];delete S.loading[r];for(var $=function(we){we||T.cleanup()},ie=0;ie<V.length;ie++)V[ie](B,$)}});T.send(I)}}getRoot(r){var u,y=F.getDocument().location.protocol;return r&&r.useTLS||y==="https:"?u=this.options.cdn_https:u=this.options.cdn_http,u.replace(/\/*$/,"")+"/"+this.options.version}getPath(r,u){return this.getRoot(u)+"/"+r+this.options.suffix+".js"}}var m=new o("_pusher_dependencies","Pusher.DependenciesReceivers"),g=new p({cdn_http:c.cdn_http,cdn_https:c.cdn_https,version:c.VERSION,suffix:c.dependency_suffix,receivers:m});const f={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}};var w={buildLogSuffix:function(h){const r="See:",u=f.urls[h];if(!u)return"";let y;return u.fullUrl?y=u.fullUrl:u.path&&(y=f.baseUrl+u.path),y?`${r} ${y}`:""}},C;(function(h){h.UserAuthentication="user-authentication",h.ChannelAuthorization="channel-authorization"})(C||(C={}));class k extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class x extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class A extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class E extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class D extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class q extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class Q extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class K extends Error{constructor(r,u){super(u),this.status=r,Object.setPrototypeOf(this,new.target.prototype)}}var de=function(h,r,u,y,S){const T=F.createXHR();T.open("POST",u.endpoint,!0),T.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var I in u.headers)T.setRequestHeader(I,u.headers[I]);if(u.headersProvider!=null){let B=u.headersProvider();for(var I in B)T.setRequestHeader(I,B[I])}return T.onreadystatechange=function(){if(T.readyState===4)if(T.status===200){let B,V=!1;try{B=JSON.parse(T.responseText),V=!0}catch{S(new K(200,`JSON returned from ${y.toString()} endpoint was invalid, yet status code was 200. Data was: ${T.responseText}`),null)}V&&S(null,B)}else{let B="";switch(y){case C.UserAuthentication:B=w.buildLogSuffix("authenticationEndpoint");break;case C.ChannelAuthorization:B=`Clients must be authorized to join private or presence channels. ${w.buildLogSuffix("authorizationEndpoint")}`;break}S(new K(T.status,`Unable to retrieve auth string from ${y.toString()} endpoint - received status: ${T.status} from ${u.endpoint}. ${B}`),null)}},T.send(r),T};function Le(h){return yn(Ge(h))}var G=String.fromCharCode,Oe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ge=function(h){var r=h.charCodeAt(0);return r<128?h:r<2048?G(192|r>>>6)+G(128|r&63):G(224|r>>>12&15)+G(128|r>>>6&63)+G(128|r&63)},Ge=function(h){return h.replace(/[^\x00-\x7F]/g,ge)},Te=function(h){var r=[0,2,1][h.length%3],u=h.charCodeAt(0)<<16|(h.length>1?h.charCodeAt(1):0)<<8|(h.length>2?h.charCodeAt(2):0),y=[Oe.charAt(u>>>18),Oe.charAt(u>>>12&63),r>=2?"=":Oe.charAt(u>>>6&63),r>=1?"=":Oe.charAt(u&63)];return y.join("")},yn=window.btoa||function(h){return h.replace(/[\s\S]{1,3}/g,Te)};class un{constructor(r,u,y,S){this.clear=u,this.timer=r(()=>{this.timer&&(this.timer=S(this.timer))},y)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var Cn=un;function qn(h){window.clearTimeout(h)}function Hn(h){window.clearInterval(h)}class je extends Cn{constructor(r,u){super(setTimeout,qn,r,function(y){return u(),null})}}class wn extends Cn{constructor(r,u){super(setInterval,Hn,r,function(y){return u(),y})}}var Wn={now(){return Date.now?Date.now():new Date().valueOf()},defer(h){return new je(0,h)},method(h,...r){var u=Array.prototype.slice.call(arguments,1);return function(y){return y[h].apply(y,u.concat(arguments))}}},me=Wn;function Se(h,...r){for(var u=0;u<r.length;u++){var y=r[u];for(var S in y)y[S]&&y[S].constructor&&y[S].constructor===Object?h[S]=Se(h[S]||{},y[S]):h[S]=y[S]}return h}function Qe(){for(var h=["Pusher"],r=0;r<arguments.length;r++)typeof arguments[r]=="string"?h.push(arguments[r]):h.push(Zn(arguments[r]));return h.join(" : ")}function ze(h,r){var u=Array.prototype.indexOf;if(h===null)return-1;if(u&&h.indexOf===u)return h.indexOf(r);for(var y=0,S=h.length;y<S;y++)if(h[y]===r)return y;return-1}function Ie(h,r){for(var u in h)Object.prototype.hasOwnProperty.call(h,u)&&r(h[u],u,h)}function hn(h){var r=[];return Ie(h,function(u,y){r.push(y)}),r}function H(h){var r=[];return Ie(h,function(u){r.push(u)}),r}function ye(h,r,u){for(var y=0;y<h.length;y++)r.call(u||window,h[y],y,h)}function te(h,r){for(var u=[],y=0;y<h.length;y++)u.push(r(h[y],y,h,u));return u}function Ce(h,r){var u={};return Ie(h,function(y,S){u[S]=r(y)}),u}function qe(h,r){r=r||function(S){return!!S};for(var u=[],y=0;y<h.length;y++)r(h[y],y,h,u)&&u.push(h[y]);return u}function ne(h,r){var u={};return Ie(h,function(y,S){(r&&r(y,S,h,u)||y)&&(u[S]=y)}),u}function Nn(h){var r=[];return Ie(h,function(u,y){r.push([y,u])}),r}function Bt(h,r){for(var u=0;u<h.length;u++)if(r(h[u],u,h))return!0;return!1}function mi(h,r){for(var u=0;u<h.length;u++)if(!r(h[u],u,h))return!1;return!0}function pi(h){return Ce(h,function(r){return typeof r=="object"&&(r=Zn(r)),encodeURIComponent(Le(r.toString()))})}function vi(h){var r=ne(h,function(y){return y!==void 0}),u=te(Nn(pi(r)),me.method("join","=")).join("&");return u}function bi(h){var r=[],u=[];return function y(S,T){var I,B,V;switch(typeof S){case"object":if(!S)return null;for(I=0;I<r.length;I+=1)if(r[I]===S)return{$ref:u[I]};if(r.push(S),u.push(T),Object.prototype.toString.apply(S)==="[object Array]")for(V=[],I=0;I<S.length;I+=1)V[I]=y(S[I],T+"["+I+"]");else{V={};for(B in S)Object.prototype.hasOwnProperty.call(S,B)&&(V[B]=y(S[B],T+"["+JSON.stringify(B)+"]"))}return V;case"number":case"string":case"boolean":return S}}(h,"$")}function Zn(h){try{return JSON.stringify(h)}catch{return JSON.stringify(bi(h))}}class fi{constructor(){this.globalLog=r=>{window.console&&window.console.log&&window.console.log(r)}}debug(...r){this.log(this.globalLog,r)}warn(...r){this.log(this.globalLogWarn,r)}error(...r){this.log(this.globalLogError,r)}globalLogWarn(r){window.console&&window.console.warn?window.console.warn(r):this.globalLog(r)}globalLogError(r){window.console&&window.console.error?window.console.error(r):this.globalLogWarn(r)}log(r,...u){var y=Qe.apply(this,arguments);ws.log?ws.log(y):ws.logToConsole&&r.bind(this)(y)}}var re=new fi,gi=function(h,r,u,y,S){(u.headers!==void 0||u.headersProvider!=null)&&re.warn(`To send headers with the ${y.toString()} request, you must use AJAX, rather than JSONP.`);var T=h.nextAuthCallbackID.toString();h.nextAuthCallbackID++;var I=h.getDocument(),B=I.createElement("script");h.auth_callbacks[T]=function(ie){S(null,ie)};var V="Pusher.auth_callbacks['"+T+"']";B.src=u.endpoint+"?callback="+encodeURIComponent(V)+"&"+r;var $=I.getElementsByTagName("head")[0]||I.documentElement;$.insertBefore(B,$.firstChild)},yi=gi;class Ci{constructor(r){this.src=r}send(r){var u=this,y="Error loading "+u.src;u.script=document.createElement("script"),u.script.id=r.id,u.script.src=u.src,u.script.type="text/javascript",u.script.charset="UTF-8",u.script.addEventListener?(u.script.onerror=function(){r.callback(y)},u.script.onload=function(){r.callback(null)}):u.script.onreadystatechange=function(){(u.script.readyState==="loaded"||u.script.readyState==="complete")&&r.callback(null)},u.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(u.errorScript=document.createElement("script"),u.errorScript.id=r.id+"_error",u.errorScript.text=r.name+"('"+y+"');",u.script.async=u.errorScript.async=!1):u.script.async=!0;var S=document.getElementsByTagName("head")[0];S.insertBefore(u.script,S.firstChild),u.errorScript&&S.insertBefore(u.errorScript,u.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class wi{constructor(r,u){this.url=r,this.data=u}send(r){if(!this.request){var u=vi(this.data),y=this.url+"/"+r.number+"?"+u;this.request=F.createScriptRequest(y),this.request.send(r)}}cleanup(){this.request&&this.request.cleanup()}}var ki=function(h,r){return function(u,y){var S="http"+(r?"s":"")+"://",T=S+(h.host||h.options.host)+h.options.path,I=F.createJSONPRequest(T,u),B=F.ScriptReceivers.create(function(V,$){a.remove(B),I.cleanup(),$&&$.host&&(h.host=$.host),y&&y(V,$)});I.send(B)}},Si={name:"jsonp",getAgent:ki},xi=Si;function ft(h,r,u){var y=h+(r.useTLS?"s":""),S=r.useTLS?r.hostTLS:r.hostNonTLS;return y+"://"+S+u}function gt(h,r){var u="/app/"+h,y="?protocol="+c.PROTOCOL+"&client=js&version="+c.VERSION+(r?"&"+r:"");return u+y}var Ai={getInitial:function(h,r){var u=(r.httpPath||"")+gt(h,"flash=false");return ft("ws",r,u)}},Mi={getInitial:function(h,r){var u=(r.httpPath||"/pusher")+gt(h);return ft("http",r,u)}},Li={getInitial:function(h,r){return ft("http",r,r.httpPath||"/pusher")},getPath:function(h,r){return gt(h)}};class Ti{constructor(){this._callbacks={}}get(r){return this._callbacks[yt(r)]}add(r,u,y){var S=yt(r);this._callbacks[S]=this._callbacks[S]||[],this._callbacks[S].push({fn:u,context:y})}remove(r,u,y){if(!r&&!u&&!y){this._callbacks={};return}var S=r?[yt(r)]:hn(this._callbacks);u||y?this.removeCallback(S,u,y):this.removeAllCallbacks(S)}removeCallback(r,u,y){ye(r,function(S){this._callbacks[S]=qe(this._callbacks[S]||[],function(T){return u&&u!==T.fn||y&&y!==T.context}),this._callbacks[S].length===0&&delete this._callbacks[S]},this)}removeAllCallbacks(r){ye(r,function(u){delete this._callbacks[u]},this)}}function yt(h){return"_"+h}class Je{constructor(r){this.callbacks=new Ti,this.global_callbacks=[],this.failThrough=r}bind(r,u,y){return this.callbacks.add(r,u,y),this}bind_global(r){return this.global_callbacks.push(r),this}unbind(r,u,y){return this.callbacks.remove(r,u,y),this}unbind_global(r){return r?(this.global_callbacks=qe(this.global_callbacks||[],u=>u!==r),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(r,u,y){for(var S=0;S<this.global_callbacks.length;S++)this.global_callbacks[S](r,u);var T=this.callbacks.get(r),I=[];if(y?I.push(u,y):u&&I.push(u),T&&T.length>0)for(var S=0;S<T.length;S++)T[S].fn.apply(T[S].context||window,I);else this.failThrough&&this.failThrough(r,u);return this}}class _i extends Je{constructor(r,u,y,S,T){super(),this.initialize=F.transportConnectionInitializer,this.hooks=r,this.name=u,this.priority=y,this.key=S,this.options=T,this.state="new",this.timeline=T.timeline,this.activityTimeout=T.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var r=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(r,this.options)}catch(u){return me.defer(()=>{this.onError(u),this.changeState("closed")}),!1}return this.bindListeners(),re.debug("Connecting",{transport:this.name,url:r}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(r){return this.state==="open"?(me.defer(()=>{this.socket&&this.socket.send(r)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(r){this.emit("error",{type:"WebSocketError",error:r}),this.timeline.error(this.buildTimelineMessage({error:r.toString()}))}onClose(r){r?this.changeState("closed",{code:r.code,reason:r.reason,wasClean:r.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(r){this.emit("message",r)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=r=>{this.onError(r)},this.socket.onclose=r=>{this.onClose(r)},this.socket.onmessage=r=>{this.onMessage(r)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(r,u){this.state=r,this.timeline.info(this.buildTimelineMessage({state:r,params:u})),this.emit(r,u)}buildTimelineMessage(r){return Se({cid:this.id},r)}}class kn{constructor(r){this.hooks=r}isSupported(r){return this.hooks.isSupported(r)}createConnection(r,u,y,S){return new _i(this.hooks,r,u,y,S)}}var Ei=new kn({urls:Ai,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!F.getWebSocketAPI()},isSupported:function(){return!!F.getWebSocketAPI()},getSocket:function(h){return F.createWebSocket(h)}}),Rt={urls:Mi,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},an=Se({getSocket:function(h){return F.HTTPFactory.createStreamingSocket(h)}},Rt),On=Se({getSocket:function(h){return F.HTTPFactory.createPollingSocket(h)}},Rt),Un={isSupported:function(){return F.isXHRSupported()}},Ye=new kn(Se({},an,Un)),Qn=new kn(Se({},On,Un)),Pi={ws:Ei,xhr_streaming:Ye,xhr_polling:Qn},Ct=Pi,rd=new kn({file:"sockjs",urls:Li,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(h,r){return new window.SockJS(h,null,{js_path:g.getPath("sockjs",{useTLS:r.useTLS}),ignore_null_origin:r.ignoreNullOrigin})},beforeOpen:function(h,r){h.send(JSON.stringify({path:r}))}}),ga={isSupported:function(h){var r=F.isXDRSupported(h.useTLS);return r}},ld=new kn(Se({},an,ga)),cd=new kn(Se({},On,ga));Ct.xdr_streaming=ld,Ct.xdr_polling=cd,Ct.sockjs=rd;var dd=Ct;class ud extends Je{constructor(){super();var r=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){r.emit("online")},!1),window.addEventListener("offline",function(){r.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var hd=new ud;class md{constructor(r,u,y){this.manager=r,this.transport=u,this.minPingDelay=y.minPingDelay,this.maxPingDelay=y.maxPingDelay,this.pingDelay=void 0}createConnection(r,u,y,S){S=Se({},S,{activityTimeout:this.pingDelay});var T=this.transport.createConnection(r,u,y,S),I=null,B=function(){T.unbind("open",B),T.bind("closed",V),I=me.now()},V=$=>{if(T.unbind("closed",V),$.code===1002||$.code===1003)this.manager.reportDeath();else if(!$.wasClean&&I){var ie=me.now()-I;ie<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(ie/2,this.minPingDelay))}};return T.bind("open",B),T}isSupported(r){return this.manager.isAlive()&&this.transport.isSupported(r)}}const ya={decodeMessage:function(h){try{var r=JSON.parse(h.data),u=r.data;if(typeof u=="string")try{u=JSON.parse(r.data)}catch{}var y={event:r.event,channel:r.channel,data:u};return r.user_id&&(y.user_id=r.user_id),y}catch(S){throw{type:"MessageParseError",error:S,data:h.data}}},encodeMessage:function(h){return JSON.stringify(h)},processHandshake:function(h){var r=ya.decodeMessage(h);if(r.event==="pusher:connection_established"){if(!r.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:r.data.socket_id,activityTimeout:r.data.activity_timeout*1e3}}else{if(r.event==="pusher:error")return{action:this.getCloseAction(r.data),error:this.getCloseError(r.data)};throw"Invalid handshake"}},getCloseAction:function(h){return h.code<4e3?h.code>=1002&&h.code<=1004?"backoff":null:h.code===4e3?"tls_only":h.code<4100?"refused":h.code<4200?"backoff":h.code<4300?"retry":"refused"},getCloseError:function(h){return h.code!==1e3&&h.code!==1001?{type:"PusherError",data:{code:h.code,message:h.reason||h.message}}:null}};var Jn=ya;class pd extends Je{constructor(r,u){super(),this.id=r,this.transport=u,this.activityTimeout=u.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(r){return this.transport.send(r)}send_event(r,u,y){var S={event:r,data:u};return y&&(S.channel=y),re.debug("Event sent",S),this.send(Jn.encodeMessage(S))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var r={message:y=>{var S;try{S=Jn.decodeMessage(y)}catch(T){this.emit("error",{type:"MessageParseError",error:T,data:y.data})}if(S!==void 0){switch(re.debug("Event recd",S),S.event){case"pusher:error":this.emit("error",{type:"PusherError",data:S.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",S)}},activity:()=>{this.emit("activity")},error:y=>{this.emit("error",y)},closed:y=>{u(),y&&y.code&&this.handleCloseEvent(y),this.transport=null,this.emit("closed")}},u=()=>{Ie(r,(y,S)=>{this.transport.unbind(S,y)})};Ie(r,(y,S)=>{this.transport.bind(S,y)})}handleCloseEvent(r){var u=Jn.getCloseAction(r),y=Jn.getCloseError(r);y&&this.emit("error",y),u&&this.emit(u,{action:u,error:y})}}class vd{constructor(r,u){this.transport=r,this.callback=u,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=r=>{this.unbindListeners();var u;try{u=Jn.processHandshake(r)}catch(y){this.finish("error",{error:y}),this.transport.close();return}u.action==="connected"?this.finish("connected",{connection:new pd(u.id,this.transport),activityTimeout:u.activityTimeout}):(this.finish(u.action,{error:u.error}),this.transport.close())},this.onClosed=r=>{this.unbindListeners();var u=Jn.getCloseAction(r)||"backoff",y=Jn.getCloseError(r);this.finish(u,{error:y})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(r,u){this.callback(Se({transport:this.transport,action:r},u))}}class bd{constructor(r,u){this.timeline=r,this.options=u||{}}send(r,u){this.timeline.isEmpty()||this.timeline.send(F.TimelineTransport.getAgent(this,r),u)}}class ps extends Je{constructor(r,u){super(function(y,S){re.debug("No callbacks on "+r+" for "+y)}),this.name=r,this.pusher=u,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(r,u){return u(null,{auth:""})}trigger(r,u){if(r.indexOf("client-")!==0)throw new k("Event '"+r+"' does not start with 'client-'");if(!this.subscribed){var y=w.buildLogSuffix("triggeringClientEvents");re.warn(`Client event triggered before channel 'subscription_succeeded' event . ${y}`)}return this.pusher.send_event(r,u,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(r){var u=r.event,y=r.data;if(u==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(r);else if(u==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(r);else if(u.indexOf("pusher_internal:")!==0){var S={};this.emit(u,y,S)}}handleSubscriptionSucceededEvent(r){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",r.data)}handleSubscriptionCountEvent(r){r.data.subscription_count&&(this.subscriptionCount=r.data.subscription_count),this.emit("pusher:subscription_count",r.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(r,u)=>{r?(this.subscriptionPending=!1,re.error(r.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:r.message},r instanceof K?{status:r.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:u.auth,channel_data:u.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class vs extends ps{authorize(r,u){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:r},u)}}class fd{constructor(){this.reset()}get(r){return Object.prototype.hasOwnProperty.call(this.members,r)?{id:r,info:this.members[r]}:null}each(r){Ie(this.members,(u,y)=>{r(this.get(y))})}setMyID(r){this.myID=r}onSubscription(r){this.members=r.presence.hash,this.count=r.presence.count,this.me=this.get(this.myID)}addMember(r){return this.get(r.user_id)===null&&this.count++,this.members[r.user_id]=r.user_info,this.get(r.user_id)}removeMember(r){var u=this.get(r.user_id);return u&&(delete this.members[r.user_id],this.count--),u}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var gd=function(h,r,u,y){function S(T){return T instanceof u?T:new u(function(I){I(T)})}return new(u||(u=Promise))(function(T,I){function B(ie){try{$(y.next(ie))}catch(we){I(we)}}function V(ie){try{$(y.throw(ie))}catch(we){I(we)}}function $(ie){ie.done?T(ie.value):S(ie.value).then(B,V)}$((y=y.apply(h,r||[])).next())})};class yd extends vs{constructor(r,u){super(r,u),this.members=new fd}authorize(r,u){super.authorize(r,(y,S)=>gd(this,void 0,void 0,function*(){if(!y)if(S=S,S.channel_data!=null){var T=JSON.parse(S.channel_data);this.members.setMyID(T.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let I=w.buildLogSuffix("authorizationEndpoint");re.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${I}, or the user should be signed in.`),u("Invalid auth response");return}u(y,S)}))}handleEvent(r){var u=r.event;if(u.indexOf("pusher_internal:")===0)this.handleInternalEvent(r);else{var y=r.data,S={};r.user_id&&(S.user_id=r.user_id),this.emit(u,y,S)}}handleInternalEvent(r){var u=r.event,y=r.data;switch(u){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(r);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(r);break;case"pusher_internal:member_added":var S=this.members.addMember(y);this.emit("pusher:member_added",S);break;case"pusher_internal:member_removed":var T=this.members.removeMember(y);T&&this.emit("pusher:member_removed",T);break}}handleSubscriptionSucceededEvent(r){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(r.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Cd=s(1),bs=s(0);class wd extends vs{constructor(r,u,y){super(r,u),this.key=null,this.nacl=y}authorize(r,u){super.authorize(r,(y,S)=>{if(y){u(y,S);return}let T=S.shared_secret;if(!T){u(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(bs.decode)(T),delete S.shared_secret,u(null,S)})}trigger(r,u){throw new D("Client events are not currently supported for encrypted channels")}handleEvent(r){var u=r.event,y=r.data;if(u.indexOf("pusher_internal:")===0||u.indexOf("pusher:")===0){super.handleEvent(r);return}this.handleEncryptedEvent(u,y)}handleEncryptedEvent(r,u){if(!this.key){re.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!u.ciphertext||!u.nonce){re.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+u);return}let y=Object(bs.decode)(u.ciphertext);if(y.length<this.nacl.secretbox.overheadLength){re.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${y.length}`);return}let S=Object(bs.decode)(u.nonce);if(S.length<this.nacl.secretbox.nonceLength){re.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${S.length}`);return}let T=this.nacl.secretbox.open(y,S,this.key);if(T===null){re.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(I,B)=>{if(I){re.error(`Failed to make a request to the authEndpoint: ${B}. Unable to fetch new key, so dropping encrypted event`);return}if(T=this.nacl.secretbox.open(y,S,this.key),T===null){re.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(r,this.getDataToEmit(T))});return}this.emit(r,this.getDataToEmit(T))}getDataToEmit(r){let u=Object(Cd.decode)(r);try{return JSON.parse(u)}catch{return u}}}class kd extends Je{constructor(r,u){super(),this.state="initialized",this.connection=null,this.key=r,this.options=u,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var y=F.getNetwork();y.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),y.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(r){return this.connection?this.connection.send(r):!1}send_event(r,u,y){return this.connection?this.connection.send_event(r,u,y):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var r=(u,y)=>{u?this.runner=this.strategy.connect(0,r):y.action==="error"?(this.emit("error",{type:"HandshakeError",error:y.error}),this.timeline.error({handshakeError:y.error})):(this.abortConnecting(),this.handshakeCallbacks[y.action](y))};this.runner=this.strategy.connect(0,r)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var r=this.abandonConnection();r.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(r){this.timeline.info({action:"retry",delay:r}),r>0&&this.emit("connecting_in",Math.round(r/1e3)),this.retryTimer=new je(r||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new je(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new je(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new je(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(r){return Se({},r,{message:u=>{this.resetActivityCheck(),this.emit("message",u)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:u=>{this.emit("error",u)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(r){return Se({},r,{connected:u=>{this.activityTimeout=Math.min(this.options.activityTimeout,u.activityTimeout,u.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(u.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let r=u=>y=>{y.error&&this.emit("error",{type:"WebSocketError",error:y.error}),u(y)};return{tls_only:r(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:r(()=>{this.disconnect()}),backoff:r(()=>{this.retryIn(1e3)}),retry:r(()=>{this.retryIn(0)})}}setConnection(r){this.connection=r;for(var u in this.connectionCallbacks)this.connection.bind(u,this.connectionCallbacks[u]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var r in this.connectionCallbacks)this.connection.unbind(r,this.connectionCallbacks[r]);var u=this.connection;return this.connection=null,u}}updateState(r,u){var y=this.state;if(this.state=r,y!==r){var S=r;S==="connected"&&(S+=" with new socket ID "+u.socket_id),re.debug("State changed",y+" -> "+S),this.timeline.info({state:r,params:u}),this.emit("state_change",{previous:y,current:r}),this.emit(r,u)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class Sd{constructor(){this.channels={}}add(r,u){return this.channels[r]||(this.channels[r]=xd(r,u)),this.channels[r]}all(){return H(this.channels)}find(r){return this.channels[r]}remove(r){var u=this.channels[r];return delete this.channels[r],u}disconnect(){Ie(this.channels,function(r){r.disconnect()})}}function xd(h,r){if(h.indexOf("private-encrypted-")===0){if(r.config.nacl)return Sn.createEncryptedChannel(h,r,r.config.nacl);let u="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",y=w.buildLogSuffix("encryptedChannelSupport");throw new D(`${u}. ${y}`)}else{if(h.indexOf("private-")===0)return Sn.createPrivateChannel(h,r);if(h.indexOf("presence-")===0)return Sn.createPresenceChannel(h,r);if(h.indexOf("#")===0)throw new x('Cannot create a channel with name "'+h+'".');return Sn.createChannel(h,r)}}var Ad={createChannels(){return new Sd},createConnectionManager(h,r){return new kd(h,r)},createChannel(h,r){return new ps(h,r)},createPrivateChannel(h,r){return new vs(h,r)},createPresenceChannel(h,r){return new yd(h,r)},createEncryptedChannel(h,r,u){return new wd(h,r,u)},createTimelineSender(h,r){return new bd(h,r)},createHandshake(h,r){return new vd(h,r)},createAssistantToTheTransportManager(h,r,u){return new md(h,r,u)}},Sn=Ad;class Ca{constructor(r){this.options=r||{},this.livesLeft=this.options.lives||1/0}getAssistant(r){return Sn.createAssistantToTheTransportManager(this,r,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Yn{constructor(r,u){this.strategies=r,this.loop=!!u.loop,this.failFast=!!u.failFast,this.timeout=u.timeout,this.timeoutLimit=u.timeoutLimit}isSupported(){return Bt(this.strategies,me.method("isSupported"))}connect(r,u){var y=this.strategies,S=0,T=this.timeout,I=null,B=(V,$)=>{$?u(null,$):(S=S+1,this.loop&&(S=S%y.length),S<y.length?(T&&(T=T*2,this.timeoutLimit&&(T=Math.min(T,this.timeoutLimit))),I=this.tryStrategy(y[S],r,{timeout:T,failFast:this.failFast},B)):u(!0))};return I=this.tryStrategy(y[S],r,{timeout:T,failFast:this.failFast},B),{abort:function(){I.abort()},forceMinPriority:function(V){r=V,I&&I.forceMinPriority(V)}}}tryStrategy(r,u,y,S){var T=null,I=null;return y.timeout>0&&(T=new je(y.timeout,function(){I.abort(),S(!0)})),I=r.connect(u,function(B,V){B&&T&&T.isRunning()&&!y.failFast||(T&&T.ensureAborted(),S(B,V))}),{abort:function(){T&&T.ensureAborted(),I.abort()},forceMinPriority:function(B){I.forceMinPriority(B)}}}}class fs{constructor(r){this.strategies=r}isSupported(){return Bt(this.strategies,me.method("isSupported"))}connect(r,u){return Md(this.strategies,r,function(y,S){return function(T,I){if(S[y].error=T,T){Ld(S)&&u(!0);return}ye(S,function(B){B.forceMinPriority(I.transport.priority)}),u(null,I)}})}}function Md(h,r,u){var y=te(h,function(S,T,I,B){return S.connect(r,u(T,B))});return{abort:function(){ye(y,Td)},forceMinPriority:function(S){ye(y,function(T){T.forceMinPriority(S)})}}}function Ld(h){return mi(h,function(r){return!!r.error})}function Td(h){!h.error&&!h.aborted&&(h.abort(),h.aborted=!0)}class _d{constructor(r,u,y){this.strategy=r,this.transports=u,this.ttl=y.ttl||1800*1e3,this.usingTLS=y.useTLS,this.timeline=y.timeline}isSupported(){return this.strategy.isSupported()}connect(r,u){var y=this.usingTLS,S=Ed(y),T=S&&S.cacheSkipCount?S.cacheSkipCount:0,I=[this.strategy];if(S&&S.timestamp+this.ttl>=me.now()){var B=this.transports[S.transport];B&&(["ws","wss"].includes(S.transport)||T>3?(this.timeline.info({cached:!0,transport:S.transport,latency:S.latency}),I.push(new Yn([B],{timeout:S.latency*2+1e3,failFast:!0}))):T++)}var V=me.now(),$=I.pop().connect(r,function ie(we,Bi){we?(wa(y),I.length>0?(V=me.now(),$=I.pop().connect(r,ie)):u(we)):(Pd(y,Bi.transport.name,me.now()-V,T),u(null,Bi))});return{abort:function(){$.abort()},forceMinPriority:function(ie){r=ie,$&&$.forceMinPriority(ie)}}}}function gs(h){return"pusherTransport"+(h?"TLS":"NonTLS")}function Ed(h){var r=F.getLocalStorage();if(r)try{var u=r[gs(h)];if(u)return JSON.parse(u)}catch{wa(h)}return null}function Pd(h,r,u,y){var S=F.getLocalStorage();if(S)try{S[gs(h)]=Zn({timestamp:me.now(),transport:r,latency:u,cacheSkipCount:y})}catch{}}function wa(h){var r=F.getLocalStorage();if(r)try{delete r[gs(h)]}catch{}}class Ii{constructor(r,{delay:u}){this.strategy=r,this.options={delay:u}}isSupported(){return this.strategy.isSupported()}connect(r,u){var y=this.strategy,S,T=new je(this.options.delay,function(){S=y.connect(r,u)});return{abort:function(){T.ensureAborted(),S&&S.abort()},forceMinPriority:function(I){r=I,S&&S.forceMinPriority(I)}}}}class Ht{constructor(r,u,y){this.test=r,this.trueBranch=u,this.falseBranch=y}isSupported(){var r=this.test()?this.trueBranch:this.falseBranch;return r.isSupported()}connect(r,u){var y=this.test()?this.trueBranch:this.falseBranch;return y.connect(r,u)}}class Id{constructor(r){this.strategy=r}isSupported(){return this.strategy.isSupported()}connect(r,u){var y=this.strategy.connect(r,function(S,T){T&&y.abort(),u(S,T)});return y}}function Nt(h){return function(){return h.isSupported()}}var Dd=function(h,r,u){var y={};function S(Ia,Iu,Du,Bu,Ru){var Da=u(h,Ia,Iu,Du,Bu,Ru);return y[Ia]=Da,Da}var T=Object.assign({},r,{hostNonTLS:h.wsHost+":"+h.wsPort,hostTLS:h.wsHost+":"+h.wssPort,httpPath:h.wsPath}),I=Object.assign({},T,{useTLS:!0}),B=Object.assign({},r,{hostNonTLS:h.httpHost+":"+h.httpPort,hostTLS:h.httpHost+":"+h.httpsPort,httpPath:h.httpPath}),V={loop:!0,timeout:15e3,timeoutLimit:6e4},$=new Ca({minPingDelay:1e4,maxPingDelay:h.activityTimeout}),ie=new Ca({lives:2,minPingDelay:1e4,maxPingDelay:h.activityTimeout}),we=S("ws","ws",3,T,$),Bi=S("wss","ws",3,I,$),Lu=S("sockjs","sockjs",1,B),Ma=S("xhr_streaming","xhr_streaming",1,B,ie),Tu=S("xdr_streaming","xdr_streaming",1,B,ie),La=S("xhr_polling","xhr_polling",1,B),_u=S("xdr_polling","xdr_polling",1,B),Ta=new Yn([we],V),Eu=new Yn([Bi],V),Pu=new Yn([Lu],V),_a=new Yn([new Ht(Nt(Ma),Ma,Tu)],V),Ea=new Yn([new Ht(Nt(La),La,_u)],V),Pa=new Yn([new Ht(Nt(_a),new fs([_a,new Ii(Ea,{delay:4e3})]),Ea)],V),ks=new Ht(Nt(Pa),Pa,Pu),Ss;return r.useTLS?Ss=new fs([Ta,new Ii(ks,{delay:2e3})]):Ss=new fs([Ta,new Ii(Eu,{delay:2e3}),new Ii(ks,{delay:5e3})]),new _d(new Id(new Ht(Nt(we),Ss,ks)),y,{ttl:18e5,timeline:r.timeline,useTLS:r.useTLS})},Bd=Dd,Rd=function(){var h=this;h.timeline.info(h.buildTimelineMessage({transport:h.name+(h.options.useTLS?"s":"")})),h.hooks.isInitialized()?h.changeState("initialized"):h.hooks.file?(h.changeState("initializing"),g.load(h.hooks.file,{useTLS:h.options.useTLS},function(r,u){h.hooks.isInitialized()?(h.changeState("initialized"),u(!0)):(r&&h.onError(r),h.onClose(),u(!1))})):h.onClose()},Hd={getRequest:function(h){var r=new window.XDomainRequest;return r.ontimeout=function(){h.emit("error",new A),h.close()},r.onerror=function(u){h.emit("error",u),h.close()},r.onprogress=function(){r.responseText&&r.responseText.length>0&&h.onChunk(200,r.responseText)},r.onload=function(){r.responseText&&r.responseText.length>0&&h.onChunk(200,r.responseText),h.emit("finished",200),h.close()},r},abortRequest:function(h){h.ontimeout=h.onerror=h.onprogress=h.onload=null,h.abort()}},Nd=Hd;const Od=256*1024;class Ud extends Je{constructor(r,u,y){super(),this.hooks=r,this.method=u,this.url=y}start(r){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},F.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(r)}close(){this.unloader&&(F.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(r,u){for(;;){var y=this.advanceBuffer(u);if(y)this.emit("chunk",{status:r,data:y});else break}this.isBufferTooLong(u)&&this.emit("buffer_too_long")}advanceBuffer(r){var u=r.slice(this.position),y=u.indexOf(`
|
|
1668
|
-
`);return y!==-1?(this.position+=y+1,u.slice(0,y)):null}isBufferTooLong(r){return this.position===r.length&&r.length>Od}}var ys;(function(h){h[h.CONNECTING=0]="CONNECTING",h[h.OPEN=1]="OPEN",h[h.CLOSED=3]="CLOSED"})(ys||(ys={}));var Xn=ys,Vd=1;class Fd{constructor(r,u){this.hooks=r,this.session=Sa(1e3)+"/"+zd(8),this.location=Kd(u),this.readyState=Xn.CONNECTING,this.openStream()}send(r){return this.sendRaw(JSON.stringify([r]))}ping(){this.hooks.sendHeartbeat(this)}close(r,u){this.onClose(r,u,!0)}sendRaw(r){if(this.readyState===Xn.OPEN)try{return F.createSocketRequest("POST",ka(Gd(this.location,this.session))).start(r),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(r,u,y){this.closeStream(),this.readyState=Xn.CLOSED,this.onclose&&this.onclose({code:r,reason:u,wasClean:y})}onChunk(r){if(r.status===200){this.readyState===Xn.OPEN&&this.onActivity();var u,y=r.data.slice(0,1);switch(y){case"o":u=JSON.parse(r.data.slice(1)||"{}"),this.onOpen(u);break;case"a":u=JSON.parse(r.data.slice(1)||"[]");for(var S=0;S<u.length;S++)this.onEvent(u[S]);break;case"m":u=JSON.parse(r.data.slice(1)||"null"),this.onEvent(u);break;case"h":this.hooks.onHeartbeat(this);break;case"c":u=JSON.parse(r.data.slice(1)||"[]"),this.onClose(u[0],u[1],!0);break}}}onOpen(r){this.readyState===Xn.CONNECTING?(r&&r.hostname&&(this.location.base=jd(this.location.base,r.hostname)),this.readyState=Xn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(r){this.readyState===Xn.OPEN&&this.onmessage&&this.onmessage({data:r})}onActivity(){this.onactivity&&this.onactivity()}onError(r){this.onerror&&this.onerror(r)}openStream(){this.stream=F.createSocketRequest("POST",ka(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",r=>{this.onChunk(r)}),this.stream.bind("finished",r=>{this.hooks.onFinished(this,r)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(r){me.defer(()=>{this.onError(r),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Kd(h){var r=/([^\?]*)\/*(\??.*)/.exec(h);return{base:r[1],queryString:r[2]}}function Gd(h,r){return h.base+"/"+r+"/xhr_send"}function ka(h){var r=h.indexOf("?")===-1?"?":"&";return h+r+"t="+ +new Date+"&n="+Vd++}function jd(h,r){var u=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(h);return u[1]+r+u[3]}function Sa(h){return F.randomInt(h)}function zd(h){for(var r=[],u=0;u<h;u++)r.push(Sa(32).toString(32));return r.join("")}var qd=Fd,Wd={getReceiveURL:function(h,r){return h.base+"/"+r+"/xhr_streaming"+h.queryString},onHeartbeat:function(h){h.sendRaw("[]")},sendHeartbeat:function(h){h.sendRaw("[]")},onFinished:function(h,r){h.onClose(1006,"Connection interrupted ("+r+")",!1)}},Zd=Wd,Qd={getReceiveURL:function(h,r){return h.base+"/"+r+"/xhr"+h.queryString},onHeartbeat:function(){},sendHeartbeat:function(h){h.sendRaw("[]")},onFinished:function(h,r){r===200?h.reconnect():h.onClose(1006,"Connection interrupted ("+r+")",!1)}},Jd=Qd,Yd={getRequest:function(h){var r=F.getXHRAPI(),u=new r;return u.onreadystatechange=u.onprogress=function(){switch(u.readyState){case 3:u.responseText&&u.responseText.length>0&&h.onChunk(u.status,u.responseText);break;case 4:u.responseText&&u.responseText.length>0&&h.onChunk(u.status,u.responseText),h.emit("finished",u.status),h.close();break}},u},abortRequest:function(h){h.onreadystatechange=null,h.abort()}},Xd=Yd,$d={createStreamingSocket(h){return this.createSocket(Zd,h)},createPollingSocket(h){return this.createSocket(Jd,h)},createSocket(h,r){return new qd(h,r)},createXHR(h,r){return this.createRequest(Xd,h,r)},createRequest(h,r,u){return new Ud(h,r,u)}},xa=$d;xa.createXDR=function(h,r){return this.createRequest(Nd,h,r)};var eu=xa,nu={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:a,DependenciesReceivers:m,getDefaultStrategy:Bd,Transports:dd,transportConnectionInitializer:Rd,HTTPFactory:eu,TimelineTransport:xi,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(h){window.Pusher=h;var r=()=>{this.onDocumentBody(h.ready)};window.JSON?r():g.load("json2",{},r)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:de,jsonp:yi}},onDocumentBody(h){document.body?h():setTimeout(()=>{this.onDocumentBody(h)},0)},createJSONPRequest(h,r){return new wi(h,r)},createScriptRequest(h){return new Ci(h)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var h=this.getXHRAPI();return new h},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return hd},createWebSocket(h){var r=this.getWebSocketAPI();return new r(h)},createSocketRequest(h,r){if(this.isXHRSupported())return this.HTTPFactory.createXHR(h,r);if(this.isXDRSupported(r.indexOf("https:")===0))return this.HTTPFactory.createXDR(h,r);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var h=this.getXHRAPI();return!!h&&new h().withCredentials!==void 0},isXDRSupported(h){var r=h?"https:":"http:",u=this.getProtocol();return!!window.XDomainRequest&&u===r},addUnloadListener(h){window.addEventListener!==void 0?window.addEventListener("unload",h,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",h)},removeUnloadListener(h){window.addEventListener!==void 0?window.removeEventListener("unload",h,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",h)},randomInt(h){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*h)}},F=nu,Cs;(function(h){h[h.ERROR=3]="ERROR",h[h.INFO=6]="INFO",h[h.DEBUG=7]="DEBUG"})(Cs||(Cs={}));var Di=Cs;class tu{constructor(r,u,y){this.key=r,this.session=u,this.events=[],this.options=y||{},this.sent=0,this.uniqueID=0}log(r,u){r<=this.options.level&&(this.events.push(Se({},u,{timestamp:me.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(r){this.log(Di.ERROR,r)}info(r){this.log(Di.INFO,r)}debug(r){this.log(Di.DEBUG,r)}isEmpty(){return this.events.length===0}send(r,u){var y=Se({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],r(y,(S,T)=>{S||this.sent++,u&&u(S,T)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class iu{constructor(r,u,y,S){this.name=r,this.priority=u,this.transport=y,this.options=S||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(r,u){if(this.isSupported()){if(this.priority<r)return Aa(new M,u)}else return Aa(new Q,u);var y=!1,S=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),T=null,I=function(){S.unbind("initialized",I),S.connect()},B=function(){T=Sn.createHandshake(S,function(we){y=!0,ie(),u(null,we)})},V=function(we){ie(),u(we)},$=function(){ie();var we;we=Zn(S),u(new E(we))},ie=function(){S.unbind("initialized",I),S.unbind("open",B),S.unbind("error",V),S.unbind("closed",$)};return S.bind("initialized",I),S.bind("open",B),S.bind("error",V),S.bind("closed",$),S.initialize(),{abort:()=>{y||(ie(),T?T.close():S.close())},forceMinPriority:we=>{y||this.priority<we&&(T?T.close():S.close())}}}}function Aa(h,r){return me.defer(function(){r(h)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:su}=F;var ou=function(h,r,u,y,S,T){var I=su[u];if(!I)throw new q(u);var B=(!h.enabledTransports||ze(h.enabledTransports,r)!==-1)&&(!h.disabledTransports||ze(h.disabledTransports,r)===-1),V;return B?(S=Object.assign({ignoreNullOrigin:h.ignoreNullOrigin},S),V=new iu(r,y,T?T.getAssistant(I):I,S)):V=au,V},au={isSupported:function(){return!1},connect:function(h,r){var u=me.defer(function(){r(new Q)});return{abort:function(){u.ensureAborted()},forceMinPriority:function(){}}}};function ru(h){if(h==null)throw"You must pass an options object";if(h.cluster==null)throw"Options object must provide a cluster";"disableStats"in h&&re.warn("The disableStats option is deprecated in favor of enableStats")}const lu=(h,r)=>{var u="socket_id="+encodeURIComponent(h.socketId);for(var y in r.params)u+="&"+encodeURIComponent(y)+"="+encodeURIComponent(r.params[y]);if(r.paramsProvider!=null){let S=r.paramsProvider();for(var y in S)u+="&"+encodeURIComponent(y)+"="+encodeURIComponent(S[y])}return u};var cu=h=>{if(typeof F.getAuthorizers()[h.transport]>"u")throw`'${h.transport}' is not a recognized auth transport`;return(r,u)=>{const y=lu(r,h);F.getAuthorizers()[h.transport](F,y,h,C.UserAuthentication,u)}};const du=(h,r)=>{var u="socket_id="+encodeURIComponent(h.socketId);u+="&channel_name="+encodeURIComponent(h.channelName);for(var y in r.params)u+="&"+encodeURIComponent(y)+"="+encodeURIComponent(r.params[y]);if(r.paramsProvider!=null){let S=r.paramsProvider();for(var y in S)u+="&"+encodeURIComponent(y)+"="+encodeURIComponent(S[y])}return u};var uu=h=>{if(typeof F.getAuthorizers()[h.transport]>"u")throw`'${h.transport}' is not a recognized auth transport`;return(r,u)=>{const y=du(r,h);F.getAuthorizers()[h.transport](F,y,h,C.ChannelAuthorization,u)}};const hu=(h,r,u)=>{const y={authTransport:r.transport,authEndpoint:r.endpoint,auth:{params:r.params,headers:r.headers}};return(S,T)=>{const I=h.channel(S.channelName);u(I,y).authorize(S.socketId,T)}};function mu(h,r){let u={activityTimeout:h.activityTimeout||c.activityTimeout,cluster:h.cluster,httpPath:h.httpPath||c.httpPath,httpPort:h.httpPort||c.httpPort,httpsPort:h.httpsPort||c.httpsPort,pongTimeout:h.pongTimeout||c.pongTimeout,statsHost:h.statsHost||c.stats_host,unavailableTimeout:h.unavailableTimeout||c.unavailableTimeout,wsPath:h.wsPath||c.wsPath,wsPort:h.wsPort||c.wsPort,wssPort:h.wssPort||c.wssPort,enableStats:gu(h),httpHost:pu(h),useTLS:fu(h),wsHost:vu(h),userAuthenticator:yu(h),channelAuthorizer:wu(h,r)};return"disabledTransports"in h&&(u.disabledTransports=h.disabledTransports),"enabledTransports"in h&&(u.enabledTransports=h.enabledTransports),"ignoreNullOrigin"in h&&(u.ignoreNullOrigin=h.ignoreNullOrigin),"timelineParams"in h&&(u.timelineParams=h.timelineParams),"nacl"in h&&(u.nacl=h.nacl),u}function pu(h){return h.httpHost?h.httpHost:h.cluster?`sockjs-${h.cluster}.pusher.com`:c.httpHost}function vu(h){return h.wsHost?h.wsHost:bu(h.cluster)}function bu(h){return`ws-${h}.pusher.com`}function fu(h){return F.getProtocol()==="https:"?!0:h.forceTLS!==!1}function gu(h){return"enableStats"in h?h.enableStats:"disableStats"in h?!h.disableStats:!1}function yu(h){const r=Object.assign(Object.assign({},c.userAuthentication),h.userAuthentication);return"customHandler"in r&&r.customHandler!=null?r.customHandler:cu(r)}function Cu(h,r){let u;return"channelAuthorization"in h?u=Object.assign(Object.assign({},c.channelAuthorization),h.channelAuthorization):(u={transport:h.authTransport||c.authTransport,endpoint:h.authEndpoint||c.authEndpoint},"auth"in h&&("params"in h.auth&&(u.params=h.auth.params),"headers"in h.auth&&(u.headers=h.auth.headers)),"authorizer"in h&&(u.customHandler=hu(r,u,h.authorizer))),u}function wu(h,r){const u=Cu(h,r);return"customHandler"in u&&u.customHandler!=null?u.customHandler:uu(u)}class ku extends Je{constructor(r){super(function(u,y){re.debug(`No callbacks on watchlist events for ${u}`)}),this.pusher=r,this.bindWatchlistInternalEvent()}handleEvent(r){r.data.events.forEach(u=>{this.emit(u.name,u)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",r=>{var u=r.event;u==="pusher_internal:watchlist_events"&&this.handleEvent(r)})}}function Su(){let h,r;return{promise:new Promise((y,S)=>{h=y,r=S}),resolve:h,reject:r}}var xu=Su;class Au extends Je{constructor(r){super(function(u,y){re.debug("No callbacks on user for "+u)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(u,y)=>{if(u){re.warn(`Error during signin: ${u}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:y.auth,user_data:y.user_data})},this.pusher=r,this.pusher.connection.bind("state_change",({previous:u,current:y})=>{u!=="connected"&&y==="connected"&&this._signin(),u==="connected"&&y!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new ku(r),this.pusher.connection.bind("message",u=>{var y=u.event;y==="pusher:signin_success"&&this._onSigninSuccess(u.data),this.serverToUserChannel&&this.serverToUserChannel.name===u.channel&&this.serverToUserChannel.handleEvent(u)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(r){try{this.user_data=JSON.parse(r.user_data)}catch{re.error(`Failed parsing user data after signin: ${r.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){re.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const r=u=>{u.subscriptionPending&&u.subscriptionCancelled?u.reinstateSubscription():!u.subscriptionPending&&this.pusher.connection.state==="connected"&&u.subscribe()};this.serverToUserChannel=new ps(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((u,y)=>{u.indexOf("pusher_internal:")===0||u.indexOf("pusher:")===0||this.emit(u,y)}),r(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:r,resolve:u,reject:y}=xu();r.done=!1;const S=()=>{r.done=!0};r.then(S).catch(S),this.signinDonePromise=r,this._signinDoneResolve=u}}class _e{static ready(){_e.isReady=!0;for(var r=0,u=_e.instances.length;r<u;r++)_e.instances[r].connect()}static getClientFeatures(){return hn(ne({ws:F.Transports.ws},function(r){return r.isSupported({})}))}constructor(r,u){Mu(r),ru(u),this.key=r,this.config=mu(u,this),this.channels=Sn.createChannels(),this.global_emitter=new Je,this.sessionID=F.randomInt(1e9),this.timeline=new tu(this.key,this.sessionID,{cluster:this.config.cluster,features:_e.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Di.INFO,version:c.VERSION}),this.config.enableStats&&(this.timelineSender=Sn.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+F.TimelineTransport.name}));var y=S=>F.getDefaultStrategy(this.config,S,ou);this.connection=Sn.createConnectionManager(this.key,{getStrategy:y,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",S=>{var T=S.event,I=T.indexOf("pusher_internal:")===0;if(S.channel){var B=this.channel(S.channel);B&&B.handleEvent(S)}I||this.global_emitter.emit(S.event,S.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",S=>{re.warn(S)}),_e.instances.push(this),this.timeline.info({instances:_e.instances.length}),this.user=new Au(this),_e.isReady&&this.connect()}channel(r){return this.channels.find(r)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var r=this.connection.isUsingTLS(),u=this.timelineSender;this.timelineSenderTimer=new wn(6e4,function(){u.send(r)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(r,u,y){return this.global_emitter.bind(r,u,y),this}unbind(r,u,y){return this.global_emitter.unbind(r,u,y),this}bind_global(r){return this.global_emitter.bind_global(r),this}unbind_global(r){return this.global_emitter.unbind_global(r),this}unbind_all(r){return this.global_emitter.unbind_all(),this}subscribeAll(){var r;for(r in this.channels.channels)this.channels.channels.hasOwnProperty(r)&&this.subscribe(r)}subscribe(r){var u=this.channels.add(r,this);return u.subscriptionPending&&u.subscriptionCancelled?u.reinstateSubscription():!u.subscriptionPending&&this.connection.state==="connected"&&u.subscribe(),u}unsubscribe(r){var u=this.channels.find(r);u&&u.subscriptionPending?u.cancelSubscription():(u=this.channels.remove(r),u&&u.subscribed&&u.unsubscribe())}send_event(r,u,y){return this.connection.send_event(r,u,y)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}_e.instances=[],_e.isReady=!1,_e.logToConsole=!1,_e.Runtime=F,_e.ScriptReceivers=F.ScriptReceivers,_e.DependenciesReceivers=F.DependenciesReceivers,_e.auth_callbacks=F.auth_callbacks;var ws=i.default=_e;function Mu(h){if(h==null)throw"You must pass your app key when you instantiate Pusher."}F.setup(_e)}])})})(la);var fc=la.exports;const gc=bc(fc);class ca{constructor(e){d(this,"container");d(this,"onAction");d(this,"onFail");d(this,"initialTime");d(this,"timeLeft");d(this,"timerId");d(this,"payment");this.container=e.container,this.onAction=e.onAction,this.onFail=e.onFail,this.initialTime=1800,this.timeLeft=this.initialTime,this.timerId=null}attachListener(){const e=this.container.querySelector("#transfer-acn"),t=this.container.querySelector("#transfer-bank"),i=this.container.querySelector("#copy-acn"),s=this.container.querySelector("#acn-tooltip"),o=this.container.querySelector("#transfer-amount"),a=this.container.querySelector("#copy-amount"),l=this.container.querySelector("#amount-tooltip"),c=this.container.querySelector("#transfer-button"),p=this.container.querySelector("#transfer-header-text"),m=this.container.querySelector("#bank-name-text"),g=this.container.querySelector("#beneficiary-text"),f=this.container.querySelector("#amount-text"),b=this.container.querySelectorAll(".copy-text"),w=this.container.querySelector("#account-number-text"),C=this.container.querySelector("#expiration-text");p&&(p.innerHTML=Ve["transfer-header"]),f&&(f.innerHTML=j.amount),b.forEach(k=>{k.innerHTML=P.copy}),w&&(w.innerHTML=Ve["account-number"]),m&&(m.innerHTML=Ve["bank-name"]),g&&(g.innerHTML=Ve.beneficiary),C&&(C.innerHTML=Ve["expiration-text"]),i&&e&&i.addEventListener("click",()=>{s&&(t&&_.track("copy_transferBank",{payment_method:"Transfer",payment_process:"Payment Started",account_number:e.innerHTML,bank_name:t.innerHTML}),this.copyToClipboard(e.innerHTML,s))}),a&&o&&a.addEventListener("click",()=>{l&&(_.track("copy_transferAmount",{payment_method:"Transfer",amount:o.innerHTML.split(" ")[1].replace(/,/g,"")}),this.copyToClipboard(o.innerHTML.split(" ")[1].replace(/,/g,""),l))}),c&&(c.innerHTML=Ve["made-transfer"],c.addEventListener("click",()=>{this.onAction(5),_.track("initiate_payment_verification",{payment_method:"Transfer"})}))}startTimer(e){this.stopTimer(),this.timerId=window.setInterval(()=>{if(this.timeLeft>0){this.timeLeft-=1;const t=this.container.querySelector("#time-left");t&&(t.innerHTML=tt(this.timeLeft))}else this.stopTimer(),e==="check"&&this.onAction(2)},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}copyToClipboard(e,t){navigator.clipboard.writeText(e).then(()=>{t.innerHTML=P.copied}).catch(()=>{t.innerHTML=P["copy-fail"]})}renderComponent(e){var g,f,b,w,C,k;e&&(this.payment=e),this.container.innerHTML=this.render();const t=this.container.querySelector("#transfer-amount"),i=this.container.querySelector("#transfer-bank"),s=this.container.querySelector("#account-name"),o=this.container.querySelector("#transfer-acn"),a=this.container.querySelector("#time-left"),l=((g=this.payment)==null?void 0:g.currency)||"USD",c=l==="USD"?(f=this.payment)==null?void 0:f.localCurrency:l;if(t&&(t.innerHTML=`${c} ${Me(this.payment.totalTaxAmount?this.payment.totalLocalAmount:l==="USD"?(b=this.payment)==null?void 0:b.localAmount:(w=this.payment)==null?void 0:w.amount,2)}`),i&&this.payment.bankDetails&&(i.innerHTML=(C=this.payment.bankDetails)==null?void 0:C.bankName),s&&this.payment.bankDetails&&(s.innerHTML=(k=this.payment.bankDetails)==null?void 0:k.accountName),o&&this.payment.bankDetails&&(o.innerHTML=this.payment.bankDetails.accountNumber),a&&(a.innerHTML=tt(this.initialTime)),this.startTimer("poll"),e.status==="inProgress"){const x="45654f3ce4c9512ea9a4",A="us2";var p=new gc(x,{cluster:A}),m=p.subscribe(e.reference);m.bind("payment_status",M=>{M.status==="successful"?(clearInterval(this.timerId||void 0),this.onAction(6),_.track("verify_payment",{payment_method:"Transfer",verification_status:"Success"}),M!=null&&M.redirectUrl&&setTimeout(()=>{const E=new URL(M.redirectUrl);E.searchParams.append("status",M.status),E.searchParams.append("reference",M.reference),window.location.href=E.toString()},1800)):M.status==="failed"&&(clearInterval(this.timerId||void 0),this.onFail(7,"Transfer failed"),_.track("verify_payment",{payment_method:"Transfer",verification_status:"Failed"}))})}this.attachListener()}render(){return vc}}const yc=`<div id="trasferConfirmationProgress" data-section="transfer">
|
|
1667
|
+
*/(function(n,e){(function(i,s){n.exports=s()})(window,function(){return function(t){var i={};function s(o){if(i[o])return i[o].exports;var a=i[o]={i:o,l:!1,exports:{}};return t[o].call(a.exports,a,a.exports,s),a.l=!0,a.exports}return s.m=t,s.c=i,s.d=function(o,a,l){s.o(o,a)||Object.defineProperty(o,a,{enumerable:!0,get:l})},s.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},s.t=function(o,a){if(a&1&&(o=s(o)),a&8||a&4&&typeof o=="object"&&o&&o.__esModule)return o;var l=Object.create(null);if(s.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:o}),a&2&&typeof o!="string")for(var c in o)s.d(l,c,(function(p){return o[p]}).bind(null,c));return l},s.n=function(o){var a=o&&o.__esModule?function(){return o.default}:function(){return o};return s.d(a,"a",a),a},s.o=function(o,a){return Object.prototype.hasOwnProperty.call(o,a)},s.p="",s(s.s=2)}([function(t,i,s){var o=this&&this.__extends||function(){var C=function(k,x){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,M){A.__proto__=M}||function(A,M){for(var P in M)M.hasOwnProperty(P)&&(A[P]=M[P])},C(k,x)};return function(k,x){C(k,x);function A(){this.constructor=k}k.prototype=x===null?Object.create(x):(A.prototype=x.prototype,new A)}}();Object.defineProperty(i,"__esModule",{value:!0});var a=256,l=function(){function C(k){k===void 0&&(k="="),this._paddingCharacter=k}return C.prototype.encodedLength=function(k){return this._paddingCharacter?(k+2)/3*4|0:(k*8+5)/6|0},C.prototype.encode=function(k){for(var x="",A=0;A<k.length-2;A+=3){var M=k[A]<<16|k[A+1]<<8|k[A+2];x+=this._encodeByte(M>>>3*6&63),x+=this._encodeByte(M>>>2*6&63),x+=this._encodeByte(M>>>1*6&63),x+=this._encodeByte(M>>>0*6&63)}var P=k.length-A;if(P>0){var M=k[A]<<16|(P===2?k[A+1]<<8:0);x+=this._encodeByte(M>>>3*6&63),x+=this._encodeByte(M>>>2*6&63),P===2?x+=this._encodeByte(M>>>1*6&63):x+=this._paddingCharacter||"",x+=this._paddingCharacter||""}return x},C.prototype.maxDecodedLength=function(k){return this._paddingCharacter?k/4*3|0:(k*6+7)/8|0},C.prototype.decodedLength=function(k){return this.maxDecodedLength(k.length-this._getPaddingLength(k))},C.prototype.decode=function(k){if(k.length===0)return new Uint8Array(0);for(var x=this._getPaddingLength(k),A=k.length-x,M=new Uint8Array(this.maxDecodedLength(A)),P=0,D=0,q=0,Q=0,K=0,W=0,de=0;D<A-4;D+=4)Q=this._decodeChar(k.charCodeAt(D+0)),K=this._decodeChar(k.charCodeAt(D+1)),W=this._decodeChar(k.charCodeAt(D+2)),de=this._decodeChar(k.charCodeAt(D+3)),M[P++]=Q<<2|K>>>4,M[P++]=K<<4|W>>>2,M[P++]=W<<6|de,q|=Q&a,q|=K&a,q|=W&a,q|=de&a;if(D<A-1&&(Q=this._decodeChar(k.charCodeAt(D)),K=this._decodeChar(k.charCodeAt(D+1)),M[P++]=Q<<2|K>>>4,q|=Q&a,q|=K&a),D<A-2&&(W=this._decodeChar(k.charCodeAt(D+2)),M[P++]=K<<4|W>>>2,q|=W&a),D<A-3&&(de=this._decodeChar(k.charCodeAt(D+3)),M[P++]=W<<6|de,q|=de&a),q!==0)throw new Error("Base64Coder: incorrect characters for decoding");return M},C.prototype._encodeByte=function(k){var x=k;return x+=65,x+=25-k>>>8&6,x+=51-k>>>8&-75,x+=61-k>>>8&-15,x+=62-k>>>8&3,String.fromCharCode(x)},C.prototype._decodeChar=function(k){var x=a;return x+=(42-k&k-44)>>>8&-a+k-43+62,x+=(46-k&k-48)>>>8&-a+k-47+63,x+=(47-k&k-58)>>>8&-a+k-48+52,x+=(64-k&k-91)>>>8&-a+k-65+0,x+=(96-k&k-123)>>>8&-a+k-97+26,x},C.prototype._getPaddingLength=function(k){var x=0;if(this._paddingCharacter){for(var A=k.length-1;A>=0&&k[A]===this._paddingCharacter;A--)x++;if(k.length<4||x>2)throw new Error("Base64Coder: incorrect padding")}return x},C}();i.Coder=l;var c=new l;function p(C){return c.encode(C)}i.encode=p;function m(C){return c.decode(C)}i.decode=m;var g=function(C){o(k,C);function k(){return C!==null&&C.apply(this,arguments)||this}return k.prototype._encodeByte=function(x){var A=x;return A+=65,A+=25-x>>>8&6,A+=51-x>>>8&-75,A+=61-x>>>8&-13,A+=62-x>>>8&49,String.fromCharCode(A)},k.prototype._decodeChar=function(x){var A=a;return A+=(44-x&x-46)>>>8&-a+x-45+62,A+=(94-x&x-96)>>>8&-a+x-95+63,A+=(47-x&x-58)>>>8&-a+x-48+52,A+=(64-x&x-91)>>>8&-a+x-65+0,A+=(96-x&x-123)>>>8&-a+x-97+26,A},k}(l);i.URLSafeCoder=g;var f=new g;function b(C){return f.encode(C)}i.encodeURLSafe=b;function w(C){return f.decode(C)}i.decodeURLSafe=w,i.encodedLength=function(C){return c.encodedLength(C)},i.maxDecodedLength=function(C){return c.maxDecodedLength(C)},i.decodedLength=function(C){return c.decodedLength(C)}},function(t,i,s){Object.defineProperty(i,"__esModule",{value:!0});var o="utf8: invalid string",a="utf8: invalid source encoding";function l(m){for(var g=new Uint8Array(c(m)),f=0,b=0;b<m.length;b++){var w=m.charCodeAt(b);w<128?g[f++]=w:w<2048?(g[f++]=192|w>>6,g[f++]=128|w&63):w<55296?(g[f++]=224|w>>12,g[f++]=128|w>>6&63,g[f++]=128|w&63):(b++,w=(w&1023)<<10,w|=m.charCodeAt(b)&1023,w+=65536,g[f++]=240|w>>18,g[f++]=128|w>>12&63,g[f++]=128|w>>6&63,g[f++]=128|w&63)}return g}i.encode=l;function c(m){for(var g=0,f=0;f<m.length;f++){var b=m.charCodeAt(f);if(b<128)g+=1;else if(b<2048)g+=2;else if(b<55296)g+=3;else if(b<=57343){if(f>=m.length-1)throw new Error(o);f++,g+=4}else throw new Error(o)}return g}i.encodedLength=c;function p(m){for(var g=[],f=0;f<m.length;f++){var b=m[f];if(b&128){var w=void 0;if(b<224){if(f>=m.length)throw new Error(a);var C=m[++f];if((C&192)!==128)throw new Error(a);b=(b&31)<<6|C&63,w=128}else if(b<240){if(f>=m.length-1)throw new Error(a);var C=m[++f],k=m[++f];if((C&192)!==128||(k&192)!==128)throw new Error(a);b=(b&15)<<12|(C&63)<<6|k&63,w=2048}else if(b<248){if(f>=m.length-2)throw new Error(a);var C=m[++f],k=m[++f],x=m[++f];if((C&192)!==128||(k&192)!==128||(x&192)!==128)throw new Error(a);b=(b&15)<<18|(C&63)<<12|(k&63)<<6|x&63,w=65536}else throw new Error(a);if(b<w||b>=55296&&b<=57343)throw new Error(a);if(b>=65536){if(b>1114111)throw new Error(a);b-=65536,g.push(String.fromCharCode(55296|b>>10)),b=56320|b&1023}}g.push(String.fromCharCode(b))}return g.join("")}i.decode=p},function(t,i,s){t.exports=s(3).default},function(t,i,s){s.r(i);class o{constructor(r,u){this.lastId=0,this.prefix=r,this.name=u}create(r){this.lastId++;var u=this.lastId,y=this.prefix+u,S=this.name+"["+u+"]",T=!1,I=function(){T||(r.apply(null,arguments),T=!0)};return this[u]=I,{number:u,id:y,name:S,callback:I}}remove(r){delete this[r.number]}}var a=new o("_pusher_script_","Pusher.ScriptReceivers"),l={VERSION:"8.4.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""},c=l;class p{constructor(r){this.options=r,this.receivers=r.receivers||a,this.loading={}}load(r,u,y){var S=this;if(S.loading[r]&&S.loading[r].length>0)S.loading[r].push(y);else{S.loading[r]=[y];var T=F.createScriptRequest(S.getPath(r,u)),I=S.receivers.create(function(B){if(S.receivers.remove(I),S.loading[r]){var V=S.loading[r];delete S.loading[r];for(var $=function(we){we||T.cleanup()},ie=0;ie<V.length;ie++)V[ie](B,$)}});T.send(I)}}getRoot(r){var u,y=F.getDocument().location.protocol;return r&&r.useTLS||y==="https:"?u=this.options.cdn_https:u=this.options.cdn_http,u.replace(/\/*$/,"")+"/"+this.options.version}getPath(r,u){return this.getRoot(u)+"/"+r+this.options.suffix+".js"}}var m=new o("_pusher_dependencies","Pusher.DependenciesReceivers"),g=new p({cdn_http:c.cdn_http,cdn_https:c.cdn_https,version:c.VERSION,suffix:c.dependency_suffix,receivers:m});const f={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}};var w={buildLogSuffix:function(h){const r="See:",u=f.urls[h];if(!u)return"";let y;return u.fullUrl?y=u.fullUrl:u.path&&(y=f.baseUrl+u.path),y?`${r} ${y}`:""}},C;(function(h){h.UserAuthentication="user-authentication",h.ChannelAuthorization="channel-authorization"})(C||(C={}));class k extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class x extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class A extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class P extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class D extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class q extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class Q extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class K extends Error{constructor(r,u){super(u),this.status=r,Object.setPrototypeOf(this,new.target.prototype)}}var de=function(h,r,u,y,S){const T=F.createXHR();T.open("POST",u.endpoint,!0),T.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var I in u.headers)T.setRequestHeader(I,u.headers[I]);if(u.headersProvider!=null){let B=u.headersProvider();for(var I in B)T.setRequestHeader(I,B[I])}return T.onreadystatechange=function(){if(T.readyState===4)if(T.status===200){let B,V=!1;try{B=JSON.parse(T.responseText),V=!0}catch{S(new K(200,`JSON returned from ${y.toString()} endpoint was invalid, yet status code was 200. Data was: ${T.responseText}`),null)}V&&S(null,B)}else{let B="";switch(y){case C.UserAuthentication:B=w.buildLogSuffix("authenticationEndpoint");break;case C.ChannelAuthorization:B=`Clients must be authorized to join private or presence channels. ${w.buildLogSuffix("authorizationEndpoint")}`;break}S(new K(T.status,`Unable to retrieve auth string from ${y.toString()} endpoint - received status: ${T.status} from ${u.endpoint}. ${B}`),null)}},T.send(r),T};function Le(h){return yn(Ge(h))}var G=String.fromCharCode,Oe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ge=function(h){var r=h.charCodeAt(0);return r<128?h:r<2048?G(192|r>>>6)+G(128|r&63):G(224|r>>>12&15)+G(128|r>>>6&63)+G(128|r&63)},Ge=function(h){return h.replace(/[^\x00-\x7F]/g,ge)},Te=function(h){var r=[0,2,1][h.length%3],u=h.charCodeAt(0)<<16|(h.length>1?h.charCodeAt(1):0)<<8|(h.length>2?h.charCodeAt(2):0),y=[Oe.charAt(u>>>18),Oe.charAt(u>>>12&63),r>=2?"=":Oe.charAt(u>>>6&63),r>=1?"=":Oe.charAt(u&63)];return y.join("")},yn=window.btoa||function(h){return h.replace(/[\s\S]{1,3}/g,Te)};class un{constructor(r,u,y,S){this.clear=u,this.timer=r(()=>{this.timer&&(this.timer=S(this.timer))},y)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var Cn=un;function qn(h){window.clearTimeout(h)}function Hn(h){window.clearInterval(h)}class je extends Cn{constructor(r,u){super(setTimeout,qn,r,function(y){return u(),null})}}class wn extends Cn{constructor(r,u){super(setInterval,Hn,r,function(y){return u(),y})}}var Wn={now(){return Date.now?Date.now():new Date().valueOf()},defer(h){return new je(0,h)},method(h,...r){var u=Array.prototype.slice.call(arguments,1);return function(y){return y[h].apply(y,u.concat(arguments))}}},me=Wn;function Se(h,...r){for(var u=0;u<r.length;u++){var y=r[u];for(var S in y)y[S]&&y[S].constructor&&y[S].constructor===Object?h[S]=Se(h[S]||{},y[S]):h[S]=y[S]}return h}function Qe(){for(var h=["Pusher"],r=0;r<arguments.length;r++)typeof arguments[r]=="string"?h.push(arguments[r]):h.push(Zn(arguments[r]));return h.join(" : ")}function ze(h,r){var u=Array.prototype.indexOf;if(h===null)return-1;if(u&&h.indexOf===u)return h.indexOf(r);for(var y=0,S=h.length;y<S;y++)if(h[y]===r)return y;return-1}function Ie(h,r){for(var u in h)Object.prototype.hasOwnProperty.call(h,u)&&r(h[u],u,h)}function hn(h){var r=[];return Ie(h,function(u,y){r.push(y)}),r}function H(h){var r=[];return Ie(h,function(u){r.push(u)}),r}function ye(h,r,u){for(var y=0;y<h.length;y++)r.call(u||window,h[y],y,h)}function te(h,r){for(var u=[],y=0;y<h.length;y++)u.push(r(h[y],y,h,u));return u}function Ce(h,r){var u={};return Ie(h,function(y,S){u[S]=r(y)}),u}function qe(h,r){r=r||function(S){return!!S};for(var u=[],y=0;y<h.length;y++)r(h[y],y,h,u)&&u.push(h[y]);return u}function ne(h,r){var u={};return Ie(h,function(y,S){(r&&r(y,S,h,u)||y)&&(u[S]=y)}),u}function Nn(h){var r=[];return Ie(h,function(u,y){r.push([y,u])}),r}function Bt(h,r){for(var u=0;u<h.length;u++)if(r(h[u],u,h))return!0;return!1}function mi(h,r){for(var u=0;u<h.length;u++)if(!r(h[u],u,h))return!1;return!0}function pi(h){return Ce(h,function(r){return typeof r=="object"&&(r=Zn(r)),encodeURIComponent(Le(r.toString()))})}function vi(h){var r=ne(h,function(y){return y!==void 0}),u=te(Nn(pi(r)),me.method("join","=")).join("&");return u}function bi(h){var r=[],u=[];return function y(S,T){var I,B,V;switch(typeof S){case"object":if(!S)return null;for(I=0;I<r.length;I+=1)if(r[I]===S)return{$ref:u[I]};if(r.push(S),u.push(T),Object.prototype.toString.apply(S)==="[object Array]")for(V=[],I=0;I<S.length;I+=1)V[I]=y(S[I],T+"["+I+"]");else{V={};for(B in S)Object.prototype.hasOwnProperty.call(S,B)&&(V[B]=y(S[B],T+"["+JSON.stringify(B)+"]"))}return V;case"number":case"string":case"boolean":return S}}(h,"$")}function Zn(h){try{return JSON.stringify(h)}catch{return JSON.stringify(bi(h))}}class fi{constructor(){this.globalLog=r=>{window.console&&window.console.log&&window.console.log(r)}}debug(...r){this.log(this.globalLog,r)}warn(...r){this.log(this.globalLogWarn,r)}error(...r){this.log(this.globalLogError,r)}globalLogWarn(r){window.console&&window.console.warn?window.console.warn(r):this.globalLog(r)}globalLogError(r){window.console&&window.console.error?window.console.error(r):this.globalLogWarn(r)}log(r,...u){var y=Qe.apply(this,arguments);ws.log?ws.log(y):ws.logToConsole&&r.bind(this)(y)}}var re=new fi,gi=function(h,r,u,y,S){(u.headers!==void 0||u.headersProvider!=null)&&re.warn(`To send headers with the ${y.toString()} request, you must use AJAX, rather than JSONP.`);var T=h.nextAuthCallbackID.toString();h.nextAuthCallbackID++;var I=h.getDocument(),B=I.createElement("script");h.auth_callbacks[T]=function(ie){S(null,ie)};var V="Pusher.auth_callbacks['"+T+"']";B.src=u.endpoint+"?callback="+encodeURIComponent(V)+"&"+r;var $=I.getElementsByTagName("head")[0]||I.documentElement;$.insertBefore(B,$.firstChild)},yi=gi;class Ci{constructor(r){this.src=r}send(r){var u=this,y="Error loading "+u.src;u.script=document.createElement("script"),u.script.id=r.id,u.script.src=u.src,u.script.type="text/javascript",u.script.charset="UTF-8",u.script.addEventListener?(u.script.onerror=function(){r.callback(y)},u.script.onload=function(){r.callback(null)}):u.script.onreadystatechange=function(){(u.script.readyState==="loaded"||u.script.readyState==="complete")&&r.callback(null)},u.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(u.errorScript=document.createElement("script"),u.errorScript.id=r.id+"_error",u.errorScript.text=r.name+"('"+y+"');",u.script.async=u.errorScript.async=!1):u.script.async=!0;var S=document.getElementsByTagName("head")[0];S.insertBefore(u.script,S.firstChild),u.errorScript&&S.insertBefore(u.errorScript,u.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class wi{constructor(r,u){this.url=r,this.data=u}send(r){if(!this.request){var u=vi(this.data),y=this.url+"/"+r.number+"?"+u;this.request=F.createScriptRequest(y),this.request.send(r)}}cleanup(){this.request&&this.request.cleanup()}}var ki=function(h,r){return function(u,y){var S="http"+(r?"s":"")+"://",T=S+(h.host||h.options.host)+h.options.path,I=F.createJSONPRequest(T,u),B=F.ScriptReceivers.create(function(V,$){a.remove(B),I.cleanup(),$&&$.host&&(h.host=$.host),y&&y(V,$)});I.send(B)}},Si={name:"jsonp",getAgent:ki},xi=Si;function ft(h,r,u){var y=h+(r.useTLS?"s":""),S=r.useTLS?r.hostTLS:r.hostNonTLS;return y+"://"+S+u}function gt(h,r){var u="/app/"+h,y="?protocol="+c.PROTOCOL+"&client=js&version="+c.VERSION+(r?"&"+r:"");return u+y}var Ai={getInitial:function(h,r){var u=(r.httpPath||"")+gt(h,"flash=false");return ft("ws",r,u)}},Mi={getInitial:function(h,r){var u=(r.httpPath||"/pusher")+gt(h);return ft("http",r,u)}},Li={getInitial:function(h,r){return ft("http",r,r.httpPath||"/pusher")},getPath:function(h,r){return gt(h)}};class Ti{constructor(){this._callbacks={}}get(r){return this._callbacks[yt(r)]}add(r,u,y){var S=yt(r);this._callbacks[S]=this._callbacks[S]||[],this._callbacks[S].push({fn:u,context:y})}remove(r,u,y){if(!r&&!u&&!y){this._callbacks={};return}var S=r?[yt(r)]:hn(this._callbacks);u||y?this.removeCallback(S,u,y):this.removeAllCallbacks(S)}removeCallback(r,u,y){ye(r,function(S){this._callbacks[S]=qe(this._callbacks[S]||[],function(T){return u&&u!==T.fn||y&&y!==T.context}),this._callbacks[S].length===0&&delete this._callbacks[S]},this)}removeAllCallbacks(r){ye(r,function(u){delete this._callbacks[u]},this)}}function yt(h){return"_"+h}class Je{constructor(r){this.callbacks=new Ti,this.global_callbacks=[],this.failThrough=r}bind(r,u,y){return this.callbacks.add(r,u,y),this}bind_global(r){return this.global_callbacks.push(r),this}unbind(r,u,y){return this.callbacks.remove(r,u,y),this}unbind_global(r){return r?(this.global_callbacks=qe(this.global_callbacks||[],u=>u!==r),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(r,u,y){for(var S=0;S<this.global_callbacks.length;S++)this.global_callbacks[S](r,u);var T=this.callbacks.get(r),I=[];if(y?I.push(u,y):u&&I.push(u),T&&T.length>0)for(var S=0;S<T.length;S++)T[S].fn.apply(T[S].context||window,I);else this.failThrough&&this.failThrough(r,u);return this}}class _i extends Je{constructor(r,u,y,S,T){super(),this.initialize=F.transportConnectionInitializer,this.hooks=r,this.name=u,this.priority=y,this.key=S,this.options=T,this.state="new",this.timeline=T.timeline,this.activityTimeout=T.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var r=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(r,this.options)}catch(u){return me.defer(()=>{this.onError(u),this.changeState("closed")}),!1}return this.bindListeners(),re.debug("Connecting",{transport:this.name,url:r}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(r){return this.state==="open"?(me.defer(()=>{this.socket&&this.socket.send(r)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(r){this.emit("error",{type:"WebSocketError",error:r}),this.timeline.error(this.buildTimelineMessage({error:r.toString()}))}onClose(r){r?this.changeState("closed",{code:r.code,reason:r.reason,wasClean:r.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(r){this.emit("message",r)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=r=>{this.onError(r)},this.socket.onclose=r=>{this.onClose(r)},this.socket.onmessage=r=>{this.onMessage(r)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(r,u){this.state=r,this.timeline.info(this.buildTimelineMessage({state:r,params:u})),this.emit(r,u)}buildTimelineMessage(r){return Se({cid:this.id},r)}}class kn{constructor(r){this.hooks=r}isSupported(r){return this.hooks.isSupported(r)}createConnection(r,u,y,S){return new _i(this.hooks,r,u,y,S)}}var Ei=new kn({urls:Ai,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!F.getWebSocketAPI()},isSupported:function(){return!!F.getWebSocketAPI()},getSocket:function(h){return F.createWebSocket(h)}}),Rt={urls:Mi,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},an=Se({getSocket:function(h){return F.HTTPFactory.createStreamingSocket(h)}},Rt),On=Se({getSocket:function(h){return F.HTTPFactory.createPollingSocket(h)}},Rt),Un={isSupported:function(){return F.isXHRSupported()}},Ye=new kn(Se({},an,Un)),Qn=new kn(Se({},On,Un)),Pi={ws:Ei,xhr_streaming:Ye,xhr_polling:Qn},Ct=Pi,rd=new kn({file:"sockjs",urls:Li,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(h,r){return new window.SockJS(h,null,{js_path:g.getPath("sockjs",{useTLS:r.useTLS}),ignore_null_origin:r.ignoreNullOrigin})},beforeOpen:function(h,r){h.send(JSON.stringify({path:r}))}}),ga={isSupported:function(h){var r=F.isXDRSupported(h.useTLS);return r}},ld=new kn(Se({},an,ga)),cd=new kn(Se({},On,ga));Ct.xdr_streaming=ld,Ct.xdr_polling=cd,Ct.sockjs=rd;var dd=Ct;class ud extends Je{constructor(){super();var r=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){r.emit("online")},!1),window.addEventListener("offline",function(){r.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var hd=new ud;class md{constructor(r,u,y){this.manager=r,this.transport=u,this.minPingDelay=y.minPingDelay,this.maxPingDelay=y.maxPingDelay,this.pingDelay=void 0}createConnection(r,u,y,S){S=Se({},S,{activityTimeout:this.pingDelay});var T=this.transport.createConnection(r,u,y,S),I=null,B=function(){T.unbind("open",B),T.bind("closed",V),I=me.now()},V=$=>{if(T.unbind("closed",V),$.code===1002||$.code===1003)this.manager.reportDeath();else if(!$.wasClean&&I){var ie=me.now()-I;ie<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(ie/2,this.minPingDelay))}};return T.bind("open",B),T}isSupported(r){return this.manager.isAlive()&&this.transport.isSupported(r)}}const ya={decodeMessage:function(h){try{var r=JSON.parse(h.data),u=r.data;if(typeof u=="string")try{u=JSON.parse(r.data)}catch{}var y={event:r.event,channel:r.channel,data:u};return r.user_id&&(y.user_id=r.user_id),y}catch(S){throw{type:"MessageParseError",error:S,data:h.data}}},encodeMessage:function(h){return JSON.stringify(h)},processHandshake:function(h){var r=ya.decodeMessage(h);if(r.event==="pusher:connection_established"){if(!r.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:r.data.socket_id,activityTimeout:r.data.activity_timeout*1e3}}else{if(r.event==="pusher:error")return{action:this.getCloseAction(r.data),error:this.getCloseError(r.data)};throw"Invalid handshake"}},getCloseAction:function(h){return h.code<4e3?h.code>=1002&&h.code<=1004?"backoff":null:h.code===4e3?"tls_only":h.code<4100?"refused":h.code<4200?"backoff":h.code<4300?"retry":"refused"},getCloseError:function(h){return h.code!==1e3&&h.code!==1001?{type:"PusherError",data:{code:h.code,message:h.reason||h.message}}:null}};var Jn=ya;class pd extends Je{constructor(r,u){super(),this.id=r,this.transport=u,this.activityTimeout=u.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(r){return this.transport.send(r)}send_event(r,u,y){var S={event:r,data:u};return y&&(S.channel=y),re.debug("Event sent",S),this.send(Jn.encodeMessage(S))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var r={message:y=>{var S;try{S=Jn.decodeMessage(y)}catch(T){this.emit("error",{type:"MessageParseError",error:T,data:y.data})}if(S!==void 0){switch(re.debug("Event recd",S),S.event){case"pusher:error":this.emit("error",{type:"PusherError",data:S.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",S)}},activity:()=>{this.emit("activity")},error:y=>{this.emit("error",y)},closed:y=>{u(),y&&y.code&&this.handleCloseEvent(y),this.transport=null,this.emit("closed")}},u=()=>{Ie(r,(y,S)=>{this.transport.unbind(S,y)})};Ie(r,(y,S)=>{this.transport.bind(S,y)})}handleCloseEvent(r){var u=Jn.getCloseAction(r),y=Jn.getCloseError(r);y&&this.emit("error",y),u&&this.emit(u,{action:u,error:y})}}class vd{constructor(r,u){this.transport=r,this.callback=u,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=r=>{this.unbindListeners();var u;try{u=Jn.processHandshake(r)}catch(y){this.finish("error",{error:y}),this.transport.close();return}u.action==="connected"?this.finish("connected",{connection:new pd(u.id,this.transport),activityTimeout:u.activityTimeout}):(this.finish(u.action,{error:u.error}),this.transport.close())},this.onClosed=r=>{this.unbindListeners();var u=Jn.getCloseAction(r)||"backoff",y=Jn.getCloseError(r);this.finish(u,{error:y})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(r,u){this.callback(Se({transport:this.transport,action:r},u))}}class bd{constructor(r,u){this.timeline=r,this.options=u||{}}send(r,u){this.timeline.isEmpty()||this.timeline.send(F.TimelineTransport.getAgent(this,r),u)}}class ps extends Je{constructor(r,u){super(function(y,S){re.debug("No callbacks on "+r+" for "+y)}),this.name=r,this.pusher=u,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(r,u){return u(null,{auth:""})}trigger(r,u){if(r.indexOf("client-")!==0)throw new k("Event '"+r+"' does not start with 'client-'");if(!this.subscribed){var y=w.buildLogSuffix("triggeringClientEvents");re.warn(`Client event triggered before channel 'subscription_succeeded' event . ${y}`)}return this.pusher.send_event(r,u,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(r){var u=r.event,y=r.data;if(u==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(r);else if(u==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(r);else if(u.indexOf("pusher_internal:")!==0){var S={};this.emit(u,y,S)}}handleSubscriptionSucceededEvent(r){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",r.data)}handleSubscriptionCountEvent(r){r.data.subscription_count&&(this.subscriptionCount=r.data.subscription_count),this.emit("pusher:subscription_count",r.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(r,u)=>{r?(this.subscriptionPending=!1,re.error(r.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:r.message},r instanceof K?{status:r.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:u.auth,channel_data:u.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class vs extends ps{authorize(r,u){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:r},u)}}class fd{constructor(){this.reset()}get(r){return Object.prototype.hasOwnProperty.call(this.members,r)?{id:r,info:this.members[r]}:null}each(r){Ie(this.members,(u,y)=>{r(this.get(y))})}setMyID(r){this.myID=r}onSubscription(r){this.members=r.presence.hash,this.count=r.presence.count,this.me=this.get(this.myID)}addMember(r){return this.get(r.user_id)===null&&this.count++,this.members[r.user_id]=r.user_info,this.get(r.user_id)}removeMember(r){var u=this.get(r.user_id);return u&&(delete this.members[r.user_id],this.count--),u}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var gd=function(h,r,u,y){function S(T){return T instanceof u?T:new u(function(I){I(T)})}return new(u||(u=Promise))(function(T,I){function B(ie){try{$(y.next(ie))}catch(we){I(we)}}function V(ie){try{$(y.throw(ie))}catch(we){I(we)}}function $(ie){ie.done?T(ie.value):S(ie.value).then(B,V)}$((y=y.apply(h,r||[])).next())})};class yd extends vs{constructor(r,u){super(r,u),this.members=new fd}authorize(r,u){super.authorize(r,(y,S)=>gd(this,void 0,void 0,function*(){if(!y)if(S=S,S.channel_data!=null){var T=JSON.parse(S.channel_data);this.members.setMyID(T.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let I=w.buildLogSuffix("authorizationEndpoint");re.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${I}, or the user should be signed in.`),u("Invalid auth response");return}u(y,S)}))}handleEvent(r){var u=r.event;if(u.indexOf("pusher_internal:")===0)this.handleInternalEvent(r);else{var y=r.data,S={};r.user_id&&(S.user_id=r.user_id),this.emit(u,y,S)}}handleInternalEvent(r){var u=r.event,y=r.data;switch(u){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(r);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(r);break;case"pusher_internal:member_added":var S=this.members.addMember(y);this.emit("pusher:member_added",S);break;case"pusher_internal:member_removed":var T=this.members.removeMember(y);T&&this.emit("pusher:member_removed",T);break}}handleSubscriptionSucceededEvent(r){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(r.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Cd=s(1),bs=s(0);class wd extends vs{constructor(r,u,y){super(r,u),this.key=null,this.nacl=y}authorize(r,u){super.authorize(r,(y,S)=>{if(y){u(y,S);return}let T=S.shared_secret;if(!T){u(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(bs.decode)(T),delete S.shared_secret,u(null,S)})}trigger(r,u){throw new D("Client events are not currently supported for encrypted channels")}handleEvent(r){var u=r.event,y=r.data;if(u.indexOf("pusher_internal:")===0||u.indexOf("pusher:")===0){super.handleEvent(r);return}this.handleEncryptedEvent(u,y)}handleEncryptedEvent(r,u){if(!this.key){re.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!u.ciphertext||!u.nonce){re.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+u);return}let y=Object(bs.decode)(u.ciphertext);if(y.length<this.nacl.secretbox.overheadLength){re.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${y.length}`);return}let S=Object(bs.decode)(u.nonce);if(S.length<this.nacl.secretbox.nonceLength){re.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${S.length}`);return}let T=this.nacl.secretbox.open(y,S,this.key);if(T===null){re.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(I,B)=>{if(I){re.error(`Failed to make a request to the authEndpoint: ${B}. Unable to fetch new key, so dropping encrypted event`);return}if(T=this.nacl.secretbox.open(y,S,this.key),T===null){re.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(r,this.getDataToEmit(T))});return}this.emit(r,this.getDataToEmit(T))}getDataToEmit(r){let u=Object(Cd.decode)(r);try{return JSON.parse(u)}catch{return u}}}class kd extends Je{constructor(r,u){super(),this.state="initialized",this.connection=null,this.key=r,this.options=u,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var y=F.getNetwork();y.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),y.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(r){return this.connection?this.connection.send(r):!1}send_event(r,u,y){return this.connection?this.connection.send_event(r,u,y):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var r=(u,y)=>{u?this.runner=this.strategy.connect(0,r):y.action==="error"?(this.emit("error",{type:"HandshakeError",error:y.error}),this.timeline.error({handshakeError:y.error})):(this.abortConnecting(),this.handshakeCallbacks[y.action](y))};this.runner=this.strategy.connect(0,r)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var r=this.abandonConnection();r.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(r){this.timeline.info({action:"retry",delay:r}),r>0&&this.emit("connecting_in",Math.round(r/1e3)),this.retryTimer=new je(r||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new je(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new je(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new je(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(r){return Se({},r,{message:u=>{this.resetActivityCheck(),this.emit("message",u)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:u=>{this.emit("error",u)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(r){return Se({},r,{connected:u=>{this.activityTimeout=Math.min(this.options.activityTimeout,u.activityTimeout,u.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(u.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let r=u=>y=>{y.error&&this.emit("error",{type:"WebSocketError",error:y.error}),u(y)};return{tls_only:r(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:r(()=>{this.disconnect()}),backoff:r(()=>{this.retryIn(1e3)}),retry:r(()=>{this.retryIn(0)})}}setConnection(r){this.connection=r;for(var u in this.connectionCallbacks)this.connection.bind(u,this.connectionCallbacks[u]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var r in this.connectionCallbacks)this.connection.unbind(r,this.connectionCallbacks[r]);var u=this.connection;return this.connection=null,u}}updateState(r,u){var y=this.state;if(this.state=r,y!==r){var S=r;S==="connected"&&(S+=" with new socket ID "+u.socket_id),re.debug("State changed",y+" -> "+S),this.timeline.info({state:r,params:u}),this.emit("state_change",{previous:y,current:r}),this.emit(r,u)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class Sd{constructor(){this.channels={}}add(r,u){return this.channels[r]||(this.channels[r]=xd(r,u)),this.channels[r]}all(){return H(this.channels)}find(r){return this.channels[r]}remove(r){var u=this.channels[r];return delete this.channels[r],u}disconnect(){Ie(this.channels,function(r){r.disconnect()})}}function xd(h,r){if(h.indexOf("private-encrypted-")===0){if(r.config.nacl)return Sn.createEncryptedChannel(h,r,r.config.nacl);let u="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",y=w.buildLogSuffix("encryptedChannelSupport");throw new D(`${u}. ${y}`)}else{if(h.indexOf("private-")===0)return Sn.createPrivateChannel(h,r);if(h.indexOf("presence-")===0)return Sn.createPresenceChannel(h,r);if(h.indexOf("#")===0)throw new x('Cannot create a channel with name "'+h+'".');return Sn.createChannel(h,r)}}var Ad={createChannels(){return new Sd},createConnectionManager(h,r){return new kd(h,r)},createChannel(h,r){return new ps(h,r)},createPrivateChannel(h,r){return new vs(h,r)},createPresenceChannel(h,r){return new yd(h,r)},createEncryptedChannel(h,r,u){return new wd(h,r,u)},createTimelineSender(h,r){return new bd(h,r)},createHandshake(h,r){return new vd(h,r)},createAssistantToTheTransportManager(h,r,u){return new md(h,r,u)}},Sn=Ad;class Ca{constructor(r){this.options=r||{},this.livesLeft=this.options.lives||1/0}getAssistant(r){return Sn.createAssistantToTheTransportManager(this,r,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Yn{constructor(r,u){this.strategies=r,this.loop=!!u.loop,this.failFast=!!u.failFast,this.timeout=u.timeout,this.timeoutLimit=u.timeoutLimit}isSupported(){return Bt(this.strategies,me.method("isSupported"))}connect(r,u){var y=this.strategies,S=0,T=this.timeout,I=null,B=(V,$)=>{$?u(null,$):(S=S+1,this.loop&&(S=S%y.length),S<y.length?(T&&(T=T*2,this.timeoutLimit&&(T=Math.min(T,this.timeoutLimit))),I=this.tryStrategy(y[S],r,{timeout:T,failFast:this.failFast},B)):u(!0))};return I=this.tryStrategy(y[S],r,{timeout:T,failFast:this.failFast},B),{abort:function(){I.abort()},forceMinPriority:function(V){r=V,I&&I.forceMinPriority(V)}}}tryStrategy(r,u,y,S){var T=null,I=null;return y.timeout>0&&(T=new je(y.timeout,function(){I.abort(),S(!0)})),I=r.connect(u,function(B,V){B&&T&&T.isRunning()&&!y.failFast||(T&&T.ensureAborted(),S(B,V))}),{abort:function(){T&&T.ensureAborted(),I.abort()},forceMinPriority:function(B){I.forceMinPriority(B)}}}}class fs{constructor(r){this.strategies=r}isSupported(){return Bt(this.strategies,me.method("isSupported"))}connect(r,u){return Md(this.strategies,r,function(y,S){return function(T,I){if(S[y].error=T,T){Ld(S)&&u(!0);return}ye(S,function(B){B.forceMinPriority(I.transport.priority)}),u(null,I)}})}}function Md(h,r,u){var y=te(h,function(S,T,I,B){return S.connect(r,u(T,B))});return{abort:function(){ye(y,Td)},forceMinPriority:function(S){ye(y,function(T){T.forceMinPriority(S)})}}}function Ld(h){return mi(h,function(r){return!!r.error})}function Td(h){!h.error&&!h.aborted&&(h.abort(),h.aborted=!0)}class _d{constructor(r,u,y){this.strategy=r,this.transports=u,this.ttl=y.ttl||1800*1e3,this.usingTLS=y.useTLS,this.timeline=y.timeline}isSupported(){return this.strategy.isSupported()}connect(r,u){var y=this.usingTLS,S=Ed(y),T=S&&S.cacheSkipCount?S.cacheSkipCount:0,I=[this.strategy];if(S&&S.timestamp+this.ttl>=me.now()){var B=this.transports[S.transport];B&&(["ws","wss"].includes(S.transport)||T>3?(this.timeline.info({cached:!0,transport:S.transport,latency:S.latency}),I.push(new Yn([B],{timeout:S.latency*2+1e3,failFast:!0}))):T++)}var V=me.now(),$=I.pop().connect(r,function ie(we,Bi){we?(wa(y),I.length>0?(V=me.now(),$=I.pop().connect(r,ie)):u(we)):(Pd(y,Bi.transport.name,me.now()-V,T),u(null,Bi))});return{abort:function(){$.abort()},forceMinPriority:function(ie){r=ie,$&&$.forceMinPriority(ie)}}}}function gs(h){return"pusherTransport"+(h?"TLS":"NonTLS")}function Ed(h){var r=F.getLocalStorage();if(r)try{var u=r[gs(h)];if(u)return JSON.parse(u)}catch{wa(h)}return null}function Pd(h,r,u,y){var S=F.getLocalStorage();if(S)try{S[gs(h)]=Zn({timestamp:me.now(),transport:r,latency:u,cacheSkipCount:y})}catch{}}function wa(h){var r=F.getLocalStorage();if(r)try{delete r[gs(h)]}catch{}}class Ii{constructor(r,{delay:u}){this.strategy=r,this.options={delay:u}}isSupported(){return this.strategy.isSupported()}connect(r,u){var y=this.strategy,S,T=new je(this.options.delay,function(){S=y.connect(r,u)});return{abort:function(){T.ensureAborted(),S&&S.abort()},forceMinPriority:function(I){r=I,S&&S.forceMinPriority(I)}}}}class Ht{constructor(r,u,y){this.test=r,this.trueBranch=u,this.falseBranch=y}isSupported(){var r=this.test()?this.trueBranch:this.falseBranch;return r.isSupported()}connect(r,u){var y=this.test()?this.trueBranch:this.falseBranch;return y.connect(r,u)}}class Id{constructor(r){this.strategy=r}isSupported(){return this.strategy.isSupported()}connect(r,u){var y=this.strategy.connect(r,function(S,T){T&&y.abort(),u(S,T)});return y}}function Nt(h){return function(){return h.isSupported()}}var Dd=function(h,r,u){var y={};function S(Ia,Iu,Du,Bu,Ru){var Da=u(h,Ia,Iu,Du,Bu,Ru);return y[Ia]=Da,Da}var T=Object.assign({},r,{hostNonTLS:h.wsHost+":"+h.wsPort,hostTLS:h.wsHost+":"+h.wssPort,httpPath:h.wsPath}),I=Object.assign({},T,{useTLS:!0}),B=Object.assign({},r,{hostNonTLS:h.httpHost+":"+h.httpPort,hostTLS:h.httpHost+":"+h.httpsPort,httpPath:h.httpPath}),V={loop:!0,timeout:15e3,timeoutLimit:6e4},$=new Ca({minPingDelay:1e4,maxPingDelay:h.activityTimeout}),ie=new Ca({lives:2,minPingDelay:1e4,maxPingDelay:h.activityTimeout}),we=S("ws","ws",3,T,$),Bi=S("wss","ws",3,I,$),Lu=S("sockjs","sockjs",1,B),Ma=S("xhr_streaming","xhr_streaming",1,B,ie),Tu=S("xdr_streaming","xdr_streaming",1,B,ie),La=S("xhr_polling","xhr_polling",1,B),_u=S("xdr_polling","xdr_polling",1,B),Ta=new Yn([we],V),Eu=new Yn([Bi],V),Pu=new Yn([Lu],V),_a=new Yn([new Ht(Nt(Ma),Ma,Tu)],V),Ea=new Yn([new Ht(Nt(La),La,_u)],V),Pa=new Yn([new Ht(Nt(_a),new fs([_a,new Ii(Ea,{delay:4e3})]),Ea)],V),ks=new Ht(Nt(Pa),Pa,Pu),Ss;return r.useTLS?Ss=new fs([Ta,new Ii(ks,{delay:2e3})]):Ss=new fs([Ta,new Ii(Eu,{delay:2e3}),new Ii(ks,{delay:5e3})]),new _d(new Id(new Ht(Nt(we),Ss,ks)),y,{ttl:18e5,timeline:r.timeline,useTLS:r.useTLS})},Bd=Dd,Rd=function(){var h=this;h.timeline.info(h.buildTimelineMessage({transport:h.name+(h.options.useTLS?"s":"")})),h.hooks.isInitialized()?h.changeState("initialized"):h.hooks.file?(h.changeState("initializing"),g.load(h.hooks.file,{useTLS:h.options.useTLS},function(r,u){h.hooks.isInitialized()?(h.changeState("initialized"),u(!0)):(r&&h.onError(r),h.onClose(),u(!1))})):h.onClose()},Hd={getRequest:function(h){var r=new window.XDomainRequest;return r.ontimeout=function(){h.emit("error",new A),h.close()},r.onerror=function(u){h.emit("error",u),h.close()},r.onprogress=function(){r.responseText&&r.responseText.length>0&&h.onChunk(200,r.responseText)},r.onload=function(){r.responseText&&r.responseText.length>0&&h.onChunk(200,r.responseText),h.emit("finished",200),h.close()},r},abortRequest:function(h){h.ontimeout=h.onerror=h.onprogress=h.onload=null,h.abort()}},Nd=Hd;const Od=256*1024;class Ud extends Je{constructor(r,u,y){super(),this.hooks=r,this.method=u,this.url=y}start(r){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},F.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(r)}close(){this.unloader&&(F.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(r,u){for(;;){var y=this.advanceBuffer(u);if(y)this.emit("chunk",{status:r,data:y});else break}this.isBufferTooLong(u)&&this.emit("buffer_too_long")}advanceBuffer(r){var u=r.slice(this.position),y=u.indexOf(`
|
|
1668
|
+
`);return y!==-1?(this.position+=y+1,u.slice(0,y)):null}isBufferTooLong(r){return this.position===r.length&&r.length>Od}}var ys;(function(h){h[h.CONNECTING=0]="CONNECTING",h[h.OPEN=1]="OPEN",h[h.CLOSED=3]="CLOSED"})(ys||(ys={}));var Xn=ys,Vd=1;class Fd{constructor(r,u){this.hooks=r,this.session=Sa(1e3)+"/"+zd(8),this.location=Kd(u),this.readyState=Xn.CONNECTING,this.openStream()}send(r){return this.sendRaw(JSON.stringify([r]))}ping(){this.hooks.sendHeartbeat(this)}close(r,u){this.onClose(r,u,!0)}sendRaw(r){if(this.readyState===Xn.OPEN)try{return F.createSocketRequest("POST",ka(Gd(this.location,this.session))).start(r),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(r,u,y){this.closeStream(),this.readyState=Xn.CLOSED,this.onclose&&this.onclose({code:r,reason:u,wasClean:y})}onChunk(r){if(r.status===200){this.readyState===Xn.OPEN&&this.onActivity();var u,y=r.data.slice(0,1);switch(y){case"o":u=JSON.parse(r.data.slice(1)||"{}"),this.onOpen(u);break;case"a":u=JSON.parse(r.data.slice(1)||"[]");for(var S=0;S<u.length;S++)this.onEvent(u[S]);break;case"m":u=JSON.parse(r.data.slice(1)||"null"),this.onEvent(u);break;case"h":this.hooks.onHeartbeat(this);break;case"c":u=JSON.parse(r.data.slice(1)||"[]"),this.onClose(u[0],u[1],!0);break}}}onOpen(r){this.readyState===Xn.CONNECTING?(r&&r.hostname&&(this.location.base=jd(this.location.base,r.hostname)),this.readyState=Xn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(r){this.readyState===Xn.OPEN&&this.onmessage&&this.onmessage({data:r})}onActivity(){this.onactivity&&this.onactivity()}onError(r){this.onerror&&this.onerror(r)}openStream(){this.stream=F.createSocketRequest("POST",ka(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",r=>{this.onChunk(r)}),this.stream.bind("finished",r=>{this.hooks.onFinished(this,r)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(r){me.defer(()=>{this.onError(r),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Kd(h){var r=/([^\?]*)\/*(\??.*)/.exec(h);return{base:r[1],queryString:r[2]}}function Gd(h,r){return h.base+"/"+r+"/xhr_send"}function ka(h){var r=h.indexOf("?")===-1?"?":"&";return h+r+"t="+ +new Date+"&n="+Vd++}function jd(h,r){var u=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(h);return u[1]+r+u[3]}function Sa(h){return F.randomInt(h)}function zd(h){for(var r=[],u=0;u<h;u++)r.push(Sa(32).toString(32));return r.join("")}var qd=Fd,Wd={getReceiveURL:function(h,r){return h.base+"/"+r+"/xhr_streaming"+h.queryString},onHeartbeat:function(h){h.sendRaw("[]")},sendHeartbeat:function(h){h.sendRaw("[]")},onFinished:function(h,r){h.onClose(1006,"Connection interrupted ("+r+")",!1)}},Zd=Wd,Qd={getReceiveURL:function(h,r){return h.base+"/"+r+"/xhr"+h.queryString},onHeartbeat:function(){},sendHeartbeat:function(h){h.sendRaw("[]")},onFinished:function(h,r){r===200?h.reconnect():h.onClose(1006,"Connection interrupted ("+r+")",!1)}},Jd=Qd,Yd={getRequest:function(h){var r=F.getXHRAPI(),u=new r;return u.onreadystatechange=u.onprogress=function(){switch(u.readyState){case 3:u.responseText&&u.responseText.length>0&&h.onChunk(u.status,u.responseText);break;case 4:u.responseText&&u.responseText.length>0&&h.onChunk(u.status,u.responseText),h.emit("finished",u.status),h.close();break}},u},abortRequest:function(h){h.onreadystatechange=null,h.abort()}},Xd=Yd,$d={createStreamingSocket(h){return this.createSocket(Zd,h)},createPollingSocket(h){return this.createSocket(Jd,h)},createSocket(h,r){return new qd(h,r)},createXHR(h,r){return this.createRequest(Xd,h,r)},createRequest(h,r,u){return new Ud(h,r,u)}},xa=$d;xa.createXDR=function(h,r){return this.createRequest(Nd,h,r)};var eu=xa,nu={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:a,DependenciesReceivers:m,getDefaultStrategy:Bd,Transports:dd,transportConnectionInitializer:Rd,HTTPFactory:eu,TimelineTransport:xi,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(h){window.Pusher=h;var r=()=>{this.onDocumentBody(h.ready)};window.JSON?r():g.load("json2",{},r)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:de,jsonp:yi}},onDocumentBody(h){document.body?h():setTimeout(()=>{this.onDocumentBody(h)},0)},createJSONPRequest(h,r){return new wi(h,r)},createScriptRequest(h){return new Ci(h)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var h=this.getXHRAPI();return new h},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return hd},createWebSocket(h){var r=this.getWebSocketAPI();return new r(h)},createSocketRequest(h,r){if(this.isXHRSupported())return this.HTTPFactory.createXHR(h,r);if(this.isXDRSupported(r.indexOf("https:")===0))return this.HTTPFactory.createXDR(h,r);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var h=this.getXHRAPI();return!!h&&new h().withCredentials!==void 0},isXDRSupported(h){var r=h?"https:":"http:",u=this.getProtocol();return!!window.XDomainRequest&&u===r},addUnloadListener(h){window.addEventListener!==void 0?window.addEventListener("unload",h,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",h)},removeUnloadListener(h){window.addEventListener!==void 0?window.removeEventListener("unload",h,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",h)},randomInt(h){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*h)}},F=nu,Cs;(function(h){h[h.ERROR=3]="ERROR",h[h.INFO=6]="INFO",h[h.DEBUG=7]="DEBUG"})(Cs||(Cs={}));var Di=Cs;class tu{constructor(r,u,y){this.key=r,this.session=u,this.events=[],this.options=y||{},this.sent=0,this.uniqueID=0}log(r,u){r<=this.options.level&&(this.events.push(Se({},u,{timestamp:me.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(r){this.log(Di.ERROR,r)}info(r){this.log(Di.INFO,r)}debug(r){this.log(Di.DEBUG,r)}isEmpty(){return this.events.length===0}send(r,u){var y=Se({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],r(y,(S,T)=>{S||this.sent++,u&&u(S,T)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class iu{constructor(r,u,y,S){this.name=r,this.priority=u,this.transport=y,this.options=S||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(r,u){if(this.isSupported()){if(this.priority<r)return Aa(new M,u)}else return Aa(new Q,u);var y=!1,S=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),T=null,I=function(){S.unbind("initialized",I),S.connect()},B=function(){T=Sn.createHandshake(S,function(we){y=!0,ie(),u(null,we)})},V=function(we){ie(),u(we)},$=function(){ie();var we;we=Zn(S),u(new P(we))},ie=function(){S.unbind("initialized",I),S.unbind("open",B),S.unbind("error",V),S.unbind("closed",$)};return S.bind("initialized",I),S.bind("open",B),S.bind("error",V),S.bind("closed",$),S.initialize(),{abort:()=>{y||(ie(),T?T.close():S.close())},forceMinPriority:we=>{y||this.priority<we&&(T?T.close():S.close())}}}}function Aa(h,r){return me.defer(function(){r(h)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:su}=F;var ou=function(h,r,u,y,S,T){var I=su[u];if(!I)throw new q(u);var B=(!h.enabledTransports||ze(h.enabledTransports,r)!==-1)&&(!h.disabledTransports||ze(h.disabledTransports,r)===-1),V;return B?(S=Object.assign({ignoreNullOrigin:h.ignoreNullOrigin},S),V=new iu(r,y,T?T.getAssistant(I):I,S)):V=au,V},au={isSupported:function(){return!1},connect:function(h,r){var u=me.defer(function(){r(new Q)});return{abort:function(){u.ensureAborted()},forceMinPriority:function(){}}}};function ru(h){if(h==null)throw"You must pass an options object";if(h.cluster==null)throw"Options object must provide a cluster";"disableStats"in h&&re.warn("The disableStats option is deprecated in favor of enableStats")}const lu=(h,r)=>{var u="socket_id="+encodeURIComponent(h.socketId);for(var y in r.params)u+="&"+encodeURIComponent(y)+"="+encodeURIComponent(r.params[y]);if(r.paramsProvider!=null){let S=r.paramsProvider();for(var y in S)u+="&"+encodeURIComponent(y)+"="+encodeURIComponent(S[y])}return u};var cu=h=>{if(typeof F.getAuthorizers()[h.transport]>"u")throw`'${h.transport}' is not a recognized auth transport`;return(r,u)=>{const y=lu(r,h);F.getAuthorizers()[h.transport](F,y,h,C.UserAuthentication,u)}};const du=(h,r)=>{var u="socket_id="+encodeURIComponent(h.socketId);u+="&channel_name="+encodeURIComponent(h.channelName);for(var y in r.params)u+="&"+encodeURIComponent(y)+"="+encodeURIComponent(r.params[y]);if(r.paramsProvider!=null){let S=r.paramsProvider();for(var y in S)u+="&"+encodeURIComponent(y)+"="+encodeURIComponent(S[y])}return u};var uu=h=>{if(typeof F.getAuthorizers()[h.transport]>"u")throw`'${h.transport}' is not a recognized auth transport`;return(r,u)=>{const y=du(r,h);F.getAuthorizers()[h.transport](F,y,h,C.ChannelAuthorization,u)}};const hu=(h,r,u)=>{const y={authTransport:r.transport,authEndpoint:r.endpoint,auth:{params:r.params,headers:r.headers}};return(S,T)=>{const I=h.channel(S.channelName);u(I,y).authorize(S.socketId,T)}};function mu(h,r){let u={activityTimeout:h.activityTimeout||c.activityTimeout,cluster:h.cluster,httpPath:h.httpPath||c.httpPath,httpPort:h.httpPort||c.httpPort,httpsPort:h.httpsPort||c.httpsPort,pongTimeout:h.pongTimeout||c.pongTimeout,statsHost:h.statsHost||c.stats_host,unavailableTimeout:h.unavailableTimeout||c.unavailableTimeout,wsPath:h.wsPath||c.wsPath,wsPort:h.wsPort||c.wsPort,wssPort:h.wssPort||c.wssPort,enableStats:gu(h),httpHost:pu(h),useTLS:fu(h),wsHost:vu(h),userAuthenticator:yu(h),channelAuthorizer:wu(h,r)};return"disabledTransports"in h&&(u.disabledTransports=h.disabledTransports),"enabledTransports"in h&&(u.enabledTransports=h.enabledTransports),"ignoreNullOrigin"in h&&(u.ignoreNullOrigin=h.ignoreNullOrigin),"timelineParams"in h&&(u.timelineParams=h.timelineParams),"nacl"in h&&(u.nacl=h.nacl),u}function pu(h){return h.httpHost?h.httpHost:h.cluster?`sockjs-${h.cluster}.pusher.com`:c.httpHost}function vu(h){return h.wsHost?h.wsHost:bu(h.cluster)}function bu(h){return`ws-${h}.pusher.com`}function fu(h){return F.getProtocol()==="https:"?!0:h.forceTLS!==!1}function gu(h){return"enableStats"in h?h.enableStats:"disableStats"in h?!h.disableStats:!1}function yu(h){const r=Object.assign(Object.assign({},c.userAuthentication),h.userAuthentication);return"customHandler"in r&&r.customHandler!=null?r.customHandler:cu(r)}function Cu(h,r){let u;return"channelAuthorization"in h?u=Object.assign(Object.assign({},c.channelAuthorization),h.channelAuthorization):(u={transport:h.authTransport||c.authTransport,endpoint:h.authEndpoint||c.authEndpoint},"auth"in h&&("params"in h.auth&&(u.params=h.auth.params),"headers"in h.auth&&(u.headers=h.auth.headers)),"authorizer"in h&&(u.customHandler=hu(r,u,h.authorizer))),u}function wu(h,r){const u=Cu(h,r);return"customHandler"in u&&u.customHandler!=null?u.customHandler:uu(u)}class ku extends Je{constructor(r){super(function(u,y){re.debug(`No callbacks on watchlist events for ${u}`)}),this.pusher=r,this.bindWatchlistInternalEvent()}handleEvent(r){r.data.events.forEach(u=>{this.emit(u.name,u)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",r=>{var u=r.event;u==="pusher_internal:watchlist_events"&&this.handleEvent(r)})}}function Su(){let h,r;return{promise:new Promise((y,S)=>{h=y,r=S}),resolve:h,reject:r}}var xu=Su;class Au extends Je{constructor(r){super(function(u,y){re.debug("No callbacks on user for "+u)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(u,y)=>{if(u){re.warn(`Error during signin: ${u}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:y.auth,user_data:y.user_data})},this.pusher=r,this.pusher.connection.bind("state_change",({previous:u,current:y})=>{u!=="connected"&&y==="connected"&&this._signin(),u==="connected"&&y!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new ku(r),this.pusher.connection.bind("message",u=>{var y=u.event;y==="pusher:signin_success"&&this._onSigninSuccess(u.data),this.serverToUserChannel&&this.serverToUserChannel.name===u.channel&&this.serverToUserChannel.handleEvent(u)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(r){try{this.user_data=JSON.parse(r.user_data)}catch{re.error(`Failed parsing user data after signin: ${r.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){re.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const r=u=>{u.subscriptionPending&&u.subscriptionCancelled?u.reinstateSubscription():!u.subscriptionPending&&this.pusher.connection.state==="connected"&&u.subscribe()};this.serverToUserChannel=new ps(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((u,y)=>{u.indexOf("pusher_internal:")===0||u.indexOf("pusher:")===0||this.emit(u,y)}),r(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:r,resolve:u,reject:y}=xu();r.done=!1;const S=()=>{r.done=!0};r.then(S).catch(S),this.signinDonePromise=r,this._signinDoneResolve=u}}class _e{static ready(){_e.isReady=!0;for(var r=0,u=_e.instances.length;r<u;r++)_e.instances[r].connect()}static getClientFeatures(){return hn(ne({ws:F.Transports.ws},function(r){return r.isSupported({})}))}constructor(r,u){Mu(r),ru(u),this.key=r,this.config=mu(u,this),this.channels=Sn.createChannels(),this.global_emitter=new Je,this.sessionID=F.randomInt(1e9),this.timeline=new tu(this.key,this.sessionID,{cluster:this.config.cluster,features:_e.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Di.INFO,version:c.VERSION}),this.config.enableStats&&(this.timelineSender=Sn.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+F.TimelineTransport.name}));var y=S=>F.getDefaultStrategy(this.config,S,ou);this.connection=Sn.createConnectionManager(this.key,{getStrategy:y,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",S=>{var T=S.event,I=T.indexOf("pusher_internal:")===0;if(S.channel){var B=this.channel(S.channel);B&&B.handleEvent(S)}I||this.global_emitter.emit(S.event,S.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",S=>{re.warn(S)}),_e.instances.push(this),this.timeline.info({instances:_e.instances.length}),this.user=new Au(this),_e.isReady&&this.connect()}channel(r){return this.channels.find(r)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var r=this.connection.isUsingTLS(),u=this.timelineSender;this.timelineSenderTimer=new wn(6e4,function(){u.send(r)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(r,u,y){return this.global_emitter.bind(r,u,y),this}unbind(r,u,y){return this.global_emitter.unbind(r,u,y),this}bind_global(r){return this.global_emitter.bind_global(r),this}unbind_global(r){return this.global_emitter.unbind_global(r),this}unbind_all(r){return this.global_emitter.unbind_all(),this}subscribeAll(){var r;for(r in this.channels.channels)this.channels.channels.hasOwnProperty(r)&&this.subscribe(r)}subscribe(r){var u=this.channels.add(r,this);return u.subscriptionPending&&u.subscriptionCancelled?u.reinstateSubscription():!u.subscriptionPending&&this.connection.state==="connected"&&u.subscribe(),u}unsubscribe(r){var u=this.channels.find(r);u&&u.subscriptionPending?u.cancelSubscription():(u=this.channels.remove(r),u&&u.subscribed&&u.unsubscribe())}send_event(r,u,y){return this.connection.send_event(r,u,y)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}_e.instances=[],_e.isReady=!1,_e.logToConsole=!1,_e.Runtime=F,_e.ScriptReceivers=F.ScriptReceivers,_e.DependenciesReceivers=F.DependenciesReceivers,_e.auth_callbacks=F.auth_callbacks;var ws=i.default=_e;function Mu(h){if(h==null)throw"You must pass your app key when you instantiate Pusher."}F.setup(_e)}])})})(la);var fc=la.exports;const gc=bc(fc);class ca{constructor(e){d(this,"container");d(this,"onAction");d(this,"onFail");d(this,"initialTime");d(this,"timeLeft");d(this,"timerId");d(this,"payment");this.container=e.container,this.onAction=e.onAction,this.onFail=e.onFail,this.initialTime=1800,this.timeLeft=this.initialTime,this.timerId=null}attachListener(){const e=this.container.querySelector("#transfer-acn"),t=this.container.querySelector("#transfer-bank"),i=this.container.querySelector("#copy-acn"),s=this.container.querySelector("#acn-tooltip"),o=this.container.querySelector("#transfer-amount"),a=this.container.querySelector("#copy-amount"),l=this.container.querySelector("#amount-tooltip"),c=this.container.querySelector("#transfer-button"),p=this.container.querySelector("#transfer-header-text"),m=this.container.querySelector("#bank-name-text"),g=this.container.querySelector("#beneficiary-text"),f=this.container.querySelector("#amount-text"),b=this.container.querySelectorAll(".copy-text"),w=this.container.querySelector("#account-number-text"),C=this.container.querySelector("#expiration-text");p&&(p.innerHTML=Ve["transfer-header"]),f&&(f.innerHTML=j.amount),b.forEach(k=>{k.innerHTML=E.copy}),w&&(w.innerHTML=Ve["account-number"]),m&&(m.innerHTML=Ve["bank-name"]),g&&(g.innerHTML=Ve.beneficiary),C&&(C.innerHTML=Ve["expiration-text"]),i&&e&&i.addEventListener("click",()=>{s&&(t&&_.track("copy_transferBank",{payment_method:"Transfer",payment_process:"Payment Started",account_number:e.innerHTML,bank_name:t.innerHTML}),this.copyToClipboard(e.innerHTML,s))}),a&&o&&a.addEventListener("click",()=>{l&&(_.track("copy_transferAmount",{payment_method:"Transfer",amount:o.innerHTML.split(" ")[1].replace(/,/g,"")}),this.copyToClipboard(o.innerHTML.split(" ")[1].replace(/,/g,""),l))}),c&&(c.innerHTML=Ve["made-transfer"],c.addEventListener("click",()=>{this.onAction(5),_.track("initiate_payment_verification",{payment_method:"Transfer"})}))}startTimer(e){this.stopTimer(),this.timerId=window.setInterval(()=>{if(this.timeLeft>0){this.timeLeft-=1;const t=this.container.querySelector("#time-left");t&&(t.innerHTML=tt(this.timeLeft))}else this.stopTimer(),e==="check"&&this.onAction(2)},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}copyToClipboard(e,t){navigator.clipboard.writeText(e).then(()=>{t.innerHTML=E.copied}).catch(()=>{t.innerHTML=E["copy-fail"]})}renderComponent(e){var g,f,b,w,C,k;e&&(this.payment=e),this.container.innerHTML=this.render();const t=this.container.querySelector("#transfer-amount"),i=this.container.querySelector("#transfer-bank"),s=this.container.querySelector("#account-name"),o=this.container.querySelector("#transfer-acn"),a=this.container.querySelector("#time-left"),l=((g=this.payment)==null?void 0:g.currency)||"USD",c=l==="USD"?(f=this.payment)==null?void 0:f.localCurrency:l;if(t&&(t.innerHTML=`${c} ${Me(this.payment.totalTaxAmount?this.payment.totalLocalAmount:l==="USD"?(b=this.payment)==null?void 0:b.localAmount:(w=this.payment)==null?void 0:w.amount,2)}`),i&&this.payment.bankDetails&&(i.innerHTML=(C=this.payment.bankDetails)==null?void 0:C.bankName),s&&this.payment.bankDetails&&(s.innerHTML=(k=this.payment.bankDetails)==null?void 0:k.accountName),o&&this.payment.bankDetails&&(o.innerHTML=this.payment.bankDetails.accountNumber),a&&(a.innerHTML=tt(this.initialTime)),this.startTimer("poll"),e.status==="inProgress"){const x="45654f3ce4c9512ea9a4",A="us2";var p=new gc(x,{cluster:A}),m=p.subscribe(e.reference);m.bind("payment_status",M=>{M.status==="successful"?(clearInterval(this.timerId||void 0),this.onAction(6),_.track("verify_payment",{payment_method:"Transfer",verification_status:"Success"}),M!=null&&M.redirectUrl&&setTimeout(()=>{const P=new URL(M.redirectUrl);P.searchParams.append("status",M.status),P.searchParams.append("reference",M.reference),window.location.href=P.toString()},1800)):M.status==="failed"&&(clearInterval(this.timerId||void 0),this.onFail(7,"Transfer failed"),_.track("verify_payment",{payment_method:"Transfer",verification_status:"Failed"}))})}this.attachListener()}render(){return vc}}const yc=`<div id="trasferConfirmationProgress" data-section="transfer">
|
|
1669
1669
|
<div>
|
|
1670
1670
|
<div>
|
|
1671
1671
|
<div class=" grid grid-rows-[auto_1fr] gap-4 mx-5">
|
|
@@ -1748,7 +1748,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1748
1748
|
</div>
|
|
1749
1749
|
</div>
|
|
1750
1750
|
</div>
|
|
1751
|
-
</div>`;class Cc{constructor(e){d(this,"container");d(this,"onAction");d(this,"ref");d(this,"token");d(this,"initialTime",300);d(this,"abortController");d(this,"timeLeft");d(this,"timer");d(this,"timerId",null);d(this,"rdtCode");d(this,"url");d(this,"callBackUrl");d(this,"payment");d(this,"setPaymentResponses");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses}attachListeners(){const e=this.container.querySelector("#confirming-txn-status"),t=this.container.querySelector("#confirming-txn-status-end-text"),i=this.container.querySelector("#account-details-text"),s=this.container.querySelector("#please-wait-text"),o=this.container.querySelector("#minutes-text"),a=this.container.querySelector("#bankname-text"),l=this.container.querySelector("#beneficiary-text"),c=this.container.querySelector("#transfer-bank"),p=this.container.querySelector("#transfer-acn-pr"),m=this.container.querySelector("#copy-acn-pr"),g=this.container.querySelector("#acn-tooltip-pr");e&&(e.innerHTML=
|
|
1751
|
+
</div>`;class Cc{constructor(e){d(this,"container");d(this,"onAction");d(this,"ref");d(this,"token");d(this,"initialTime",300);d(this,"abortController");d(this,"timeLeft");d(this,"timer");d(this,"timerId",null);d(this,"rdtCode");d(this,"url");d(this,"callBackUrl");d(this,"payment");d(this,"setPaymentResponses");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses}attachListeners(){const e=this.container.querySelector("#confirming-txn-status"),t=this.container.querySelector("#confirming-txn-status-end-text"),i=this.container.querySelector("#account-details-text"),s=this.container.querySelector("#please-wait-text"),o=this.container.querySelector("#minutes-text"),a=this.container.querySelector("#bankname-text"),l=this.container.querySelector("#beneficiary-text"),c=this.container.querySelector("#transfer-bank"),p=this.container.querySelector("#transfer-acn-pr"),m=this.container.querySelector("#copy-acn-pr"),g=this.container.querySelector("#acn-tooltip-pr");e&&(e.innerHTML=E["confirming-txn-status"]),t&&(t.innerHTML=E["few-minutes"]),s&&(s.innerHTML=E["please-wait-for"]),o&&(o.innerHTML=E.minutes),a&&(a.innerHTML=Ve["bank-name"]),l&&(l.innerHTML=Ve.beneficiary),i&&(i.innerHTML=Ve["account-details"]);const f=this.container.querySelector("#show-acn");f&&f.addEventListener("click",()=>{this.onAction(1),clearTimeout(this.timer)}),m&&p&&m.addEventListener("click",()=>{_.track("copy_transferBank",{payment_method:"Transfer",payment_process:"Payment Verification",account_number:p.innerHTML,bank_name:c==null?void 0:c.innerHTML}),g&&(g.innerHTML=E.copy,this.copyToClipboard(p.innerHTML,g))}),this.initialTime=300,this.timeLeft=this.initialTime;const b=3e4;this.abortController=new AbortController,setTimeout(()=>{this.verifyTransfer(this.token,b,({data:w,headers:C})=>{this.onAction(6),this.redirectTo(w,C)})},5e3),this.startTimer()}updateProgressTimerContent(){const t=2*Math.PI*40,s=(this.initialTime-this.timeLeft)/this.initialTime*100/100*t,o=this.container.querySelector(".circle-progress");o&&(o.setAttribute("stroke-dasharray",`${t}`),o.setAttribute("stroke-dashoffset",`${s}`))}async verifyTransfer(e,t,i){let s=0,o=t,a=!0,l;this.abortController&&(l=this.abortController.signal);const c=async()=>{if(this.timeLeft<=0){a=!1,this.onAction(8);return}s+=1;try{const p=await Xe(e,this.ref,l,this.rdtCode,this.url);p.data.status==="inProgress"?(a&&(o=t*(s+1),this.timer=setTimeout(c,o)),this.setPaymentResponses(p.data,p.headers)):p.data.status==="successful"||p.data.status==="success"?(this.setPaymentResponses(p.data,p.headers),a=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),_.track("verify_payment",{payment_method:"Transfer",verification_status:"Success"}),i(p)):p.data.status==="failed"&&(this.setPaymentResponses(p.data,p.headers),a=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),this.onAction(7,"Transfer failed"),_.track("verify_payment",{payment_method:"Transfer",verification_status:"Failed"}))}catch{a&&(o=t*(s+1),this.timer=setTimeout(c,o))}};c()}redirectTo(e,t){const i=t.get("spf-redirect-url");this.callBackUrl=i||this.callBackUrl,this.callBackUrl&&setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status",e.status),s.searchParams.append("reference",e.reference),window.location.href=s.toString()},1800)}startTimer(){const e=this.container.querySelector("#ctd-timer");this.stopTimer(),this.timerId=window.setInterval(()=>{this.timeLeft>0?(this.timeLeft-=1,e&&(e.innerHTML=tt(this.timeLeft),this.startTimer()),this.updateProgressTimerContent()):(this.stopTimer(),this.onAction(8))},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}renderTransferDetailsComponent(e){var o,a;e&&(this.payment=e),this.container.innerHTML=this.render();const t=this.container.querySelector("#transfer-bank"),i=this.container.querySelector("#transfer-acn-pr"),s=this.container.querySelector("#account-name");t&&e.bankDetails&&(t.innerHTML=(o=e.bankDetails)==null?void 0:o.bankName),i&&e.bankDetails&&(i.innerHTML=e.bankDetails.accountNumber),s&&e.bankDetails&&(s.innerHTML=(a=e.bankDetails)==null?void 0:a.accountName)}copyToClipboard(e,t){navigator.clipboard.writeText(e).then(()=>{t.innerHTML=E.copied}).catch(()=>{t.innerHTML=E["copy-fail"]})}renderComponent(e){this.container.innerHTML=this.render(),this.renderTransferDetailsComponent(e),this.attachListeners()}render(){return yc}}const wc=`<div id="paymentExpired" data-section="transfer">
|
|
1752
1752
|
<div class="container-center min-h-[30dvh]">
|
|
1753
1753
|
<div>
|
|
1754
1754
|
<div class="container-center mb-5">
|
|
@@ -1771,7 +1771,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1771
1771
|
</div> -->
|
|
1772
1772
|
</div>
|
|
1773
1773
|
</div>
|
|
1774
|
-
</div>`;class kc{constructor(e){d(this,"container");this.container=e.container}attachListeners(){const e=this.container.querySelector("#payment-warning-text"),t=this.container.querySelector("#payment-warning-desc");e&&(e.innerHTML=Ve["account-expired"]),t&&(t.innerHTML=Ve["account-expired-desc"])}renderComponent(){this.container.innerHTML=this.render()}render(){return wc}}class Sc{constructor({amount:e,totalAmount:t,closeModal:i,container:s,customer:o,token:a,currency:l,rdtCode:c,url:p,reference:m,callBackUrl:g,metadata:f,localCurrency:b,disablePaymentMethods:w,restartTransactionProcess:C,hidePaymentMethods:k,retryingPayment:x}){d(this,"container");d(this,"contents");d(this,"closeModal");d(this,"customer");d(this,"transferDetails");d(this,"transferConfirmationProgress");d(this,"transferConfirmationEnd");d(this,"transferExpired");d(this,"mainLoader");d(this,"warningScreen");d(this,"successScreen");d(this,"merchantPlanDetail",{});d(this,"token");d(this,"currency");d(this,"amount");d(this,"totalAmount");d(this,"rdtCode");d(this,"url");d(this,"reference");d(this,"_currentStep");d(this,"activeRef");d(this,"paymentResponse");d(this,"timerId");d(this,"abortController",null);d(this,"callBackUrl");d(this,"metadata");d(this,"localCurrency");d(this,"transactionIssuesScreen");d(this,"disablePaymentMethods");d(this,"paymentResponseHeaders");d(this,"restartTransactionProcess");d(this,"hidePaymentMethods");d(this,"retryingPayment");d(this,"isMaxRetriesReached");d(this,"isMobile",!1);d(this,"errorText");this.currency=l,this.container=s,this.contents=this.container.querySelector("#payment-content-view"),this.closeModal=i,this.token=a,this.customer=o,this.amount=e,this.totalAmount=t,this.rdtCode=c,this.url=p,this.reference=m,this._currentStep=1,this.callBackUrl=g,this.metadata=f,this.localCurrency=b,this.disablePaymentMethods=w,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=C,this.hidePaymentMethods=k,this.retryingPayment=x,this.isMaxRetriesReached=!1,this.renderTransferContent(),this.paymentResponse={},this.activeRef="",this.timerId=null,this.errorText="",this.mainLoader=new ke(this.contents),this.mainLoader.mountLoader("25dvh"),this.currentStep===1&&(this.abortController=new AbortController,this.createTransfer()),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderTransferContent(),e===1&&this.createTransfer()}attachInputListeners(){const e=this.container.querySelector("#transfer-try-again"),t=this.container.querySelector("#transfer-sent"),i=this.container.querySelector(".success-button");e&&e.addEventListener("click",()=>{this.currentStep=1}),t&&t.addEventListener("click",()=>{this.abortController&&(this.abortController.abort(),this.currentStep=5)}),i&&i.addEventListener("click",()=>{this.closeModal(),_.track("checkout_closes")})}onSentVerify(e){e!==2?this.abortController&&(this.abortController.abort(),this.currentStep=e):this.currentStep=2}async verifyTransfer(){try{const e=await Xe(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=7}}async createTransfer(){requestAnimationFrame(()=>{const e=this.container.querySelector("#loader"),t=this.container.querySelector("#details-content");t&&(this.mainLoader=new ke(this.contents),this.mainLoader.mountLoader("25dvh"),t.classList.add("hidden")),_.track("start_payment",{payment_method:"Transfer"});const i=bt();(()=>{var o,a;if(this.retryingPayment){const l={channel:"bank_transfer",reference:this.reference};return et(this.token,l,this.rdtCode,this.url)}else{const l={amount:this.amount,channel:"bank_transfer",currency:this.currency,customer:this.customer,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((o=this.merchantPlanDetail)==null?void 0:o.taxQuoteId)&&{taxQuoteId:(a=this.merchantPlanDetail)==null?void 0:a.taxQuoteId},deviceInformation:i};return Ri(this.token,l,this.rdtCode,this.url)}})().then(async({data:o,headers:a})=>{if(this.paymentResponse=o,this.paymentResponseHeaders=a,o.providerMessage){const l=await Z(o.providerMessage,R());this.errorText=l}if(o.status==="failed")this.currentStep=7,_.track("stop_transferProcess",{payment_method:"Transfer",verification_status:"Failed"}),o.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue();else if(e&&t&&(e.classList.add("hidden"),t.classList.remove("hidden")),this.activeRef=o.reference,this.paymentResponse=o,o.bankDetails&&o.bankDetails.accountNumber)this.transferDetails=new ca({container:this.contents,onAction:l=>{this.onSentVerify.bind(this)(l)},onFail:async(l,c)=>{if(this.currentStep=l,l===7&&c){const p=await Z(c,R());this.errorText=p,this.warningScreen.setPaymentError(this.errorText)}}}),this.transferDetails.renderComponent(this.paymentResponse||o);else if(o.providerMessage){const l=await Z(o.providerMessage,R());this.errorText=l,this.currentStep=7,this.warningScreen.setPaymentError(this.errorText)}else{const l=await Z("Error fetching bank details",R());this.currentStep=7,this.warningScreen.setPaymentError(l)}}).catch(async o=>{if(_.track("verify_payment",{payment_method:"Transfer",verification_status:"Null"}),o.code==="payment_max_retry_attempts")this.isMaxRetriesReached=!0,this.verifyTransfer(),this.currentStep=7,_.track("max_retries_reached",{payment_method:"Transfer"}),this.warningScreen.setPaymentError(P["maximum-retries"],P["maximum-retries-desc"],j["merchant-back"]);else if(o!=null&&o.message){const a=await Z(o.message,R());this.errorText=a,this.currentStep=7,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=7,this.warningScreen.setPaymentError(P["payment-failed"]);this.warningScreen.hideReportIssue()})})}goBackToMerchant(){Ee(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderTransferContent(e){var i;e&&(this.merchantPlanDetail=e);const t=document.getElementById("go-back");if(this.isMobile&&this.hidePaymentMethods(),this.currentStep!==1?(t==null||t.classList.add("hidden"),this.disablePaymentMethods("bank_transfer")):t==null||t.addEventListener("click",()=>{this.restartTransactionProcess()}),this.contents){switch(this.currentStep){case 1:this.transferDetails=new ca({container:this.contents,onAction:s=>{this.onSentVerify.bind(this)(s)},onFail:async(s,o)=>{if(this.currentStep=s,s===7&&o){const a=await Z(o,R());this.errorText=a,this.warningScreen.setPaymentError(this.errorText)}}});break;case 2:this.transferExpired=new kc({container:this.contents}),this.transferExpired.renderComponent();break;case 5:this.transferConfirmationProgress=new Cc({container:this.contents,onAction:async(s,o)=>{if(this.currentStep=s,s===7&&o){const a=await Z(o,R());this.errorText=a,this.warningScreen.setPaymentError(this.errorText)}},ref:this.activeRef,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(s,o)=>{this.paymentResponse=s,this.paymentResponseHeaders=o}}),this.transferConfirmationProgress.renderComponent(this.paymentResponse);break;case 6:this.successScreen=new Vn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(i=this.merchantPlanDetail)==null?void 0:i.rate.rate}),this.successScreen.renderComponent();break;case 7:this.warningScreen=new en({container:this.contents,onReportIssue:()=>this.currentStep=8,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this)}),this.contents.innerHTML=this.warningScreen.render();break;case 8:this.transferConfirmationEnd=new oa({container:this.contents,onAction:s=>{this.currentStep=s},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders,paymentMethod:"Transfer"}),this.transferConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new it({container:this.contents,onAction:async()=>{var s,o;if(this.currentStep=7,(s=this.paymentResponse)!=null&&s.providerMessage){const a=await Z((o=this.paymentResponse)==null?void 0:o.providerMessage,R());this.errorText=a}this.warningScreen.setPaymentError(this.errorText||P["payment-failed"])},token:this.token,rdtCode:this.rdtCode,url:this.url,paymentChannel:"bank_transfer",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break}this.attachInputListeners()}}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}stopProgressBar(){const e=this.container.querySelector(".progress-bar");e&&(e.style.animationPlayState="paused")}copyToClipboard(e,t){navigator.clipboard.writeText(e).then(()=>{t.innerHTML=P.copied}).catch(()=>{t.innerHTML=P["copy-fail"]})}destroyTimer(){this.stopTimer()}stopPolling(){this.abortController&&this.abortController.abort()}}function da(){return function(n,e){let t=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:()=>t,set:o=>{t=o}})}}class ce extends Error{constructor(e,t){super(e),this.status=t,this.name="FetchError"}}class gn extends Error{constructor(e){super(e),this.name="AuthorizationError"}}class hs{constructor(e){d(this,"token");d(this,"baseurl","https://api.spotflow.co/api/v1");d(this,"headers");d(this,"rdtCode");d(this,"url");d(this,"getHeaders",(e,t)=>{if(!e)throw new gn("Missing authorization token");const i=new Headers;return i.append("Content-Type","application/json"),i.append("Authorization",`Bearer ${e}`),i.append("Origin","https://sdk.spotflow.co"),t&&i.append("Spotflow-Payment-Code",t),i});this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.headers=this.getHeaders(this.token,this.rdtCode)}}class ua extends hs{constructor(e){super(e)}async createCardPayment(e){try{const t=await fetch(`${ue(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!t.ok){const s=await t.json();throw s.message?new ce(s.message,t.status):new ce("Network response was not ok",t.status)}return await t.json()}catch(t){throw t instanceof ce?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof gn?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}async createUssdPayment(e){try{const t=await fetch(`${ue(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!t.ok){const s=await t.json();throw s.message?new ce(s.message,t.status):new ce("Network response was not ok",t.status)}return{data:await t.json(),headers:t.headers}}catch(t){throw t instanceof ce?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof gn?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}async validateCardPayment(e){try{const t=await fetch(`${ue(this.baseurl,this.url)}/payments/validate`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!t.ok){const s=await t.json();throw s.message?new ce(s.message,t.status):new ce("Network response was not ok",t.status)}return await t.json()}catch(t){throw t instanceof ce?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof gn?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}async authorizeCardPayment(e){try{const t=await fetch(`${ue(this.baseurl,this.url)}/payments/authorize`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!t.ok){const s=await t.json();throw s.message?new ce(s.message,t.status):new ce("Network response was not ok",t.status)}return await t.json()}catch(t){throw t instanceof ce?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof gn?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}async createTransferPayment(e){try{const t=await fetch(`${ue(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!t.ok){const s=await t.json();throw s.message?new ce(s.message,t.status):new ce("Network response was not ok",t.status)}return await t.json()}catch(t){throw t instanceof ce?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof gn?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}async verifyPayment(e,t){try{const i=await fetch(`${ue(this.baseurl,this.url)}/payments/verify?reference=${e}`,{method:"GET",headers:this.headers,signal:t});if(!i.ok){const o=await i.json();throw o.message?new ce(o.message,i.status):new ce("Network response was not ok",i.status)}return{data:await i.json(),headers:i.headers}}catch(i){throw i instanceof ce?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof gn?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}}class xc extends hs{constructor(e){super(e)}async getMerchantConfig(e,t){try{const i=await fetch(`${ue(this.baseurl,this.url)}/checkout-configurations?currency=${t}&planId=${e||""}`,{headers:this.headers,method:"GET"});if(!i.ok){const s=await i.json();throw s.message?new ce(s.message,i.status):new ce("Network response was not ok",i.status)}return i.json()}catch(i){throw i instanceof ce?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof gn?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}}class Ac extends hs{constructor(e){super(e)}async getBankList(){try{const e=await fetch(`${ue(this.baseurl,this.url)}/banks?ussd=true`,{headers:this.headers,method:"GET"});if(!e.ok){const t=await e.json();throw t.message?new ce(t.message,e.status):new ce("Network response was not ok",e.status)}return e.json()}catch(e){throw e instanceof ce?(Vt.showToast(e.message,"error",9e3),console.error(`FetchError: ${e.message} (status: ${e.status})`)):e instanceof gn?console.error(`AuthorizationError: ${e.message}`):console.error(`Unexpected error: ${e}`),e}}}const Mc=`<form id="ussdBanks">
|
|
1774
|
+
</div>`;class kc{constructor(e){d(this,"container");this.container=e.container}attachListeners(){const e=this.container.querySelector("#payment-warning-text"),t=this.container.querySelector("#payment-warning-desc");e&&(e.innerHTML=Ve["account-expired"]),t&&(t.innerHTML=Ve["account-expired-desc"])}renderComponent(){this.container.innerHTML=this.render()}render(){return wc}}class Sc{constructor({amount:e,totalAmount:t,closeModal:i,container:s,customer:o,token:a,currency:l,rdtCode:c,url:p,reference:m,callBackUrl:g,metadata:f,localCurrency:b,disablePaymentMethods:w,restartTransactionProcess:C,hidePaymentMethods:k,retryingPayment:x}){d(this,"container");d(this,"contents");d(this,"closeModal");d(this,"customer");d(this,"transferDetails");d(this,"transferConfirmationProgress");d(this,"transferConfirmationEnd");d(this,"transferExpired");d(this,"mainLoader");d(this,"warningScreen");d(this,"successScreen");d(this,"merchantPlanDetail",{});d(this,"token");d(this,"currency");d(this,"amount");d(this,"totalAmount");d(this,"rdtCode");d(this,"url");d(this,"reference");d(this,"_currentStep");d(this,"activeRef");d(this,"paymentResponse");d(this,"timerId");d(this,"abortController",null);d(this,"callBackUrl");d(this,"metadata");d(this,"localCurrency");d(this,"transactionIssuesScreen");d(this,"disablePaymentMethods");d(this,"paymentResponseHeaders");d(this,"restartTransactionProcess");d(this,"hidePaymentMethods");d(this,"retryingPayment");d(this,"isMaxRetriesReached");d(this,"isMobile",!1);d(this,"errorText");this.currency=l,this.container=s,this.contents=this.container.querySelector("#payment-content-view"),this.closeModal=i,this.token=a,this.customer=o,this.amount=e,this.totalAmount=t,this.rdtCode=c,this.url=p,this.reference=m,this._currentStep=1,this.callBackUrl=g,this.metadata=f,this.localCurrency=b,this.disablePaymentMethods=w,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=C,this.hidePaymentMethods=k,this.retryingPayment=x,this.isMaxRetriesReached=!1,this.renderTransferContent(),this.paymentResponse={},this.activeRef="",this.timerId=null,this.errorText="",this.mainLoader=new ke(this.contents),this.mainLoader.mountLoader("25dvh"),this.currentStep===1&&(this.abortController=new AbortController,this.createTransfer()),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderTransferContent(),e===1&&this.createTransfer()}attachInputListeners(){const e=this.container.querySelector("#transfer-try-again"),t=this.container.querySelector("#transfer-sent"),i=this.container.querySelector(".success-button");e&&e.addEventListener("click",()=>{this.currentStep=1}),t&&t.addEventListener("click",()=>{this.abortController&&(this.abortController.abort(),this.currentStep=5)}),i&&i.addEventListener("click",()=>{this.closeModal(),_.track("checkout_closes")})}onSentVerify(e){e!==2?this.abortController&&(this.abortController.abort(),this.currentStep=e):this.currentStep=2}async verifyTransfer(){try{const e=await Xe(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=7}}async createTransfer(){requestAnimationFrame(()=>{const e=this.container.querySelector("#loader"),t=this.container.querySelector("#details-content");t&&(this.mainLoader=new ke(this.contents),this.mainLoader.mountLoader("25dvh"),t.classList.add("hidden")),_.track("start_payment",{payment_method:"Transfer"});const i=bt();(()=>{var o,a;if(this.retryingPayment){const l={channel:"bank_transfer",reference:this.reference};return et(this.token,l,this.rdtCode,this.url)}else{const l={amount:this.amount,channel:"bank_transfer",currency:this.currency,customer:this.customer,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((o=this.merchantPlanDetail)==null?void 0:o.taxQuoteId)&&{taxQuoteId:(a=this.merchantPlanDetail)==null?void 0:a.taxQuoteId},deviceInformation:i};return Ri(this.token,l,this.rdtCode,this.url)}})().then(async({data:o,headers:a})=>{if(this.paymentResponse=o,this.paymentResponseHeaders=a,o.providerMessage){const l=await Z(o.providerMessage,R());this.errorText=l}if(o.status==="failed")this.currentStep=7,_.track("stop_transferProcess",{payment_method:"Transfer",verification_status:"Failed"}),o.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(E["payment-failed"]),this.warningScreen.hideReportIssue();else if(e&&t&&(e.classList.add("hidden"),t.classList.remove("hidden")),this.activeRef=o.reference,this.paymentResponse=o,o.bankDetails&&o.bankDetails.accountNumber)this.transferDetails=new ca({container:this.contents,onAction:l=>{this.onSentVerify.bind(this)(l)},onFail:async(l,c)=>{if(this.currentStep=l,l===7&&c){const p=await Z(c,R());this.errorText=p,this.warningScreen.setPaymentError(this.errorText)}}}),this.transferDetails.renderComponent(this.paymentResponse||o);else if(o.providerMessage){const l=await Z(o.providerMessage,R());this.errorText=l,this.currentStep=7,this.warningScreen.setPaymentError(this.errorText)}else{const l=await Z("Error fetching bank details",R());this.currentStep=7,this.warningScreen.setPaymentError(l)}}).catch(async o=>{if(_.track("verify_payment",{payment_method:"Transfer",verification_status:"Null"}),o.code==="payment_max_retry_attempts")this.isMaxRetriesReached=!0,this.verifyTransfer(),this.currentStep=7,_.track("max_retries_reached",{payment_method:"Transfer"}),this.warningScreen.setPaymentError(E["maximum-retries"],E["maximum-retries-desc"],j["merchant-back"]);else if(o!=null&&o.message){const a=await Z(o.message,R());this.errorText=a,this.currentStep=7,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=7,this.warningScreen.setPaymentError(E["payment-failed"]);this.warningScreen.hideReportIssue()})})}goBackToMerchant(){Ee(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderTransferContent(e){var i;e&&(this.merchantPlanDetail=e);const t=document.getElementById("go-back");if(this.isMobile&&this.hidePaymentMethods(),this.currentStep!==1?(t==null||t.classList.add("hidden"),this.disablePaymentMethods("bank_transfer")):t==null||t.addEventListener("click",()=>{this.restartTransactionProcess()}),this.contents){switch(this.currentStep){case 1:this.transferDetails=new ca({container:this.contents,onAction:s=>{this.onSentVerify.bind(this)(s)},onFail:async(s,o)=>{if(this.currentStep=s,s===7&&o){const a=await Z(o,R());this.errorText=a,this.warningScreen.setPaymentError(this.errorText)}}});break;case 2:this.transferExpired=new kc({container:this.contents}),this.transferExpired.renderComponent();break;case 5:this.transferConfirmationProgress=new Cc({container:this.contents,onAction:async(s,o)=>{if(this.currentStep=s,s===7&&o){const a=await Z(o,R());this.errorText=a,this.warningScreen.setPaymentError(this.errorText)}},ref:this.activeRef,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(s,o)=>{this.paymentResponse=s,this.paymentResponseHeaders=o}}),this.transferConfirmationProgress.renderComponent(this.paymentResponse);break;case 6:this.successScreen=new Vn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(i=this.merchantPlanDetail)==null?void 0:i.rate.rate}),this.successScreen.renderComponent();break;case 7:this.warningScreen=new en({container:this.contents,onReportIssue:()=>this.currentStep=8,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this)}),this.contents.innerHTML=this.warningScreen.render();break;case 8:this.transferConfirmationEnd=new oa({container:this.contents,onAction:s=>{this.currentStep=s},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders,paymentMethod:"Transfer"}),this.transferConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new it({container:this.contents,onAction:async()=>{var s,o;if(this.currentStep=7,(s=this.paymentResponse)!=null&&s.providerMessage){const a=await Z((o=this.paymentResponse)==null?void 0:o.providerMessage,R());this.errorText=a}this.warningScreen.setPaymentError(this.errorText||E["payment-failed"])},token:this.token,rdtCode:this.rdtCode,url:this.url,paymentChannel:"bank_transfer",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break}this.attachInputListeners()}}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}stopProgressBar(){const e=this.container.querySelector(".progress-bar");e&&(e.style.animationPlayState="paused")}copyToClipboard(e,t){navigator.clipboard.writeText(e).then(()=>{t.innerHTML=E.copied}).catch(()=>{t.innerHTML=E["copy-fail"]})}destroyTimer(){this.stopTimer()}stopPolling(){this.abortController&&this.abortController.abort()}}function da(){return function(n,e){let t=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:()=>t,set:o=>{t=o}})}}class ce extends Error{constructor(e,t){super(e),this.status=t,this.name="FetchError"}}class gn extends Error{constructor(e){super(e),this.name="AuthorizationError"}}class hs{constructor(e){d(this,"token");d(this,"baseurl","https://api.spotflow.co/api/v1");d(this,"headers");d(this,"rdtCode");d(this,"url");d(this,"getHeaders",(e,t)=>{if(!e)throw new gn("Missing authorization token");const i=new Headers;return i.append("Content-Type","application/json"),i.append("Authorization",`Bearer ${e}`),i.append("Origin","https://sdk.spotflow.co"),t&&i.append("Spotflow-Payment-Code",t),i});this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.headers=this.getHeaders(this.token,this.rdtCode)}}class ua extends hs{constructor(e){super(e)}async createCardPayment(e){try{const t=await fetch(`${ue(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!t.ok){const s=await t.json();throw s.message?new ce(s.message,t.status):new ce("Network response was not ok",t.status)}return await t.json()}catch(t){throw t instanceof ce?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof gn?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}async createUssdPayment(e){try{const t=await fetch(`${ue(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!t.ok){const s=await t.json();throw s.message?new ce(s.message,t.status):new ce("Network response was not ok",t.status)}return{data:await t.json(),headers:t.headers}}catch(t){throw t instanceof ce?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof gn?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}async validateCardPayment(e){try{const t=await fetch(`${ue(this.baseurl,this.url)}/payments/validate`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!t.ok){const s=await t.json();throw s.message?new ce(s.message,t.status):new ce("Network response was not ok",t.status)}return await t.json()}catch(t){throw t instanceof ce?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof gn?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}async authorizeCardPayment(e){try{const t=await fetch(`${ue(this.baseurl,this.url)}/payments/authorize`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!t.ok){const s=await t.json();throw s.message?new ce(s.message,t.status):new ce("Network response was not ok",t.status)}return await t.json()}catch(t){throw t instanceof ce?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof gn?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}async createTransferPayment(e){try{const t=await fetch(`${ue(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!t.ok){const s=await t.json();throw s.message?new ce(s.message,t.status):new ce("Network response was not ok",t.status)}return await t.json()}catch(t){throw t instanceof ce?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof gn?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}async verifyPayment(e,t){try{const i=await fetch(`${ue(this.baseurl,this.url)}/payments/verify?reference=${e}`,{method:"GET",headers:this.headers,signal:t});if(!i.ok){const o=await i.json();throw o.message?new ce(o.message,i.status):new ce("Network response was not ok",i.status)}return{data:await i.json(),headers:i.headers}}catch(i){throw i instanceof ce?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof gn?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}}class xc extends hs{constructor(e){super(e)}async getMerchantConfig(e,t){try{const i=await fetch(`${ue(this.baseurl,this.url)}/checkout-configurations?currency=${t}&planId=${e||""}`,{headers:this.headers,method:"GET"});if(!i.ok){const s=await i.json();throw s.message?new ce(s.message,i.status):new ce("Network response was not ok",i.status)}return i.json()}catch(i){throw i instanceof ce?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof gn?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}}class Ac extends hs{constructor(e){super(e)}async getBankList(){try{const e=await fetch(`${ue(this.baseurl,this.url)}/banks?ussd=true`,{headers:this.headers,method:"GET"});if(!e.ok){const t=await e.json();throw t.message?new ce(t.message,e.status):new ce("Network response was not ok",e.status)}return e.json()}catch(e){throw e instanceof ce?(Vt.showToast(e.message,"error",9e3),console.error(`FetchError: ${e.message} (status: ${e.status})`)):e instanceof gn?console.error(`AuthorizationError: ${e.message}`):console.error(`Unexpected error: ${e}`),e}}}const Mc=`<form id="ussdBanks">
|
|
1775
1775
|
<div>
|
|
1776
1776
|
<h5 class="text-grey-400 font-semibold text-sm">Please choose your bank to begin payment</h5>
|
|
1777
1777
|
<div class="mt-2">
|
|
@@ -1991,7 +1991,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1991
1991
|
<!-- Tab options -->
|
|
1992
1992
|
</div>
|
|
1993
1993
|
</div>
|
|
1994
|
-
</div>`;class Hc{constructor(e){d(this,"container");d(this,"email");d(this,"amount",0);d(this,"metadata");d(this,"currency");d(this,"localCurrency");d(this,"mainLoader");d(this,"trialAmount");d(this,"trial");d(this,"merchantDetail");d(this,"onAction");d(this,"isMobile");d(this,"onClose");d(this,"currentPaymentMethod");d(this,"countryCode");this.container=e.container,this.email=e.email,this.amount=e.amount||0,this.metadata=e.metadata,this.currency=e.currency,this.localCurrency=e.localCurrency,this.merchantDetail=e.merchantDetail,this.onAction=e.onAction,this.isMobile=e.isMobile,this.trial=e.trial,this.onClose=e.onClose,this.trialAmount=e.trialAmount,this.currentPaymentMethod=e.currentPaymentMethod,this.countryCode=e.countryCode}attachListeners(){const e=this.container.querySelectorAll(".tab-button");Array.from(e).forEach(o=>{const a=o.dataset.name||"",l=o.querySelector(".tab-button-icon"),c=o.querySelector(".tab-button-label");l&&(l.innerHTML=se[a].icon),c&&(c.textContent=se[a].label),o.addEventListener("click",p=>{p.preventDefault(),this.onAction(a)})});const i=this.container.querySelector("#close-btn");i&&i.addEventListener("click",()=>{this.onClose(!0)});const s=document.getElementById("go-back");s==null||s.addEventListener("click",()=>{this.onAction("")})}renderComponent(){var Cn,qn,Hn,je,wn,Wn,me,Se,Qe,ze,Ie,hn,H,ye,te,Ce,qe,ne,Nn,Bt,mi,pi,vi,bi,Zn,fi,re,gi,yi,Ci,wi,ki,Si,xi,ft,gt,Ai,Mi,Li,Ti,yt,Je,_i,kn,Ei,Rt;this.container.innerHTML=this.render(),this.mainLoader=new ke(this.container),this.amount=this.amount;const e=this.container.querySelector("#merchant-logo-container"),t=this.container.querySelector("#merchant-logo"),i=this.container.querySelector("#merchant-email"),s=this.container.querySelector("#merchant-email-mob"),o=this.container.querySelector("#trial-info"),a=this.container.querySelector("#todays-total-amount"),l=this.container.querySelector("#plan-name"),c=this.container.querySelector("#plan-name-mob"),p=this.container.querySelector("#payment-fees"),m=this.container.querySelector("#currency-cursor"),g=this.container.querySelector("#currency-cursor-mob"),f=this.container.querySelector("#payment-rate-display"),b=this.container.querySelector("#payment-rate-display-mob"),w=this.container.querySelector("#designated-rate"),C=this.container.querySelector("#designated-rate-mob"),k=this.container.querySelector("#designated-rate-no-plan"),x=this.container.querySelector("#source-rate"),A=this.container.querySelector("#source-rate-mob"),M=this.container.querySelector("#tax-rate"),
|
|
1994
|
+
</div>`;class Hc{constructor(e){d(this,"container");d(this,"email");d(this,"amount",0);d(this,"metadata");d(this,"currency");d(this,"localCurrency");d(this,"mainLoader");d(this,"trialAmount");d(this,"trial");d(this,"merchantDetail");d(this,"onAction");d(this,"isMobile");d(this,"onClose");d(this,"currentPaymentMethod");d(this,"countryCode");this.container=e.container,this.email=e.email,this.amount=e.amount||0,this.metadata=e.metadata,this.currency=e.currency,this.localCurrency=e.localCurrency,this.merchantDetail=e.merchantDetail,this.onAction=e.onAction,this.isMobile=e.isMobile,this.trial=e.trial,this.onClose=e.onClose,this.trialAmount=e.trialAmount,this.currentPaymentMethod=e.currentPaymentMethod,this.countryCode=e.countryCode}attachListeners(){const e=this.container.querySelectorAll(".tab-button");Array.from(e).forEach(o=>{const a=o.dataset.name||"",l=o.querySelector(".tab-button-icon"),c=o.querySelector(".tab-button-label");l&&(l.innerHTML=se[a].icon),c&&(c.textContent=se[a].label),o.addEventListener("click",p=>{p.preventDefault(),this.onAction(a)})});const i=this.container.querySelector("#close-btn");i&&i.addEventListener("click",()=>{this.onClose(!0)});const s=document.getElementById("go-back");s==null||s.addEventListener("click",()=>{this.onAction("")})}renderComponent(){var Cn,qn,Hn,je,wn,Wn,me,Se,Qe,ze,Ie,hn,H,ye,te,Ce,qe,ne,Nn,Bt,mi,pi,vi,bi,Zn,fi,re,gi,yi,Ci,wi,ki,Si,xi,ft,gt,Ai,Mi,Li,Ti,yt,Je,_i,kn,Ei,Rt;this.container.innerHTML=this.render(),this.mainLoader=new ke(this.container),this.amount=this.amount;const e=this.container.querySelector("#merchant-logo-container"),t=this.container.querySelector("#merchant-logo"),i=this.container.querySelector("#merchant-email"),s=this.container.querySelector("#merchant-email-mob"),o=this.container.querySelector("#trial-info"),a=this.container.querySelector("#todays-total-amount"),l=this.container.querySelector("#plan-name"),c=this.container.querySelector("#plan-name-mob"),p=this.container.querySelector("#payment-fees"),m=this.container.querySelector("#currency-cursor"),g=this.container.querySelector("#currency-cursor-mob"),f=this.container.querySelector("#payment-rate-display"),b=this.container.querySelector("#payment-rate-display-mob"),w=this.container.querySelector("#designated-rate"),C=this.container.querySelector("#designated-rate-mob"),k=this.container.querySelector("#designated-rate-no-plan"),x=this.container.querySelector("#source-rate"),A=this.container.querySelector("#source-rate-mob"),M=this.container.querySelector("#tax-rate"),P=this.container.querySelector("#tax-rate-mob"),D=this.container.querySelector("#tooltip-localCurrency"),q=this.container.querySelector("#tooltip-localCurrency-mob"),Q=this.container.querySelector("#select-payment-method-text"),K=this.container.querySelector("#amount-text"),W=this.container.querySelector("#what-is-this"),de=this.container.querySelector("#reflect"),Le=this.container.querySelector("#please-note"),G=this.container.querySelector("#what-is-this-mob"),Oe=this.container.querySelector("#reflect-mob"),ge=this.container.querySelector("#please-note-mob"),Ge=this.container.querySelector("#to-pay-text"),Te=this.container.querySelector("#language-dropdown");if(Te){const an=this.currency==="USD"?this.localCurrency:this.currency,On=(Cn=Hi(an,this.countryCode))==null?void 0:Cn.language,Un=new Set;Un.add("en"),On&&On!=="en"&&Un.add(On),mn&&!Un.has(mn)&&Un.add(mn),Un.forEach(Ye=>{const Qn=new Option(Ye,Ye);Qn.value=Ye,Qn.text=Ic[Ye]||Ye,Ye===R()&&(Qn.selected=!0),Te.appendChild(Qn)}),Re.subscribeToLoading(Ye=>{Te.disabled=Ye}),Te.addEventListener("change",async Ye=>{const Pi=Ye.target.value;Ft(Pi);try{await Re.setLanguage(Pi)}catch(Ct){console.error("Failed to change language:",Ct)}finally{}})}if(Q&&(Q.innerHTML=j.select_payment_method_text),K&&(K.innerHTML=`${j.amount}:`),Ge&&(Ge.innerHTML=`${j["to-pay"]}:`),W&&(W.innerHTML=E["what-is-this"]),de&&(de.innerHTML=E["rate-reflect-note"]),Le&&(Le.innerHTML=E["rate-please-note"]),G&&(G.innerHTML=E["what-is-this"]),Oe&&(Oe.innerHTML=E["rate-reflect-note"]),ge&&(ge.innerHTML=E["rate-please-note"]),(qn=this.merchantDetail)!=null&&qn.merchantLogo?t&&t.setAttribute("src",(Hn=this.merchantDetail)==null?void 0:Hn.merchantLogo):e&&(t==null||t.remove(),e.innerHTML=`<div class="font-semibold text-tone-100 rounded-2xl w-8 h-8 bg-tone-10 container-center uppercase">${this.merchantDetail.merchantName[0]}</div>`),i&&(i.innerHTML=this.email),s&&(s.innerHTML=this.email),l){if((wn=(je=this.merchantDetail)==null?void 0:je.plan)!=null&&wn.title){const an=((me=(Wn=this.merchantDetail)==null?void 0:Wn.plan)==null?void 0:me.title)||"";l.textContent=hi(an)}(Se=this.metadata)!=null&&Se.productName&&(l.textContent=hi(this.metadata.productName))}if(c){if((ze=(Qe=this.merchantDetail)==null?void 0:Qe.plan)!=null&&ze.title){const an=((hn=(Ie=this.merchantDetail)==null?void 0:Ie.plan)==null?void 0:hn.title)||"";c.textContent=hi(an)}(H=this.metadata)!=null&&H.productName&&(c.textContent=hi(this.metadata.productName))}if(m&&(this.currency==="USD"?f&&(f.innerHTML=`1 ${((te=(ye=this.merchantDetail)==null?void 0:ye.rate)==null?void 0:te.to)||"-"} = ${((qe=(Ce=this.merchantDetail)==null?void 0:Ce.rate)==null?void 0:qe.from)||"-"} ${Me(((ne=this.merchantDetail.rate)==null?void 0:ne.rate)||1,2)} `):m.innerHTML=""),g&&(this.currency==="USD"?b&&(b.innerHTML=`1 ${((Bt=(Nn=this.merchantDetail)==null?void 0:Nn.rate)==null?void 0:Bt.to)||"-"} = ${((pi=(mi=this.merchantDetail)==null?void 0:mi.rate)==null?void 0:pi.from)||"-"} ${Me(((vi=this.merchantDetail.rate)==null?void 0:vi.rate)||1,2)} `):g.innerHTML=""),(Zn=(bi=this.merchantDetail)==null?void 0:bi.plan)!=null&&Zn.title||(fi=this.metadata)!=null&&fi.productName?w&&(((gi=(re=this.merchantDetail)==null?void 0:re.plan)==null?void 0:gi.trial)?(o==null||o.classList.remove("hidden"),w.innerHTML=`${this.currency} ${Me(this.amount,2)}`):(w.innerHTML=`${this.currency} ${Me(this.amount,2)}`,o==null||o.classList.add("hidden"))):(k&&(k.innerHTML=`<span> ${this.currency} ${Me(this.amount,2)} </span>`),l&&c&&(l.remove(),c==null||c.remove()),this.localCurrency?w==null||w.remove():p&&p.remove()),C){const an=(Ci=(yi=this.merchantDetail)==null?void 0:yi.plan)==null?void 0:Ci.trial,On=(xi=(Si=(ki=(wi=this.merchantDetail)==null?void 0:wi.plan)==null?void 0:ki.trial)==null?void 0:Si.pricingList[0])==null?void 0:xi.amount;an&&a?(a.textContent=`${this.currency} ${Me(On,2)}`,C.innerHTML=`${this.currency} ${Me(this.amount,2)}`):C.innerHTML=`${this.currency} ${Me(this.amount,2)}`}x&&(this.localCurrency&&this.localCurrency!==this.currency?x.children[1].innerHTML=`${this.localCurrency} ${Me(this.amount*(((gt=(ft=this.merchantDetail)==null?void 0:ft.rate)==null?void 0:gt.rate)||1),2)}`:x.remove()),A&&(this.localCurrency&&this.localCurrency!==this.currency?A.children[1].innerHTML=`${this.localCurrency} ${Me(this.amount*(((Mi=(Ai=this.merchantDetail)==null?void 0:Ai.rate)==null?void 0:Mi.rate)||1),2)}`:A.remove());const yn=this.localCurrency!==this.currency?this.amount*(((Ti=(Li=this.merchantDetail)==null?void 0:Li.rate)==null?void 0:Ti.rate)||1):this.amount;M&&(yt=this.merchantDetail)!=null&&yt.taxQuoteId&&(Je=this.merchantDetail)!=null&&Je.totalAmount&&(M.classList.remove("hidden"),M.children[1].innerHTML=`${this.localCurrency!==this.currency?this.localCurrency:this.currency} ${Me(((_i=this.merchantDetail)==null?void 0:_i.totalAmount)-yn,2)}`),P&&(kn=this.merchantDetail)!=null&&kn.taxQuoteId&&(Ei=this.merchantDetail)!=null&&Ei.totalAmount&&(P.classList.remove("hidden"),P.children[1].innerHTML=`${this.localCurrency!==this.currency?this.localCurrency:this.currency} ${Me(((Rt=this.merchantDetail)==null?void 0:Rt.totalAmount)-yn,2)}`);const un=Pc[this.localCurrency];D&&this.localCurrency&&(D.innerHTML=un?`${un} (${this.localCurrency})`:this.localCurrency),q&&this.localCurrency&&(q.innerHTML=un?`${un} (${this.localCurrency})`:this.localCurrency),this.renderPaymentOptions(this.container),this.attachListeners()}async translate(e){const s=await(await fetch("http://localhost:5002/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({q:e,source:"en",target:"fr"})})).json();return s==null?void 0:s.translatedText}renderPaymentOptions(e){const t=e.querySelector(".payment-options"),i=Bn(this.currency,this.localCurrency);if(t){const s=this.merchantDetail.plan?[se.card]:this.merchantDetail.paymentMethods.filter(o=>o!=="ussd").filter(o=>!(this.currency!=="USD"&&o==="stablecoin")).map(o=>se[o]);if(this.isMobile){let o='<div class="">';s.forEach(a=>{o+=`
|
|
1995
1995
|
<div key=${a.key}>
|
|
1996
1996
|
<button class="tab-button gap-2 mb-4 group" data-name="${a.key}">
|
|
1997
1997
|
<div class="lg:block">${a.icon}</div>
|
|
@@ -2071,7 +2071,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
2071
2071
|
|
|
2072
2072
|
</div>
|
|
2073
2073
|
</div>
|
|
2074
|
-
</div>`;class Oc{constructor(e){d(this,"container");d(this,"onAction");d(this,"onSuccess");d(this,"ref");d(this,"token");d(this,"initialTime",300);d(this,"abortController");d(this,"timeLeft");d(this,"timer");d(this,"timerId",null);d(this,"rdtCode");d(this,"url");d(this,"callBackUrl");d(this,"setPaymentResponses");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.onSuccess=e.onSuccess,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses}attachListeners(){const e=this.container.querySelector("#confirming-txn-status"),t=this.container.querySelector("#confirming-txn-status-end-text"),i=this.container.querySelector("#please-wait-text"),s=this.container.querySelector("#minutes-text");e&&(e.innerHTML=
|
|
2074
|
+
</div>`;class Oc{constructor(e){d(this,"container");d(this,"onAction");d(this,"onSuccess");d(this,"ref");d(this,"token");d(this,"initialTime",300);d(this,"abortController");d(this,"timeLeft");d(this,"timer");d(this,"timerId",null);d(this,"rdtCode");d(this,"url");d(this,"callBackUrl");d(this,"setPaymentResponses");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.onSuccess=e.onSuccess,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses}attachListeners(){const e=this.container.querySelector("#confirming-txn-status"),t=this.container.querySelector("#confirming-txn-status-end-text"),i=this.container.querySelector("#please-wait-text"),s=this.container.querySelector("#minutes-text");e&&(e.innerHTML=E["confirming-txn-status"]),t&&(t.innerHTML=E["few-minutes"]),i&&(i.innerHTML=E["please-wait-for"]),s&&(s.innerHTML=E.minutes),this.initialTime=300,this.timeLeft=this.initialTime;const o=3e4;this.abortController=new AbortController,setTimeout(()=>{this.verifyMobileMoney(this.token,o,({data:a,headers:l})=>{this.onAction(4),this.redirectTo(a,l,"success")},()=>{this.onAction(5)})},5e3),this.startTimer()}async verifyMobileMoney(e,t,i,s){let o=0,a=t,l=!0,c;this.abortController&&(c=this.abortController.signal);const p=async()=>{if(this.timeLeft<=0){l=!1,this.onAction(8);return}o+=1;try{const m=await Xe(e,this.ref,c,this.rdtCode,this.url);m.data.status==="failed"&&(l=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),this.setPaymentResponses(m.data,m.headers),_.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Failed"}),s(m)),m.data.status==="inProgress"&&(l&&(a=t*(o+1),this.timer=setTimeout(p,a)),this.setPaymentResponses(m.data,m.headers)),(m.data.status==="success"||m.data.status==="successful")&&(this.setPaymentResponses(m.data,m.headers),l=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),_.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Success"}),i(m))}catch{l&&(a=t*(o+1),this.timer=setTimeout(p,a))}};p()}redirectTo(e,t,i){const s=t.get("spf-redirect-url");this.callBackUrl=s||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const o=new URL(this.callBackUrl);o.searchParams.append("status",e.status),o.searchParams.append("reference",e.reference),window.location.href=o.toString()},1800):i==="success"&&this.onSuccess(e)}startTimer(){const e=this.container.querySelector("#ctd-timer");this.stopTimer(),this.timerId=window.setInterval(()=>{this.timeLeft>0?(this.timeLeft-=1,e&&(e.innerHTML=tt(this.timeLeft),this.startTimer())):(this.stopTimer(),this.onAction(8))},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return Nc}}const Uc=`<div data-section="mobile_money">
|
|
2075
2075
|
<form id="mobile-money-form">
|
|
2076
2076
|
<div>
|
|
2077
2077
|
<h5 class="text-grey-400 font-semibold text-sm" data-translate="header-text" id="header-text"></h5>
|
|
@@ -2217,7 +2217,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
2217
2217
|
</div>
|
|
2218
2218
|
</div>
|
|
2219
2219
|
</div>
|
|
2220
|
-
</div>`;class jc{constructor(e){d(this,"container");d(this,"onAction");d(this,"callBackUrl");d(this,"paymentResponse");d(this,"paymentResponseHeaders");d(this,"paymentMethod");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders,this.paymentMethod=e.paymentMethod}attachListeners(){const e=this.container.querySelector(".details-form-button"),t=this.container.querySelector("#mobile-money-button-text"),i=this.container.querySelector("#long-processing-text"),s=this.container.querySelector("#confirmed-text");i&&(i.innerHTML=P["long-processing"]),s&&(s.innerHTML=P["once-confirmed"]),t&&(t.innerHTML=j["merchant-back"]),e&&e.addEventListener("click",()=>{var o;_.track("redirect_to_merchant",{payment_method:this.paymentMethod,status:(o=this.paymentResponse)==null?void 0:o.status}),Ee(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){var e;this.container.innerHTML=this.render(),_.track("payment_timeout",{payment_method:this.paymentMethod,status:(e=this.paymentResponse)==null?void 0:e.status}),this.attachListeners()}render(){return Gc}}class zc{constructor({container:e,merchantKey:t,localCurrency:i,metadata:s,callBackUrl:o,rdtCode:a,reference:l,onSuccess:c,url:p,customer:m,amount:g,totalAmount:f,token:b,currency:w,disablePaymentMethods:C,hidePaymentMethods:k,showPaymentMethods:x,onClose:A,restartTransactionProcess:M,retryingPayment:E,countryCode:D}){d(this,"contents");d(this,"mobileMoneyForm");d(this,"mobileMoneyValidationForm");d(this,"onSuccess");d(this,"mobileMoneyConfirmation");d(this,"mobileMoneyConfirmationEnd");d(this,"transactionIssuesScreen");d(this,"container");d(this,"pageLoader");d(this,"mainLoader");d(this,"_currentStep");d(this,"successScreen");d(this,"customer");d(this,"activeRef");d(this,"warningScreen");d(this,"amount");d(this,"totalAmount");d(this,"url");d(this,"reference");d(this,"metadata");d(this,"currency");d(this,"localCurrency");d(this,"token");d(this,"callBackUrl");d(this,"rdtCode");d(this,"merchantDetails");d(this,"onClose");d(this,"hidePaymentMethods");d(this,"showPaymentMethods");d(this,"disablePaymentMethods");d(this,"paymentResponse");d(this,"paymentResponseHeaders");d(this,"restartTransactionProcess");d(this,"retryingPayment");d(this,"isMaxRetriesReached");d(this,"isMobile",!1);d(this,"countryCode");d(this,"errorText");d(this,"otpMessage");this.container=e,this.onSuccess=c||(()=>null),this.token=b,this.currency=w,this.amount=g,this.totalAmount=f,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.activeRef="",this.token=t,this.customer=m,this.metadata=s,this.localCurrency=i,this.callBackUrl=o,this.localCurrency=i,this.rdtCode=a,this.url=p,this.reference=l,this.merchantDetails={},this.disablePaymentMethods=C,this.hidePaymentMethods=k,this.showPaymentMethods=x,this.onClose=A,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=M,this.retryingPayment=E,this.isMaxRetriesReached=!1,this.countryCode=D,this.errorText="",this.otpMessage="",_.track("mobile_money_opens",{payment_method:"Mobile Money"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderMobileMoneyContent()}attachInputListeners(){}async createMobileMoney(e,t){e.stopPropagation(),e.preventDefault();const i=this.container.querySelector(".spinner"),s=this.container.querySelector("#mobile-money-button-text");i&&s&&(i.classList.remove("hidden"),s.classList.add("hidden"));const o=bt();(()=>{var l,c;if(this.retryingPayment){const p={channel:"mobile_money",reference:this.reference,mobileMoney:{code:t.code,phoneNumber:t.phoneNumber,...t.otp&&{otp:t.otp}}};return et(this.token,p,this.rdtCode,this.url)}else{const p={amount:this.amount,channel:"mobile_money",currency:this.currency,customer:this.customer,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,mobileMoney:{code:t.code,phoneNumber:t.phoneNumber,...t.otp&&{otp:t.otp}},...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((l=this.merchantDetails)==null?void 0:l.taxQuoteId)&&{taxQuoteId:(c=this.merchantDetails)==null?void 0:c.taxQuoteId},...this.countryCode&&{countryCode:this.countryCode},deviceInformation:o};return Ha(this.token,p,this.rdtCode,this.url)}})().then(async({data:l,headers:c})=>{var p,m;if(this.paymentResponse=l,this.paymentResponseHeaders=c,l.providerMessage){const g=await Z(l.providerMessage,R());this.errorText=g}if(l.status==="failed"){this.currentStep=5,l.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue(),_.track("start_payment_failed",{payment_method:"Mobile Money",verification_status:"Failed",payment_error:l.providerMessage||"Payment failed"});return}else if(l.status==="success"||l.status==="successful"){this.currentStep=4,_.track("start_payment_success",{payment_method:"Mobile Money",verification_status:"Success"}),Ee(l,c,l==null?void 0:l.callBackUrl);return}else if(((p=l==null?void 0:l.authorization)==null?void 0:p.mode)==="otp"){this.activeRef=l.reference;const g=await Z((m=this.paymentResponse)==null?void 0:m.providerMessage,R());this.otpMessage=g,this.currentStep=6;return}else this.currentStep=3}).catch(async l=>{if(_.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Null"}),l.code==="payment_max_retry_attempts")this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=5,this.warningScreen.setPaymentError(P["maximum-retries"],P["maximum-retries-desc"],j["merchant-back"]);else{const c=await Z(l.message,R());this.errorText=c,l.message?(this.currentStep=5,this.warningScreen.setPaymentError(this.errorText)):(this.currentStep=5,this.warningScreen.setPaymentError(P["payment-failed"]))}this.warningScreen.hideReportIssue()}).finally(()=>{i&&s&&(i.classList.add("hidden"),s.classList.remove("hidden"))})}showLoader(){this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader()}submitOtp(e,t){e.preventDefault();const i=this.container.querySelector(".spinner"),s=this.container.querySelector("#mobile-money-button-text"),o={authorization:{otp:t},reference:this.activeRef};_.track("input_MobileMoneyOTP",{payment_method:"Mobile Money",authentication_type:"0TP"}),i&&s&&(i.classList.remove("hidden"),s.classList.add("hidden")),Ot(this.token,o,this.rdtCode,this.url).then(({data:l})=>{l.status==="failed"?(this.activeRef=l.reference,this.currentStep=3):["success","successful","failed"].includes(l.status)?["success","successful"].includes(l.status)&&(this.activeRef=l.reference,this.currentStep=3):(this.activeRef=l.reference,this.currentStep=3)}).catch(async l=>{_.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Failed",authentication_type:"OTP"});const c=this.container.querySelector("#otp-error");if(l.code==="invalid_otp"){if(c){const p=await Z(l.message,R());c.innerHTML=p}_.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Failed",authentication_type:"OTP"})}else this.currentStep=3}).finally(()=>{i&&s&&(i.classList.add("hidden"),s.classList.remove("hidden"))})}async verifyPaymentProcess(){try{const e=await Xe(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=5}}goBackToMerchant(){Ee(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderMobileMoneyContent(e){if(e&&(this.merchantDetails=e),this.currentStep===3&&this.disablePaymentMethods("mobile_money"),this.currentStep!==1){const t=document.getElementById("go-back");t&&(t.classList.remove("flex","items-center","gap-2","mb-2"),t.innerHTML="")}switch(this.currentStep===6?this.hidePaymentMethods():this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.currentStep){case 1:this.mobileMoneyForm=new Vc({container:this.contents,merchantKey:this.token,url:this.url,onAction:t=>i=>this.createMobileMoney.bind(this)(t,i),ref:this.activeRef,switchScreen:t=>{this.currentStep=t},rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,totalAmount:this.totalAmount,restartTransactionProcess:this.restartTransactionProcess.bind(this),merchantDetails:this.merchantDetails,countryCode:this.countryCode||""}),this.mobileMoneyForm.renderContent();break;case 2:this.mainLoader=new ke(this.contents),this.mainLoader.mountLoader("25dvh"),this.mainLoader.updateMessage(xe["please-wait"]);break;case 3:this.mobileMoneyConfirmation=new Oc({container:this.contents,onAction:t=>{this.currentStep=t},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(t,i)=>{this.paymentResponse=t,this.paymentResponseHeaders=i}}),this.mobileMoneyConfirmation.renderComponent();break;case 4:this.successScreen=new Vn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate}),this.successScreen.renderComponent();break;case 5:this.warningScreen=new en({container:this.contents,onReportIssue:()=>this.currentStep=9,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this)}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 6:this.mobileMoneyValidationForm=new Kc({container:this.contents,onClose:this.onClose,onAction:t=>i=>this.submitOtp.bind(this)(t,i),otpMessage:this.otpMessage||xe["enter-phone-otp"]}),this.mobileMoneyValidationForm.renderComponent();break;case 7:this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 8:this.mobileMoneyConfirmationEnd=new jc({container:this.contents,onAction:t=>{this.currentStep=t},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders,paymentMethod:"Mobile Money"}),this.mobileMoneyConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new it({container:this.contents,onAction:()=>{var t;this.currentStep=5,this.warningScreen.setPaymentError(((t=this.paymentResponse)==null?void 0:t.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"mobile_money",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break}this.attachInputListeners()}}const qc=`<div id="eft-authenticate-container" data-section="eft">
|
|
2220
|
+
</div>`;class jc{constructor(e){d(this,"container");d(this,"onAction");d(this,"callBackUrl");d(this,"paymentResponse");d(this,"paymentResponseHeaders");d(this,"paymentMethod");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders,this.paymentMethod=e.paymentMethod}attachListeners(){const e=this.container.querySelector(".details-form-button"),t=this.container.querySelector("#mobile-money-button-text"),i=this.container.querySelector("#long-processing-text"),s=this.container.querySelector("#confirmed-text");i&&(i.innerHTML=E["long-processing"]),s&&(s.innerHTML=E["once-confirmed"]),t&&(t.innerHTML=j["merchant-back"]),e&&e.addEventListener("click",()=>{var o;_.track("redirect_to_merchant",{payment_method:this.paymentMethod,status:(o=this.paymentResponse)==null?void 0:o.status}),Ee(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){var e;this.container.innerHTML=this.render(),_.track("payment_timeout",{payment_method:this.paymentMethod,status:(e=this.paymentResponse)==null?void 0:e.status}),this.attachListeners()}render(){return Gc}}class zc{constructor({container:e,merchantKey:t,localCurrency:i,metadata:s,callBackUrl:o,rdtCode:a,reference:l,onSuccess:c,url:p,customer:m,amount:g,totalAmount:f,token:b,currency:w,disablePaymentMethods:C,hidePaymentMethods:k,showPaymentMethods:x,onClose:A,restartTransactionProcess:M,retryingPayment:P,countryCode:D}){d(this,"contents");d(this,"mobileMoneyForm");d(this,"mobileMoneyValidationForm");d(this,"onSuccess");d(this,"mobileMoneyConfirmation");d(this,"mobileMoneyConfirmationEnd");d(this,"transactionIssuesScreen");d(this,"container");d(this,"pageLoader");d(this,"mainLoader");d(this,"_currentStep");d(this,"successScreen");d(this,"customer");d(this,"activeRef");d(this,"warningScreen");d(this,"amount");d(this,"totalAmount");d(this,"url");d(this,"reference");d(this,"metadata");d(this,"currency");d(this,"localCurrency");d(this,"token");d(this,"callBackUrl");d(this,"rdtCode");d(this,"merchantDetails");d(this,"onClose");d(this,"hidePaymentMethods");d(this,"showPaymentMethods");d(this,"disablePaymentMethods");d(this,"paymentResponse");d(this,"paymentResponseHeaders");d(this,"restartTransactionProcess");d(this,"retryingPayment");d(this,"isMaxRetriesReached");d(this,"isMobile",!1);d(this,"countryCode");d(this,"errorText");d(this,"otpMessage");this.container=e,this.onSuccess=c||(()=>null),this.token=b,this.currency=w,this.amount=g,this.totalAmount=f,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.activeRef="",this.token=t,this.customer=m,this.metadata=s,this.localCurrency=i,this.callBackUrl=o,this.localCurrency=i,this.rdtCode=a,this.url=p,this.reference=l,this.merchantDetails={},this.disablePaymentMethods=C,this.hidePaymentMethods=k,this.showPaymentMethods=x,this.onClose=A,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=M,this.retryingPayment=P,this.isMaxRetriesReached=!1,this.countryCode=D,this.errorText="",this.otpMessage="",_.track("mobile_money_opens",{payment_method:"Mobile Money"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderMobileMoneyContent()}attachInputListeners(){}async createMobileMoney(e,t){e.stopPropagation(),e.preventDefault();const i=this.container.querySelector(".spinner"),s=this.container.querySelector("#mobile-money-button-text");i&&s&&(i.classList.remove("hidden"),s.classList.add("hidden"));const o=bt();(()=>{var l,c;if(this.retryingPayment){const p={channel:"mobile_money",reference:this.reference,mobileMoney:{code:t.code,phoneNumber:t.phoneNumber,...t.otp&&{otp:t.otp}}};return et(this.token,p,this.rdtCode,this.url)}else{const p={amount:this.amount,channel:"mobile_money",currency:this.currency,customer:this.customer,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,mobileMoney:{code:t.code,phoneNumber:t.phoneNumber,...t.otp&&{otp:t.otp}},...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((l=this.merchantDetails)==null?void 0:l.taxQuoteId)&&{taxQuoteId:(c=this.merchantDetails)==null?void 0:c.taxQuoteId},...this.countryCode&&{countryCode:this.countryCode},deviceInformation:o};return Ha(this.token,p,this.rdtCode,this.url)}})().then(async({data:l,headers:c})=>{var p,m;if(this.paymentResponse=l,this.paymentResponseHeaders=c,l.providerMessage){const g=await Z(l.providerMessage,R());this.errorText=g}if(l.status==="failed"){this.currentStep=5,l.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(E["payment-failed"]),this.warningScreen.hideReportIssue(),_.track("start_payment_failed",{payment_method:"Mobile Money",verification_status:"Failed",payment_error:l.providerMessage||"Payment failed"});return}else if(l.status==="success"||l.status==="successful"){this.currentStep=4,_.track("start_payment_success",{payment_method:"Mobile Money",verification_status:"Success"}),Ee(l,c,l==null?void 0:l.callBackUrl);return}else if(((p=l==null?void 0:l.authorization)==null?void 0:p.mode)==="otp"){this.activeRef=l.reference;const g=await Z((m=this.paymentResponse)==null?void 0:m.providerMessage,R());this.otpMessage=g,this.currentStep=6;return}else this.currentStep=3}).catch(async l=>{if(_.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Null"}),l.code==="payment_max_retry_attempts")this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=5,this.warningScreen.setPaymentError(E["maximum-retries"],E["maximum-retries-desc"],j["merchant-back"]);else{const c=await Z(l.message,R());this.errorText=c,l.message?(this.currentStep=5,this.warningScreen.setPaymentError(this.errorText)):(this.currentStep=5,this.warningScreen.setPaymentError(E["payment-failed"]))}this.warningScreen.hideReportIssue()}).finally(()=>{i&&s&&(i.classList.add("hidden"),s.classList.remove("hidden"))})}showLoader(){this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader()}submitOtp(e,t){e.preventDefault();const i=this.container.querySelector(".spinner"),s=this.container.querySelector("#mobile-money-button-text"),o={authorization:{otp:t},reference:this.activeRef};_.track("input_MobileMoneyOTP",{payment_method:"Mobile Money",authentication_type:"0TP"}),i&&s&&(i.classList.remove("hidden"),s.classList.add("hidden")),Ot(this.token,o,this.rdtCode,this.url).then(({data:l})=>{l.status==="failed"?(this.activeRef=l.reference,this.currentStep=3):["success","successful","failed"].includes(l.status)?["success","successful"].includes(l.status)&&(this.activeRef=l.reference,this.currentStep=3):(this.activeRef=l.reference,this.currentStep=3)}).catch(async l=>{_.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Failed",authentication_type:"OTP"});const c=this.container.querySelector("#otp-error");if(l.code==="invalid_otp"){if(c){const p=await Z(l.message,R());c.innerHTML=p}_.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Failed",authentication_type:"OTP"})}else this.currentStep=3}).finally(()=>{i&&s&&(i.classList.add("hidden"),s.classList.remove("hidden"))})}async verifyPaymentProcess(){try{const e=await Xe(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=5}}goBackToMerchant(){Ee(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderMobileMoneyContent(e){if(e&&(this.merchantDetails=e),this.currentStep===3&&this.disablePaymentMethods("mobile_money"),this.currentStep!==1){const t=document.getElementById("go-back");t&&(t.classList.remove("flex","items-center","gap-2","mb-2"),t.innerHTML="")}switch(this.currentStep===6?this.hidePaymentMethods():this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.currentStep){case 1:this.mobileMoneyForm=new Vc({container:this.contents,merchantKey:this.token,url:this.url,onAction:t=>i=>this.createMobileMoney.bind(this)(t,i),ref:this.activeRef,switchScreen:t=>{this.currentStep=t},rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,totalAmount:this.totalAmount,restartTransactionProcess:this.restartTransactionProcess.bind(this),merchantDetails:this.merchantDetails,countryCode:this.countryCode||""}),this.mobileMoneyForm.renderContent();break;case 2:this.mainLoader=new ke(this.contents),this.mainLoader.mountLoader("25dvh"),this.mainLoader.updateMessage(xe["please-wait"]);break;case 3:this.mobileMoneyConfirmation=new Oc({container:this.contents,onAction:t=>{this.currentStep=t},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(t,i)=>{this.paymentResponse=t,this.paymentResponseHeaders=i}}),this.mobileMoneyConfirmation.renderComponent();break;case 4:this.successScreen=new Vn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate}),this.successScreen.renderComponent();break;case 5:this.warningScreen=new en({container:this.contents,onReportIssue:()=>this.currentStep=9,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this)}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 6:this.mobileMoneyValidationForm=new Kc({container:this.contents,onClose:this.onClose,onAction:t=>i=>this.submitOtp.bind(this)(t,i),otpMessage:this.otpMessage||xe["enter-phone-otp"]}),this.mobileMoneyValidationForm.renderComponent();break;case 7:this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 8:this.mobileMoneyConfirmationEnd=new jc({container:this.contents,onAction:t=>{this.currentStep=t},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders,paymentMethod:"Mobile Money"}),this.mobileMoneyConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new it({container:this.contents,onAction:()=>{var t;this.currentStep=5,this.warningScreen.setPaymentError(((t=this.paymentResponse)==null?void 0:t.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"mobile_money",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break}this.attachInputListeners()}}const qc=`<div id="eft-authenticate-container" data-section="eft">
|
|
2221
2221
|
<div class="pt-3">
|
|
2222
2222
|
<div class="container-center">
|
|
2223
2223
|
<svg width="98" height="32" viewBox="0 0 98 32" fill="none" xmlns="http://www.w3.org/2000/svg"
|
|
@@ -2250,7 +2250,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
2250
2250
|
</div>
|
|
2251
2251
|
</div>
|
|
2252
2252
|
|
|
2253
|
-
</div>`;class va{constructor(e){d(this,"container");d(this,"payment");d(this,"warningError");d(this,"pageLoader");d(this,"onAction");d(this,"restartTransactionProcess");this.container=e.container,this.onAction=e.onAction,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new en({container:this.container,onAction:this.restartTransactionProcess.bind(this)})}attachListener(){const e=this.container.querySelector("#authenticate-btn"),t=this.container.querySelector("#authenticate-request-text"),i=this.container.querySelector("#authenticate-button-text");t&&(t.innerHTML=An["authenticate-request"]),i&&(i.innerHTML=An.authenticate),e&&e.addEventListener("click",()=>{this.onAction(),_.track("start_payment",{payment_method:"EFT"})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return qc}}class Wc{constructor({amount:e,totalAmount:t,container:i,customer:s,token:o,currency:a,rdtCode:l,url:c,reference:p,callBackUrl:m,metadata:g,localCurrency:f,hidePaymentMethods:b,showPaymentMethods:w,restartTransactionProcess:C,retryingPayment:k}){d(this,"contents");d(this,"eftAuthenticate");d(this,"successScreen");d(this,"pageLoader");d(this,"warningScreen");d(this,"transactionIssuesScreen");d(this,"container");d(this,"customer");d(this,"token");d(this,"amount");d(this,"totalAmount");d(this,"currency");d(this,"_currentStep");d(this,"rdtCode");d(this,"url");d(this,"reference");d(this,"callBackUrl");d(this,"metadata");d(this,"localCurrency");d(this,"hidePaymentMethods");d(this,"showPaymentMethods");d(this,"merchantPlanDetail",{});d(this,"restartTransactionProcess");d(this,"retryingPayment");d(this,"isMaxRetriesReached");d(this,"isMobile",!1);d(this,"paymentResponse");d(this,"paymentResponseHeaders");d(this,"errorText");this.currency=a,this.container=i,this.token=o,this.customer=s,this.amount=e,this.totalAmount=t,this.rdtCode=l,this.url=c,this.reference=p,this.callBackUrl=m,this.metadata=g,this.localCurrency=f,this._currentStep=1,this.contents=this.container.querySelector("#payment-content-view"),this.hidePaymentMethods=b,this.showPaymentMethods=w,this.restartTransactionProcess=C,this.retryingPayment=k,this.isMaxRetriesReached=!1,this.paymentResponse={},this.paymentResponseHeaders={},this.errorText="",this.renderEftContent(),_.track("eft_opens",{payment_method:"EFT"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderEftContent()}showLoader(){this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage(
|
|
2253
|
+
</div>`;class va{constructor(e){d(this,"container");d(this,"payment");d(this,"warningError");d(this,"pageLoader");d(this,"onAction");d(this,"restartTransactionProcess");this.container=e.container,this.onAction=e.onAction,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new en({container:this.container,onAction:this.restartTransactionProcess.bind(this)})}attachListener(){const e=this.container.querySelector("#authenticate-btn"),t=this.container.querySelector("#authenticate-request-text"),i=this.container.querySelector("#authenticate-button-text");t&&(t.innerHTML=An["authenticate-request"]),i&&(i.innerHTML=An.authenticate),e&&e.addEventListener("click",()=>{this.onAction(),_.track("start_payment",{payment_method:"EFT"})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return qc}}class Wc{constructor({amount:e,totalAmount:t,container:i,customer:s,token:o,currency:a,rdtCode:l,url:c,reference:p,callBackUrl:m,metadata:g,localCurrency:f,hidePaymentMethods:b,showPaymentMethods:w,restartTransactionProcess:C,retryingPayment:k}){d(this,"contents");d(this,"eftAuthenticate");d(this,"successScreen");d(this,"pageLoader");d(this,"warningScreen");d(this,"transactionIssuesScreen");d(this,"container");d(this,"customer");d(this,"token");d(this,"amount");d(this,"totalAmount");d(this,"currency");d(this,"_currentStep");d(this,"rdtCode");d(this,"url");d(this,"reference");d(this,"callBackUrl");d(this,"metadata");d(this,"localCurrency");d(this,"hidePaymentMethods");d(this,"showPaymentMethods");d(this,"merchantPlanDetail",{});d(this,"restartTransactionProcess");d(this,"retryingPayment");d(this,"isMaxRetriesReached");d(this,"isMobile",!1);d(this,"paymentResponse");d(this,"paymentResponseHeaders");d(this,"errorText");this.currency=a,this.container=i,this.token=o,this.customer=s,this.amount=e,this.totalAmount=t,this.rdtCode=l,this.url=c,this.reference=p,this.callBackUrl=m,this.metadata=g,this.localCurrency=f,this._currentStep=1,this.contents=this.container.querySelector("#payment-content-view"),this.hidePaymentMethods=b,this.showPaymentMethods=w,this.restartTransactionProcess=C,this.retryingPayment=k,this.isMaxRetriesReached=!1,this.paymentResponse={},this.paymentResponseHeaders={},this.errorText="",this.renderEftContent(),_.track("eft_opens",{payment_method:"EFT"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderEftContent()}showLoader(){this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage(E["verify-payment"])}goBackToMerchant(){Ee(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}async createEftPayment(){const e=this.container.querySelector(".spinner"),t=this.container.querySelector("#authenticate-button-text");e&&t&&(e.classList.remove("hidden"),t.classList.add("hidden"));const i=bt();(()=>{var o,a;if(this.retryingPayment){const l={channel:"eft",reference:this.reference};return et(this.token,l,this.rdtCode,this.url)}else{const l={amount:this.amount,channel:"eft",currency:this.currency,customer:this.customer,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((o=this.merchantPlanDetail)==null?void 0:o.taxQuoteId)&&{taxQuoteId:(a=this.merchantPlanDetail)==null?void 0:a.taxQuoteId},deviceInformation:i};return Ri(this.token,l,this.rdtCode,this.url)}})().then(async({data:o,headers:a})=>{var l,c,p;if(this.paymentResponse=o,this.paymentResponseHeaders=a,o.providerMessage){const m=await Z(o.providerMessage,R());this.errorText=m}if(o.status==="failed"){this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(E["payment-failed"]),_.track("start_payment",{payment_method:"EFT",verification_status:"Failed"});return}else if(((l=o==null?void 0:o.authorization)==null?void 0:l.mode)==="redirect"){(c=o==null?void 0:o.authorization)!=null&&c.redirectUrl&&this.redirectToOzow((p=o==null?void 0:o.authorization)==null?void 0:p.redirectUrl);return}else this.currentStep=4,o!=null&&o.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(An["unable-redirect-url"])}).catch(async o=>{if(o.code==="payment_max_retry_attempts")this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,this.warningScreen.setPaymentError(E["maximum-retries"],E["maximum-retries-desc"],j["merchant-back"]);else if(o.message){const a=await Z(o.message,R());this.errorText=a,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(j["payment-failed"])}).finally(()=>{e&&t&&(e.classList.add("hidden"),t.classList.remove("hidden"))})}redirectToOzow(e){const t=window.open(e,"_blank");if(t){_.track("auth_redirect",{payment_method:"EFT",authentication_type:"Redirect",verification_status:"In Progress"}),this.currentStep=3,this.showLoader();const i=setInterval(()=>{t.closed&&(clearInterval(i),this.verifyPaymentProcess())},2e3)}}async verifyPaymentProcess(){try{const e=await Xe(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers;const t=this.paymentResponse.status;if(t==="successful")this.currentStep=2,_.track("verify_payment",{payment_method:"EFT",verification_status:"Success"}),Ee(this.paymentResponse,this.paymentResponseHeaders,"success");else if(t==="failed"){if(this.paymentResponse.providerMessage){const i=await Z(this.paymentResponse.providerMessage,R());this.errorText=i}this.currentStep=4,_.track("verify_payment",{payment_method:"EFT",verification_status:"Failed"}),this.paymentResponse.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(j["payment-failed"])}else t==="cancelled"&&(this.isMaxRetriesReached=!0,this.currentStep=4,this.warningScreen.setPaymentError(An["payment-cancelled"],An["cancel-payment-desc"],j["merchant-back"]))}catch{this.currentStep=4,this.warningScreen.setPaymentError(j["payment-failed"])}}renderEftContent(e){var i;e&&(this.merchantPlanDetail=e);const t=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),t==null||t.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents)switch(this.currentStep){case 1:this.eftAuthenticate=new va({container:this.contents,onAction:this.createEftPayment.bind(this),restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break;case 2:this.successScreen=new Vn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(i=this.merchantPlanDetail)==null?void 0:i.rate.rate}),this.successScreen.renderComponent();break;case 3:this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage(E["verify-payment"]);break;case 4:this.warningScreen=new en({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=5}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.transactionIssuesScreen=new it({container:this.contents,onAction:async()=>{var s,o;if((s=this.paymentResponse)!=null&&s.providerMessage){const a=await Z((o=this.paymentResponse)==null?void 0:o.providerMessage,R());this.errorText=a}this.currentStep=4,this.warningScreen.setPaymentError(this.errorText||E["payment-failed"])},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"eft",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;default:this.eftAuthenticate=new va({container:this.contents,onAction:this.createEftPayment.bind(this),restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break}}}const Zc=`<form id="stablecoins-form" data-section="stablecoin">
|
|
2254
2254
|
<div class="mt-2 flex flex-col gap-4">
|
|
2255
2255
|
<div class="relative bank-select-relative">
|
|
2256
2256
|
<div class="relative w-full">
|
|
@@ -2299,7 +2299,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
2299
2299
|
</div>
|
|
2300
2300
|
|
|
2301
2301
|
</div>
|
|
2302
|
-
</form>`;function Qc(n){return`https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${encodeURIComponent(n)}`}class ba{constructor(e){d(this,"container");d(this,"warningError");d(this,"pageLoader");d(this,"onAction");d(this,"onVerify");d(this,"restartTransactionProcess");d(this,"chainsList",[]);d(this,"assetList",[]);d(this,"merchantKey");d(this,"_currentStep");d(this,"rdtCode");d(this,"url");d(this,"amount");d(this,"customer");d(this,"warningScreen");d(this,"merchantPlanDetail",{});d(this,"metadata");d(this,"callBackUrl");d(this,"reference");d(this,"token");d(this,"currency");d(this,"paymentResponse");d(this,"localCurrency");d(this,"retryingPayment");d(this,"isMaxRetriesReached");d(this,"errorText");this.container=e.container,this.onAction=e.onAction,this.onVerify=e.onVerify,this.amount=e.amount,this.currency=e.currency,this.restartTransactionProcess=e.restartTransactionProcess,this.paymentResponse={},this.token=e.token,this.reference=e.reference,this.callBackUrl=e.callBackUrl,this.customer=e.customer,this.metadata=e.metadata,this.retryingPayment=e.retryingPayment,this.localCurrency=e.localCurrency,this.warningError=new en({container:this.container,onAction:this.restartTransactionProcess.bind(this)}),this.merchantKey=e.merchantKey,this.url=e.url,this.rdtCode=e.rdtCode,this._currentStep=1,this.isMaxRetriesReached=!1,this.errorText=""}populateSelect(e,t,i,s){if(!e)return;e.innerHTML="";const o=document.createElement("option");o.value="",o.textContent=i,o.disabled=!0,o.selected=!0,e.appendChild(o),t.forEach(a=>{const l=document.createElement("option");l.value=a.value,l.textContent=s?a.label.toUpperCase():Bc(a.label),e.appendChild(l)})}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e}copyToClipboard(e,t){const i=t.innerHTML;navigator.clipboard.writeText(e).then(()=>{t.innerHTML=Fe["copied-text"],setTimeout(()=>{t.innerHTML=i},1500)}).catch(()=>{t.innerHTML="Failed to copy",setTimeout(()=>{t.innerHTML=i},1500)})}attachListener(){var g;const e=document.querySelector('span[name="select-asset-text"]'),t=document.querySelector('span[name="select-chain-text"]'),i=this.container.querySelector("#chain-select"),s=this.container.querySelector("#asset-select"),o=document.querySelector("#wallet-address-text");o&&(o.textContent=Fe["wallet-address"]),e&&(e.textContent=Fe["select-asset"]),t&&(t.textContent=Fe["select-chain"]),this.populateSelect(i,this.chainsList,Fe["select-chain"]);const a=async()=>{if(this.chainsList.length===0)try{const f=await qa(this.merchantKey,this.rdtCode,this.url);this.chainsList=f.map(b=>({label:b,value:b}))}catch(f){console.error("Error fetching chains:",f),this.chainsList=[]}this.populateSelect(i,this.chainsList,Fe["select-chain"])},l=async()=>{if(this.assetList.length===0)try{const f=await za(this.merchantKey,this.rdtCode,this.url);this.assetList=f.map(b=>({label:b,value:b}))}catch(f){console.error("Error fetching assets:",f),this.assetList=[]}this.populateSelect(s,this.assetList,Fe["select-asset"],!0)};a(),l();const c=this.container.querySelector("#qr-code"),p=(g=Fe["payment-text"])==null?void 0:g.replace("{amount}",`${this.amount.toString()} ${this.currency}`),m=async()=>{var w,C;const f=i.value,b=s.value;if(f&&b){i.disabled=!0,s.disabled=!0,await this.createStablecoinPayment({chain:f,asset:b});const k=(C=(w=this.paymentResponse)==null?void 0:w.stablecoin)==null?void 0:C.depositAddress,x=Qc(k);c.innerHTML=`
|
|
2302
|
+
</form>`;function Qc(n){return`https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${encodeURIComponent(n)}`}class ba{constructor(e){d(this,"container");d(this,"warningError");d(this,"pageLoader");d(this,"onAction");d(this,"onVerify");d(this,"restartTransactionProcess");d(this,"chainsList",[]);d(this,"assetList",[]);d(this,"merchantKey");d(this,"_currentStep");d(this,"rdtCode");d(this,"url");d(this,"amount");d(this,"customer");d(this,"warningScreen");d(this,"merchantPlanDetail",{});d(this,"metadata");d(this,"callBackUrl");d(this,"reference");d(this,"token");d(this,"currency");d(this,"paymentResponse");d(this,"localCurrency");d(this,"onStepChange");d(this,"retryingPayment");d(this,"isMaxRetriesReached");d(this,"errorText");this.container=e.container,this.onAction=e.onAction,this.onVerify=e.onVerify,this.amount=e.amount,this.currency=e.currency,this.restartTransactionProcess=e.restartTransactionProcess,this.paymentResponse={},this.token=e.token,this.reference=e.reference,this.callBackUrl=e.callBackUrl,this.customer=e.customer,this.metadata=e.metadata,this.retryingPayment=e.retryingPayment,this.localCurrency=e.localCurrency,this.warningError=new en({container:this.container,onAction:this.restartTransactionProcess.bind(this)}),this.merchantKey=e.merchantKey,this.url=e.url,this.rdtCode=e.rdtCode,this._currentStep=1,this.isMaxRetriesReached=!1,this.errorText="",this.onStepChange=e.onStepChange}populateSelect(e,t,i,s){if(!e)return;e.innerHTML="";const o=document.createElement("option");o.value="",o.textContent=i,o.disabled=!0,o.selected=!0,e.appendChild(o),t.forEach(a=>{const l=document.createElement("option");l.value=a.value,l.textContent=s?a.label.toUpperCase():Bc(a.label),e.appendChild(l)})}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e}copyToClipboard(e,t){const i=t.innerHTML;navigator.clipboard.writeText(e).then(()=>{t.innerHTML=Fe["copied-text"],setTimeout(()=>{t.innerHTML=i},1500)}).catch(()=>{t.innerHTML="Failed to copy",setTimeout(()=>{t.innerHTML=i},1500)})}attachListener(){var g;const e=document.querySelector('span[name="select-asset-text"]'),t=document.querySelector('span[name="select-chain-text"]'),i=this.container.querySelector("#chain-select"),s=this.container.querySelector("#asset-select"),o=document.querySelector("#wallet-address-text");o&&(o.textContent=Fe["wallet-address"]),e&&(e.textContent=Fe["select-asset"]),t&&(t.textContent=Fe["select-chain"]),this.populateSelect(i,this.chainsList,Fe["select-chain"]);const a=async()=>{if(this.chainsList.length===0)try{const f=await qa(this.merchantKey,this.rdtCode,this.url);this.chainsList=f.map(b=>({label:b,value:b}))}catch(f){console.error("Error fetching chains:",f),this.chainsList=[]}this.populateSelect(i,this.chainsList,Fe["select-chain"])},l=async()=>{if(this.assetList.length===0)try{const f=await za(this.merchantKey,this.rdtCode,this.url);this.assetList=f.map(b=>({label:b,value:b}))}catch(f){console.error("Error fetching assets:",f),this.assetList=[]}this.populateSelect(s,this.assetList,Fe["select-asset"],!0)};a(),l();const c=this.container.querySelector("#qr-code"),p=(g=Fe["payment-text"])==null?void 0:g.replace("{amount}",`${this.amount.toString()} ${this.currency}`),m=async()=>{var w,C;const f=i.value,b=s.value;if(f&&b){i.disabled=!0,s.disabled=!0,await this.createStablecoinPayment({chain:f,asset:b});const k=(C=(w=this.paymentResponse)==null?void 0:w.stablecoin)==null?void 0:C.depositAddress,x=Qc(k);c.innerHTML=`
|
|
2303
2303
|
<div>
|
|
2304
2304
|
<div class='mb-4 mt-2'>
|
|
2305
2305
|
<p class=" text-black text-xs font-medium" id="payment-text">${p||""}</p>
|
|
@@ -2330,7 +2330,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
2330
2330
|
</button>
|
|
2331
2331
|
</div>
|
|
2332
2332
|
</div>
|
|
2333
|
-
`;const A=c.querySelector("#confirm-payment-btn"),M=c.querySelector("#wallet-address");M&&(M.textContent=Fe["copy-text"]),A&&(A.textContent=Fe["payment-confirmation"]),A==null||A.addEventListener("click",async()=>{await this.onVerify()}),M==null||M.addEventListener("click",()=>{this.copyToClipboard(k,M)})}else c.innerHTML=""};i.addEventListener("change",m),s.addEventListener("change",m)}async createStablecoinPayment(e){const t=this.container.querySelector(".spinner"),i=this.container.querySelector("#confirm-payment-btn"),s=i?i.querySelector(".text"):null;t&&s&&(t.classList.remove("hidden"),s.classList.add("hidden"));const o=bt();return(()=>{var l,c;if(this.retryingPayment){const p={channel:"stablecoin",reference:this.reference,stablecoin:{asset:e.asset,chain:e.chain}};return et(this.token,p,this.rdtCode,this.url)}else{const p={amount:this.amount,channel:"stablecoin",currency:this.currency,customer:this.customer,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,isCheckout:!0,...this.localCurrency&&{localCurrency:this.localCurrency},deviceInformation:o,...((l=this.merchantPlanDetail)==null?void 0:l.taxQuoteId)&&{taxQuoteId:(c=this.merchantPlanDetail)==null?void 0:c.taxQuoteId},stablecoin:{asset:e.asset,chain:e.chain}};return Na(this.token,p,this.rdtCode,this.url)}})().then(async({data:l,headers:c})=>{if(this.paymentResponse=l,l.status==="failed"){if(this.
|
|
2333
|
+
`;const A=c.querySelector("#confirm-payment-btn"),M=c.querySelector("#wallet-address");M&&(M.textContent=Fe["copy-text"]),A&&(A.textContent=Fe["payment-confirmation"]),A==null||A.addEventListener("click",async()=>{await this.onVerify()}),M==null||M.addEventListener("click",()=>{this.copyToClipboard(k,M)})}else c.innerHTML=""};i.addEventListener("change",m),s.addEventListener("change",m)}async createStablecoinPayment(e){const t=this.container.querySelector(".spinner"),i=this.container.querySelector("#confirm-payment-btn"),s=i?i.querySelector(".text"):null;t&&s&&(t.classList.remove("hidden"),s.classList.add("hidden"));const o=bt();return(()=>{var l,c;if(this.retryingPayment){const p={channel:"stablecoin",reference:this.reference,stablecoin:{asset:e.asset,chain:e.chain}};return et(this.token,p,this.rdtCode,this.url)}else{const p={amount:this.amount,channel:"stablecoin",currency:this.currency,customer:this.customer,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,isCheckout:!0,...this.localCurrency&&{localCurrency:this.localCurrency},deviceInformation:o,...((l=this.merchantPlanDetail)==null?void 0:l.taxQuoteId)&&{taxQuoteId:(c=this.merchantPlanDetail)==null?void 0:c.taxQuoteId},stablecoin:{asset:e.asset,chain:e.chain}};return Na(this.token,p,this.rdtCode,this.url)}})().then(async({data:l,headers:c})=>{var p;if(this.paymentResponse=l,l.status==="failed"){if((p=this.onStepChange)==null||p.call(this,4),l.providerMessage){const m=await Z(l.providerMessage,wt.language);this.errorText=m,this.warningScreen.setPaymentError(this.errorText)}else this.warningScreen.setPaymentError(E["payment-failed"]);_.track("start_payment",{payment_method:"Stablecoins",verification_status:"Failed"});return}else if(l.status==="success")this.currentStep=2,_.track("start_payment_success",{payment_method:"Mobile Money",verification_status:"Success"}),Ee(l,c,l==null?void 0:l.callBackUrl);else return}).catch(async l=>{var c,p;if(_.track("verify_payment",{payment_method:"Stablecoins",verification_status:"Null"}),l.code==="payment_max_retry_attempts")this.isMaxRetriesReached=!0,(c=this.onStepChange)==null||c.call(this,4),this.warningScreen.setPaymentError(E["maximum-retries"],E["maximum-retries-desc"],j["merchant-back"]);else if((p=this.onStepChange)==null||p.call(this,4),l.message){const m=await Z(l.message,wt==null?void 0:wt.language);this.errorText=m,this.warningScreen.setPaymentError(this.errorText)}else this.warningScreen.setPaymentError(E["payment-failed"]);this.warningScreen.hideReportIssue()}).finally(()=>{t&&s&&(t.classList.add("hidden"),s.classList.remove("hidden"))})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return Zc}}const Jc=`<div id="stablecoinConfirmationProgress" data-section="stablecoin">
|
|
2334
2334
|
<div>
|
|
2335
2335
|
<div>
|
|
2336
2336
|
<div class=" grid grid-rows-[auto_1fr] gap-4 mx-5">
|
|
@@ -2369,7 +2369,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
2369
2369
|
|
|
2370
2370
|
</div>
|
|
2371
2371
|
</div>
|
|
2372
|
-
</div>`;class Yc{constructor(e){d(this,"container");d(this,"onAction");d(this,"onSuccess");d(this,"ref");d(this,"token");d(this,"initialTime",300);d(this,"abortController");d(this,"timeLeft");d(this,"timer");d(this,"timerId",null);d(this,"rdtCode");d(this,"url");d(this,"callBackUrl");d(this,"setPaymentResponses");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.onSuccess=e.onSuccess,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses}attachListeners(){const e=this.container.querySelector("#confirming-txn-status"),t=this.container.querySelector("#confirming-txn-status-end-text"),i=this.container.querySelector("#please-wait-text"),s=this.container.querySelector("#minutes-text");e&&(e.innerHTML=
|
|
2372
|
+
</div>`;class Yc{constructor(e){d(this,"container");d(this,"onAction");d(this,"onSuccess");d(this,"ref");d(this,"token");d(this,"initialTime",300);d(this,"abortController");d(this,"timeLeft");d(this,"timer");d(this,"timerId",null);d(this,"rdtCode");d(this,"url");d(this,"callBackUrl");d(this,"setPaymentResponses");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.onSuccess=e.onSuccess,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses}attachListeners(){const e=this.container.querySelector("#confirming-txn-status"),t=this.container.querySelector("#confirming-txn-status-end-text"),i=this.container.querySelector("#please-wait-text"),s=this.container.querySelector("#minutes-text");e&&(e.innerHTML=E["confirming-txn-status"]),t&&(t.innerHTML=E["few-minutes"]),i&&(i.innerHTML=E["please-wait-for"]),s&&(s.innerHTML=E.minutes),this.initialTime=300,this.timeLeft=this.initialTime;const o=3e4;this.abortController=new AbortController,setTimeout(()=>{this.verifyStablecoins(this.token,o,({data:a,headers:l})=>{this.onAction(2),this.redirectTo(a,l,"success")},()=>{this.onAction(4)})},5e3),this.startTimer()}async verifyStablecoins(e,t,i,s){let o=0,a=t,l=!0,c;this.abortController&&(c=this.abortController.signal);const p=async()=>{if(this.timeLeft<=0){l=!1,this.onAction(7);return}o+=1;try{const m=await Xe(e,this.ref,c,this.rdtCode,this.url);m.data.status==="failed"&&(l=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),this.setPaymentResponses(m.data,m.headers),_.track("verify_payment",{payment_method:"Stablecoins",verification_status:"Failed"}),s(m)),m.data.status==="inProgress"&&(l&&(a=t*(o+1),this.timer=setTimeout(p,a)),this.setPaymentResponses(m.data,m.headers)),(m.data.status==="success"||m.data.status==="successful")&&(this.setPaymentResponses(m.data,m.headers),l=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),_.track("verify_payment",{payment_method:"Stablecoins",verification_status:"Success"}),i(m))}catch{l&&(a=t*(o+1),this.timer=setTimeout(p,a))}};p()}redirectTo(e,t,i){const s=t.get("spf-redirect-url");this.callBackUrl=s||this.callBackUrl,(i==="success"||i==="successful")&&this.onSuccess(e)}startTimer(){const e=this.container.querySelector("#ctd-timer");this.stopTimer(),this.timerId=window.setInterval(()=>{this.timeLeft>0?(this.timeLeft-=1,e&&(e.innerHTML=tt(this.timeLeft),this.startTimer())):(this.stopTimer(),this.onAction(8))},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return Jc}}const Xc=`<div id="checkoutConfirmationEnd" data-section="stablecoin">
|
|
2373
2373
|
<div class="w-full">
|
|
2374
2374
|
<div id="otp-content" class=" grid gap-4">
|
|
2375
2375
|
<h5 class="text-black" id="otp-message">
|
|
@@ -2397,7 +2397,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
2397
2397
|
</div>
|
|
2398
2398
|
</div>
|
|
2399
2399
|
</div>
|
|
2400
|
-
</div>`;class $c{constructor(e){d(this,"container");d(this,"onAction");d(this,"callBackUrl");d(this,"paymentResponse");d(this,"paymentResponseHeaders");d(this,"paymentMethod");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders,this.paymentMethod=e.paymentMethod}attachListeners(){const e=this.container.querySelector(".details-form-button");e&&e.addEventListener("click",()=>{var t;_.track("redirect_to_merchant",{payment_method:this.paymentMethod,status:(t=this.paymentResponse)==null?void 0:t.status}),Ee(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){var e;this.container.innerHTML=this.render(),_.track("payment_timeout",{payment_method:this.paymentMethod,status:(e=this.paymentResponse)==null?void 0:e.status}),this.attachListeners()}render(){return Xc}}class ed{constructor({container:e,restartTransactionProcess:t,amount:i,currency:s,customer:o,callBackUrl:a,metadata:l,reference:c,rdtCode:p,url:m,token:g,retryingPayment:f,totalAmount:b,localCurrency:w,onSuccess:C}){d(this,"contents");d(this,"container");d(this,"stableCoinsForm");d(this,"successScreen");d(this,"stablecoinConfirmationEnd");d(this,"pageLoader");d(this,"onSuccess");d(this,"restartTransactionProcess");d(this,"stablecoinsConfirmationProgress");d(this,"_currentStep");d(this,"customer");d(this,"totalAmount");d(this,"amount");d(this,"currency");d(this,"rdtCode");d(this,"url");d(this,"reference");d(this,"callBackUrl");d(this,"metadata");d(this,"retryingPayment");d(this,"warningScreen");d(this,"transactionIssuesScreen");d(this,"paymentResponse");d(this,"paymentResponseHeaders");d(this,"isMaxRetriesReached");d(this,"token");d(this,"localCurrency");this.token=g,this.amount=i,this.totalAmount=b,this.currency=s,this.customer=o,this.rdtCode=p,this.url=m,this.reference=c,this.callBackUrl=a,this.metadata=l,this.retryingPayment=f,this.container=e,this.restartTransactionProcess=t,this.isMaxRetriesReached=!1,this.localCurrency=w,this.paymentResponseHeaders={},this.paymentResponse={},this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.onSuccess=C||(()=>null)}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderStablecoinsContent()}showLoader(){this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage(
|
|
2400
|
+
</div>`;class $c{constructor(e){d(this,"container");d(this,"onAction");d(this,"callBackUrl");d(this,"paymentResponse");d(this,"paymentResponseHeaders");d(this,"paymentMethod");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders,this.paymentMethod=e.paymentMethod}attachListeners(){const e=this.container.querySelector(".details-form-button");e&&e.addEventListener("click",()=>{var t;_.track("redirect_to_merchant",{payment_method:this.paymentMethod,status:(t=this.paymentResponse)==null?void 0:t.status}),Ee(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){var e;this.container.innerHTML=this.render(),_.track("payment_timeout",{payment_method:this.paymentMethod,status:(e=this.paymentResponse)==null?void 0:e.status}),this.attachListeners()}render(){return Xc}}class ed{constructor({container:e,restartTransactionProcess:t,amount:i,currency:s,customer:o,callBackUrl:a,metadata:l,reference:c,rdtCode:p,url:m,token:g,retryingPayment:f,totalAmount:b,localCurrency:w,onSuccess:C}){d(this,"contents");d(this,"container");d(this,"stableCoinsForm");d(this,"successScreen");d(this,"stablecoinConfirmationEnd");d(this,"pageLoader");d(this,"onSuccess");d(this,"restartTransactionProcess");d(this,"stablecoinsConfirmationProgress");d(this,"_currentStep");d(this,"customer");d(this,"totalAmount");d(this,"amount");d(this,"currency");d(this,"rdtCode");d(this,"url");d(this,"reference");d(this,"callBackUrl");d(this,"metadata");d(this,"retryingPayment");d(this,"warningScreen");d(this,"transactionIssuesScreen");d(this,"paymentResponse");d(this,"paymentResponseHeaders");d(this,"isMaxRetriesReached");d(this,"token");d(this,"localCurrency");d(this,"errorText");this.token=g,this.amount=i,this.totalAmount=b,this.currency=s,this.customer=o,this.rdtCode=p,this.url=m,this.reference=c,this.callBackUrl=a,this.metadata=l,this.retryingPayment=f,this.container=e,this.restartTransactionProcess=t,this.isMaxRetriesReached=!1,this.localCurrency=w,this.paymentResponseHeaders={},this.paymentResponse={},this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.onSuccess=C||(()=>null),this.errorText=""}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderStablecoinsContent()}showLoader(){this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage(E["verify-payment"])}setPaymentError(e){const t=this.container.querySelector("#payment-warning-text");t&&(t.textContent=e)}goBackToMerchant(){Ee(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}async verifyPaymentProcess(){try{const e=await Xe(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers;const t=this.paymentResponse.status;t==="successful"?(this.currentStep=2,_.track("verify_payment",{payment_method:"Stablecoins",verification_status:"Success"}),Ee(this.paymentResponse,this.paymentResponseHeaders,"success")):t==="failed"?(this.currentStep=4,_.track("verify_payment",{payment_method:"Stablecoins",verification_status:"Failed"}),this.paymentResponse.providerMessage?this.warningScreen.setPaymentError(this.paymentResponse.providerMessage):this.warningScreen.setPaymentError("Payment failed")):t==="cancelled"&&(this.isMaxRetriesReached=!0,this.currentStep=4,this.warningScreen.setPaymentError("Payment Cancelled","You have cancelled the payment. Go back to merchant website to start the payment process again.","Go back to Merchant"))}catch{this.currentStep=4,this.warningScreen.setPaymentError("Payment failed")}}renderStablecoinsContent(e){var t;if(this.contents)switch(this.currentStep){case 1:this.stableCoinsForm=new ba({container:this.contents,onAction:()=>{},paymentResponse:this.paymentResponse,restartTransactionProcess:this.restartTransactionProcess.bind(this),merchantKey:this.token,rdtCode:this.rdtCode,url:this.url,amount:this.amount,currency:this.currency,onVerify:async()=>{this.currentStep=6,await this.verifyPaymentProcess()},callBackUrl:this.callBackUrl,customer:this.customer,metadata:this.metadata,reference:this.reference,retryingPayment:this.retryingPayment,token:this.token,totalAmount:this.totalAmount,localCurrency:this.localCurrency,onStepChange:i=>{this.currentStep=i}}),this.stableCoinsForm.renderComponent();break;case 2:this.successScreen=new Vn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency}),this.successScreen.renderComponent();break;case 3:this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage(E["verify-payment"]);break;case 4:this.warningScreen=new en({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this._currentStep=7}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.setPaymentError(((t=this.paymentResponse)==null?void 0:t.providerMessage)||E["payment-failed"],this.errorText,this.isMaxRetriesReached?E["merchant-back"]:E["try-again"]),this.warningScreen.attachListener();break;case 5:this.transactionIssuesScreen=new it({container:this.contents,onAction:()=>{var i;this.currentStep=4,this.warningScreen.setPaymentError(((i=this.paymentResponse)==null?void 0:i.providerMessage)||E["payment-failed"])},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"stablecoin",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;case 6:this.stablecoinsConfirmationProgress=new Yc({container:this.contents,callBackUrl:this.callBackUrl,setPaymentResponses:(i,s)=>{this.paymentResponse=i,this.paymentResponseHeaders=s},token:this.token,onAction:i=>{this.currentStep=i},ref:this.reference,onSuccess:()=>{this.currentStep=2,setTimeout(()=>{Ee(this.paymentResponse,this.paymentResponseHeaders,"success")},2500)}}),this.stablecoinsConfirmationProgress.renderComponent();break;case 7:this.stablecoinConfirmationEnd=new $c({container:this.contents,onAction:i=>{this.currentStep=i},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders,paymentMethod:"Stablecoins"}),this.stablecoinConfirmationEnd.renderComponent();break;default:this.stableCoinsForm=new ba({container:this.contents,onAction:()=>{},restartTransactionProcess:this.restartTransactionProcess.bind(this),merchantKey:this.token,rdtCode:this.rdtCode,url:this.url,amount:this.amount,currency:this.currency,onVerify:this.verifyPaymentProcess.bind(this),paymentResponse:this.paymentResponse,callBackUrl:this.callBackUrl,customer:this.customer,metadata:this.metadata,reference:this.reference,retryingPayment:this.retryingPayment,token:this.token,totalAmount:this.totalAmount,localCurrency:this.localCurrency}),this.stableCoinsForm.renderComponent();break}}}const nd=`<div id="eft-authenticate-container" data-section="opay">
|
|
2401
2401
|
<div class="pt-3">
|
|
2402
2402
|
<div class="md:w-4/6 mx-auto mt-4">
|
|
2403
2403
|
<p class="text-lg font-medium text-center" id="authenticate-request-text" data-translate="authenticate-request">
|
|
@@ -2416,7 +2416,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
2416
2416
|
</div>
|
|
2417
2417
|
</div>
|
|
2418
2418
|
|
|
2419
|
-
</div>`;class fa{constructor(e){d(this,"container");d(this,"payment");d(this,"warningError");d(this,"pageLoader");d(this,"onAction");d(this,"restartTransactionProcess");this.container=e.container,this.onAction=e.onAction,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new en({container:this.container,onAction:this.restartTransactionProcess.bind(this)})}attachListener(){const e=this.container.querySelector("#authenticate-btn"),t=this.container.querySelector("#authenticate-request-text"),i=this.container.querySelector("#authenticate-button-text");t&&(t.innerHTML=Mn["authenticate-request"]),i&&(i.innerHTML=Mn.authenticate),e&&e.addEventListener("click",()=>{this.onAction(),_.track("start_payment",{payment_method:"OPAY"})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return nd}}class td{constructor({amount:e,totalAmount:t,container:i,customer:s,token:o,currency:a,rdtCode:l,url:c,reference:p,callBackUrl:m,metadata:g,localCurrency:f,hidePaymentMethods:b,showPaymentMethods:w,restartTransactionProcess:C,retryingPayment:k}){d(this,"contents");d(this,"OpayAuthenticate");d(this,"successScreen");d(this,"pageLoader");d(this,"warningScreen");d(this,"transactionIssuesScreen");d(this,"container");d(this,"customer");d(this,"token");d(this,"amount");d(this,"totalAmount");d(this,"currency");d(this,"_currentStep");d(this,"rdtCode");d(this,"url");d(this,"reference");d(this,"callBackUrl");d(this,"metadata");d(this,"localCurrency");d(this,"hidePaymentMethods");d(this,"showPaymentMethods");d(this,"merchantPlanDetail",{});d(this,"restartTransactionProcess");d(this,"retryingPayment");d(this,"isMaxRetriesReached");d(this,"isMobile",!1);d(this,"paymentResponse");d(this,"paymentResponseHeaders");d(this,"countdownInterval");d(this,"popupInterval");d(this,"errorText");this.currency=a,this.container=i,this.token=o,this.customer=s,this.amount=e,this.totalAmount=t,this.rdtCode=l,this.url=c,this.reference=p,this.callBackUrl=m,this.metadata=g,this.localCurrency=f,this._currentStep=1,this.countdownInterval,this.contents=this.container.querySelector("#payment-content-view"),this.hidePaymentMethods=b,this.showPaymentMethods=w,this.restartTransactionProcess=C,this.retryingPayment=k,this.isMaxRetriesReached=!1,this.paymentResponse={},this.paymentResponseHeaders={},this.errorText="",this.renderOpayContent(),_.track("pay_with_opay_opens",{payment_method:"OPAY"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderOpayContent()}showLoader(){this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage(P["verify-payment"])}goBackToMerchant(){Ee(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}async createOpayPayment(){const e=this.container.querySelector(".spinner"),t=this.container.querySelector("#authenticate-button-text");e&&t&&(e.classList.remove("hidden"),t.classList.add("hidden"));const i=bt();(()=>{var o,a;if(this.retryingPayment){const l={channel:"pay_with_opay",reference:this.reference};return et(this.token,l,this.rdtCode,this.url)}else{const l={amount:this.amount,channel:"pay_with_opay",currency:this.currency,customer:this.customer,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((o=this.merchantPlanDetail)==null?void 0:o.taxQuoteId)&&{taxQuoteId:(a=this.merchantPlanDetail)==null?void 0:a.taxQuoteId},deviceInformation:i};return Ri(this.token,l,this.rdtCode,this.url)}})().then(async({data:o,headers:a})=>{var l,c,p;if(this.paymentResponse=o,this.paymentResponseHeaders=a,o.providerMessage){const m=await Z(o.providerMessage,R());this.errorText=m}if(o.status==="failed"){this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),_.track("start_payment",{payment_method:"OPAY",verification_status:"Failed"});return}else if(((l=o==null?void 0:o.authorization)==null?void 0:l.mode)==="redirect"){(c=o==null?void 0:o.authorization)!=null&&c.redirectUrl&&this.redirectToOpay((p=o==null?void 0:o.authorization)==null?void 0:p.redirectUrl);return}else this.currentStep=4,o!=null&&o.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(Mn["unable-redirect-url"])}).catch(async o=>{if(o.code==="payment_max_retry_attempts")this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,this.warningScreen.setPaymentError(P["maximum-retries"],P["maximum-retries-desc"],j["merchant-back"]);else if(o.message){const a=await Z(o.message,R());this.errorText=a,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(j["payment-failed"])}).finally(()=>{e&&t&&(e.classList.add("hidden"),t.classList.remove("hidden"))})}startCountdown(e,t,i){let s=e;t(s);const o=setInterval(()=>{s--,t(s),s<=0&&(clearInterval(o),i())},1e3);return o}redirectToOpay(e){const t=window.open(e,"_blank");t&&(this.currentStep=3,this.showLoader(),this.countdownInterval=this.startCountdown(1800,i=>{},()=>{this.verifyPaymentProcess()}),this.popupInterval=setInterval(()=>{t.closed&&(clearInterval(this.countdownInterval),clearInterval(this.popupInterval),this.verifyPaymentProcess())},2e3))}async verifyPaymentProcess(){try{const e=await Xe(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers;const t=this.paymentResponse.status;if(t==="successful")this.currentStep=2,_.track("verify_payment",{payment_method:"OPAY",verification_status:"Success"}),Ee(this.paymentResponse,this.paymentResponseHeaders,"success");else if(t==="failed"){if(this.paymentResponse.providerMessage){const i=await Z(this.paymentResponse.providerMessage,R());this.errorText=i}this.currentStep=4,_.track("verify_payment",{payment_method:"OPAY",verification_status:"Failed"}),this.paymentResponse.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(j["payment-failed"])}else t==="cancelled"&&(this.isMaxRetriesReached=!0,this.currentStep=4,this.warningScreen.setPaymentError(Mn["payment-cancelled"],Mn["cancel-payment-desc"],j["merchant-back"]))}catch{this.currentStep=4,this.warningScreen.setPaymentError(j["payment-failed"])}}renderOpayContent(e){var i;e&&(this.merchantPlanDetail=e);const t=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),t==null||t.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents)switch(this.currentStep){case 1:this.OpayAuthenticate=new fa({container:this.contents,onAction:this.createOpayPayment.bind(this),restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.OpayAuthenticate.renderComponent();break;case 2:this.successScreen=new Vn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(i=this.merchantPlanDetail)==null?void 0:i.rate.rate}),this.successScreen.renderComponent();break;case 3:this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage(P["verify-payment"]);break;case 4:this.warningScreen=new en({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=5}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.transactionIssuesScreen=new it({container:this.contents,onAction:async()=>{var s,o;if((s=this.paymentResponse)!=null&&s.providerMessage){const a=await Z((o=this.paymentResponse)==null?void 0:o.providerMessage,R());this.errorText=a}this.currentStep=4,this.warningScreen.setPaymentError(this.errorText||P["payment-failed"])},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"pay_with_opay",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;default:this.OpayAuthenticate=new fa({container:this.contents,onAction:this.createOpayPayment.bind(this),restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.OpayAuthenticate.renderComponent();break}}}class id{constructor({container:e,customerDetails:t,encryption:i,merchantKey:s,modalContainer:o,amount:a,planId:l,rdtCode:c,url:p,reference:m,callBackUrl:g,metadata:f,localCurrency:b,closePayment:w,countryCode:C,mode:k}){d(this,"validChannels",[]);d(this,"disabledChannels",[]);d(this,"selectedChannel");d(this,"modalContainer");d(this,"currentPaymentMethod");d(this,"mainLayout");d(this,"mainHeader");d(this,"mainFooter");d(this,"testCard");d(this,"merchantPlanDetail",{});d(this,"mainScreen");d(this,"currency");d(this,"card");d(this,"transfer");d(this,"ussd");d(this,"mobileMoney");d(this,"eft");d(this,"opay");d(this,"stablecoins");d(this,"encryption");d(this,"merchantKey");d(this,"planId");d(this,"customerDetails");d(this,"amount",0);d(this,"rdtCode");d(this,"url");d(this,"reference");d(this,"isMobile",!1);d(this,"callBackUrl");d(this,"metadata");d(this,"localCurrency");d(this,"closePayment");d(this,"retryingPayment");d(this,"totalAmount");d(this,"countryCode");d(this,"mainLoader");d(this,"mode");d(this,"selectedMethods");this.validChannels=[],this.disabledChannels=[],this.selectedChannel="",this.modalContainer=o,this.encryption=i,this.planId=l||"",this.merchantKey=s,this.amount=a||0,this.rdtCode=c||"",this.url=p||"",this.reference=m,this.mainLayout=e,this.callBackUrl=g,this.metadata=f||{},this.localCurrency=b||"",this.isMobile=window.matchMedia("(max-width: 767px)").matches,this.currentPaymentMethod="",this.currency="",this.closePayment=w,this.retryingPayment=!1,this.totalAmount=0,this.countryCode=C||"",this.customerDetails=t,this.mode=k,this.selectedMethods=[]}mountScreen(e,t,i,s){var c,p;i&&(this.validChannels=i),s&&(this.disabledChannels=s),this.mainLayout.innerHTML=this.render(),this.merchantPlanDetail=e,this.currency=t;const o=(p=(c=this.merchantPlanDetail.plan)==null?void 0:c.pricingOptions)==null?void 0:p.find(m=>m.currency===this.currency);this.amount=(o==null?void 0:o.amount)||this.amount,this.totalAmount=this.merchantPlanDetail.totalAmount||this.amount,this.mainHeader=new Hc({container:document.getElementById("main-header"),email:this.customerDetails.email,amount:this.amount,metadata:this.metadata,currency:this.currency,localCurrency:this.localCurrency,merchantDetail:e,onAction:this.switchTab.bind(this),isMobile:this.isMobile,onClose:m=>{this.closeBTN.bind(this)(m)},currentPaymentMethod:this.currentPaymentMethod,countryCode:this.countryCode}),this.mainHeader.renderComponent(),this.testCard=new aa({container:document.getElementById("test-container"),closeCallback:()=>{const m=document.getElementById("test-container");m&&(m.innerHTML="",m.classList.add("hidden"))}});const a=!1,l=As(this.merchantKey);this.mainFooter=new ra({container:document.getElementById("main-footer"),testCardContainer:document.getElementById("test-container"),keyEnvironment:l||(this.mode?this.mode:null),isVisible:a}),document.addEventListener("DOMContentLoaded",()=>{const m=document.getElementById("main-footer"),g=document.getElementById("test-container");new ra({container:m,testCardContainer:g,keyEnvironment:l||(this.mode?this.mode:null),isVisible:a}).renderComponent()}),this.mainFooter.renderComponent(),this.setupPaymentMethodButtons(),this.selectedChannel&&(this.currentPaymentMethod=this.selectedChannel),this.updatePaymentMethodView(this.merchantKey,this.customerDetails,this.amount,this.totalAmount,this.currency),this.renderPaymentMethodContent(),this.setCurrentPaymentMethod(this.currentPaymentMethod)}setupPaymentMethodButtons(){const e=document.querySelectorAll(".tab-button");e.forEach(i=>{i.removeAttribute("disabled"),i.classList.remove("hidden","disabled","limit-exceeded");const s=i.querySelector(".disabled-indicator");s&&i.removeChild(s)});const t=[...this.validChannels,...this.disabledChannels];e.forEach(i=>{const s=i.getAttribute("data-name");s&&!t.includes(s)&&i.classList.add("hidden")}),this.disabledChannels.forEach(i=>{const s=Array.from(e).find(o=>o.getAttribute("data-name")===i);if(s){s.setAttribute("disabled","true"),s.classList.add("disabled","limit-exceeded"),s.setAttribute("title","Transaction amount exceeds limit for this payment method");const o=document.createElement("span");o.classList.add("disabled-indicator"),o.style.fontSize="10px",o.style.color="#FF5733",o.style.display="block",s.appendChild(o)}})}attachListeners(){const e=document.getElementById("go-back"),t=document.getElementById("select-payment-method-text");this.isMobile&&(this.currentPaymentMethod?(e&&(e.classList.add("flex","items-center","gap-2","mb-2"),e.innerHTML=` <svg width="9" height="18" viewBox="0 0 9 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2419
|
+
</div>`;class fa{constructor(e){d(this,"container");d(this,"payment");d(this,"warningError");d(this,"pageLoader");d(this,"onAction");d(this,"restartTransactionProcess");this.container=e.container,this.onAction=e.onAction,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new en({container:this.container,onAction:this.restartTransactionProcess.bind(this)})}attachListener(){const e=this.container.querySelector("#authenticate-btn"),t=this.container.querySelector("#authenticate-request-text"),i=this.container.querySelector("#authenticate-button-text");t&&(t.innerHTML=Mn["authenticate-request"]),i&&(i.innerHTML=Mn.authenticate),e&&e.addEventListener("click",()=>{this.onAction(),_.track("start_payment",{payment_method:"OPAY"})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return nd}}class td{constructor({amount:e,totalAmount:t,container:i,customer:s,token:o,currency:a,rdtCode:l,url:c,reference:p,callBackUrl:m,metadata:g,localCurrency:f,hidePaymentMethods:b,showPaymentMethods:w,restartTransactionProcess:C,retryingPayment:k}){d(this,"contents");d(this,"OpayAuthenticate");d(this,"successScreen");d(this,"pageLoader");d(this,"warningScreen");d(this,"transactionIssuesScreen");d(this,"container");d(this,"customer");d(this,"token");d(this,"amount");d(this,"totalAmount");d(this,"currency");d(this,"_currentStep");d(this,"rdtCode");d(this,"url");d(this,"reference");d(this,"callBackUrl");d(this,"metadata");d(this,"localCurrency");d(this,"hidePaymentMethods");d(this,"showPaymentMethods");d(this,"merchantPlanDetail",{});d(this,"restartTransactionProcess");d(this,"retryingPayment");d(this,"isMaxRetriesReached");d(this,"isMobile",!1);d(this,"paymentResponse");d(this,"paymentResponseHeaders");d(this,"countdownInterval");d(this,"popupInterval");d(this,"errorText");this.currency=a,this.container=i,this.token=o,this.customer=s,this.amount=e,this.totalAmount=t,this.rdtCode=l,this.url=c,this.reference=p,this.callBackUrl=m,this.metadata=g,this.localCurrency=f,this._currentStep=1,this.countdownInterval,this.contents=this.container.querySelector("#payment-content-view"),this.hidePaymentMethods=b,this.showPaymentMethods=w,this.restartTransactionProcess=C,this.retryingPayment=k,this.isMaxRetriesReached=!1,this.paymentResponse={},this.paymentResponseHeaders={},this.errorText="",this.renderOpayContent(),_.track("pay_with_opay_opens",{payment_method:"OPAY"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderOpayContent()}showLoader(){this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage(E["verify-payment"])}goBackToMerchant(){Ee(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}async createOpayPayment(){const e=this.container.querySelector(".spinner"),t=this.container.querySelector("#authenticate-button-text");e&&t&&(e.classList.remove("hidden"),t.classList.add("hidden"));const i=bt();(()=>{var o,a;if(this.retryingPayment){const l={channel:"pay_with_opay",reference:this.reference};return et(this.token,l,this.rdtCode,this.url)}else{const l={amount:this.amount,channel:"pay_with_opay",currency:this.currency,customer:this.customer,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((o=this.merchantPlanDetail)==null?void 0:o.taxQuoteId)&&{taxQuoteId:(a=this.merchantPlanDetail)==null?void 0:a.taxQuoteId},deviceInformation:i};return Ri(this.token,l,this.rdtCode,this.url)}})().then(async({data:o,headers:a})=>{var l,c,p;if(this.paymentResponse=o,this.paymentResponseHeaders=a,o.providerMessage){const m=await Z(o.providerMessage,R());this.errorText=m}if(o.status==="failed"){this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(E["payment-failed"]),_.track("start_payment",{payment_method:"OPAY",verification_status:"Failed"});return}else if(((l=o==null?void 0:o.authorization)==null?void 0:l.mode)==="redirect"){(c=o==null?void 0:o.authorization)!=null&&c.redirectUrl&&this.redirectToOpay((p=o==null?void 0:o.authorization)==null?void 0:p.redirectUrl);return}else this.currentStep=4,o!=null&&o.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(Mn["unable-redirect-url"])}).catch(async o=>{if(o.code==="payment_max_retry_attempts")this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,this.warningScreen.setPaymentError(E["maximum-retries"],E["maximum-retries-desc"],j["merchant-back"]);else if(o.message){const a=await Z(o.message,R());this.errorText=a,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(j["payment-failed"])}).finally(()=>{e&&t&&(e.classList.add("hidden"),t.classList.remove("hidden"))})}startCountdown(e,t,i){let s=e;t(s);const o=setInterval(()=>{s--,t(s),s<=0&&(clearInterval(o),i())},1e3);return o}redirectToOpay(e){const t=window.open(e,"_blank");t&&(this.currentStep=3,this.showLoader(),this.countdownInterval=this.startCountdown(1800,i=>{},()=>{this.verifyPaymentProcess()}),this.popupInterval=setInterval(()=>{t.closed&&(clearInterval(this.countdownInterval),clearInterval(this.popupInterval),this.verifyPaymentProcess())},2e3))}async verifyPaymentProcess(){try{const e=await Xe(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers;const t=this.paymentResponse.status;if(t==="successful")this.currentStep=2,_.track("verify_payment",{payment_method:"OPAY",verification_status:"Success"}),Ee(this.paymentResponse,this.paymentResponseHeaders,"success");else if(t==="failed"){if(this.paymentResponse.providerMessage){const i=await Z(this.paymentResponse.providerMessage,R());this.errorText=i}this.currentStep=4,_.track("verify_payment",{payment_method:"OPAY",verification_status:"Failed"}),this.paymentResponse.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(j["payment-failed"])}else t==="cancelled"&&(this.isMaxRetriesReached=!0,this.currentStep=4,this.warningScreen.setPaymentError(Mn["payment-cancelled"],Mn["cancel-payment-desc"],j["merchant-back"]))}catch{this.currentStep=4,this.warningScreen.setPaymentError(j["payment-failed"])}}renderOpayContent(e){var i;e&&(this.merchantPlanDetail=e);const t=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),t==null||t.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents)switch(this.currentStep){case 1:this.OpayAuthenticate=new fa({container:this.contents,onAction:this.createOpayPayment.bind(this),restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.OpayAuthenticate.renderComponent();break;case 2:this.successScreen=new Vn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(i=this.merchantPlanDetail)==null?void 0:i.rate.rate}),this.successScreen.renderComponent();break;case 3:this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage(E["verify-payment"]);break;case 4:this.warningScreen=new en({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=5}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.transactionIssuesScreen=new it({container:this.contents,onAction:async()=>{var s,o;if((s=this.paymentResponse)!=null&&s.providerMessage){const a=await Z((o=this.paymentResponse)==null?void 0:o.providerMessage,R());this.errorText=a}this.currentStep=4,this.warningScreen.setPaymentError(this.errorText||E["payment-failed"])},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"pay_with_opay",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;default:this.OpayAuthenticate=new fa({container:this.contents,onAction:this.createOpayPayment.bind(this),restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.OpayAuthenticate.renderComponent();break}}}class id{constructor({container:e,customerDetails:t,encryption:i,merchantKey:s,modalContainer:o,amount:a,planId:l,rdtCode:c,url:p,reference:m,callBackUrl:g,metadata:f,localCurrency:b,closePayment:w,countryCode:C,mode:k}){d(this,"validChannels",[]);d(this,"disabledChannels",[]);d(this,"selectedChannel");d(this,"modalContainer");d(this,"currentPaymentMethod");d(this,"mainLayout");d(this,"mainHeader");d(this,"mainFooter");d(this,"testCard");d(this,"merchantPlanDetail",{});d(this,"mainScreen");d(this,"currency");d(this,"card");d(this,"transfer");d(this,"ussd");d(this,"mobileMoney");d(this,"eft");d(this,"opay");d(this,"stablecoins");d(this,"encryption");d(this,"merchantKey");d(this,"planId");d(this,"customerDetails");d(this,"amount",0);d(this,"rdtCode");d(this,"url");d(this,"reference");d(this,"isMobile",!1);d(this,"callBackUrl");d(this,"metadata");d(this,"localCurrency");d(this,"closePayment");d(this,"retryingPayment");d(this,"totalAmount");d(this,"countryCode");d(this,"mainLoader");d(this,"mode");d(this,"selectedMethods");this.validChannels=[],this.disabledChannels=[],this.selectedChannel="",this.modalContainer=o,this.encryption=i,this.planId=l||"",this.merchantKey=s,this.amount=a||0,this.rdtCode=c||"",this.url=p||"",this.reference=m,this.mainLayout=e,this.callBackUrl=g,this.metadata=f||{},this.localCurrency=b||"",this.isMobile=window.matchMedia("(max-width: 767px)").matches,this.currentPaymentMethod="",this.currency="",this.closePayment=w,this.retryingPayment=!1,this.totalAmount=0,this.countryCode=C||"",this.customerDetails=t,this.mode=k,this.selectedMethods=[]}mountScreen(e,t,i,s){var c,p;i&&(this.validChannels=i),s&&(this.disabledChannels=s),this.mainLayout.innerHTML=this.render(),this.merchantPlanDetail=e,this.currency=t;const o=(p=(c=this.merchantPlanDetail.plan)==null?void 0:c.pricingOptions)==null?void 0:p.find(m=>m.currency===this.currency);this.amount=(o==null?void 0:o.amount)||this.amount,this.totalAmount=this.merchantPlanDetail.totalAmount||this.amount,this.mainHeader=new Hc({container:document.getElementById("main-header"),email:this.customerDetails.email,amount:this.amount,metadata:this.metadata,currency:this.currency,localCurrency:this.localCurrency,merchantDetail:e,onAction:this.switchTab.bind(this),isMobile:this.isMobile,onClose:m=>{this.closeBTN.bind(this)(m)},currentPaymentMethod:this.currentPaymentMethod,countryCode:this.countryCode}),this.mainHeader.renderComponent(),this.testCard=new aa({container:document.getElementById("test-container"),closeCallback:()=>{const m=document.getElementById("test-container");m&&(m.innerHTML="",m.classList.add("hidden"))}});const a=!1,l=As(this.merchantKey);this.mainFooter=new ra({container:document.getElementById("main-footer"),testCardContainer:document.getElementById("test-container"),keyEnvironment:l||(this.mode?this.mode:null),isVisible:a}),document.addEventListener("DOMContentLoaded",()=>{const m=document.getElementById("main-footer"),g=document.getElementById("test-container");new ra({container:m,testCardContainer:g,keyEnvironment:l||(this.mode?this.mode:null),isVisible:a}).renderComponent()}),this.mainFooter.renderComponent(),this.setupPaymentMethodButtons(),this.selectedChannel&&(this.currentPaymentMethod=this.selectedChannel),this.updatePaymentMethodView(this.merchantKey,this.customerDetails,this.amount,this.totalAmount,this.currency),this.renderPaymentMethodContent(),this.setCurrentPaymentMethod(this.currentPaymentMethod)}setupPaymentMethodButtons(){const e=document.querySelectorAll(".tab-button");e.forEach(i=>{i.removeAttribute("disabled"),i.classList.remove("hidden","disabled","limit-exceeded");const s=i.querySelector(".disabled-indicator");s&&i.removeChild(s)});const t=[...this.validChannels,...this.disabledChannels];e.forEach(i=>{const s=i.getAttribute("data-name");s&&!t.includes(s)&&i.classList.add("hidden")}),this.disabledChannels.forEach(i=>{const s=Array.from(e).find(o=>o.getAttribute("data-name")===i);if(s){s.setAttribute("disabled","true"),s.classList.add("disabled","limit-exceeded"),s.setAttribute("title","Transaction amount exceeds limit for this payment method");const o=document.createElement("span");o.classList.add("disabled-indicator"),o.style.fontSize="10px",o.style.color="#FF5733",o.style.display="block",s.appendChild(o)}})}attachListeners(){const e=document.getElementById("go-back"),t=document.getElementById("select-payment-method-text");this.isMobile&&(this.currentPaymentMethod?(e&&(e.classList.add("flex","items-center","gap-2","mb-2"),e.innerHTML=` <svg width="9" height="18" viewBox="0 0 9 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2420
2420
|
<path d="M7.99984 16.9201L1.47984 10.4001C0.709844 9.63008 0.709844 8.37008 1.47984 7.60008L7.99984 1.08008" stroke="#0D0716" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2421
2421
|
</svg>
|
|
2422
2422
|
<span class="text-tone-100 font-semibold">
|