@spot-flow/checkout-inline-js 0.1.32-dev.6 → 0.1.32

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.
@@ -42,7 +42,7 @@
42
42
  </div>
43
43
  <!-- end of footer -->
44
44
  </div>
45
- </div>`,ve=(n,e)=>e||n;let ee=class extends Error{constructor(e,i){super(e),this.status=i,this.name="FetchError"}},De=class extends Error{constructor(e){super(e),this.name="AuthorizationError"}};const je=(n,e,i)=>{if(!n)throw new De("Missing authorization token");const t=new Headers;return i||t.append("Content-Type","application/json"),t.append("Authorization",`Bearer ${n}`),e&&t.append("Spotflow-Payment-Code",e),t},Ge="https://api.spotflow.co/api/v1",fs=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ge,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},oi=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ge,t)}/payments/authorize`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},xt=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ge,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},gs=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ge,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?new ee(l.message,s.status):new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`UnexpectedError: ${o}`),o}},vn=async(n,e,i,t,o)=>{try{const s=je(n,t),r=await fetch(`${ve(Ge,o)}/payments/verify?reference=${e}`,{method:"GET",headers:s,signal:i});if(!r.ok){const c=await r.json();throw c.message?new ee(c.message,r.status):new ee("Network response was not ok",r.status)}return{data:await r.json(),headers:r.headers}}catch(s){throw s instanceof ee?console.error(`FetchError: ${s.message} (status: ${s.status})`):s instanceof De?console.error(`AuthorizationError: ${s.message}`):console.error(`Unexpected error: ${s}`),s}};async function ys(n,e,i,t,o){const s=je(n,i);try{const r=await fetch(`${ve(Ge,t)}/mobile-money/providers?currency=${o||e}`,{headers:s,method:"GET"});if(!r.ok){const l=await r.json();throw l.message?new ee(l.message,r.status):new ee("Network response was not okay",r.status)}return await r.json()}catch(r){throw r instanceof ee?console.error(`FetchError: ${r.message} (status: ${r.status})`):r instanceof De?console.error(`AuthorizationError: ${r.message}`):console.error(`Unexpected error: ${r}`),r}}const ks=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ge,t)}/payments/cancel`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const r=await s.json();throw r.message?new ee(r.message,s.status):new ee("Network response was not ok",s.status)}return{headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},ws=async(n,e,i,t)=>{try{const o=je(n,i,!0),s=await fetch(`${ve(Ge,t)}/disputes/upload-documents`,{method:"POST",headers:o,body:e});if(!s.ok){const r=await s.json();throw r.message?new ee(r.message,s.status):new ee("Network response was not ok",s.status)}return s.json()}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Cs=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ge,t)}/disputes/reference`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const r=await s.json();throw r.message?new ee(r.message,s.status):new ee("Network response was not ok",s.status)}return s.json()}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},si=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ge,t)}/payments/retry`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},ke=(n,e)=>{const i=new Intl.NumberFormat("ng-NG",{style:"decimal",maximumFractionDigits:e||0,minimumFractionDigits:e||0});return isNaN(parseFloat(i.format(n)))?"-":i.format(n)},pe={card:{key:"card",label:"Pay with Card",icon:`<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
45
+ </div>`,ve=(n,e)=>e||n;let ee=class extends Error{constructor(e,i){super(e),this.status=i,this.name="FetchError"}},De=class extends Error{constructor(e){super(e),this.name="AuthorizationError"}};const je=(n,e,i)=>{if(!n)throw new De("Missing authorization token");const t=new Headers;return i||t.append("Content-Type","application/json"),t.append("Authorization",`Bearer ${n}`),e&&t.append("Spotflow-Payment-Code",e),t},Ge="https://api.spotflow.co/api/v1",fs=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ge,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},oi=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ge,t)}/payments/authorize`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Lt=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ge,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},gs=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ge,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?new ee(l.message,s.status):new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`UnexpectedError: ${o}`),o}},vn=async(n,e,i,t,o)=>{try{const s=je(n,t),r=await fetch(`${ve(Ge,o)}/payments/verify?reference=${e}`,{method:"GET",headers:s,signal:i});if(!r.ok){const c=await r.json();throw c.message?new ee(c.message,r.status):new ee("Network response was not ok",r.status)}return{data:await r.json(),headers:r.headers}}catch(s){throw s instanceof ee?console.error(`FetchError: ${s.message} (status: ${s.status})`):s instanceof De?console.error(`AuthorizationError: ${s.message}`):console.error(`Unexpected error: ${s}`),s}};async function ys(n,e,i,t,o){const s=je(n,i);try{const r=await fetch(`${ve(Ge,t)}/mobile-money/providers?currency=${o||e}`,{headers:s,method:"GET"});if(!r.ok){const l=await r.json();throw l.message?new ee(l.message,r.status):new ee("Network response was not okay",r.status)}return await r.json()}catch(r){throw r instanceof ee?console.error(`FetchError: ${r.message} (status: ${r.status})`):r instanceof De?console.error(`AuthorizationError: ${r.message}`):console.error(`Unexpected error: ${r}`),r}}const ks=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ge,t)}/payments/cancel`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const r=await s.json();throw r.message?new ee(r.message,s.status):new ee("Network response was not ok",s.status)}return{headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},ws=async(n,e,i,t)=>{try{const o=je(n,i,!0),s=await fetch(`${ve(Ge,t)}/disputes/upload-documents`,{method:"POST",headers:o,body:e});if(!s.ok){const r=await s.json();throw r.message?new ee(r.message,s.status):new ee("Network response was not ok",s.status)}return s.json()}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Cs=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ge,t)}/disputes/reference`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const r=await s.json();throw r.message?new ee(r.message,s.status):new ee("Network response was not ok",s.status)}return s.json()}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},si=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ge,t)}/payments/retry`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},ke=(n,e)=>{const i=new Intl.NumberFormat("ng-NG",{style:"decimal",maximumFractionDigits:e||0,minimumFractionDigits:e||0});return isNaN(parseFloat(i.format(n)))?"-":i.format(n)},pe={card:{key:"card",label:"Pay with Card",icon:`<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
46
46
  <path d="M1.83398 6.16992H15.1673" stroke="currentColor" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
47
47
  <path d="M4.5 11.5034H5.83333" stroke="currentColor" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
48
48
  <path d="M7.5 11.5034H10.1667" stroke="currentColor" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
@@ -77,7 +77,7 @@
77
77
  <path d="M13.834 12.0002V7.3335" stroke="#0D0716" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
78
78
  <path d="M1.16602 14.6665H15.8327" stroke="#0D0716" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
79
79
  <path d="M8.5 5.6665C9.05228 5.6665 9.5 5.21879 9.5 4.6665C9.5 4.11422 9.05228 3.6665 8.5 3.6665C7.94772 3.6665 7.5 4.11422 7.5 4.6665C7.5 5.21879 7.94772 5.6665 8.5 5.6665Z" stroke="#0D0716" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
80
- </svg>`}};pe.card.label,pe.card.icon,pe.card.key,pe.bank_transfer.label,pe.bank_transfer.icon,pe.bank_transfer.key,pe.ussd.label,pe.ussd.icon,pe.ussd.key,pe.mobile_money.label,pe.mobile_money.icon,pe.mobile_money.key,pe.eft.label,pe.eft.icon,pe.eft.key;const Lt=[{name:"MasterCard",icon:`<svg width="24" height="14" viewBox="0 0 24 14" fill="none" xmlns="http://www.w3.org/2000/svg">
80
+ </svg>`}};pe.card.label,pe.card.icon,pe.card.key,pe.bank_transfer.label,pe.bank_transfer.icon,pe.bank_transfer.key,pe.ussd.label,pe.ussd.icon,pe.ussd.key,pe.mobile_money.label,pe.mobile_money.icon,pe.mobile_money.key,pe.eft.label,pe.eft.icon,pe.eft.key;const Tt=[{name:"MasterCard",icon:`<svg width="24" height="14" viewBox="0 0 24 14" fill="none" xmlns="http://www.w3.org/2000/svg">
81
81
  <path d="M15.3295 1.73883H8.91364V12.2617H15.3295V1.73883Z" fill="#FF5F00"/>
82
82
  <path d="M9.32119 6.99988C9.32018 5.98645 9.5718 4.98609 10.057 4.07454C10.5422 3.16299 11.2483 2.36413 12.1218 1.73845C11.0401 0.962455 9.74099 0.479876 8.37301 0.345869C7.00503 0.211862 5.62333 0.43183 4.38585 0.98064C3.14837 1.52945 2.10503 2.38496 1.37509 3.44937C0.645144 4.51379 0.258057 5.74417 0.258057 6.99988C0.258057 8.25559 0.645144 9.48597 1.37509 10.5504C2.10503 11.6148 3.14837 12.4703 4.38585 13.0191C5.62333 13.5679 7.00503 13.7879 8.37301 13.6539C9.74099 13.5199 11.0401 13.0373 12.1218 12.2613C11.2483 11.6356 10.5422 10.8368 10.057 9.92521C9.57181 9.01366 9.32019 8.0133 9.32119 6.99988Z" fill="#EB001B"/>
83
83
  <path d="M23.9852 6.99994C23.9852 8.25563 23.5982 9.48601 22.8683 10.5504C22.1384 11.6148 21.0951 12.4703 19.8576 13.0192C18.6201 13.568 17.2385 13.788 15.8705 13.654C14.5025 13.5199 13.2035 13.0374 12.1218 12.2614C12.9945 11.6351 13.7001 10.8361 14.1852 9.92466C14.6703 9.01325 14.9224 8.01321 14.9224 6.99994C14.9224 5.98667 14.6703 4.98663 14.1852 4.07522C13.7001 3.16381 12.9945 2.36483 12.1218 1.73851C13.2035 0.962513 14.5025 0.479933 15.8705 0.345928C17.2385 0.211923 18.6201 0.431901 19.8576 0.980717C21.0951 1.52953 22.1384 2.38504 22.8683 3.44946C23.5982 4.51387 23.9852 5.74425 23.9852 6.99994Z" fill="#F79E1B"/>
@@ -203,11 +203,11 @@
203
203
  d="M2.80944 12.6864L7.40177 4.11968C8.13226 2.75698 10.1359 2.75698 10.8664 4.11968L15.4587 12.6864C16.1374 13.9525 15.1936 15.4677 13.7264 15.4677H4.54174C3.0745 15.4677 2.13075 13.9525 2.80944 12.6864ZM9.13406 5.28061C9.53593 5.28061 9.86171 5.60639 9.86171 6.00826V11.1018C9.86171 11.5037 9.53593 11.8295 9.13406 11.8295C8.73219 11.8295 8.40641 11.5037 8.40641 11.1018V6.00826C8.40641 5.60639 8.73219 5.28061 9.13406 5.28061ZM8.2245 13.1029C8.2245 13.6052 8.63172 14.0124 9.13406 14.0124C9.6364 14.0124 10.0436 13.6052 10.0436 13.1029C10.0436 12.6005 9.6364 12.1933 9.13406 12.1933C8.63172 12.1933 8.2245 12.6005 8.2245 13.1029Z"
204
204
  fill="white" />
205
205
  </svg>
206
- <span id="custom-toast-msg">${e}</span>`:e,t.appendChild(o);const s=document.createElement("span");return s.textContent="×",s.classList.add("close-btn","opacity-0"),s.onclick=()=>hn.removeToast(t),t.appendChild(s),t}),m(hn,"showToast",(e,i,t=3e3)=>{const o=document.getElementById("toast-container");if(o){const s=hn.createToast(e,i);o.appendChild(s),s.offsetHeight,s.classList.add("show"),setTimeout(()=>hn.removeToast(s),t)}}),m(hn,"removeToast",e=>{e.classList.remove("show"),e.addEventListener("transitionend",()=>{e.parentElement&&e.parentElement.removeChild(e)})});let li=hn;class Tt{constructor(e){m(this,"container");m(this,"onAction");m(this,"cardDetailsValues");m(this,"creditCardTypes");m(this,"merchantName");this.container=e.container,this.onAction=e.onAction,this.creditCardTypes=[...Lt],this.cardDetailsValues={number:"",expiry:"",cvv:""},this.merchantName=e.merchantName}attachListener(){const e=document.querySelector("#pci-dss");e&&e.classList.remove("hidden");const i=document.querySelector('input[name="number"]'),t=document.querySelector('input[name="expiry"]'),o=document.querySelector('input[name="cvv"]'),s=document.querySelector(".details-form-button"),r=document.querySelector("#checkoutcard");i&&i.addEventListener("input",l=>this.handleInputChange(l,s)),t&&t.addEventListener("input",l=>this.handleInputChange(l,s)),o&&o.addEventListener("input",l=>this.handleInputChange(l,s)),r&&r.addEventListener("submit",l=>{var c,b;l.preventDefault(),this.onAction(l)({pan:As(this.cardDetailsValues.number),cvv:this.cardDetailsValues.cvv,expiryMonth:(c=this.cardDetailsValues)==null?void 0:c.expiry.split("/")[0].trim(),expiryYear:(b=this.cardDetailsValues)==null?void 0:b.expiry.split("/")[1].trim()})})}validateCreditCard(e){if(e=e.replace(/\D/g,""),!e||e.length===0||e.length<13||e.length>19)return!1;const i=e.split("").map(o=>parseInt(o,10));for(let o=i.length-2;o>=0;o-=2){let s=i[o]*2;s>9&&(s-=9),i[o]=s}return i.reduce((o,s)=>o+s,0)%10===0}handleInputChange(e,i){var l,c;const t=e.target,{name:o,value:s}=t;let r=s;if(s.trim()===""){this.emptyCardState(t,o);return}if(o==="number"){r=Ms(s);const b=r.replace(/\s+/g,""),p=this.validateCreditCard(b);this.filterCreditCardType(s);const g=this.creditCardTypes[0].name;if(g){const f=Es[g];(b.length===f.map(y=>y)[0]||b.length===f.map(y=>y)[1])&&this.checkInputValidity(p,t,"Your card number is invalid",s.trim().length>=14&&s.trim().length<=19)}}else if(o==="expiry"){const b=new Date;r=Ls(s);const p=r.split("/"),g=(l=p[0])==null?void 0:l.trim(),f=(c=p[1])==null?void 0:c.trim(),y=new Date().getFullYear()%100,C=b.getMonth()+1;let k=!0;(parseInt(f)===y&&parseInt(g)<C||parseInt(f)<y)&&(k=!1),(f==null?void 0:f.length)===2&&this.checkInputValidity(k,t,"Your card has expired",p.join("").length===4)}else o==="cvv"&&(r=xs(s));if(this.cardDetailsValues={...this.cardDetailsValues,[o]:r},t.value=r,this.validateCard())i&&i.removeAttribute("disabled");else if(i){if(i.disabled)return;i.setAttribute("disabled","")}}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}}displayCardTypes(){requestAnimationFrame(()=>{const e=this.container.querySelector("#card-type");e.innerHTML="",this.creditCardTypes.length>0?this.creditCardTypes.forEach(i=>{const t=document.createElement("div");t.classList.add("card-type"),t.innerHTML=i.icon,e.appendChild(t)}):e.innerHTML=`<svg width="25" height="16" viewBox="0 0 25 16" fill="none" xmlns="http://www.w3.org/2000/svg">
206
+ <span id="custom-toast-msg">${e}</span>`:e,t.appendChild(o);const s=document.createElement("span");return s.textContent="×",s.classList.add("close-btn","opacity-0"),s.onclick=()=>hn.removeToast(t),t.appendChild(s),t}),m(hn,"showToast",(e,i,t=3e3)=>{const o=document.getElementById("toast-container");if(o){const s=hn.createToast(e,i);o.appendChild(s),s.offsetHeight,s.classList.add("show"),setTimeout(()=>hn.removeToast(s),t)}}),m(hn,"removeToast",e=>{e.classList.remove("show"),e.addEventListener("transitionend",()=>{e.parentElement&&e.parentElement.removeChild(e)})});let li=hn;class Et{constructor(e){m(this,"container");m(this,"onAction");m(this,"cardDetailsValues");m(this,"creditCardTypes");m(this,"merchantName");this.container=e.container,this.onAction=e.onAction,this.creditCardTypes=[...Tt],this.cardDetailsValues={number:"",expiry:"",cvv:""},this.merchantName=e.merchantName}attachListener(){const e=document.querySelector("#pci-dss");e&&e.classList.remove("hidden");const i=document.querySelector('input[name="number"]'),t=document.querySelector('input[name="expiry"]'),o=document.querySelector('input[name="cvv"]'),s=document.querySelector(".details-form-button"),r=document.querySelector("#checkoutcard");i&&i.addEventListener("input",l=>this.handleInputChange(l,s)),t&&t.addEventListener("input",l=>this.handleInputChange(l,s)),o&&o.addEventListener("input",l=>this.handleInputChange(l,s)),r&&r.addEventListener("submit",l=>{var c,b;l.preventDefault(),this.onAction(l)({pan:As(this.cardDetailsValues.number),cvv:this.cardDetailsValues.cvv,expiryMonth:(c=this.cardDetailsValues)==null?void 0:c.expiry.split("/")[0].trim(),expiryYear:(b=this.cardDetailsValues)==null?void 0:b.expiry.split("/")[1].trim()})})}validateCreditCard(e){if(e=e.replace(/\D/g,""),!e||e.length===0||e.length<13||e.length>19)return!1;const i=e.split("").map(o=>parseInt(o,10));for(let o=i.length-2;o>=0;o-=2){let s=i[o]*2;s>9&&(s-=9),i[o]=s}return i.reduce((o,s)=>o+s,0)%10===0}handleInputChange(e,i){var l,c;const t=e.target,{name:o,value:s}=t;let r=s;if(s.trim()===""){this.emptyCardState(t,o);return}if(o==="number"){r=Ms(s);const b=r.replace(/\s+/g,""),p=this.validateCreditCard(b);this.filterCreditCardType(s);const g=this.creditCardTypes[0].name;if(g){const f=Es[g];(b.length===f.map(y=>y)[0]||b.length===f.map(y=>y)[1])&&this.checkInputValidity(p,t,"Your card number is invalid",s.trim().length>=14&&s.trim().length<=19)}}else if(o==="expiry"){const b=new Date;r=Ls(s);const p=r.split("/"),g=(l=p[0])==null?void 0:l.trim(),f=(c=p[1])==null?void 0:c.trim(),y=new Date().getFullYear()%100,C=b.getMonth()+1;let k=!0;(parseInt(f)===y&&parseInt(g)<C||parseInt(f)<y)&&(k=!1),(f==null?void 0:f.length)===2&&this.checkInputValidity(k,t,"Your card has expired",p.join("").length===4)}else o==="cvv"&&(r=xs(s));if(this.cardDetailsValues={...this.cardDetailsValues,[o]:r},t.value=r,this.validateCard())i&&i.removeAttribute("disabled");else if(i){if(i.disabled)return;i.setAttribute("disabled","")}}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}}displayCardTypes(){requestAnimationFrame(()=>{const e=this.container.querySelector("#card-type");e.innerHTML="",this.creditCardTypes.length>0?this.creditCardTypes.forEach(i=>{const t=document.createElement("div");t.classList.add("card-type"),t.innerHTML=i.icon,e.appendChild(t)}):e.innerHTML=`<svg width="25" height="16" viewBox="0 0 25 16" fill="none" xmlns="http://www.w3.org/2000/svg">
207
207
  <path
208
208
  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"
209
209
  fill="#B6B4B9" />
210
- </svg>`})}filterCreditCardType(e){e?(this.creditCardTypes=Lt.filter(i=>i.name===Ts(e)),this.displayCardTypes()):(this.creditCardTypes=[],this.displayCardTypes())}emptyCardState(e,i){e.style.border="";const t=document.getElementById("card-number-error"),o=document.getElementById("expiry-error"),s=this.container.querySelector("#card-type"),r=document.querySelector("#card-error"),l=document.querySelector("#card-details");if(e.style.color="#0D0716",l&&(l.style.border="1px solid #9E9BA1"),r&&(r.classList.remove("block"),r.classList.add("hidden")),o&&o.remove(),t&&t.remove(),this.cardDetailsValues={...this.cardDetailsValues,[i]:""},i==="number"&&(s.innerHTML=`<svg width="25" height="16" viewBox="0 0 25 16" fill="none" xmlns="http://www.w3.org/2000/svg">
210
+ </svg>`})}filterCreditCardType(e){e?(this.creditCardTypes=Tt.filter(i=>i.name===Ts(e)),this.displayCardTypes()):(this.creditCardTypes=[],this.displayCardTypes())}emptyCardState(e,i){e.style.border="";const t=document.getElementById("card-number-error"),o=document.getElementById("expiry-error"),s=this.container.querySelector("#card-type"),r=document.querySelector("#card-error"),l=document.querySelector("#card-details");if(e.style.color="#0D0716",l&&(l.style.border="1px solid #9E9BA1"),r&&(r.classList.remove("block"),r.classList.add("hidden")),o&&o.remove(),t&&t.remove(),this.cardDetailsValues={...this.cardDetailsValues,[i]:""},i==="number"&&(s.innerHTML=`<svg width="25" height="16" viewBox="0 0 25 16" fill="none" xmlns="http://www.w3.org/2000/svg">
211
211
  <path
212
212
  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"
213
213
  fill="#B6B4B9" />
@@ -229,7 +229,7 @@
229
229
  </p>
230
230
  </div>
231
231
  </div>
232
- </div>`;class Gn{constructor({container:e,amount:i,currency:t,localCurrency:o,rate:s,message:r}){m(this,"container");m(this,"amount");m(this,"currency");m(this,"localCurrency");m(this,"rate");m(this,"message");this.container=e,this.amount=i,this.currency=t,this.localCurrency=o,this.rate=s,this.message=r}attachListener(){}renderComponent(){this.container.innerHTML=this.render();const e=document.querySelector("#success-amount"),i=document.querySelector("#source-rate"),t=document.querySelector("#payment-success-text");t&&(this.message?t.innerHTML=this.message:t.innerHTML="Payment Successful");const o=document.querySelector("#source-rate-mob");i&&this.localCurrency&&this.localCurrency!==this.currency&&(i.children[0].innerHTML="Paid: "),o&&this.localCurrency&&this.localCurrency!==this.currency&&(o.children[0].innerHTML="Paid: "),e&&(this.localCurrency?this.localCurrency!==this.currency&&(e.innerHTML=`${this.currency} ${ke(this.amount)} (${this.localCurrency} ${ke(this.amount*(this.rate||1),2)})`):e.innerHTML=`${this.currency} ${ke(this.amount)}`)}render(){return Ns}}const Et=`<div id="paymentWarning">
232
+ </div>`;class Gn{constructor({container:e,amount:i,currency:t,localCurrency:o,rate:s,message:r}){m(this,"container");m(this,"amount");m(this,"currency");m(this,"localCurrency");m(this,"rate");m(this,"message");this.container=e,this.amount=i,this.currency=t,this.localCurrency=o,this.rate=s,this.message=r}attachListener(){}renderComponent(){this.container.innerHTML=this.render();const e=document.querySelector("#success-amount"),i=document.querySelector("#source-rate"),t=document.querySelector("#payment-success-text");t&&(this.message?t.innerHTML=this.message:t.innerHTML="Payment Successful");const o=document.querySelector("#source-rate-mob");i&&this.localCurrency&&this.localCurrency!==this.currency&&(i.children[0].innerHTML="Paid: "),o&&this.localCurrency&&this.localCurrency!==this.currency&&(o.children[0].innerHTML="Paid: "),e&&(this.localCurrency?this.localCurrency!==this.currency&&(e.innerHTML=`${this.currency} ${ke(this.amount)} (${this.localCurrency} ${ke(this.amount*(this.rate||1),2)})`):e.innerHTML=`${this.currency} ${ke(this.amount)}`)}render(){return Ns}}const Pt=`<div id="paymentWarning">
233
233
  <div class="container-center min-h-[30dvh]">
234
234
  <div>
235
235
  <div class="container-center mb-5">
@@ -254,13 +254,13 @@
254
254
  <!-- <div class="mt-8">
255
255
  <button class="button-outline w-60" id="try-again">I have made the payment</button>
256
256
  </div> -->
257
-
257
+ <!--
258
258
  <div class="mt-10 text-center" id="report">
259
259
  <button id="report-issue" class="text-error-dark font-semibold hover:underline">Report transaction</button>
260
- </div>
260
+ </div> -->
261
261
  </div>
262
262
  </div>
263
- </div>`;class fn{constructor({container:e,onAction:i,onReportIssue:t}){m(this,"container");m(this,"onAction");m(this,"onReportIssue");this.container=e,this.onAction=i||(()=>null),this.onReportIssue=t||(()=>null)}attachListener(){const e=this.container.querySelector("#try-again"),i=this.container.querySelector("#report-issue");e&&e.addEventListener("click",()=>{this.onAction&&this.onAction()}),i&&i.addEventListener("click",()=>{this.onReportIssue&&this.onReportIssue()})}setPaymentError(e,i,t){const o=this.container.querySelector("#payment-warning-text"),s=this.container.querySelector("#payment-warning-desc"),r=this.container.querySelector("#try-again");o&&(o.textContent=e),s&&i&&(s.textContent=i),r&&t&&(r.textContent=t),this.attachListener()}hideReportIssue(){const e=this.container.querySelector("#report-issue");e&&(e.style.display="none")}renderComponent(){this.container.innerHTML=this.render()}render(){return Et}}const Is=`<div id="checkoutcardotp">
263
+ </div>`;class fn{constructor({container:e,onAction:i,onReportIssue:t}){m(this,"container");m(this,"onAction");m(this,"onReportIssue");this.container=e,this.onAction=i||(()=>null),this.onReportIssue=t||(()=>null)}attachListener(){const e=this.container.querySelector("#try-again"),i=this.container.querySelector("#report-issue");e&&e.addEventListener("click",()=>{this.onAction&&this.onAction()}),i&&i.addEventListener("click",()=>{this.onReportIssue&&this.onReportIssue()})}setPaymentError(e,i,t){const o=this.container.querySelector("#payment-warning-text"),s=this.container.querySelector("#payment-warning-desc"),r=this.container.querySelector("#try-again");o&&(o.textContent=e),s&&i&&(s.textContent=i),r&&t&&(r.textContent=t),this.attachListener()}hideReportIssue(){const e=this.container.querySelector("#report-issue");e&&(e.style.display="none")}renderComponent(){this.container.innerHTML=this.render()}render(){return Pt}}const Is=`<div id="checkoutcardotp">
264
264
  <div class="w-full">
265
265
  <div id="otp-content" class=" grid gap-4">
266
266
  <h5 class="text-black" id="otp-message">
@@ -675,9 +675,9 @@
675
675
 
676
676
  </div>
677
677
  </div>
678
- </div>`}renderTransactionIssuesComponent(){const e=document.querySelector("#main-header"),i=document.querySelector("#main-content"),t=document.querySelector("#main-footer");switch(e&&(e.style.display="none"),i&&i.classList.remove("box-container"),t&&(t.style.display="none"),this.currentStep){case 1:this.transactionIssuesForm=new Gs({container:this.container,uploadEvidenceFile:this.uploadEvidenceFile.bind(this),onAction:this.submitDisputeForm.bind(this),paymentResponse:this.paymentResponse}),this.transactionIssuesForm.renderComponent();break}this.attachListener()}}var le;(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"})(le||(le={}));function Vs(n){return n.nodeType===n.ELEMENT_NODE}function Vn(n){const e=n==null?void 0:n.host;return(e==null?void 0:e.shadowRoot)===n}function Fn(n){return Object.prototype.toString.call(n)==="[object ShadowRoot]"}function Fs(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 zs(n){const{cssText:e}=n;if(e.split('"').length<3)return e;const i=["@import",`url(${JSON.stringify(n.href)})`];return n.layerName===""?i.push("layer"):n.layerName&&i.push(`layer(${n.layerName})`),n.supportsText&&i.push(`supports(${n.supportsText})`),n.media.length&&i.push(n.media.mediaText),i.join(" ")+";"}function ci(n){try{const e=n.rules||n.cssRules;return e?Fs(Array.from(e,Pt).join("")):null}catch{return null}}function Pt(n){let e;if(Ws(n))try{e=ci(n.styleSheet)||zs(n)}catch{}else if(Zs(n)&&n.selectorText.includes(":"))return qs(n.cssText);return e||n.cssText}function qs(n){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return n.replace(e,"$1\\$2")}function Ws(n){return"styleSheet"in n}function Zs(n){return"selectorText"in n}class Nt{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var i;if(!e)return-1;const t=(i=this.getMeta(e))===null||i===void 0?void 0:i.id;return t??-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 i=this.getId(e);this.idNodeMap.delete(i),e.childNodes&&e.childNodes.forEach(t=>this.removeNodeFromMap(t))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,i){const t=i.id;this.idNodeMap.set(t,e),this.nodeMetaMap.set(e,i)}replace(e,i){const t=this.getNode(e);if(t){const o=this.nodeMetaMap.get(t);o&&this.nodeMetaMap.set(i,o)}this.idNodeMap.set(e,i)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Js(){return new Nt}function Ui({element:n,maskInputOptions:e,tagName:i,type:t,value:o,maskInputFn:s}){let r=o||"";const l=t&&gn(t);return(e[i.toLowerCase()]||l&&e[l])&&(s?r=s(r,n):r="*".repeat(r.length)),r}function gn(n){return n.toLowerCase()}const It="__rrweb_original__";function $s(n){const e=n.getContext("2d");if(!e)return!0;const i=50;for(let t=0;t<n.width;t+=i)for(let o=0;o<n.height;o+=i){const s=e.getImageData,r=It in s?s[It]:s;if(new Uint32Array(r.call(e,t,o,Math.min(i,n.width-t),Math.min(i,n.height-o)).data.buffer).some(c=>c!==0))return!1}return!0}function Ki(n){const e=n.type;return n.hasAttribute("data-rr-is-password")?"password":e?gn(e):null}function Bt(n,e){var i;let t;try{t=new URL(n,e??window.location.href)}catch{return null}const o=/\.([0-9a-z]+)(?:$)/i,s=t.pathname.match(o);return(i=s==null?void 0:s[1])!==null&&i!==void 0?i:null}let Ys=1;const Qs=new RegExp("[^a-z0-9-_:]"),zn=-2;function Rt(){return Ys++}function Xs(n){if(n instanceof HTMLFormElement)return"form";const e=gn(n.tagName);return Qs.test(e)?"div":e}function ea(n){let e="";return n.indexOf("//")>-1?e=n.split("/").slice(0,3).join("/"):e=n.split("/")[0],e=e.split("?")[0],e}let Tn,Dt;const na=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ia=/^(?:[a-z+]+:)?\/\//i,ta=/^www\..*/i,oa=/^(data:)([^,]*),(.*)/i;function ui(n,e){return(n||"").replace(na,(i,t,o,s,r,l)=>{const c=o||r||l,b=t||s||"";if(!c)return i;if(ia.test(c)||ta.test(c))return`url(${b}${c}${b})`;if(oa.test(c))return`url(${b}${c}${b})`;if(c[0]==="/")return`url(${b}${ea(e)+c}${b})`;const p=e.split("/"),g=c.split("/");p.pop();for(const f of g)f!=="."&&(f===".."?p.pop():p.push(f));return`url(${b}${p.join("/")}${b})`})}const sa=/^[^ \t\n\r\u000c]+/,aa=/^[, \t\n\r\u000c]+/;function ra(n,e){if(e.trim()==="")return e;let i=0;function t(s){let r;const l=s.exec(e.substring(i));return l?(r=l[0],i+=r.length,r):""}const o=[];for(;t(aa),!(i>=e.length);){let s=t(sa);if(s.slice(-1)===",")s=En(n,s.substring(0,s.length-1)),o.push(s);else{let r="";s=En(n,s);let l=!1;for(;;){const c=e.charAt(i);if(c===""){o.push((s+r).trim());break}else if(l)c===")"&&(l=!1);else if(c===","){i+=1,o.push((s+r).trim());break}else c==="("&&(l=!0);r+=c,i+=1}}}return o.join(", ")}function En(n,e){if(!e||e.trim()==="")return e;const i=n.createElement("a");return i.href=e,i.href}function la(n){return!!(n.tagName==="svg"||n.ownerSVGElement)}function ji(){const n=document.createElement("a");return n.href="",n.href}function Ot(n,e,i,t){return t&&(i==="src"||i==="href"&&!(e==="use"&&t[0]==="#")||i==="xlink:href"&&t[0]!=="#"||i==="background"&&(e==="table"||e==="td"||e==="th")?En(n,t):i==="srcset"?ra(n,t):i==="style"?ui(t,ji()):e==="object"&&i==="data"?En(n,t):t)}function Ht(n,e,i){return(n==="video"||n==="audio")&&e==="autoplay"}function da(n,e,i){try{if(typeof e=="string"){if(n.classList.contains(e))return!0}else for(let t=n.classList.length;t--;){const o=n.classList[t];if(e.test(o))return!0}if(i)return n.matches(i)}catch{}return!1}function mi(n,e,i){if(!n)return!1;if(n.nodeType!==n.ELEMENT_NODE)return i?mi(n.parentNode,e,i):!1;for(let t=n.classList.length;t--;){const o=n.classList[t];if(e.test(o))return!0}return i?mi(n.parentNode,e,i):!1}function Ut(n,e,i,t){try{const o=n.nodeType===n.ELEMENT_NODE?n:n.parentElement;if(o===null)return!1;if(typeof e=="string"){if(t){if(o.closest(`.${e}`))return!0}else if(o.classList.contains(e))return!0}else if(mi(o,e,t))return!0;if(i){if(t){if(o.closest(i))return!0}else if(o.matches(i))return!0}}catch{}return!1}function ca(n,e,i){const t=n.contentWindow;if(!t)return;let o=!1,s;try{s=t.document.readyState}catch{return}if(s!=="complete"){const l=setTimeout(()=>{o||(e(),o=!0)},i);n.addEventListener("load",()=>{clearTimeout(l),o=!0,e()});return}const r="about:blank";if(t.location.href!==r||n.src===r||n.src==="")return setTimeout(e,0),n.addEventListener("load",e);n.addEventListener("load",e)}function ua(n,e,i){let t=!1,o;try{o=n.sheet}catch{return}if(o)return;const s=setTimeout(()=>{t||(e(),t=!0)},i);n.addEventListener("load",()=>{clearTimeout(s),t=!0,e()})}function ma(n,e){const{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:r,inlineStylesheet:l,maskInputOptions:c={},maskTextFn:b,maskInputFn:p,dataURLOptions:g={},inlineImages:f,recordCanvas:y,keepIframeSrcFn:C,newlyAddedElement:k=!1}=e,S=ha(i,t);switch(n.nodeType){case n.DOCUMENT_NODE:return n.compatMode!=="CSS1Compat"?{type:le.Document,childNodes:[],compatMode:n.compatMode}:{type:le.Document,childNodes:[]};case n.DOCUMENT_TYPE_NODE:return{type:le.DocumentType,name:n.name,publicId:n.publicId,systemId:n.systemId,rootId:S};case n.ELEMENT_NODE:return ba(n,{doc:i,blockClass:o,blockSelector:s,inlineStylesheet:l,maskInputOptions:c,maskInputFn:p,dataURLOptions:g,inlineImages:f,recordCanvas:y,keepIframeSrcFn:C,newlyAddedElement:k,rootId:S});case n.TEXT_NODE:return pa(n,{needsMask:r,maskTextFn:b,rootId:S});case n.CDATA_SECTION_NODE:return{type:le.CDATA,textContent:"",rootId:S};case n.COMMENT_NODE:return{type:le.Comment,textContent:n.textContent||"",rootId:S};default:return!1}}function ha(n,e){if(!e.hasNode(n))return;const i=e.getId(n);return i===1?void 0:i}function pa(n,e){var i;const{needsMask:t,maskTextFn:o,rootId:s}=e,r=n.parentNode&&n.parentNode.tagName;let l=n.textContent;const c=r==="STYLE"?!0:void 0,b=r==="SCRIPT"?!0:void 0;if(c&&l){try{n.nextSibling||n.previousSibling||!((i=n.parentNode.sheet)===null||i===void 0)&&i.cssRules&&(l=ci(n.parentNode.sheet))}catch(p){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${p}`,n)}l=ui(l,ji())}return b&&(l="SCRIPT_PLACEHOLDER"),!c&&!b&&l&&t&&(l=o?o(l,n.parentElement):l.replace(/[\S]/g,"*")),{type:le.Text,textContent:l||"",isStyle:c,rootId:s}}function ba(n,e){const{doc:i,blockClass:t,blockSelector:o,inlineStylesheet:s,maskInputOptions:r={},maskInputFn:l,dataURLOptions:c={},inlineImages:b,recordCanvas:p,keepIframeSrcFn:g,newlyAddedElement:f=!1,rootId:y}=e,C=da(n,t,o),k=Xs(n);let S={};const A=n.attributes.length;for(let _=0;_<A;_++){const E=n.attributes[_];Ht(k,E.name,E.value)||(S[E.name]=Ot(i,k,gn(E.name),E.value))}if(k==="link"&&s){const _=Array.from(i.styleSheets).find(N=>N.href===n.href);let E=null;_&&(E=ci(_)),E&&(delete S.rel,delete S.href,S._cssText=ui(E,_.href))}if(k==="style"&&n.sheet&&!(n.innerText||n.textContent||"").trim().length){const _=ci(n.sheet);_&&(S._cssText=ui(_,ji()))}if(k==="input"||k==="textarea"||k==="select"){const _=n.value,E=n.checked;S.type!=="radio"&&S.type!=="checkbox"&&S.type!=="submit"&&S.type!=="button"&&_?S.value=Ui({element:n,type:Ki(n),tagName:k,value:_,maskInputOptions:r,maskInputFn:l}):E&&(S.checked=E)}if(k==="option"&&(n.selected&&!r.select?S.selected=!0:delete S.selected),k==="canvas"&&p){if(n.__context==="2d")$s(n)||(S.rr_dataURL=n.toDataURL(c.type,c.quality));else if(!("__context"in n)){const _=n.toDataURL(c.type,c.quality),E=document.createElement("canvas");E.width=n.width,E.height=n.height;const N=E.toDataURL(c.type,c.quality);_!==N&&(S.rr_dataURL=_)}}if(k==="img"&&b){Tn||(Tn=i.createElement("canvas"),Dt=Tn.getContext("2d"));const _=n,E=_.crossOrigin;_.crossOrigin="anonymous";const N=()=>{_.removeEventListener("load",N);try{Tn.width=_.naturalWidth,Tn.height=_.naturalHeight,Dt.drawImage(_,0,0),S.rr_dataURL=Tn.toDataURL(c.type,c.quality)}catch(V){console.warn(`Cannot inline img src=${_.currentSrc}! Error: ${V}`)}E?S.crossOrigin=E:_.removeAttribute("crossorigin")};_.complete&&_.naturalWidth!==0?N():_.addEventListener("load",N)}if(k==="audio"||k==="video"){const _=S;_.rr_mediaState=n.paused?"paused":"played",_.rr_mediaCurrentTime=n.currentTime,_.rr_mediaPlaybackRate=n.playbackRate,_.rr_mediaMuted=n.muted,_.rr_mediaLoop=n.loop,_.rr_mediaVolume=n.volume}if(f||(n.scrollLeft&&(S.rr_scrollLeft=n.scrollLeft),n.scrollTop&&(S.rr_scrollTop=n.scrollTop)),C){const{width:_,height:E}=n.getBoundingClientRect();S={class:S.class,rr_width:`${_}px`,rr_height:`${E}px`}}k==="iframe"&&!g(S.src)&&(n.contentDocument||(S.rr_src=S.src),delete S.src);let M;try{customElements.get(k)&&(M=!0)}catch{}return{type:le.Element,tagName:k,attributes:S,childNodes:[],isSVG:la(n)||void 0,needBlock:C,rootId:y,isCustom:M}}function ne(n){return n==null?"":n.toLowerCase()}function va(n,e){if(e.comment&&n.type===le.Comment)return!0;if(n.type===le.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"&&Bt(n.attributes.href)==="js"))return!0;if(e.headFavicon&&(n.tagName==="link"&&n.attributes.rel==="shortcut icon"||n.tagName==="meta"&&(ne(n.attributes.name).match(/^msapplication-tile(image|color)$/)||ne(n.attributes.name)==="application-name"||ne(n.attributes.rel)==="icon"||ne(n.attributes.rel)==="apple-touch-icon"||ne(n.attributes.rel)==="shortcut icon")))return!0;if(n.tagName==="meta"){if(e.headMetaDescKeywords&&ne(n.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ne(n.attributes.property).match(/^(og|twitter|fb):/)||ne(n.attributes.name).match(/^(og|twitter):/)||ne(n.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(ne(n.attributes.name)==="robots"||ne(n.attributes.name)==="googlebot"||ne(n.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&n.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(ne(n.attributes.name)==="author"||ne(n.attributes.name)==="generator"||ne(n.attributes.name)==="framework"||ne(n.attributes.name)==="publisher"||ne(n.attributes.name)==="progid"||ne(n.attributes.property).match(/^article:/)||ne(n.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(ne(n.attributes.name)==="google-site-verification"||ne(n.attributes.name)==="yandex-verification"||ne(n.attributes.name)==="csrf-token"||ne(n.attributes.name)==="p:domain_verify"||ne(n.attributes.name)==="verify-v1"||ne(n.attributes.name)==="verification"||ne(n.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Pn(n,e){const{doc:i,mirror:t,blockClass:o,blockSelector:s,maskTextClass:r,maskTextSelector:l,skipChild:c=!1,inlineStylesheet:b=!0,maskInputOptions:p={},maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C={},inlineImages:k=!1,recordCanvas:S=!1,onSerialize:A,onIframeLoad:M,iframeLoadTimeout:_=5e3,onStylesheetLoad:E,stylesheetLoadTimeout:N=5e3,keepIframeSrcFn:V=()=>!1,newlyAddedElement:F=!1}=e;let{needsMask:U}=e,{preserveWhiteSpace:G=!0}=e;!U&&n.childNodes&&(U=Ut(n,r,l,U===void 0));const oe=ma(n,{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,dataURLOptions:C,inlineImages:k,recordCanvas:S,keepIframeSrcFn:V,newlyAddedElement:F});if(!oe)return console.warn(n,"not serialized"),null;let fe;t.hasNode(n)?fe=t.getId(n):va(oe,y)||!G&&oe.type===le.Text&&!oe.isStyle&&!oe.textContent.replace(/^\s+|\s+$/gm,"").length?fe=zn:fe=Rt();const K=Object.assign(oe,{id:fe});if(t.add(n,K),fe===zn)return null;A&&A(n);let Ae=!c;if(K.type===le.Element){Ae=Ae&&!K.needBlock,delete K.needBlock;const ue=n.shadowRoot;ue&&Fn(ue)&&(K.isShadowHost=!0)}if((K.type===le.Document||K.type===le.Element)&&Ae){y.headWhitespace&&K.type===le.Element&&K.tagName==="head"&&(G=!1);const ue={doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:r,maskTextSelector:l,skipChild:c,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C,inlineImages:k,recordCanvas:S,preserveWhiteSpace:G,onSerialize:A,onIframeLoad:M,iframeLoadTimeout:_,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:V};if(!(K.type===le.Element&&K.tagName==="textarea"&&K.attributes.value!==void 0))for(const Te of Array.from(n.childNodes)){const Me=Pn(Te,ue);Me&&K.childNodes.push(Me)}if(Vs(n)&&n.shadowRoot)for(const Te of Array.from(n.shadowRoot.childNodes)){const Me=Pn(Te,ue);Me&&(Fn(n.shadowRoot)&&(Me.isShadow=!0),K.childNodes.push(Me))}}return n.parentNode&&Vn(n.parentNode)&&Fn(n.parentNode)&&(K.isShadow=!0),K.type===le.Element&&K.tagName==="iframe"&&ca(n,()=>{const ue=n.contentDocument;if(ue&&M){const Te=Pn(ue,{doc:ue,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:r,maskTextSelector:l,skipChild:!1,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C,inlineImages:k,recordCanvas:S,preserveWhiteSpace:G,onSerialize:A,onIframeLoad:M,iframeLoadTimeout:_,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:V});Te&&M(n,Te)}},_),K.type===le.Element&&K.tagName==="link"&&typeof K.attributes.rel=="string"&&(K.attributes.rel==="stylesheet"||K.attributes.rel==="preload"&&typeof K.attributes.href=="string"&&Bt(K.attributes.href)==="css")&&ua(n,()=>{if(E){const ue=Pn(n,{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:r,maskTextSelector:l,skipChild:!1,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C,inlineImages:k,recordCanvas:S,preserveWhiteSpace:G,onSerialize:A,onIframeLoad:M,iframeLoadTimeout:_,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:V});ue&&E(n,ue)}},N),K}function fa(n,e){const{mirror:i=new Nt,blockClass:t="rr-block",blockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:r=null,inlineStylesheet:l=!0,inlineImages:c=!1,recordCanvas:b=!1,maskAllInputs:p=!1,maskTextFn:g,maskInputFn:f,slimDOM:y=!1,dataURLOptions:C,preserveWhiteSpace:k,onSerialize:S,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:_,stylesheetLoadTimeout:E,keepIframeSrcFn:N=()=>!1}=e||{};return Pn(n,{doc:n,mirror:i,blockClass:t,blockSelector:o,maskTextClass:s,maskTextSelector:r,skipChild:!1,inlineStylesheet:l,maskInputOptions:p===!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}:p===!1?{password:!0}:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:y==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:y===!1?{}:y,dataURLOptions:C,inlineImages:c,recordCanvas:b,preserveWhiteSpace:k,onSerialize:S,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:_,stylesheetLoadTimeout:E,keepIframeSrcFn:N,newlyAddedElement:!1})}function Se(n,e,i=document){const t={capture:!0,passive:!0};return i.addEventListener(n,e,t),()=>i.removeEventListener(n,e,t)}const Nn=`Please stop import mirror directly. Instead of that,\r
678
+ </div>`}renderTransactionIssuesComponent(){const e=document.querySelector("#main-header"),i=document.querySelector("#main-content"),t=document.querySelector("#main-footer");switch(e&&(e.style.display="none"),i&&i.classList.remove("box-container"),t&&(t.style.display="none"),this.currentStep){case 1:this.transactionIssuesForm=new Gs({container:this.container,uploadEvidenceFile:this.uploadEvidenceFile.bind(this),onAction:this.submitDisputeForm.bind(this),paymentResponse:this.paymentResponse}),this.transactionIssuesForm.renderComponent();break}this.attachListener()}}var le;(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"})(le||(le={}));function Vs(n){return n.nodeType===n.ELEMENT_NODE}function Vn(n){const e=n==null?void 0:n.host;return(e==null?void 0:e.shadowRoot)===n}function Fn(n){return Object.prototype.toString.call(n)==="[object ShadowRoot]"}function Fs(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 zs(n){const{cssText:e}=n;if(e.split('"').length<3)return e;const i=["@import",`url(${JSON.stringify(n.href)})`];return n.layerName===""?i.push("layer"):n.layerName&&i.push(`layer(${n.layerName})`),n.supportsText&&i.push(`supports(${n.supportsText})`),n.media.length&&i.push(n.media.mediaText),i.join(" ")+";"}function ci(n){try{const e=n.rules||n.cssRules;return e?Fs(Array.from(e,Nt).join("")):null}catch{return null}}function Nt(n){let e;if(Ws(n))try{e=ci(n.styleSheet)||zs(n)}catch{}else if(Zs(n)&&n.selectorText.includes(":"))return qs(n.cssText);return e||n.cssText}function qs(n){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return n.replace(e,"$1\\$2")}function Ws(n){return"styleSheet"in n}function Zs(n){return"selectorText"in n}class It{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var i;if(!e)return-1;const t=(i=this.getMeta(e))===null||i===void 0?void 0:i.id;return t??-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 i=this.getId(e);this.idNodeMap.delete(i),e.childNodes&&e.childNodes.forEach(t=>this.removeNodeFromMap(t))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,i){const t=i.id;this.idNodeMap.set(t,e),this.nodeMetaMap.set(e,i)}replace(e,i){const t=this.getNode(e);if(t){const o=this.nodeMetaMap.get(t);o&&this.nodeMetaMap.set(i,o)}this.idNodeMap.set(e,i)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Js(){return new It}function Ui({element:n,maskInputOptions:e,tagName:i,type:t,value:o,maskInputFn:s}){let r=o||"";const l=t&&gn(t);return(e[i.toLowerCase()]||l&&e[l])&&(s?r=s(r,n):r="*".repeat(r.length)),r}function gn(n){return n.toLowerCase()}const Bt="__rrweb_original__";function $s(n){const e=n.getContext("2d");if(!e)return!0;const i=50;for(let t=0;t<n.width;t+=i)for(let o=0;o<n.height;o+=i){const s=e.getImageData,r=Bt in s?s[Bt]:s;if(new Uint32Array(r.call(e,t,o,Math.min(i,n.width-t),Math.min(i,n.height-o)).data.buffer).some(c=>c!==0))return!1}return!0}function Ki(n){const e=n.type;return n.hasAttribute("data-rr-is-password")?"password":e?gn(e):null}function Rt(n,e){var i;let t;try{t=new URL(n,e??window.location.href)}catch{return null}const o=/\.([0-9a-z]+)(?:$)/i,s=t.pathname.match(o);return(i=s==null?void 0:s[1])!==null&&i!==void 0?i:null}let Ys=1;const Qs=new RegExp("[^a-z0-9-_:]"),zn=-2;function Dt(){return Ys++}function Xs(n){if(n instanceof HTMLFormElement)return"form";const e=gn(n.tagName);return Qs.test(e)?"div":e}function ea(n){let e="";return n.indexOf("//")>-1?e=n.split("/").slice(0,3).join("/"):e=n.split("/")[0],e=e.split("?")[0],e}let Tn,Ot;const na=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ia=/^(?:[a-z+]+:)?\/\//i,ta=/^www\..*/i,oa=/^(data:)([^,]*),(.*)/i;function ui(n,e){return(n||"").replace(na,(i,t,o,s,r,l)=>{const c=o||r||l,b=t||s||"";if(!c)return i;if(ia.test(c)||ta.test(c))return`url(${b}${c}${b})`;if(oa.test(c))return`url(${b}${c}${b})`;if(c[0]==="/")return`url(${b}${ea(e)+c}${b})`;const p=e.split("/"),g=c.split("/");p.pop();for(const f of g)f!=="."&&(f===".."?p.pop():p.push(f));return`url(${b}${p.join("/")}${b})`})}const sa=/^[^ \t\n\r\u000c]+/,aa=/^[, \t\n\r\u000c]+/;function ra(n,e){if(e.trim()==="")return e;let i=0;function t(s){let r;const l=s.exec(e.substring(i));return l?(r=l[0],i+=r.length,r):""}const o=[];for(;t(aa),!(i>=e.length);){let s=t(sa);if(s.slice(-1)===",")s=En(n,s.substring(0,s.length-1)),o.push(s);else{let r="";s=En(n,s);let l=!1;for(;;){const c=e.charAt(i);if(c===""){o.push((s+r).trim());break}else if(l)c===")"&&(l=!1);else if(c===","){i+=1,o.push((s+r).trim());break}else c==="("&&(l=!0);r+=c,i+=1}}}return o.join(", ")}function En(n,e){if(!e||e.trim()==="")return e;const i=n.createElement("a");return i.href=e,i.href}function la(n){return!!(n.tagName==="svg"||n.ownerSVGElement)}function ji(){const n=document.createElement("a");return n.href="",n.href}function Ht(n,e,i,t){return t&&(i==="src"||i==="href"&&!(e==="use"&&t[0]==="#")||i==="xlink:href"&&t[0]!=="#"||i==="background"&&(e==="table"||e==="td"||e==="th")?En(n,t):i==="srcset"?ra(n,t):i==="style"?ui(t,ji()):e==="object"&&i==="data"?En(n,t):t)}function Ut(n,e,i){return(n==="video"||n==="audio")&&e==="autoplay"}function da(n,e,i){try{if(typeof e=="string"){if(n.classList.contains(e))return!0}else for(let t=n.classList.length;t--;){const o=n.classList[t];if(e.test(o))return!0}if(i)return n.matches(i)}catch{}return!1}function mi(n,e,i){if(!n)return!1;if(n.nodeType!==n.ELEMENT_NODE)return i?mi(n.parentNode,e,i):!1;for(let t=n.classList.length;t--;){const o=n.classList[t];if(e.test(o))return!0}return i?mi(n.parentNode,e,i):!1}function Kt(n,e,i,t){try{const o=n.nodeType===n.ELEMENT_NODE?n:n.parentElement;if(o===null)return!1;if(typeof e=="string"){if(t){if(o.closest(`.${e}`))return!0}else if(o.classList.contains(e))return!0}else if(mi(o,e,t))return!0;if(i){if(t){if(o.closest(i))return!0}else if(o.matches(i))return!0}}catch{}return!1}function ca(n,e,i){const t=n.contentWindow;if(!t)return;let o=!1,s;try{s=t.document.readyState}catch{return}if(s!=="complete"){const l=setTimeout(()=>{o||(e(),o=!0)},i);n.addEventListener("load",()=>{clearTimeout(l),o=!0,e()});return}const r="about:blank";if(t.location.href!==r||n.src===r||n.src==="")return setTimeout(e,0),n.addEventListener("load",e);n.addEventListener("load",e)}function ua(n,e,i){let t=!1,o;try{o=n.sheet}catch{return}if(o)return;const s=setTimeout(()=>{t||(e(),t=!0)},i);n.addEventListener("load",()=>{clearTimeout(s),t=!0,e()})}function ma(n,e){const{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:r,inlineStylesheet:l,maskInputOptions:c={},maskTextFn:b,maskInputFn:p,dataURLOptions:g={},inlineImages:f,recordCanvas:y,keepIframeSrcFn:C,newlyAddedElement:k=!1}=e,S=ha(i,t);switch(n.nodeType){case n.DOCUMENT_NODE:return n.compatMode!=="CSS1Compat"?{type:le.Document,childNodes:[],compatMode:n.compatMode}:{type:le.Document,childNodes:[]};case n.DOCUMENT_TYPE_NODE:return{type:le.DocumentType,name:n.name,publicId:n.publicId,systemId:n.systemId,rootId:S};case n.ELEMENT_NODE:return ba(n,{doc:i,blockClass:o,blockSelector:s,inlineStylesheet:l,maskInputOptions:c,maskInputFn:p,dataURLOptions:g,inlineImages:f,recordCanvas:y,keepIframeSrcFn:C,newlyAddedElement:k,rootId:S});case n.TEXT_NODE:return pa(n,{needsMask:r,maskTextFn:b,rootId:S});case n.CDATA_SECTION_NODE:return{type:le.CDATA,textContent:"",rootId:S};case n.COMMENT_NODE:return{type:le.Comment,textContent:n.textContent||"",rootId:S};default:return!1}}function ha(n,e){if(!e.hasNode(n))return;const i=e.getId(n);return i===1?void 0:i}function pa(n,e){var i;const{needsMask:t,maskTextFn:o,rootId:s}=e,r=n.parentNode&&n.parentNode.tagName;let l=n.textContent;const c=r==="STYLE"?!0:void 0,b=r==="SCRIPT"?!0:void 0;if(c&&l){try{n.nextSibling||n.previousSibling||!((i=n.parentNode.sheet)===null||i===void 0)&&i.cssRules&&(l=ci(n.parentNode.sheet))}catch(p){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${p}`,n)}l=ui(l,ji())}return b&&(l="SCRIPT_PLACEHOLDER"),!c&&!b&&l&&t&&(l=o?o(l,n.parentElement):l.replace(/[\S]/g,"*")),{type:le.Text,textContent:l||"",isStyle:c,rootId:s}}function ba(n,e){const{doc:i,blockClass:t,blockSelector:o,inlineStylesheet:s,maskInputOptions:r={},maskInputFn:l,dataURLOptions:c={},inlineImages:b,recordCanvas:p,keepIframeSrcFn:g,newlyAddedElement:f=!1,rootId:y}=e,C=da(n,t,o),k=Xs(n);let S={};const A=n.attributes.length;for(let _=0;_<A;_++){const E=n.attributes[_];Ut(k,E.name,E.value)||(S[E.name]=Ht(i,k,gn(E.name),E.value))}if(k==="link"&&s){const _=Array.from(i.styleSheets).find(N=>N.href===n.href);let E=null;_&&(E=ci(_)),E&&(delete S.rel,delete S.href,S._cssText=ui(E,_.href))}if(k==="style"&&n.sheet&&!(n.innerText||n.textContent||"").trim().length){const _=ci(n.sheet);_&&(S._cssText=ui(_,ji()))}if(k==="input"||k==="textarea"||k==="select"){const _=n.value,E=n.checked;S.type!=="radio"&&S.type!=="checkbox"&&S.type!=="submit"&&S.type!=="button"&&_?S.value=Ui({element:n,type:Ki(n),tagName:k,value:_,maskInputOptions:r,maskInputFn:l}):E&&(S.checked=E)}if(k==="option"&&(n.selected&&!r.select?S.selected=!0:delete S.selected),k==="canvas"&&p){if(n.__context==="2d")$s(n)||(S.rr_dataURL=n.toDataURL(c.type,c.quality));else if(!("__context"in n)){const _=n.toDataURL(c.type,c.quality),E=document.createElement("canvas");E.width=n.width,E.height=n.height;const N=E.toDataURL(c.type,c.quality);_!==N&&(S.rr_dataURL=_)}}if(k==="img"&&b){Tn||(Tn=i.createElement("canvas"),Ot=Tn.getContext("2d"));const _=n,E=_.crossOrigin;_.crossOrigin="anonymous";const N=()=>{_.removeEventListener("load",N);try{Tn.width=_.naturalWidth,Tn.height=_.naturalHeight,Ot.drawImage(_,0,0),S.rr_dataURL=Tn.toDataURL(c.type,c.quality)}catch(V){console.warn(`Cannot inline img src=${_.currentSrc}! Error: ${V}`)}E?S.crossOrigin=E:_.removeAttribute("crossorigin")};_.complete&&_.naturalWidth!==0?N():_.addEventListener("load",N)}if(k==="audio"||k==="video"){const _=S;_.rr_mediaState=n.paused?"paused":"played",_.rr_mediaCurrentTime=n.currentTime,_.rr_mediaPlaybackRate=n.playbackRate,_.rr_mediaMuted=n.muted,_.rr_mediaLoop=n.loop,_.rr_mediaVolume=n.volume}if(f||(n.scrollLeft&&(S.rr_scrollLeft=n.scrollLeft),n.scrollTop&&(S.rr_scrollTop=n.scrollTop)),C){const{width:_,height:E}=n.getBoundingClientRect();S={class:S.class,rr_width:`${_}px`,rr_height:`${E}px`}}k==="iframe"&&!g(S.src)&&(n.contentDocument||(S.rr_src=S.src),delete S.src);let M;try{customElements.get(k)&&(M=!0)}catch{}return{type:le.Element,tagName:k,attributes:S,childNodes:[],isSVG:la(n)||void 0,needBlock:C,rootId:y,isCustom:M}}function ne(n){return n==null?"":n.toLowerCase()}function va(n,e){if(e.comment&&n.type===le.Comment)return!0;if(n.type===le.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"&&Rt(n.attributes.href)==="js"))return!0;if(e.headFavicon&&(n.tagName==="link"&&n.attributes.rel==="shortcut icon"||n.tagName==="meta"&&(ne(n.attributes.name).match(/^msapplication-tile(image|color)$/)||ne(n.attributes.name)==="application-name"||ne(n.attributes.rel)==="icon"||ne(n.attributes.rel)==="apple-touch-icon"||ne(n.attributes.rel)==="shortcut icon")))return!0;if(n.tagName==="meta"){if(e.headMetaDescKeywords&&ne(n.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ne(n.attributes.property).match(/^(og|twitter|fb):/)||ne(n.attributes.name).match(/^(og|twitter):/)||ne(n.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(ne(n.attributes.name)==="robots"||ne(n.attributes.name)==="googlebot"||ne(n.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&n.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(ne(n.attributes.name)==="author"||ne(n.attributes.name)==="generator"||ne(n.attributes.name)==="framework"||ne(n.attributes.name)==="publisher"||ne(n.attributes.name)==="progid"||ne(n.attributes.property).match(/^article:/)||ne(n.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(ne(n.attributes.name)==="google-site-verification"||ne(n.attributes.name)==="yandex-verification"||ne(n.attributes.name)==="csrf-token"||ne(n.attributes.name)==="p:domain_verify"||ne(n.attributes.name)==="verify-v1"||ne(n.attributes.name)==="verification"||ne(n.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Pn(n,e){const{doc:i,mirror:t,blockClass:o,blockSelector:s,maskTextClass:r,maskTextSelector:l,skipChild:c=!1,inlineStylesheet:b=!0,maskInputOptions:p={},maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C={},inlineImages:k=!1,recordCanvas:S=!1,onSerialize:A,onIframeLoad:M,iframeLoadTimeout:_=5e3,onStylesheetLoad:E,stylesheetLoadTimeout:N=5e3,keepIframeSrcFn:V=()=>!1,newlyAddedElement:F=!1}=e;let{needsMask:U}=e,{preserveWhiteSpace:G=!0}=e;!U&&n.childNodes&&(U=Kt(n,r,l,U===void 0));const oe=ma(n,{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,dataURLOptions:C,inlineImages:k,recordCanvas:S,keepIframeSrcFn:V,newlyAddedElement:F});if(!oe)return console.warn(n,"not serialized"),null;let fe;t.hasNode(n)?fe=t.getId(n):va(oe,y)||!G&&oe.type===le.Text&&!oe.isStyle&&!oe.textContent.replace(/^\s+|\s+$/gm,"").length?fe=zn:fe=Dt();const K=Object.assign(oe,{id:fe});if(t.add(n,K),fe===zn)return null;A&&A(n);let Ae=!c;if(K.type===le.Element){Ae=Ae&&!K.needBlock,delete K.needBlock;const ue=n.shadowRoot;ue&&Fn(ue)&&(K.isShadowHost=!0)}if((K.type===le.Document||K.type===le.Element)&&Ae){y.headWhitespace&&K.type===le.Element&&K.tagName==="head"&&(G=!1);const ue={doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:r,maskTextSelector:l,skipChild:c,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C,inlineImages:k,recordCanvas:S,preserveWhiteSpace:G,onSerialize:A,onIframeLoad:M,iframeLoadTimeout:_,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:V};if(!(K.type===le.Element&&K.tagName==="textarea"&&K.attributes.value!==void 0))for(const Te of Array.from(n.childNodes)){const Me=Pn(Te,ue);Me&&K.childNodes.push(Me)}if(Vs(n)&&n.shadowRoot)for(const Te of Array.from(n.shadowRoot.childNodes)){const Me=Pn(Te,ue);Me&&(Fn(n.shadowRoot)&&(Me.isShadow=!0),K.childNodes.push(Me))}}return n.parentNode&&Vn(n.parentNode)&&Fn(n.parentNode)&&(K.isShadow=!0),K.type===le.Element&&K.tagName==="iframe"&&ca(n,()=>{const ue=n.contentDocument;if(ue&&M){const Te=Pn(ue,{doc:ue,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:r,maskTextSelector:l,skipChild:!1,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C,inlineImages:k,recordCanvas:S,preserveWhiteSpace:G,onSerialize:A,onIframeLoad:M,iframeLoadTimeout:_,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:V});Te&&M(n,Te)}},_),K.type===le.Element&&K.tagName==="link"&&typeof K.attributes.rel=="string"&&(K.attributes.rel==="stylesheet"||K.attributes.rel==="preload"&&typeof K.attributes.href=="string"&&Rt(K.attributes.href)==="css")&&ua(n,()=>{if(E){const ue=Pn(n,{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:r,maskTextSelector:l,skipChild:!1,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C,inlineImages:k,recordCanvas:S,preserveWhiteSpace:G,onSerialize:A,onIframeLoad:M,iframeLoadTimeout:_,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:V});ue&&E(n,ue)}},N),K}function fa(n,e){const{mirror:i=new It,blockClass:t="rr-block",blockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:r=null,inlineStylesheet:l=!0,inlineImages:c=!1,recordCanvas:b=!1,maskAllInputs:p=!1,maskTextFn:g,maskInputFn:f,slimDOM:y=!1,dataURLOptions:C,preserveWhiteSpace:k,onSerialize:S,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:_,stylesheetLoadTimeout:E,keepIframeSrcFn:N=()=>!1}=e||{};return Pn(n,{doc:n,mirror:i,blockClass:t,blockSelector:o,maskTextClass:s,maskTextSelector:r,skipChild:!1,inlineStylesheet:l,maskInputOptions:p===!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}:p===!1?{password:!0}:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:y==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:y===!1?{}:y,dataURLOptions:C,inlineImages:c,recordCanvas:b,preserveWhiteSpace:k,onSerialize:S,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:_,stylesheetLoadTimeout:E,keepIframeSrcFn:N,newlyAddedElement:!1})}function Se(n,e,i=document){const t={capture:!0,passive:!0};return i.addEventListener(n,e,t),()=>i.removeEventListener(n,e,t)}const Nn=`Please stop import mirror directly. Instead of that,\r
679
679
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
680
- or you can use record.mirror to access the mirror instance during recording.`;let Kt={map:{},getId(){return console.error(Nn),-1},getNode(){return console.error(Nn),null},removeNodeFromMap(){console.error(Nn)},has(){return console.error(Nn),!1},reset(){console.error(Nn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Kt=new Proxy(Kt,{get(n,e,i){return e==="map"&&console.error(Nn),Reflect.get(n,e,i)}}));function qn(n,e,i={}){let t=null,o=0;return function(...s){const r=Date.now();!o&&i.leading===!1&&(o=r);const l=e-(r-o),c=this;l<=0||l>e?(t&&(clearTimeout(t),t=null),o=r,n.apply(c,s)):!t&&i.trailing!==!1&&(t=setTimeout(()=>{o=i.leading===!1?0:Date.now(),t=null,n.apply(c,s)},l))}}function hi(n,e,i,t,o=window){const s=o.Object.getOwnPropertyDescriptor(n,e);return o.Object.defineProperty(n,e,t?i:{set(r){setTimeout(()=>{i.set.call(this,r)},0),s&&s.set&&s.set.call(this,r)}}),()=>hi(n,e,s||{},!0)}function In(n,e,i){try{if(!(e in n))return()=>{};const t=n[e],o=i(t);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:t}})),n[e]=o,()=>{n[e]=t}}catch{return()=>{}}}let pi=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(pi=()=>new Date().getTime());function jt(n){var e,i,t,o,s,r;const l=n.document;return{left:l.scrollingElement?l.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:(l==null?void 0:l.documentElement.scrollLeft)||((i=(e=l==null?void 0:l.body)===null||e===void 0?void 0:e.parentElement)===null||i===void 0?void 0:i.scrollLeft)||((t=l==null?void 0:l.body)===null||t===void 0?void 0:t.scrollLeft)||0,top:l.scrollingElement?l.scrollingElement.scrollTop:n.pageYOffset!==void 0?n.pageYOffset:(l==null?void 0:l.documentElement.scrollTop)||((s=(o=l==null?void 0:l.body)===null||o===void 0?void 0:o.parentElement)===null||s===void 0?void 0:s.scrollTop)||((r=l==null?void 0:l.body)===null||r===void 0?void 0:r.scrollTop)||0}}function Gt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Vt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ft(n){return n?n.nodeType===n.ELEMENT_NODE?n:n.parentElement:null}function _e(n,e,i,t){if(!n)return!1;const o=Ft(n);if(!o)return!1;try{if(typeof e=="string"){if(o.classList.contains(e)||t&&o.closest("."+e)!==null)return!0}else if(mi(o,e,t))return!0}catch{}return!!(i&&(o.matches(i)||t&&o.closest(i)!==null))}function ga(n,e){return e.getId(n)!==-1}function Gi(n,e){return e.getId(n)===zn}function zt(n,e){if(Vn(n))return!1;const i=e.getId(n);return e.has(i)?n.parentNode&&n.parentNode.nodeType===n.DOCUMENT_NODE?!1:n.parentNode?zt(n.parentNode,e):!0:!0}function Vi(n){return!!n.changedTouches}function ya(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 i=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===i)return!0;while(i=i&&i.parentNode);return!1})}function qt(n,e){return!!(n.nodeName==="IFRAME"&&e.getMeta(n))}function Wt(n,e){return!!(n.nodeName==="LINK"&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute&&n.getAttribute("rel")==="stylesheet"&&e.getMeta(n))}function Fi(n){return!!(n!=null&&n.shadowRoot)}class ka{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var i;return(i=this.styleIDMap.get(e))!==null&&i!==void 0?i:-1}has(e){return this.styleIDMap.has(e)}add(e,i){if(this.has(e))return this.getId(e);let t;return i===void 0?t=this.id++:t=i,this.styleIDMap.set(e,t),this.idStyleMap.set(t,e),t}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 Zt(n){var e,i;let t=null;return((i=(e=n.getRootNode)===null||e===void 0?void 0:e.call(n))===null||i===void 0?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&n.getRootNode().host&&(t=n.getRootNode().host),t}function wa(n){let e=n,i;for(;i=Zt(e);)e=i;return e}function Ca(n){const e=n.ownerDocument;if(!e)return!1;const i=wa(n);return e.contains(i)}function Jt(n){const e=n.ownerDocument;return e?e.contains(n)||Ca(n):!1}var W=(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))(W||{}),z=(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))(z||{}),Le=(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))(Le||{}),Ze=(n=>(n[n.Mouse=0]="Mouse",n[n.Pen=1]="Pen",n[n.Touch=2]="Touch",n))(Ze||{}),Bn=(n=>(n[n["2D"]=0]="2D",n[n.WebGL=1]="WebGL",n[n.WebGL2=2]="WebGL2",n))(Bn||{});function $t(n){return"__ln"in n}class Sa{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 i=this.head;for(let t=0;t<e;t++)i=(i==null?void 0:i.next)||null;return i}addNode(e){const i={value:e,previous:null,next:null};if(e.__ln=i,e.previousSibling&&$t(e.previousSibling)){const t=e.previousSibling.__ln.next;i.next=t,i.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=i,t&&(t.previous=i)}else if(e.nextSibling&&$t(e.nextSibling)&&e.nextSibling.__ln.previous){const t=e.nextSibling.__ln.previous;i.previous=t,i.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=i,t&&(t.next=i)}else this.head&&(this.head.previous=i),i.next=this.head,this.head=i;i.next===null&&(this.tail=i),this.length++}removeNode(e){const i=e.__ln;this.head&&(i.previous?(i.previous.next=i.next,i.next?i.next.previous=i.previous:this.tail=i.previous):(this.head=i.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Yt=(n,e)=>`${n}@${e}`;class _a{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=[],i=new Set,t=new Sa,o=c=>{let b=c,p=zn;for(;p===zn;)b=b&&b.nextSibling,p=b&&this.mirror.getId(b);return p},s=c=>{if(!c.parentNode||!Jt(c)||c.parentNode.tagName==="TEXTAREA")return;const b=Vn(c.parentNode)?this.mirror.getId(Zt(c)):this.mirror.getId(c.parentNode),p=o(c);if(b===-1||p===-1)return t.addNode(c);const g=Pn(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=>{qt(f,this.mirror)&&this.iframeManager.addIframe(f),Wt(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Fi(c)&&this.shadowDomManager.addShadowRoot(c.shadowRoot,this.doc)},onIframeLoad:(f,y)=>{this.iframeManager.attachIframe(f,y),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,y)=>{this.stylesheetManager.attachLinkElement(f,y)}});g&&(e.push({parentId:b,nextId:p,node:g}),i.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const c of this.movedSet)Qt(this.removes,c,this.mirror)&&!this.movedSet.has(c.parentNode)||s(c);for(const c of this.addedSet)!eo(this.droppedSet,c)&&!Qt(this.removes,c,this.mirror)||eo(this.movedSet,c)?s(c):this.droppedSet.add(c);let r=null;for(;t.length;){let c=null;if(r){const b=this.mirror.getId(r.value.parentNode),p=o(r.value);b!==-1&&p!==-1&&(c=r)}if(!c){let b=t.tail;for(;b;){const p=b;if(b=b.previous,p){const g=this.mirror.getId(p.value.parentNode);if(o(p.value)===-1)continue;if(g!==-1){c=p;break}else{const y=p.value;if(y.parentNode&&y.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const C=y.parentNode.host;if(this.mirror.getId(C)!==-1){c=p;break}}}}}}if(!c){for(;t.head;)t.removeNode(t.head.value);break}r=c.previous,t.removeNode(c.value),s(c.value)}const l={texts:this.texts.map(c=>{const b=c.node;return b.parentNode&&b.parentNode.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(b.parentNode),{id:this.mirror.getId(b),value:c.value}}).filter(c=>!i.has(c.id)).filter(c=>this.mirror.has(c.id)),attributes:this.attributes.map(c=>{const{attributes:b}=c;if(typeof b.style=="string"){const p=JSON.stringify(c.styleDiff),g=JSON.stringify(c._unchangedStyles);p.length<b.style.length&&(p+g).split("var(").length===b.style.split("var(").length&&(b.style=c.styleDiff)}return{id:this.mirror.getId(c.node),attributes:b}}).filter(c=>!i.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 i=this.attributeMap.get(e);i||(i={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e,i)),i.attributes.value=Array.from(e.childNodes,t=>t.textContent||"").join("")},this.processMutation=e=>{if(!Gi(e.target,this.mirror))switch(e.type){case"characterData":{const i=e.target.textContent;!_e(e.target,this.blockClass,this.blockSelector,!1)&&i!==e.oldValue&&this.texts.push({value:Ut(e.target,this.maskTextClass,this.maskTextSelector,!0)&&i?this.maskTextFn?this.maskTextFn(i,Ft(e.target)):i.replace(/[\S]/g,"*"):i,node:e.target});break}case"attributes":{const i=e.target;let t=e.attributeName,o=e.target.getAttribute(t);if(t==="value"){const r=Ki(i);o=Ui({element:i,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:r,value:o,maskInputFn:this.maskInputFn})}if(_e(e.target,this.blockClass,this.blockSelector,!1)||o===e.oldValue)return;let s=this.attributeMap.get(e.target);if(i.tagName==="IFRAME"&&t==="src"&&!this.keepIframeSrcFn(o))if(!i.contentDocument)t="rr_src";else return;if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(e.target,s)),t==="type"&&i.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&i.setAttribute("data-rr-is-password","true"),!Ht(i.tagName,t)&&(s.attributes[t]=Ot(this.doc,gn(i.tagName),gn(t),o),t==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const r=this.unattachedDoc.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const l of Array.from(i.style)){const c=i.style.getPropertyValue(l),b=i.style.getPropertyPriority(l);c!==r.style.getPropertyValue(l)||b!==r.style.getPropertyPriority(l)?b===""?s.styleDiff[l]=c:s.styleDiff[l]=[c,b]:s._unchangedStyles[l]=[c,b]}for(const l of Array.from(r.style))i.style.getPropertyValue(l)===""&&(s.styleDiff[l]=!1)}break}case"childList":{if(_e(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(i=>this.genAdds(i,e.target)),e.removedNodes.forEach(i=>{const t=this.mirror.getId(i),o=Vn(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);_e(e.target,this.blockClass,this.blockSelector,!1)||Gi(i,this.mirror)||!ga(i,this.mirror)||(this.addedSet.has(i)?(zi(this.addedSet,i),this.droppedSet.add(i)):this.addedSet.has(e.target)&&t===-1||zt(e.target,this.mirror)||(this.movedSet.has(i)&&this.movedMap[Yt(t,o)]?zi(this.movedSet,i):this.removes.push({parentId:o,id:t,isShadow:Vn(e.target)&&Fn(e.target)?!0:void 0})),this.mapRemoves.push(i))});break}}},this.genAdds=(e,i)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Gi(e,this.mirror))return;this.movedSet.add(e);let t=null;i&&this.mirror.hasNode(i)&&(t=this.mirror.getId(i)),t&&t!==-1&&(this.movedMap[Yt(this.mirror.getId(e),t)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);_e(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach(t=>this.genAdds(t)),Fi(e)&&e.shadowRoot.childNodes.forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,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(i=>{this[i]=e[i]})}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 zi(n,e){n.delete(e),e.childNodes.forEach(i=>zi(n,i))}function Qt(n,e,i){return n.length===0?!1:Xt(n,e,i)}function Xt(n,e,i){const{parentNode:t}=e;if(!t)return!1;const o=i.getId(t);return n.some(s=>s.id===o)?!0:Xt(n,t,i)}function eo(n,e){return n.size===0?!1:no(n,e)}function no(n,e){const{parentNode:i}=e;return i?n.has(i)?!0:no(n,i):!1}let Wn;function Aa(n){Wn=n}function Ma(){Wn=void 0}const q=n=>Wn?(...i)=>{try{return n(...i)}catch(t){if(Wn&&Wn(t)===!0)return;throw t}}:n,yn=[];function Zn(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 io(n,e){var i,t;const o=new _a;yn.push(o),o.init(n);let s=window.MutationObserver||window.__rrMutationObserver;const r=(t=(i=window==null?void 0:window.Zone)===null||i===void 0?void 0:i.__symbol__)===null||t===void 0?void 0:t.call(i,"MutationObserver");r&&window[r]&&(s=window[r]);const l=new s(q(o.processMutations.bind(o)));return l.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),l}function xa({mousemoveCb:n,sampling:e,doc:i,mirror:t}){if(e.mousemove===!1)return()=>{};const o=typeof e.mousemove=="number"?e.mousemove:50,s=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let r=[],l;const c=qn(q(g=>{const f=Date.now()-l;n(r.map(y=>(y.timeOffset-=f,y)),g),r=[],l=null}),s),b=q(qn(q(g=>{const f=Zn(g),{clientX:y,clientY:C}=Vi(g)?g.changedTouches[0]:g;l||(l=pi()),r.push({x:y,y:C,id:t.getId(f),timeOffset:pi()-l}),c(typeof DragEvent<"u"&&g instanceof DragEvent?z.Drag:g instanceof MouseEvent?z.MouseMove:z.TouchMove)}),o,{trailing:!1})),p=[Se("mousemove",b,i),Se("touchmove",b,i),Se("drag",b,i)];return q(()=>{p.forEach(g=>g())})}function La({mouseInteractionCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};const r=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,l=[];let c=null;const b=p=>g=>{const f=Zn(g);if(_e(f,t,o,!0))return;let y=null,C=p;if("pointerType"in g){switch(g.pointerType){case"mouse":y=Ze.Mouse;break;case"touch":y=Ze.Touch;break;case"pen":y=Ze.Pen;break}y===Ze.Touch?Le[p]===Le.MouseDown?C="TouchStart":Le[p]===Le.MouseUp&&(C="TouchEnd"):Ze.Pen}else Vi(g)&&(y=Ze.Touch);y!==null?(c=y,(C.startsWith("Touch")&&y===Ze.Touch||C.startsWith("Mouse")&&y===Ze.Mouse)&&(y=null)):Le[p]===Le.Click&&(y=c,c=null);const k=Vi(g)?g.changedTouches[0]:g;if(!k)return;const S=i.getId(f),{clientX:A,clientY:M}=k;q(n)(Object.assign({type:Le[C],id:S,x:A,y:M},y!==null&&{pointerType:y}))};return Object.keys(Le).filter(p=>Number.isNaN(Number(p))&&!p.endsWith("_Departed")&&r[p]!==!1).forEach(p=>{let g=gn(p);const f=b(p);if(window.PointerEvent)switch(Le[p]){case Le.MouseDown:case Le.MouseUp:g=g.replace("mouse","pointer");break;case Le.TouchStart:case Le.TouchEnd:return}l.push(Se(g,f,e))}),q(()=>{l.forEach(p=>p())})}function to({scrollCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){const r=q(qn(q(l=>{const c=Zn(l);if(!c||_e(c,t,o,!0))return;const b=i.getId(c);if(c===e&&e.defaultView){const p=jt(e.defaultView);n({id:b,x:p.left,y:p.top})}else n({id:b,x:c.scrollLeft,y:c.scrollTop})}),s.scroll||100));return Se("scroll",r,e)}function Ta({viewportResizeCb:n},{win:e}){let i=-1,t=-1;const o=q(qn(q(()=>{const s=Gt(),r=Vt();(i!==s||t!==r)&&(n({width:Number(r),height:Number(s)}),i=s,t=r)}),200));return Se("resize",o,e)}const Ea=["INPUT","TEXTAREA","SELECT"],oo=new WeakMap;function Pa({inputCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,ignoreClass:s,ignoreSelector:r,maskInputOptions:l,maskInputFn:c,sampling:b,userTriggeredOnInput:p}){function g(M){let _=Zn(M);const E=M.isTrusted,N=_&&_.tagName;if(_&&N==="OPTION"&&(_=_.parentElement),!_||!N||Ea.indexOf(N)<0||_e(_,t,o,!0)||_.classList.contains(s)||r&&_.matches(r))return;let V=_.value,F=!1;const U=Ki(_)||"";U==="radio"||U==="checkbox"?F=_.checked:(l[N.toLowerCase()]||l[U])&&(V=Ui({element:_,maskInputOptions:l,tagName:N,type:U,value:V,maskInputFn:c})),f(_,p?{text:V,isChecked:F,userTriggered:E}:{text:V,isChecked:F});const G=_.name;U==="radio"&&G&&F&&e.querySelectorAll(`input[type="radio"][name="${G}"]`).forEach(oe=>{if(oe!==_){const fe=oe.value;f(oe,p?{text:fe,isChecked:!F,userTriggered:!1}:{text:fe,isChecked:!F})}})}function f(M,_){const E=oo.get(M);if(!E||E.text!==_.text||E.isChecked!==_.isChecked){oo.set(M,_);const N=i.getId(M);q(n)(Object.assign(Object.assign({},_),{id:N}))}}const C=(b.input==="last"?["change"]:["input","change"]).map(M=>Se(M,q(g),e)),k=e.defaultView;if(!k)return()=>{C.forEach(M=>M())};const S=k.Object.getOwnPropertyDescriptor(k.HTMLInputElement.prototype,"value"),A=[[k.HTMLInputElement.prototype,"value"],[k.HTMLInputElement.prototype,"checked"],[k.HTMLSelectElement.prototype,"value"],[k.HTMLTextAreaElement.prototype,"value"],[k.HTMLSelectElement.prototype,"selectedIndex"],[k.HTMLOptionElement.prototype,"selected"]];return S&&S.set&&C.push(...A.map(M=>hi(M[0],M[1],{set(){q(g)({target:this,isTrusted:!1})}},!1,k))),q(()=>{C.forEach(M=>M())})}function bi(n){const e=[];function i(t,o){if(vi("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||vi("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||vi("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||vi("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const r=Array.from(t.parentRule.cssRules).indexOf(t);o.unshift(r)}else if(t.parentStyleSheet){const r=Array.from(t.parentStyleSheet.cssRules).indexOf(t);o.unshift(r)}return o}return i(n,e)}function an(n,e,i){let t,o;return n?(n.ownerNode?t=e.getId(n.ownerNode):o=i.getId(n),{styleId:o,id:t}):{}}function Na({styleSheetRuleCb:n,mirror:e,stylesheetManager:i},{win:t}){if(!t.CSSStyleSheet||!t.CSSStyleSheet.prototype)return()=>{};const o=t.CSSStyleSheet.prototype.insertRule;t.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:q((p,g,f)=>{const[y,C]=f,{id:k,styleId:S}=an(g,e,i.styleMirror);return(k&&k!==-1||S&&S!==-1)&&n({id:k,styleId:S,adds:[{rule:y,index:C}]}),p.apply(g,f)})});const s=t.CSSStyleSheet.prototype.deleteRule;t.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:q((p,g,f)=>{const[y]=f,{id:C,styleId:k}=an(g,e,i.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,removes:[{index:y}]}),p.apply(g,f)})});let r;t.CSSStyleSheet.prototype.replace&&(r=t.CSSStyleSheet.prototype.replace,t.CSSStyleSheet.prototype.replace=new Proxy(r,{apply:q((p,g,f)=>{const[y]=f,{id:C,styleId:k}=an(g,e,i.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,replace:y}),p.apply(g,f)})}));let l;t.CSSStyleSheet.prototype.replaceSync&&(l=t.CSSStyleSheet.prototype.replaceSync,t.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:q((p,g,f)=>{const[y]=f,{id:C,styleId:k}=an(g,e,i.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,replaceSync:y}),p.apply(g,f)})}));const c={};fi("CSSGroupingRule")?c.CSSGroupingRule=t.CSSGroupingRule:(fi("CSSMediaRule")&&(c.CSSMediaRule=t.CSSMediaRule),fi("CSSConditionRule")&&(c.CSSConditionRule=t.CSSConditionRule),fi("CSSSupportsRule")&&(c.CSSSupportsRule=t.CSSSupportsRule));const b={};return Object.entries(c).forEach(([p,g])=>{b[p]={insertRule:g.prototype.insertRule,deleteRule:g.prototype.deleteRule},g.prototype.insertRule=new Proxy(b[p].insertRule,{apply:q((f,y,C)=>{const[k,S]=C,{id:A,styleId:M}=an(y.parentStyleSheet,e,i.styleMirror);return(A&&A!==-1||M&&M!==-1)&&n({id:A,styleId:M,adds:[{rule:k,index:[...bi(y),S||0]}]}),f.apply(y,C)})}),g.prototype.deleteRule=new Proxy(b[p].deleteRule,{apply:q((f,y,C)=>{const[k]=C,{id:S,styleId:A}=an(y.parentStyleSheet,e,i.styleMirror);return(S&&S!==-1||A&&A!==-1)&&n({id:S,styleId:A,removes:[{index:[...bi(y),k]}]}),f.apply(y,C)})})}),q(()=>{t.CSSStyleSheet.prototype.insertRule=o,t.CSSStyleSheet.prototype.deleteRule=s,r&&(t.CSSStyleSheet.prototype.replace=r),l&&(t.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach(([p,g])=>{g.prototype.insertRule=b[p].insertRule,g.prototype.deleteRule=b[p].deleteRule})})}function so({mirror:n,stylesheetManager:e},i){var t,o,s;let r=null;i.nodeName==="#document"?r=n.getId(i):r=n.getId(i.host);const l=i.nodeName==="#document"?(t=i.defaultView)===null||t===void 0?void 0:t.Document:(s=(o=i.ownerDocument)===null||o===void 0?void 0:o.defaultView)===null||s===void 0?void 0:s.ShadowRoot,c=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return r===null||r===-1||!l||!c?()=>{}:(Object.defineProperty(i,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var b;return(b=c.get)===null||b===void 0?void 0:b.call(this)},set(b){var p;const g=(p=c.set)===null||p===void 0?void 0:p.call(this,b);if(r!==null&&r!==-1)try{e.adoptStyleSheets(b,r)}catch{}return g}}),q(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))}function Ia({styleDeclarationCb:n,mirror:e,ignoreCSSAttributes:i,stylesheetManager:t},{win:o}){const s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:q((l,c,b)=>{var p;const[g,f,y]=b;if(i.has(g))return s.apply(c,[g,f,y]);const{id:C,styleId:k}=an((p=c.parentRule)===null||p===void 0?void 0:p.parentStyleSheet,e,t.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,set:{property:g,value:f,priority:y},index:bi(c.parentRule)}),l.apply(c,b)})});const r=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(r,{apply:q((l,c,b)=>{var p;const[g]=b;if(i.has(g))return r.apply(c,[g]);const{id:f,styleId:y}=an((p=c.parentRule)===null||p===void 0?void 0:p.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||y&&y!==-1)&&n({id:f,styleId:y,remove:{property:g},index:bi(c.parentRule)}),l.apply(c,b)})}),q(()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=r})}function Ba({mediaInteractionCb:n,blockClass:e,blockSelector:i,mirror:t,sampling:o,doc:s}){const r=q(c=>qn(q(b=>{const p=Zn(b);if(!p||_e(p,e,i,!0))return;const{currentTime:g,volume:f,muted:y,playbackRate:C,loop:k}=p;n({type:c,id:t.getId(p),currentTime:g,volume:f,muted:y,playbackRate:C,loop:k})}),o.media||500)),l=[Se("play",r(0),s),Se("pause",r(1),s),Se("seeked",r(2),s),Se("volumechange",r(3),s),Se("ratechange",r(4),s)];return q(()=>{l.forEach(c=>c())})}function Ra({fontCb:n,doc:e}){const i=e.defaultView;if(!i)return()=>{};const t=[],o=new WeakMap,s=i.FontFace;i.FontFace=function(c,b,p){const g=new s(c,b,p);return o.set(g,{family:c,buffer:typeof b!="string",descriptors:p,fontSource:typeof b=="string"?b:JSON.stringify(Array.from(new Uint8Array(b)))}),g};const r=In(e.fonts,"add",function(l){return function(c){return setTimeout(q(()=>{const b=o.get(c);b&&(n(b),o.delete(c))}),0),l.apply(this,[c])}});return t.push(()=>{i.FontFace=s}),t.push(r),q(()=>{t.forEach(l=>l())})}function Da(n){const{doc:e,mirror:i,blockClass:t,blockSelector:o,selectionCb:s}=n;let r=!0;const l=q(()=>{const c=e.getSelection();if(!c||r&&(c!=null&&c.isCollapsed))return;r=c.isCollapsed||!1;const b=[],p=c.rangeCount||0;for(let g=0;g<p;g++){const f=c.getRangeAt(g),{startContainer:y,startOffset:C,endContainer:k,endOffset:S}=f;_e(y,t,o,!0)||_e(k,t,o,!0)||b.push({start:i.getId(y),startOffset:C,end:i.getId(k),endOffset:S})}s({ranges:b})});return l(),Se("selectionchange",l)}function Oa({doc:n,customElementCb:e}){const i=n.defaultView;return!i||!i.customElements?()=>{}:In(i.customElements,"define",function(o){return function(s,r,l){try{e({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return o.apply(this,[s,r,l])}})}function Ha(n,e){const{mutationCb:i,mousemoveCb:t,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:r,inputCb:l,mediaInteractionCb:c,styleSheetRuleCb:b,styleDeclarationCb:p,canvasMutationCb:g,fontCb:f,selectionCb:y,customElementCb:C}=n;n.mutationCb=(...k)=>{e.mutation&&e.mutation(...k),i(...k)},n.mousemoveCb=(...k)=>{e.mousemove&&e.mousemove(...k),t(...k)},n.mouseInteractionCb=(...k)=>{e.mouseInteraction&&e.mouseInteraction(...k),o(...k)},n.scrollCb=(...k)=>{e.scroll&&e.scroll(...k),s(...k)},n.viewportResizeCb=(...k)=>{e.viewportResize&&e.viewportResize(...k),r(...k)},n.inputCb=(...k)=>{e.input&&e.input(...k),l(...k)},n.mediaInteractionCb=(...k)=>{e.mediaInteaction&&e.mediaInteaction(...k),c(...k)},n.styleSheetRuleCb=(...k)=>{e.styleSheetRule&&e.styleSheetRule(...k),b(...k)},n.styleDeclarationCb=(...k)=>{e.styleDeclaration&&e.styleDeclaration(...k),p(...k)},n.canvasMutationCb=(...k)=>{e.canvasMutation&&e.canvasMutation(...k),g(...k)},n.fontCb=(...k)=>{e.font&&e.font(...k),f(...k)},n.selectionCb=(...k)=>{e.selection&&e.selection(...k),y(...k)},n.customElementCb=(...k)=>{e.customElement&&e.customElement(...k),C(...k)}}function Ua(n,e={}){const i=n.doc.defaultView;if(!i)return()=>{};Ha(n,e);let t;n.recordDOM&&(t=io(n,n.doc));const o=xa(n),s=La(n),r=to(n),l=Ta(n,{win:i}),c=Pa(n),b=Ba(n);let p=()=>{},g=()=>{},f=()=>{},y=()=>{};n.recordDOM&&(p=Na(n,{win:i}),g=so(n,n.doc),f=Ia(n,{win:i}),n.collectFonts&&(y=Ra(n)));const C=Da(n),k=Oa(n),S=[];for(const A of n.plugins)S.push(A.observer(A.callback,i,A.options));return q(()=>{yn.forEach(A=>A.reset()),t==null||t.disconnect(),o(),s(),r(),l(),c(),b(),p(),g(),f(),y(),C(),k(),S.forEach(A=>A())})}function vi(n){return typeof window[n]<"u"}function fi(n){return!!(typeof window[n]<"u"&&window[n].prototype&&"insertRule"in window[n].prototype&&"deleteRule"in window[n].prototype)}class ao{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,i,t,o){const s=t||this.getIdToRemoteIdMap(e),r=o||this.getRemoteIdToIdMap(e);let l=s.get(i);return l||(l=this.generateIdFn(),s.set(i,l),r.set(l,i)),l}getIds(e,i){const t=this.getIdToRemoteIdMap(e),o=this.getRemoteIdToIdMap(e);return i.map(s=>this.getId(e,s,t,o))}getRemoteId(e,i,t){const o=t||this.getRemoteIdToIdMap(e);if(typeof i!="number")return i;const s=o.get(i);return s||-1}getRemoteIds(e,i){const t=this.getRemoteIdToIdMap(e);return i.map(o=>this.getRemoteId(e,o,t))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let i=this.iframeIdToRemoteIdMap.get(e);return i||(i=new Map,this.iframeIdToRemoteIdMap.set(e,i)),i}getRemoteIdToIdMap(e){let i=this.iframeRemoteIdToIdMap.get(e);return i||(i=new Map,this.iframeRemoteIdToIdMap.set(e,i)),i}}class Ka{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new ao(Rt),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ao(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,i){var t;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:i}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(t=this.loadListener)===null||t===void 0||t.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 i=e;if(i.data.type!=="rrweb"||i.origin!==i.data.origin||!e.source)return;const o=this.crossOriginIframeMap.get(e.source);if(!o)return;const s=this.transformCrossOriginEvent(o,i.data.event);s&&this.wrappedEmit(s,i.data.isCheckout)}transformCrossOriginEvent(e,i){var t;switch(i.type){case W.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(i.data.node,e);const o=i.data.node.id;return this.crossOriginIframeRootIdMap.set(e,o),this.patchRootIdOnNode(i.data.node,o),{timestamp:i.timestamp,type:W.IncrementalSnapshot,data:{source:z.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:i.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case W.Meta:case W.Load:case W.DomContentLoaded:return!1;case W.Plugin:return i;case W.Custom:return this.replaceIds(i.data.payload,e,["id","parentId","previousId","nextId"]),i;case W.IncrementalSnapshot:switch(i.data.source){case z.Mutation:return i.data.adds.forEach(o=>{this.replaceIds(o,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,e);const s=this.crossOriginIframeRootIdMap.get(e);s&&this.patchRootIdOnNode(o.node,s)}),i.data.removes.forEach(o=>{this.replaceIds(o,e,["parentId","id"])}),i.data.attributes.forEach(o=>{this.replaceIds(o,e,["id"])}),i.data.texts.forEach(o=>{this.replaceIds(o,e,["id"])}),i;case z.Drag:case z.TouchMove:case z.MouseMove:return i.data.positions.forEach(o=>{this.replaceIds(o,e,["id"])}),i;case z.ViewportResize:return!1;case z.MediaInteraction:case z.MouseInteraction:case z.Scroll:case z.CanvasMutation:case z.Input:return this.replaceIds(i.data,e,["id"]),i;case z.StyleSheetRule:case z.StyleDeclaration:return this.replaceIds(i.data,e,["id"]),this.replaceStyleIds(i.data,e,["styleId"]),i;case z.Font:return i;case z.Selection:return i.data.ranges.forEach(o=>{this.replaceIds(o,e,["start","end"])}),i;case z.AdoptedStyleSheet:return this.replaceIds(i.data,e,["id"]),this.replaceStyleIds(i.data,e,["styleIds"]),(t=i.data.styles)===null||t===void 0||t.forEach(o=>{this.replaceStyleIds(o,e,["styleId"])}),i}}return!1}replace(e,i,t,o){for(const s of o)!Array.isArray(i[s])&&typeof i[s]!="number"||(Array.isArray(i[s])?i[s]=e.getIds(t,i[s]):i[s]=e.getId(t,i[s]));return i}replaceIds(e,i,t){return this.replace(this.crossOriginIframeMirror,e,i,t)}replaceStyleIds(e,i,t){return this.replace(this.crossOriginIframeStyleMirror,e,i,t)}replaceIdOnNode(e,i){this.replaceIds(e,i,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(t=>{this.replaceIdOnNode(t,i)})}patchRootIdOnNode(e,i){e.type!==le.Document&&!e.rootId&&(e.rootId=i),"childNodes"in e&&e.childNodes.forEach(t=>{this.patchRootIdOnNode(t,i)})}}class ja{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,i){if(!Fn(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const t=io(Object.assign(Object.assign({},this.bypassOptions),{doc:i,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>t.disconnect()),this.restoreHandlers.push(to(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(so({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,i){const t=this;this.restoreHandlers.push(In(e.prototype,"attachShadow",function(o){return function(s){const r=o.call(this,s);return this.shadowRoot&&Jt(this)&&t.addShadowRoot(this.shadowRoot,i),r}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
680
+ or you can use record.mirror to access the mirror instance during recording.`;let jt={map:{},getId(){return console.error(Nn),-1},getNode(){return console.error(Nn),null},removeNodeFromMap(){console.error(Nn)},has(){return console.error(Nn),!1},reset(){console.error(Nn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(jt=new Proxy(jt,{get(n,e,i){return e==="map"&&console.error(Nn),Reflect.get(n,e,i)}}));function qn(n,e,i={}){let t=null,o=0;return function(...s){const r=Date.now();!o&&i.leading===!1&&(o=r);const l=e-(r-o),c=this;l<=0||l>e?(t&&(clearTimeout(t),t=null),o=r,n.apply(c,s)):!t&&i.trailing!==!1&&(t=setTimeout(()=>{o=i.leading===!1?0:Date.now(),t=null,n.apply(c,s)},l))}}function hi(n,e,i,t,o=window){const s=o.Object.getOwnPropertyDescriptor(n,e);return o.Object.defineProperty(n,e,t?i:{set(r){setTimeout(()=>{i.set.call(this,r)},0),s&&s.set&&s.set.call(this,r)}}),()=>hi(n,e,s||{},!0)}function In(n,e,i){try{if(!(e in n))return()=>{};const t=n[e],o=i(t);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:t}})),n[e]=o,()=>{n[e]=t}}catch{return()=>{}}}let pi=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(pi=()=>new Date().getTime());function Gt(n){var e,i,t,o,s,r;const l=n.document;return{left:l.scrollingElement?l.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:(l==null?void 0:l.documentElement.scrollLeft)||((i=(e=l==null?void 0:l.body)===null||e===void 0?void 0:e.parentElement)===null||i===void 0?void 0:i.scrollLeft)||((t=l==null?void 0:l.body)===null||t===void 0?void 0:t.scrollLeft)||0,top:l.scrollingElement?l.scrollingElement.scrollTop:n.pageYOffset!==void 0?n.pageYOffset:(l==null?void 0:l.documentElement.scrollTop)||((s=(o=l==null?void 0:l.body)===null||o===void 0?void 0:o.parentElement)===null||s===void 0?void 0:s.scrollTop)||((r=l==null?void 0:l.body)===null||r===void 0?void 0:r.scrollTop)||0}}function Vt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ft(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function zt(n){return n?n.nodeType===n.ELEMENT_NODE?n:n.parentElement:null}function _e(n,e,i,t){if(!n)return!1;const o=zt(n);if(!o)return!1;try{if(typeof e=="string"){if(o.classList.contains(e)||t&&o.closest("."+e)!==null)return!0}else if(mi(o,e,t))return!0}catch{}return!!(i&&(o.matches(i)||t&&o.closest(i)!==null))}function ga(n,e){return e.getId(n)!==-1}function Gi(n,e){return e.getId(n)===zn}function qt(n,e){if(Vn(n))return!1;const i=e.getId(n);return e.has(i)?n.parentNode&&n.parentNode.nodeType===n.DOCUMENT_NODE?!1:n.parentNode?qt(n.parentNode,e):!0:!0}function Vi(n){return!!n.changedTouches}function ya(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 i=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===i)return!0;while(i=i&&i.parentNode);return!1})}function Wt(n,e){return!!(n.nodeName==="IFRAME"&&e.getMeta(n))}function Zt(n,e){return!!(n.nodeName==="LINK"&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute&&n.getAttribute("rel")==="stylesheet"&&e.getMeta(n))}function Fi(n){return!!(n!=null&&n.shadowRoot)}class ka{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var i;return(i=this.styleIDMap.get(e))!==null&&i!==void 0?i:-1}has(e){return this.styleIDMap.has(e)}add(e,i){if(this.has(e))return this.getId(e);let t;return i===void 0?t=this.id++:t=i,this.styleIDMap.set(e,t),this.idStyleMap.set(t,e),t}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 Jt(n){var e,i;let t=null;return((i=(e=n.getRootNode)===null||e===void 0?void 0:e.call(n))===null||i===void 0?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&n.getRootNode().host&&(t=n.getRootNode().host),t}function wa(n){let e=n,i;for(;i=Jt(e);)e=i;return e}function Ca(n){const e=n.ownerDocument;if(!e)return!1;const i=wa(n);return e.contains(i)}function $t(n){const e=n.ownerDocument;return e?e.contains(n)||Ca(n):!1}var W=(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))(W||{}),z=(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))(z||{}),Le=(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))(Le||{}),Ze=(n=>(n[n.Mouse=0]="Mouse",n[n.Pen=1]="Pen",n[n.Touch=2]="Touch",n))(Ze||{}),Bn=(n=>(n[n["2D"]=0]="2D",n[n.WebGL=1]="WebGL",n[n.WebGL2=2]="WebGL2",n))(Bn||{});function Yt(n){return"__ln"in n}class Sa{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 i=this.head;for(let t=0;t<e;t++)i=(i==null?void 0:i.next)||null;return i}addNode(e){const i={value:e,previous:null,next:null};if(e.__ln=i,e.previousSibling&&Yt(e.previousSibling)){const t=e.previousSibling.__ln.next;i.next=t,i.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=i,t&&(t.previous=i)}else if(e.nextSibling&&Yt(e.nextSibling)&&e.nextSibling.__ln.previous){const t=e.nextSibling.__ln.previous;i.previous=t,i.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=i,t&&(t.next=i)}else this.head&&(this.head.previous=i),i.next=this.head,this.head=i;i.next===null&&(this.tail=i),this.length++}removeNode(e){const i=e.__ln;this.head&&(i.previous?(i.previous.next=i.next,i.next?i.next.previous=i.previous:this.tail=i.previous):(this.head=i.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Qt=(n,e)=>`${n}@${e}`;class _a{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=[],i=new Set,t=new Sa,o=c=>{let b=c,p=zn;for(;p===zn;)b=b&&b.nextSibling,p=b&&this.mirror.getId(b);return p},s=c=>{if(!c.parentNode||!$t(c)||c.parentNode.tagName==="TEXTAREA")return;const b=Vn(c.parentNode)?this.mirror.getId(Jt(c)):this.mirror.getId(c.parentNode),p=o(c);if(b===-1||p===-1)return t.addNode(c);const g=Pn(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=>{Wt(f,this.mirror)&&this.iframeManager.addIframe(f),Zt(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Fi(c)&&this.shadowDomManager.addShadowRoot(c.shadowRoot,this.doc)},onIframeLoad:(f,y)=>{this.iframeManager.attachIframe(f,y),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,y)=>{this.stylesheetManager.attachLinkElement(f,y)}});g&&(e.push({parentId:b,nextId:p,node:g}),i.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const c of this.movedSet)Xt(this.removes,c,this.mirror)&&!this.movedSet.has(c.parentNode)||s(c);for(const c of this.addedSet)!no(this.droppedSet,c)&&!Xt(this.removes,c,this.mirror)||no(this.movedSet,c)?s(c):this.droppedSet.add(c);let r=null;for(;t.length;){let c=null;if(r){const b=this.mirror.getId(r.value.parentNode),p=o(r.value);b!==-1&&p!==-1&&(c=r)}if(!c){let b=t.tail;for(;b;){const p=b;if(b=b.previous,p){const g=this.mirror.getId(p.value.parentNode);if(o(p.value)===-1)continue;if(g!==-1){c=p;break}else{const y=p.value;if(y.parentNode&&y.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const C=y.parentNode.host;if(this.mirror.getId(C)!==-1){c=p;break}}}}}}if(!c){for(;t.head;)t.removeNode(t.head.value);break}r=c.previous,t.removeNode(c.value),s(c.value)}const l={texts:this.texts.map(c=>{const b=c.node;return b.parentNode&&b.parentNode.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(b.parentNode),{id:this.mirror.getId(b),value:c.value}}).filter(c=>!i.has(c.id)).filter(c=>this.mirror.has(c.id)),attributes:this.attributes.map(c=>{const{attributes:b}=c;if(typeof b.style=="string"){const p=JSON.stringify(c.styleDiff),g=JSON.stringify(c._unchangedStyles);p.length<b.style.length&&(p+g).split("var(").length===b.style.split("var(").length&&(b.style=c.styleDiff)}return{id:this.mirror.getId(c.node),attributes:b}}).filter(c=>!i.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 i=this.attributeMap.get(e);i||(i={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e,i)),i.attributes.value=Array.from(e.childNodes,t=>t.textContent||"").join("")},this.processMutation=e=>{if(!Gi(e.target,this.mirror))switch(e.type){case"characterData":{const i=e.target.textContent;!_e(e.target,this.blockClass,this.blockSelector,!1)&&i!==e.oldValue&&this.texts.push({value:Kt(e.target,this.maskTextClass,this.maskTextSelector,!0)&&i?this.maskTextFn?this.maskTextFn(i,zt(e.target)):i.replace(/[\S]/g,"*"):i,node:e.target});break}case"attributes":{const i=e.target;let t=e.attributeName,o=e.target.getAttribute(t);if(t==="value"){const r=Ki(i);o=Ui({element:i,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:r,value:o,maskInputFn:this.maskInputFn})}if(_e(e.target,this.blockClass,this.blockSelector,!1)||o===e.oldValue)return;let s=this.attributeMap.get(e.target);if(i.tagName==="IFRAME"&&t==="src"&&!this.keepIframeSrcFn(o))if(!i.contentDocument)t="rr_src";else return;if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(e.target,s)),t==="type"&&i.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&i.setAttribute("data-rr-is-password","true"),!Ut(i.tagName,t)&&(s.attributes[t]=Ht(this.doc,gn(i.tagName),gn(t),o),t==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const r=this.unattachedDoc.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const l of Array.from(i.style)){const c=i.style.getPropertyValue(l),b=i.style.getPropertyPriority(l);c!==r.style.getPropertyValue(l)||b!==r.style.getPropertyPriority(l)?b===""?s.styleDiff[l]=c:s.styleDiff[l]=[c,b]:s._unchangedStyles[l]=[c,b]}for(const l of Array.from(r.style))i.style.getPropertyValue(l)===""&&(s.styleDiff[l]=!1)}break}case"childList":{if(_e(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(i=>this.genAdds(i,e.target)),e.removedNodes.forEach(i=>{const t=this.mirror.getId(i),o=Vn(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);_e(e.target,this.blockClass,this.blockSelector,!1)||Gi(i,this.mirror)||!ga(i,this.mirror)||(this.addedSet.has(i)?(zi(this.addedSet,i),this.droppedSet.add(i)):this.addedSet.has(e.target)&&t===-1||qt(e.target,this.mirror)||(this.movedSet.has(i)&&this.movedMap[Qt(t,o)]?zi(this.movedSet,i):this.removes.push({parentId:o,id:t,isShadow:Vn(e.target)&&Fn(e.target)?!0:void 0})),this.mapRemoves.push(i))});break}}},this.genAdds=(e,i)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Gi(e,this.mirror))return;this.movedSet.add(e);let t=null;i&&this.mirror.hasNode(i)&&(t=this.mirror.getId(i)),t&&t!==-1&&(this.movedMap[Qt(this.mirror.getId(e),t)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);_e(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach(t=>this.genAdds(t)),Fi(e)&&e.shadowRoot.childNodes.forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,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(i=>{this[i]=e[i]})}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 zi(n,e){n.delete(e),e.childNodes.forEach(i=>zi(n,i))}function Xt(n,e,i){return n.length===0?!1:eo(n,e,i)}function eo(n,e,i){const{parentNode:t}=e;if(!t)return!1;const o=i.getId(t);return n.some(s=>s.id===o)?!0:eo(n,t,i)}function no(n,e){return n.size===0?!1:io(n,e)}function io(n,e){const{parentNode:i}=e;return i?n.has(i)?!0:io(n,i):!1}let Wn;function Aa(n){Wn=n}function Ma(){Wn=void 0}const q=n=>Wn?(...i)=>{try{return n(...i)}catch(t){if(Wn&&Wn(t)===!0)return;throw t}}:n,yn=[];function Zn(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 to(n,e){var i,t;const o=new _a;yn.push(o),o.init(n);let s=window.MutationObserver||window.__rrMutationObserver;const r=(t=(i=window==null?void 0:window.Zone)===null||i===void 0?void 0:i.__symbol__)===null||t===void 0?void 0:t.call(i,"MutationObserver");r&&window[r]&&(s=window[r]);const l=new s(q(o.processMutations.bind(o)));return l.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),l}function xa({mousemoveCb:n,sampling:e,doc:i,mirror:t}){if(e.mousemove===!1)return()=>{};const o=typeof e.mousemove=="number"?e.mousemove:50,s=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let r=[],l;const c=qn(q(g=>{const f=Date.now()-l;n(r.map(y=>(y.timeOffset-=f,y)),g),r=[],l=null}),s),b=q(qn(q(g=>{const f=Zn(g),{clientX:y,clientY:C}=Vi(g)?g.changedTouches[0]:g;l||(l=pi()),r.push({x:y,y:C,id:t.getId(f),timeOffset:pi()-l}),c(typeof DragEvent<"u"&&g instanceof DragEvent?z.Drag:g instanceof MouseEvent?z.MouseMove:z.TouchMove)}),o,{trailing:!1})),p=[Se("mousemove",b,i),Se("touchmove",b,i),Se("drag",b,i)];return q(()=>{p.forEach(g=>g())})}function La({mouseInteractionCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};const r=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,l=[];let c=null;const b=p=>g=>{const f=Zn(g);if(_e(f,t,o,!0))return;let y=null,C=p;if("pointerType"in g){switch(g.pointerType){case"mouse":y=Ze.Mouse;break;case"touch":y=Ze.Touch;break;case"pen":y=Ze.Pen;break}y===Ze.Touch?Le[p]===Le.MouseDown?C="TouchStart":Le[p]===Le.MouseUp&&(C="TouchEnd"):Ze.Pen}else Vi(g)&&(y=Ze.Touch);y!==null?(c=y,(C.startsWith("Touch")&&y===Ze.Touch||C.startsWith("Mouse")&&y===Ze.Mouse)&&(y=null)):Le[p]===Le.Click&&(y=c,c=null);const k=Vi(g)?g.changedTouches[0]:g;if(!k)return;const S=i.getId(f),{clientX:A,clientY:M}=k;q(n)(Object.assign({type:Le[C],id:S,x:A,y:M},y!==null&&{pointerType:y}))};return Object.keys(Le).filter(p=>Number.isNaN(Number(p))&&!p.endsWith("_Departed")&&r[p]!==!1).forEach(p=>{let g=gn(p);const f=b(p);if(window.PointerEvent)switch(Le[p]){case Le.MouseDown:case Le.MouseUp:g=g.replace("mouse","pointer");break;case Le.TouchStart:case Le.TouchEnd:return}l.push(Se(g,f,e))}),q(()=>{l.forEach(p=>p())})}function oo({scrollCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){const r=q(qn(q(l=>{const c=Zn(l);if(!c||_e(c,t,o,!0))return;const b=i.getId(c);if(c===e&&e.defaultView){const p=Gt(e.defaultView);n({id:b,x:p.left,y:p.top})}else n({id:b,x:c.scrollLeft,y:c.scrollTop})}),s.scroll||100));return Se("scroll",r,e)}function Ta({viewportResizeCb:n},{win:e}){let i=-1,t=-1;const o=q(qn(q(()=>{const s=Vt(),r=Ft();(i!==s||t!==r)&&(n({width:Number(r),height:Number(s)}),i=s,t=r)}),200));return Se("resize",o,e)}const Ea=["INPUT","TEXTAREA","SELECT"],so=new WeakMap;function Pa({inputCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,ignoreClass:s,ignoreSelector:r,maskInputOptions:l,maskInputFn:c,sampling:b,userTriggeredOnInput:p}){function g(M){let _=Zn(M);const E=M.isTrusted,N=_&&_.tagName;if(_&&N==="OPTION"&&(_=_.parentElement),!_||!N||Ea.indexOf(N)<0||_e(_,t,o,!0)||_.classList.contains(s)||r&&_.matches(r))return;let V=_.value,F=!1;const U=Ki(_)||"";U==="radio"||U==="checkbox"?F=_.checked:(l[N.toLowerCase()]||l[U])&&(V=Ui({element:_,maskInputOptions:l,tagName:N,type:U,value:V,maskInputFn:c})),f(_,p?{text:V,isChecked:F,userTriggered:E}:{text:V,isChecked:F});const G=_.name;U==="radio"&&G&&F&&e.querySelectorAll(`input[type="radio"][name="${G}"]`).forEach(oe=>{if(oe!==_){const fe=oe.value;f(oe,p?{text:fe,isChecked:!F,userTriggered:!1}:{text:fe,isChecked:!F})}})}function f(M,_){const E=so.get(M);if(!E||E.text!==_.text||E.isChecked!==_.isChecked){so.set(M,_);const N=i.getId(M);q(n)(Object.assign(Object.assign({},_),{id:N}))}}const C=(b.input==="last"?["change"]:["input","change"]).map(M=>Se(M,q(g),e)),k=e.defaultView;if(!k)return()=>{C.forEach(M=>M())};const S=k.Object.getOwnPropertyDescriptor(k.HTMLInputElement.prototype,"value"),A=[[k.HTMLInputElement.prototype,"value"],[k.HTMLInputElement.prototype,"checked"],[k.HTMLSelectElement.prototype,"value"],[k.HTMLTextAreaElement.prototype,"value"],[k.HTMLSelectElement.prototype,"selectedIndex"],[k.HTMLOptionElement.prototype,"selected"]];return S&&S.set&&C.push(...A.map(M=>hi(M[0],M[1],{set(){q(g)({target:this,isTrusted:!1})}},!1,k))),q(()=>{C.forEach(M=>M())})}function bi(n){const e=[];function i(t,o){if(vi("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||vi("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||vi("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||vi("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const r=Array.from(t.parentRule.cssRules).indexOf(t);o.unshift(r)}else if(t.parentStyleSheet){const r=Array.from(t.parentStyleSheet.cssRules).indexOf(t);o.unshift(r)}return o}return i(n,e)}function an(n,e,i){let t,o;return n?(n.ownerNode?t=e.getId(n.ownerNode):o=i.getId(n),{styleId:o,id:t}):{}}function Na({styleSheetRuleCb:n,mirror:e,stylesheetManager:i},{win:t}){if(!t.CSSStyleSheet||!t.CSSStyleSheet.prototype)return()=>{};const o=t.CSSStyleSheet.prototype.insertRule;t.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:q((p,g,f)=>{const[y,C]=f,{id:k,styleId:S}=an(g,e,i.styleMirror);return(k&&k!==-1||S&&S!==-1)&&n({id:k,styleId:S,adds:[{rule:y,index:C}]}),p.apply(g,f)})});const s=t.CSSStyleSheet.prototype.deleteRule;t.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:q((p,g,f)=>{const[y]=f,{id:C,styleId:k}=an(g,e,i.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,removes:[{index:y}]}),p.apply(g,f)})});let r;t.CSSStyleSheet.prototype.replace&&(r=t.CSSStyleSheet.prototype.replace,t.CSSStyleSheet.prototype.replace=new Proxy(r,{apply:q((p,g,f)=>{const[y]=f,{id:C,styleId:k}=an(g,e,i.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,replace:y}),p.apply(g,f)})}));let l;t.CSSStyleSheet.prototype.replaceSync&&(l=t.CSSStyleSheet.prototype.replaceSync,t.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:q((p,g,f)=>{const[y]=f,{id:C,styleId:k}=an(g,e,i.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,replaceSync:y}),p.apply(g,f)})}));const c={};fi("CSSGroupingRule")?c.CSSGroupingRule=t.CSSGroupingRule:(fi("CSSMediaRule")&&(c.CSSMediaRule=t.CSSMediaRule),fi("CSSConditionRule")&&(c.CSSConditionRule=t.CSSConditionRule),fi("CSSSupportsRule")&&(c.CSSSupportsRule=t.CSSSupportsRule));const b={};return Object.entries(c).forEach(([p,g])=>{b[p]={insertRule:g.prototype.insertRule,deleteRule:g.prototype.deleteRule},g.prototype.insertRule=new Proxy(b[p].insertRule,{apply:q((f,y,C)=>{const[k,S]=C,{id:A,styleId:M}=an(y.parentStyleSheet,e,i.styleMirror);return(A&&A!==-1||M&&M!==-1)&&n({id:A,styleId:M,adds:[{rule:k,index:[...bi(y),S||0]}]}),f.apply(y,C)})}),g.prototype.deleteRule=new Proxy(b[p].deleteRule,{apply:q((f,y,C)=>{const[k]=C,{id:S,styleId:A}=an(y.parentStyleSheet,e,i.styleMirror);return(S&&S!==-1||A&&A!==-1)&&n({id:S,styleId:A,removes:[{index:[...bi(y),k]}]}),f.apply(y,C)})})}),q(()=>{t.CSSStyleSheet.prototype.insertRule=o,t.CSSStyleSheet.prototype.deleteRule=s,r&&(t.CSSStyleSheet.prototype.replace=r),l&&(t.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach(([p,g])=>{g.prototype.insertRule=b[p].insertRule,g.prototype.deleteRule=b[p].deleteRule})})}function ao({mirror:n,stylesheetManager:e},i){var t,o,s;let r=null;i.nodeName==="#document"?r=n.getId(i):r=n.getId(i.host);const l=i.nodeName==="#document"?(t=i.defaultView)===null||t===void 0?void 0:t.Document:(s=(o=i.ownerDocument)===null||o===void 0?void 0:o.defaultView)===null||s===void 0?void 0:s.ShadowRoot,c=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return r===null||r===-1||!l||!c?()=>{}:(Object.defineProperty(i,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var b;return(b=c.get)===null||b===void 0?void 0:b.call(this)},set(b){var p;const g=(p=c.set)===null||p===void 0?void 0:p.call(this,b);if(r!==null&&r!==-1)try{e.adoptStyleSheets(b,r)}catch{}return g}}),q(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))}function Ia({styleDeclarationCb:n,mirror:e,ignoreCSSAttributes:i,stylesheetManager:t},{win:o}){const s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:q((l,c,b)=>{var p;const[g,f,y]=b;if(i.has(g))return s.apply(c,[g,f,y]);const{id:C,styleId:k}=an((p=c.parentRule)===null||p===void 0?void 0:p.parentStyleSheet,e,t.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,set:{property:g,value:f,priority:y},index:bi(c.parentRule)}),l.apply(c,b)})});const r=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(r,{apply:q((l,c,b)=>{var p;const[g]=b;if(i.has(g))return r.apply(c,[g]);const{id:f,styleId:y}=an((p=c.parentRule)===null||p===void 0?void 0:p.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||y&&y!==-1)&&n({id:f,styleId:y,remove:{property:g},index:bi(c.parentRule)}),l.apply(c,b)})}),q(()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=r})}function Ba({mediaInteractionCb:n,blockClass:e,blockSelector:i,mirror:t,sampling:o,doc:s}){const r=q(c=>qn(q(b=>{const p=Zn(b);if(!p||_e(p,e,i,!0))return;const{currentTime:g,volume:f,muted:y,playbackRate:C,loop:k}=p;n({type:c,id:t.getId(p),currentTime:g,volume:f,muted:y,playbackRate:C,loop:k})}),o.media||500)),l=[Se("play",r(0),s),Se("pause",r(1),s),Se("seeked",r(2),s),Se("volumechange",r(3),s),Se("ratechange",r(4),s)];return q(()=>{l.forEach(c=>c())})}function Ra({fontCb:n,doc:e}){const i=e.defaultView;if(!i)return()=>{};const t=[],o=new WeakMap,s=i.FontFace;i.FontFace=function(c,b,p){const g=new s(c,b,p);return o.set(g,{family:c,buffer:typeof b!="string",descriptors:p,fontSource:typeof b=="string"?b:JSON.stringify(Array.from(new Uint8Array(b)))}),g};const r=In(e.fonts,"add",function(l){return function(c){return setTimeout(q(()=>{const b=o.get(c);b&&(n(b),o.delete(c))}),0),l.apply(this,[c])}});return t.push(()=>{i.FontFace=s}),t.push(r),q(()=>{t.forEach(l=>l())})}function Da(n){const{doc:e,mirror:i,blockClass:t,blockSelector:o,selectionCb:s}=n;let r=!0;const l=q(()=>{const c=e.getSelection();if(!c||r&&(c!=null&&c.isCollapsed))return;r=c.isCollapsed||!1;const b=[],p=c.rangeCount||0;for(let g=0;g<p;g++){const f=c.getRangeAt(g),{startContainer:y,startOffset:C,endContainer:k,endOffset:S}=f;_e(y,t,o,!0)||_e(k,t,o,!0)||b.push({start:i.getId(y),startOffset:C,end:i.getId(k),endOffset:S})}s({ranges:b})});return l(),Se("selectionchange",l)}function Oa({doc:n,customElementCb:e}){const i=n.defaultView;return!i||!i.customElements?()=>{}:In(i.customElements,"define",function(o){return function(s,r,l){try{e({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return o.apply(this,[s,r,l])}})}function Ha(n,e){const{mutationCb:i,mousemoveCb:t,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:r,inputCb:l,mediaInteractionCb:c,styleSheetRuleCb:b,styleDeclarationCb:p,canvasMutationCb:g,fontCb:f,selectionCb:y,customElementCb:C}=n;n.mutationCb=(...k)=>{e.mutation&&e.mutation(...k),i(...k)},n.mousemoveCb=(...k)=>{e.mousemove&&e.mousemove(...k),t(...k)},n.mouseInteractionCb=(...k)=>{e.mouseInteraction&&e.mouseInteraction(...k),o(...k)},n.scrollCb=(...k)=>{e.scroll&&e.scroll(...k),s(...k)},n.viewportResizeCb=(...k)=>{e.viewportResize&&e.viewportResize(...k),r(...k)},n.inputCb=(...k)=>{e.input&&e.input(...k),l(...k)},n.mediaInteractionCb=(...k)=>{e.mediaInteaction&&e.mediaInteaction(...k),c(...k)},n.styleSheetRuleCb=(...k)=>{e.styleSheetRule&&e.styleSheetRule(...k),b(...k)},n.styleDeclarationCb=(...k)=>{e.styleDeclaration&&e.styleDeclaration(...k),p(...k)},n.canvasMutationCb=(...k)=>{e.canvasMutation&&e.canvasMutation(...k),g(...k)},n.fontCb=(...k)=>{e.font&&e.font(...k),f(...k)},n.selectionCb=(...k)=>{e.selection&&e.selection(...k),y(...k)},n.customElementCb=(...k)=>{e.customElement&&e.customElement(...k),C(...k)}}function Ua(n,e={}){const i=n.doc.defaultView;if(!i)return()=>{};Ha(n,e);let t;n.recordDOM&&(t=to(n,n.doc));const o=xa(n),s=La(n),r=oo(n),l=Ta(n,{win:i}),c=Pa(n),b=Ba(n);let p=()=>{},g=()=>{},f=()=>{},y=()=>{};n.recordDOM&&(p=Na(n,{win:i}),g=ao(n,n.doc),f=Ia(n,{win:i}),n.collectFonts&&(y=Ra(n)));const C=Da(n),k=Oa(n),S=[];for(const A of n.plugins)S.push(A.observer(A.callback,i,A.options));return q(()=>{yn.forEach(A=>A.reset()),t==null||t.disconnect(),o(),s(),r(),l(),c(),b(),p(),g(),f(),y(),C(),k(),S.forEach(A=>A())})}function vi(n){return typeof window[n]<"u"}function fi(n){return!!(typeof window[n]<"u"&&window[n].prototype&&"insertRule"in window[n].prototype&&"deleteRule"in window[n].prototype)}class ro{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,i,t,o){const s=t||this.getIdToRemoteIdMap(e),r=o||this.getRemoteIdToIdMap(e);let l=s.get(i);return l||(l=this.generateIdFn(),s.set(i,l),r.set(l,i)),l}getIds(e,i){const t=this.getIdToRemoteIdMap(e),o=this.getRemoteIdToIdMap(e);return i.map(s=>this.getId(e,s,t,o))}getRemoteId(e,i,t){const o=t||this.getRemoteIdToIdMap(e);if(typeof i!="number")return i;const s=o.get(i);return s||-1}getRemoteIds(e,i){const t=this.getRemoteIdToIdMap(e);return i.map(o=>this.getRemoteId(e,o,t))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let i=this.iframeIdToRemoteIdMap.get(e);return i||(i=new Map,this.iframeIdToRemoteIdMap.set(e,i)),i}getRemoteIdToIdMap(e){let i=this.iframeRemoteIdToIdMap.get(e);return i||(i=new Map,this.iframeRemoteIdToIdMap.set(e,i)),i}}class Ka{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new ro(Dt),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ro(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,i){var t;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:i}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(t=this.loadListener)===null||t===void 0||t.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 i=e;if(i.data.type!=="rrweb"||i.origin!==i.data.origin||!e.source)return;const o=this.crossOriginIframeMap.get(e.source);if(!o)return;const s=this.transformCrossOriginEvent(o,i.data.event);s&&this.wrappedEmit(s,i.data.isCheckout)}transformCrossOriginEvent(e,i){var t;switch(i.type){case W.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(i.data.node,e);const o=i.data.node.id;return this.crossOriginIframeRootIdMap.set(e,o),this.patchRootIdOnNode(i.data.node,o),{timestamp:i.timestamp,type:W.IncrementalSnapshot,data:{source:z.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:i.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case W.Meta:case W.Load:case W.DomContentLoaded:return!1;case W.Plugin:return i;case W.Custom:return this.replaceIds(i.data.payload,e,["id","parentId","previousId","nextId"]),i;case W.IncrementalSnapshot:switch(i.data.source){case z.Mutation:return i.data.adds.forEach(o=>{this.replaceIds(o,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,e);const s=this.crossOriginIframeRootIdMap.get(e);s&&this.patchRootIdOnNode(o.node,s)}),i.data.removes.forEach(o=>{this.replaceIds(o,e,["parentId","id"])}),i.data.attributes.forEach(o=>{this.replaceIds(o,e,["id"])}),i.data.texts.forEach(o=>{this.replaceIds(o,e,["id"])}),i;case z.Drag:case z.TouchMove:case z.MouseMove:return i.data.positions.forEach(o=>{this.replaceIds(o,e,["id"])}),i;case z.ViewportResize:return!1;case z.MediaInteraction:case z.MouseInteraction:case z.Scroll:case z.CanvasMutation:case z.Input:return this.replaceIds(i.data,e,["id"]),i;case z.StyleSheetRule:case z.StyleDeclaration:return this.replaceIds(i.data,e,["id"]),this.replaceStyleIds(i.data,e,["styleId"]),i;case z.Font:return i;case z.Selection:return i.data.ranges.forEach(o=>{this.replaceIds(o,e,["start","end"])}),i;case z.AdoptedStyleSheet:return this.replaceIds(i.data,e,["id"]),this.replaceStyleIds(i.data,e,["styleIds"]),(t=i.data.styles)===null||t===void 0||t.forEach(o=>{this.replaceStyleIds(o,e,["styleId"])}),i}}return!1}replace(e,i,t,o){for(const s of o)!Array.isArray(i[s])&&typeof i[s]!="number"||(Array.isArray(i[s])?i[s]=e.getIds(t,i[s]):i[s]=e.getId(t,i[s]));return i}replaceIds(e,i,t){return this.replace(this.crossOriginIframeMirror,e,i,t)}replaceStyleIds(e,i,t){return this.replace(this.crossOriginIframeStyleMirror,e,i,t)}replaceIdOnNode(e,i){this.replaceIds(e,i,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(t=>{this.replaceIdOnNode(t,i)})}patchRootIdOnNode(e,i){e.type!==le.Document&&!e.rootId&&(e.rootId=i),"childNodes"in e&&e.childNodes.forEach(t=>{this.patchRootIdOnNode(t,i)})}}class ja{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,i){if(!Fn(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const t=to(Object.assign(Object.assign({},this.bypassOptions),{doc:i,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>t.disconnect()),this.restoreHandlers.push(oo(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(ao({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,i){const t=this;this.restoreHandlers.push(In(e.prototype,"attachShadow",function(o){return function(s){const r=o.call(this,s);return this.shadowRoot&&$t(this)&&t.addShadowRoot(this.shadowRoot,i),r}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
681
681
  Copyright (c) Microsoft Corporation.
682
682
 
683
683
  Permission to use, copy, modify, and/or distribute this software for any
@@ -690,7 +690,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
690
690
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
691
691
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
692
692
  PERFORMANCE OF THIS SOFTWARE.
693
- ***************************************************************************** */function Ga(n,e){var i={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e.indexOf(t)<0&&(i[t]=n[t]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,t=Object.getOwnPropertySymbols(n);o<t.length;o++)e.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(n,t[o])&&(i[t[o]]=n[t[o]]);return i}function Va(n,e,i,t){function o(s){return s instanceof i?s:new i(function(r){r(s)})}return new(i||(i=Promise))(function(s,r){function l(p){try{b(t.next(p))}catch(g){r(g)}}function c(p){try{b(t.throw(p))}catch(g){r(g)}}function b(p){p.done?s(p.value):o(p.value).then(l,c)}b((t=t.apply(n,[])).next())})}for(var Rn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fa=typeof Uint8Array>"u"?[]:new Uint8Array(256),gi=0;gi<Rn.length;gi++)Fa[Rn.charCodeAt(gi)]=gi;var za=function(n){var e=new Uint8Array(n),i,t=e.length,o="";for(i=0;i<t;i+=3)o+=Rn[e[i]>>2],o+=Rn[(e[i]&3)<<4|e[i+1]>>4],o+=Rn[(e[i+1]&15)<<2|e[i+2]>>6],o+=Rn[e[i+2]&63];return t%3===2?o=o.substring(0,o.length-1)+"=":t%3===1&&(o=o.substring(0,o.length-2)+"=="),o};const ro=new Map;function qa(n,e){let i=ro.get(n);return i||(i=new Map,ro.set(n,i)),i.has(e)||i.set(e,[]),i.get(e)}const lo=(n,e,i)=>{if(!n||!(uo(n,e)||typeof n=="object"))return;const t=n.constructor.name,o=qa(i,t);let s=o.indexOf(n);return s===-1&&(s=o.length,o.push(n)),s};function yi(n,e,i){if(n instanceof Array)return n.map(t=>yi(t,e,i));if(n===null)return n;if(n instanceof Float32Array||n instanceof Float64Array||n instanceof Int32Array||n instanceof Uint32Array||n instanceof Uint8Array||n instanceof Uint16Array||n instanceof Int16Array||n instanceof Int8Array||n instanceof Uint8ClampedArray)return{rr_type:n.constructor.name,args:[Object.values(n)]};if(n instanceof ArrayBuffer){const t=n.constructor.name,o=za(n);return{rr_type:t,base64:o}}else{if(n instanceof DataView)return{rr_type:n.constructor.name,args:[yi(n.buffer,e,i),n.byteOffset,n.byteLength]};if(n instanceof HTMLImageElement){const t=n.constructor.name,{src:o}=n;return{rr_type:t,src:o}}else if(n instanceof HTMLCanvasElement){const t="HTMLImageElement",o=n.toDataURL();return{rr_type:t,src:o}}else{if(n instanceof ImageData)return{rr_type:n.constructor.name,args:[yi(n.data,e,i),n.width,n.height]};if(uo(n,e)||typeof n=="object"){const t=n.constructor.name,o=lo(n,e,i);return{rr_type:t,index:o}}}}return n}const co=(n,e,i)=>n.map(t=>yi(t,e,i)),uo=(n,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof e[o]=="function").find(o=>n instanceof e[o]);function Wa(n,e,i,t){const o=[],s=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const r of s)try{if(typeof e.CanvasRenderingContext2D.prototype[r]!="function")continue;const l=In(e.CanvasRenderingContext2D.prototype,r,function(c){return function(...b){return _e(this.canvas,i,t,!0)||setTimeout(()=>{const p=co(b,e,this);n(this.canvas,{type:Bn["2D"],property:r,args:p})},0),c.apply(this,b)}});o.push(l)}catch{const c=hi(e.CanvasRenderingContext2D.prototype,r,{set(b){n(this.canvas,{type:Bn["2D"],property:r,args:[b],setter:!0})}});o.push(c)}return()=>{o.forEach(r=>r())}}function Za(n){return n==="experimental-webgl"?"webgl":n}function mo(n,e,i,t){const o=[];try{const s=In(n.HTMLCanvasElement.prototype,"getContext",function(r){return function(l,...c){if(!_e(this,e,i,!0)){const b=Za(l);if("__context"in this||(this.__context=b),t&&["webgl","webgl2"].includes(b))if(c[0]&&typeof c[0]=="object"){const p=c[0];p.preserveDrawingBuffer||(p.preserveDrawingBuffer=!0)}else c.splice(0,1,{preserveDrawingBuffer:!0})}return r.apply(this,[l,...c])}});o.push(s)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(s=>s())}}function ho(n,e,i,t,o,s,r){const l=[],c=Object.getOwnPropertyNames(n);for(const b of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(b))try{if(typeof n[b]!="function")continue;const p=In(n,b,function(g){return function(...f){const y=g.apply(this,f);if(lo(y,r,this),"tagName"in this.canvas&&!_e(this.canvas,t,o,!0)){const C=co(f,r,this),k={type:e,property:b,args:C};i(this.canvas,k)}return y}});l.push(p)}catch{const g=hi(n,b,{set(f){i(this.canvas,{type:e,property:b,args:[f],setter:!0})}});l.push(g)}return l}function Ja(n,e,i,t,o){const s=[];return s.push(...ho(e.WebGLRenderingContext.prototype,Bn.WebGL,n,i,t,o,e)),typeof e.WebGL2RenderingContext<"u"&&s.push(...ho(e.WebGL2RenderingContext.prototype,Bn.WebGL2,n,i,t,o,e)),()=>{s.forEach(r=>r())}}function $a(n,e){var i=n.toString(),t=i.split(`
693
+ ***************************************************************************** */function Ga(n,e){var i={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e.indexOf(t)<0&&(i[t]=n[t]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,t=Object.getOwnPropertySymbols(n);o<t.length;o++)e.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(n,t[o])&&(i[t[o]]=n[t[o]]);return i}function Va(n,e,i,t){function o(s){return s instanceof i?s:new i(function(r){r(s)})}return new(i||(i=Promise))(function(s,r){function l(p){try{b(t.next(p))}catch(g){r(g)}}function c(p){try{b(t.throw(p))}catch(g){r(g)}}function b(p){p.done?s(p.value):o(p.value).then(l,c)}b((t=t.apply(n,[])).next())})}for(var Rn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fa=typeof Uint8Array>"u"?[]:new Uint8Array(256),gi=0;gi<Rn.length;gi++)Fa[Rn.charCodeAt(gi)]=gi;var za=function(n){var e=new Uint8Array(n),i,t=e.length,o="";for(i=0;i<t;i+=3)o+=Rn[e[i]>>2],o+=Rn[(e[i]&3)<<4|e[i+1]>>4],o+=Rn[(e[i+1]&15)<<2|e[i+2]>>6],o+=Rn[e[i+2]&63];return t%3===2?o=o.substring(0,o.length-1)+"=":t%3===1&&(o=o.substring(0,o.length-2)+"=="),o};const lo=new Map;function qa(n,e){let i=lo.get(n);return i||(i=new Map,lo.set(n,i)),i.has(e)||i.set(e,[]),i.get(e)}const co=(n,e,i)=>{if(!n||!(mo(n,e)||typeof n=="object"))return;const t=n.constructor.name,o=qa(i,t);let s=o.indexOf(n);return s===-1&&(s=o.length,o.push(n)),s};function yi(n,e,i){if(n instanceof Array)return n.map(t=>yi(t,e,i));if(n===null)return n;if(n instanceof Float32Array||n instanceof Float64Array||n instanceof Int32Array||n instanceof Uint32Array||n instanceof Uint8Array||n instanceof Uint16Array||n instanceof Int16Array||n instanceof Int8Array||n instanceof Uint8ClampedArray)return{rr_type:n.constructor.name,args:[Object.values(n)]};if(n instanceof ArrayBuffer){const t=n.constructor.name,o=za(n);return{rr_type:t,base64:o}}else{if(n instanceof DataView)return{rr_type:n.constructor.name,args:[yi(n.buffer,e,i),n.byteOffset,n.byteLength]};if(n instanceof HTMLImageElement){const t=n.constructor.name,{src:o}=n;return{rr_type:t,src:o}}else if(n instanceof HTMLCanvasElement){const t="HTMLImageElement",o=n.toDataURL();return{rr_type:t,src:o}}else{if(n instanceof ImageData)return{rr_type:n.constructor.name,args:[yi(n.data,e,i),n.width,n.height]};if(mo(n,e)||typeof n=="object"){const t=n.constructor.name,o=co(n,e,i);return{rr_type:t,index:o}}}}return n}const uo=(n,e,i)=>n.map(t=>yi(t,e,i)),mo=(n,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof e[o]=="function").find(o=>n instanceof e[o]);function Wa(n,e,i,t){const o=[],s=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const r of s)try{if(typeof e.CanvasRenderingContext2D.prototype[r]!="function")continue;const l=In(e.CanvasRenderingContext2D.prototype,r,function(c){return function(...b){return _e(this.canvas,i,t,!0)||setTimeout(()=>{const p=uo(b,e,this);n(this.canvas,{type:Bn["2D"],property:r,args:p})},0),c.apply(this,b)}});o.push(l)}catch{const c=hi(e.CanvasRenderingContext2D.prototype,r,{set(b){n(this.canvas,{type:Bn["2D"],property:r,args:[b],setter:!0})}});o.push(c)}return()=>{o.forEach(r=>r())}}function Za(n){return n==="experimental-webgl"?"webgl":n}function ho(n,e,i,t){const o=[];try{const s=In(n.HTMLCanvasElement.prototype,"getContext",function(r){return function(l,...c){if(!_e(this,e,i,!0)){const b=Za(l);if("__context"in this||(this.__context=b),t&&["webgl","webgl2"].includes(b))if(c[0]&&typeof c[0]=="object"){const p=c[0];p.preserveDrawingBuffer||(p.preserveDrawingBuffer=!0)}else c.splice(0,1,{preserveDrawingBuffer:!0})}return r.apply(this,[l,...c])}});o.push(s)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(s=>s())}}function po(n,e,i,t,o,s,r){const l=[],c=Object.getOwnPropertyNames(n);for(const b of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(b))try{if(typeof n[b]!="function")continue;const p=In(n,b,function(g){return function(...f){const y=g.apply(this,f);if(co(y,r,this),"tagName"in this.canvas&&!_e(this.canvas,t,o,!0)){const C=uo(f,r,this),k={type:e,property:b,args:C};i(this.canvas,k)}return y}});l.push(p)}catch{const g=hi(n,b,{set(f){i(this.canvas,{type:e,property:b,args:[f],setter:!0})}});l.push(g)}return l}function Ja(n,e,i,t,o){const s=[];return s.push(...po(e.WebGLRenderingContext.prototype,Bn.WebGL,n,i,t,o,e)),typeof e.WebGL2RenderingContext<"u"&&s.push(...po(e.WebGL2RenderingContext.prototype,Bn.WebGL2,n,i,t,o,e)),()=>{s.forEach(r=>r())}}function $a(n,e){var i=n.toString(),t=i.split(`
694
694
  `);t.pop(),t.shift();for(var o=t[0].search(/\S/),s=/(['"])__worker_loader_strict__(['"])/g,r=0,l=t.length;r<l;++r)t[r]=t[r].substring(o).replace(s,"$1use strict$2")+`
695
695
  `;return t}function Ya(n,e){var i=$a(n),t=new Blob(i,{type:"application/javascript"});return URL.createObjectURL(t)}function Qa(n,e){var i;return function(o){return i=i||Ya(n),new Worker(i,o)}}var Xa=Qa(function(){(function(){"__worker_loader_strict__";/*! *****************************************************************************
696
696
  Copyright (c) Microsoft Corporation.
@@ -705,13 +705,13 @@ or you can use record.mirror to access the mirror instance during recording.`;le
705
705
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
706
706
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
707
707
  PERFORMANCE OF THIS SOFTWARE.
708
- ***************************************************************************** */function n(b,p,g,f){function y(C){return C instanceof g?C:new g(function(k){k(C)})}return new(g||(g=Promise))(function(C,k){function S(_){try{M(f.next(_))}catch(E){k(E)}}function A(_){try{M(f.throw(_))}catch(E){k(E)}}function M(_){_.done?C(_.value):y(_.value).then(S,A)}M((f=f.apply(b,[])).next())})}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=typeof Uint8Array>"u"?[]:new Uint8Array(256),t=0;t<e.length;t++)i[e.charCodeAt(t)]=t;var o=function(b){var p=new Uint8Array(b),g,f=p.length,y="";for(g=0;g<f;g+=3)y+=e[p[g]>>2],y+=e[(p[g]&3)<<4|p[g+1]>>4],y+=e[(p[g+1]&15)<<2|p[g+2]>>6],y+=e[p[g+2]&63];return f%3===2?y=y.substring(0,y.length-1)+"=":f%3===1&&(y=y.substring(0,y.length-2)+"=="),y};const s=new Map,r=new Map;function l(b,p,g){return n(this,void 0,void 0,function*(){const f=`${b}-${p}`;if("OffscreenCanvas"in globalThis){if(r.has(f))return r.get(f);const y=new OffscreenCanvas(b,p);y.getContext("2d");const k=yield(yield y.convertToBlob(g)).arrayBuffer(),S=o(k);return r.set(f,S),S}else return""})}const c=self;c.onmessage=function(b){return n(this,void 0,void 0,function*(){if("OffscreenCanvas"in globalThis){const{id:p,bitmap:g,width:f,height:y,dataURLOptions:C}=b.data,k=l(f,y,C),S=new OffscreenCanvas(f,y);S.getContext("2d").drawImage(g,0,0),g.close();const M=yield S.convertToBlob(C),_=M.type,E=yield M.arrayBuffer(),N=o(E);if(!s.has(p)&&(yield k)===N)return s.set(p,N),c.postMessage({id:p});if(s.get(p)===N)return c.postMessage({id:p});c.postMessage({id:p,type:_,base64:N,width:f,height:y}),s.set(p,N)}else return c.postMessage({id:b.data.id})})}})()});class er{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,b)=>{(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(b)};const{sampling:i="all",win:t,blockClass:o,blockSelector:s,recordCanvas:r,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,r&&i==="all"&&this.initCanvasMutationObserver(t,o,s),r&&typeof i=="number"&&this.initCanvasFPSObserver(i,t,o,s,{dataURLOptions:l})}initCanvasFPSObserver(e,i,t,o,s){const r=mo(i,t,o,!0),l=new Map,c=new Xa;c.onmessage=C=>{const{id:k}=C.data;if(l.set(k,!1),!("base64"in C.data))return;const{base64:S,type:A,width:M,height:_}=C.data;this.mutationCb({id:k,type:Bn["2D"],commands:[{property:"clearRect",args:[0,0,M,_]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:A}]},0,0]}]})};const b=1e3/e;let p=0,g;const f=()=>{const C=[];return i.document.querySelectorAll("canvas").forEach(k=>{_e(k,t,o,!0)||C.push(k)}),C},y=C=>{if(p&&C-p<b){g=requestAnimationFrame(y);return}p=C,f().forEach(k=>Va(this,void 0,void 0,function*(){var S;const A=this.mirror.getId(k);if(l.get(A)||k.width===0||k.height===0)return;if(l.set(A,!0),["webgl","webgl2"].includes(k.__context)){const _=k.getContext(k.__context);((S=_==null?void 0:_.getContextAttributes())===null||S===void 0?void 0:S.preserveDrawingBuffer)===!1&&_.clear(_.COLOR_BUFFER_BIT)}const M=yield createImageBitmap(k);c.postMessage({id:A,bitmap:M,width:k.width,height:k.height,dataURLOptions:s.dataURLOptions},[M])})),g=requestAnimationFrame(y)};g=requestAnimationFrame(y),this.resetObservers=()=>{r(),cancelAnimationFrame(g)}}initCanvasMutationObserver(e,i,t){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=mo(e,i,t,!1),s=Wa(this.processMutation.bind(this),e,i,t),r=Ja(this.processMutation.bind(this),e,i,t,this.mirror);this.resetObservers=()=>{o(),s(),r()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=i=>{this.rafStamps.latestId=i,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,i)=>{const t=this.mirror.getId(i);this.flushPendingCanvasMutationFor(i,t)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,i){if(this.frozen||this.locked)return;const t=this.pendingCanvasMutations.get(e);if(!t||i===-1)return;const o=t.map(r=>Ga(r,["type"])),{type:s}=t[0];this.mutationCb({id:i,type:s,commands:o}),this.pendingCanvasMutations.delete(e)}}class nr{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new ka,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,i){"_cssText"in i.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:i.id,attributes:i.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,i){if(e.length===0)return;const t={id:i,styleIds:[]},o=[];for(const s of e){let r;this.styleMirror.has(s)?r=this.styleMirror.getId(s):(r=this.styleMirror.add(s),o.push({styleId:r,rules:Array.from(s.rules||CSSRule,(l,c)=>({rule:Pt(l),index:c}))})),t.styleIds.push(r)}o.length>0&&(t.styles=o),this.adoptedStyleSheetCb(t)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class ir{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(e,i){const t=this.nodeMap.get(e);return t&&Array.from(t).some(o=>o!==i)}add(e,i){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(i))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function de(n){return Object.assign(Object.assign({},n),{timestamp:pi()})}let ae,ki,qi,wi=!1;const Oe=Js();function Jn(n={}){const{emit:e,checkoutEveryNms:i,checkoutEveryNth:t,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:r="rr-ignore",ignoreSelector:l=null,maskTextClass:c="rr-mask",maskTextSelector:b=null,inlineStylesheet:p=!0,maskAllInputs:g,maskInputOptions:f,slimDOMOptions:y,maskInputFn:C,maskTextFn:k,hooks:S,packFn:A,sampling:M={},dataURLOptions:_={},mousemoveWait:E,recordDOM:N=!0,recordCanvas:V=!1,recordCrossOriginIframes:F=!1,recordAfter:U=n.recordAfter==="DOMContentLoaded"?n.recordAfter:"load",userTriggeredOnInput:G=!1,collectFonts:oe=!1,inlineImages:fe=!1,plugins:K,keepIframeSrcFn:Ae=()=>!1,ignoreCSSAttributes:ue=new Set([]),errorHandler:Te}=n;Aa(Te);const Me=F?window.parent===window:!0;let Xe=!1;if(!Me)try{window.parent.document&&(Xe=!1)}catch{Xe=!0}if(Me&&!e)throw new Error("emit function is required");E!==void 0&&M.mousemove===void 0&&(M.mousemove=E),Oe.reset();const pn=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},en=y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:y==="all",headMetaDescKeywords:y==="all"}:y||{};ya();let Sn,bn=0;const Ee=B=>{for(const me of K||[])me.eventProcessor&&(B=me.eventProcessor(B));return A&&!Xe&&(B=A(B)),B};ae=(B,me)=>{var $;if(!(($=yn[0])===null||$===void 0)&&$.isFrozen()&&B.type!==W.FullSnapshot&&!(B.type===W.IncrementalSnapshot&&B.data.source===z.Mutation)&&yn.forEach(ge=>ge.unfreeze()),Me)e==null||e(Ee(B),me);else if(Xe){const ge={type:"rrweb",event:Ee(B),origin:window.location.origin,isCheckout:me};window.parent.postMessage(ge,"*")}if(B.type===W.FullSnapshot)Sn=B,bn=0;else if(B.type===W.IncrementalSnapshot){if(B.data.source===z.Mutation&&B.data.isAttachIframe)return;bn++;const ge=t&&bn>=t,We=i&&B.timestamp-Sn.timestamp>i;(ge||We)&&ki(!0)}};const nn=B=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Mutation},B)}))},_n=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Scroll},B)})),re=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.CanvasMutation},B)})),be=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.AdoptedStyleSheet},B)})),Re=new nr({mutationCb:nn,adoptedStyleSheetCb:be}),Pe=new Ka({mirror:Oe,mutationCb:nn,stylesheetManager:Re,recordCrossOriginIframes:F,wrappedEmit:ae});for(const B of K||[])B.getMirror&&B.getMirror({nodeMirror:Oe,crossOriginIframeMirror:Pe.crossOriginIframeMirror,crossOriginIframeStyleMirror:Pe.crossOriginIframeStyleMirror});const Ce=new ir;qi=new er({recordCanvas:V,mutationCb:re,win:window,blockClass:o,blockSelector:s,mirror:Oe,sampling:M.canvas,dataURLOptions:_});const qe=new ja({mutationCb:nn,scrollCb:_n,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:b,inlineStylesheet:p,maskInputOptions:pn,dataURLOptions:_,maskTextFn:k,maskInputFn:C,recordCanvas:V,inlineImages:fe,sampling:M,slimDOMOptions:en,iframeManager:Pe,stylesheetManager:Re,canvasManager:qi,keepIframeSrcFn:Ae,processedNodeManager:Ce},mirror:Oe});ki=(B=!1)=>{if(!N)return;ae(de({type:W.Meta,data:{href:window.location.href,width:Vt(),height:Gt()}}),B),Re.reset(),qe.init(),yn.forEach($=>$.lock());const me=fa(document,{mirror:Oe,blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:b,inlineStylesheet:p,maskAllInputs:pn,maskTextFn:k,slimDOM:en,dataURLOptions:_,recordCanvas:V,inlineImages:fe,onSerialize:$=>{qt($,Oe)&&Pe.addIframe($),Wt($,Oe)&&Re.trackLinkElement($),Fi($)&&qe.addShadowRoot($.shadowRoot,document)},onIframeLoad:($,ge)=>{Pe.attachIframe($,ge),qe.observeAttachShadow($)},onStylesheetLoad:($,ge)=>{Re.attachLinkElement($,ge)},keepIframeSrcFn:Ae});if(!me)return console.warn("Failed to snapshot the document");ae(de({type:W.FullSnapshot,data:{node:me,initialOffset:jt(window)}}),B),yn.forEach($=>$.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Re.adoptStyleSheets(document.adoptedStyleSheets,Oe.getId(document))};try{const B=[],me=ge=>{var We;return q(Ua)({mutationCb:nn,mousemoveCb:(Q,ni)=>ae(de({type:W.IncrementalSnapshot,data:{source:ni,positions:Q}})),mouseInteractionCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.MouseInteraction},Q)})),scrollCb:_n,viewportResizeCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.ViewportResize},Q)})),inputCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Input},Q)})),mediaInteractionCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.MediaInteraction},Q)})),styleSheetRuleCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.StyleSheetRule},Q)})),styleDeclarationCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.StyleDeclaration},Q)})),canvasMutationCb:re,fontCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Font},Q)})),selectionCb:Q=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Selection},Q)}))},customElementCb:Q=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.CustomElement},Q)}))},blockClass:o,ignoreClass:r,ignoreSelector:l,maskTextClass:c,maskTextSelector:b,maskInputOptions:pn,inlineStylesheet:p,sampling:M,recordDOM:N,recordCanvas:V,inlineImages:fe,userTriggeredOnInput:G,collectFonts:oe,doc:ge,maskInputFn:C,maskTextFn:k,keepIframeSrcFn:Ae,blockSelector:s,slimDOMOptions:en,dataURLOptions:_,mirror:Oe,iframeManager:Pe,stylesheetManager:Re,shadowDomManager:qe,processedNodeManager:Ce,canvasManager:qi,ignoreCSSAttributes:ue,plugins:((We=K==null?void 0:K.filter(Q=>Q.observer))===null||We===void 0?void 0:We.map(Q=>({observer:Q.observer,options:Q.options,callback:ni=>ae(de({type:W.Plugin,data:{plugin:Q.name,payload:ni}}))})))||[]},S)};Pe.addLoadListener(ge=>{try{B.push(me(ge.contentDocument))}catch(We){console.warn(We)}});const $=()=>{ki(),B.push(me(document)),wi=!0};return document.readyState==="interactive"||document.readyState==="complete"?$():(B.push(Se("DOMContentLoaded",()=>{ae(de({type:W.DomContentLoaded,data:{}})),U==="DOMContentLoaded"&&$()})),B.push(Se("load",()=>{ae(de({type:W.Load,data:{}})),U==="load"&&$()},window))),()=>{B.forEach(ge=>ge()),Ce.destroy(),wi=!1,Ma()}}catch(B){console.warn(B)}}Jn.addCustomEvent=(n,e)=>{if(!wi)throw new Error("please add custom event after start recording");ae(de({type:W.Custom,data:{tag:n,payload:e}}))},Jn.freezePage=()=>{yn.forEach(n=>n.freeze())},Jn.takeFullSnapshot=n=>{if(!wi)throw new Error("please take full snapshot after start recording");ki(n)},Jn.mirror=Oe;var po=(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))(po||{}),Ve=(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))(Ve||{}),Je={DEBUG:!1,LIB_VERSION:"2.55.1"},R;if(typeof window>"u"){var bo={hostname:""};R={navigator:{userAgent:"",onLine:!0},document:{location:bo,referrer:""},screen:{width:0,height:0},location:bo}}else R=window;var $n=24*60*60*1e3,Wi=8*1e3,Ci=Array.prototype,tr=Function.prototype,vo=Object.prototype,rn=Ci.slice,Yn=vo.toString,Si=vo.hasOwnProperty,ce=R.console,ln=R.navigator,X=R.document,_i=R.opera,Ai=R.screen,Fe=ln.userAgent,Zi=tr.bind,fo=Ci.forEach,go=Ci.indexOf,yo=Ci.map,or=Array.isArray,Ji={},h={trim:function(n){return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},J={log:function(){if(Je.DEBUG&&!h.isUndefined(ce)&&ce)try{ce.log.apply(ce,arguments)}catch{h.each(arguments,function(e){ce.log(e)})}},warn:function(){if(Je.DEBUG&&!h.isUndefined(ce)&&ce){var n=["Mixpanel warning:"].concat(h.toArray(arguments));try{ce.warn.apply(ce,n)}catch{h.each(n,function(i){ce.warn(i)})}}},error:function(){if(Je.DEBUG&&!h.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(h.toArray(arguments));try{ce.error.apply(ce,n)}catch{h.each(n,function(i){ce.error(i)})}}},critical:function(){if(!h.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(h.toArray(arguments));try{ce.error.apply(ce,n)}catch{h.each(n,function(i){ce.error(i)})}}}},$i=function(n,e){return function(){return arguments[0]="["+e+"] "+arguments[0],n.apply(J,arguments)}},Mi=function(n){return{log:$i(J.log,n),error:$i(J.error,n),critical:$i(J.critical,n)}};h.bind=function(n,e){var i,t;if(Zi&&n.bind===Zi)return Zi.apply(n,rn.call(arguments,1));if(!h.isFunction(n))throw new TypeError;return i=rn.call(arguments,2),t=function(){if(!(this instanceof t))return n.apply(e,i.concat(rn.call(arguments)));var o={};o.prototype=n.prototype;var s=new o;o.prototype=null;var r=n.apply(s,i.concat(rn.call(arguments)));return Object(r)===r?r:s},t},h.each=function(n,e,i){if(n!=null){if(fo&&n.forEach===fo)n.forEach(e,i);else if(n.length===+n.length){for(var t=0,o=n.length;t<o;t++)if(t in n&&e.call(i,n[t],t,n)===Ji)return}else for(var s in n)if(Si.call(n,s)&&e.call(i,n[s],s,n)===Ji)return}},h.extend=function(n){return h.each(rn.call(arguments,1),function(e){for(var i in e)e[i]!==void 0&&(n[i]=e[i])}),n},h.isArray=or||function(n){return Yn.call(n)==="[object Array]"},h.isFunction=function(n){try{return/^\s*\bfunction\b/.test(n)}catch{return!1}},h.isArguments=function(n){return!!(n&&Si.call(n,"callee"))},h.toArray=function(n){return n?n.toArray?n.toArray():h.isArray(n)||h.isArguments(n)?rn.call(n):h.values(n):[]},h.map=function(n,e,i){if(yo&&n.map===yo)return n.map(e,i);var t=[];return h.each(n,function(o){t.push(e.call(i,o))}),t},h.keys=function(n){var e=[];return n===null||h.each(n,function(i,t){e[e.length]=t}),e},h.values=function(n){var e=[];return n===null||h.each(n,function(i){e[e.length]=i}),e},h.include=function(n,e){var i=!1;return n===null?i:go&&n.indexOf===go?n.indexOf(e)!=-1:(h.each(n,function(t){if(i||(i=t===e))return Ji}),i)},h.includes=function(n,e){return n.indexOf(e)!==-1},h.inherit=function(n,e){return n.prototype=new e,n.prototype.constructor=n,n.superclass=e.prototype,n},h.isObject=function(n){return n===Object(n)&&!h.isArray(n)},h.isEmptyObject=function(n){if(h.isObject(n)){for(var e in n)if(Si.call(n,e))return!1;return!0}return!1},h.isUndefined=function(n){return n===void 0},h.isString=function(n){return Yn.call(n)=="[object String]"},h.isDate=function(n){return Yn.call(n)=="[object Date]"},h.isNumber=function(n){return Yn.call(n)=="[object Number]"},h.isElement=function(n){return!!(n&&n.nodeType===1)},h.encodeDates=function(n){return h.each(n,function(e,i){h.isDate(e)?n[i]=h.formatDate(e):h.isObject(e)&&(n[i]=h.encodeDates(e))}),n},h.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},h.formatDate=function(n){function e(i){return i<10?"0"+i:i}return n.getUTCFullYear()+"-"+e(n.getUTCMonth()+1)+"-"+e(n.getUTCDate())+"T"+e(n.getUTCHours())+":"+e(n.getUTCMinutes())+":"+e(n.getUTCSeconds())},h.strip_empty_properties=function(n){var e={};return h.each(n,function(i,t){h.isString(i)&&i.length>0&&(e[t]=i)}),e},h.truncate=function(n,e){var i;return typeof n=="string"?i=n.slice(0,e):h.isArray(n)?(i=[],h.each(n,function(t){i.push(h.truncate(t,e))})):h.isObject(n)?(i={},h.each(n,function(t,o){i[o]=h.truncate(t,e)})):i=n,i},h.JSONEncode=function(){return function(n){var e=n,i=function(o){var s=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return s.lastIndex=0,s.test(o)?'"'+o.replace(s,function(l){var c=r[l];return typeof c=="string"?c:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+o+'"'},t=function(o,s){var r="",l=" ",c=0,b="",p="",g=0,f=r,y=[],C=s[o];switch(C&&typeof C=="object"&&typeof C.toJSON=="function"&&(C=C.toJSON(o)),typeof C){case"string":return i(C);case"number":return isFinite(C)?String(C):"null";case"boolean":case"null":return String(C);case"object":if(!C)return"null";if(r+=l,y=[],Yn.apply(C)==="[object Array]"){for(g=C.length,c=0;c<g;c+=1)y[c]=t(c,C)||"null";return p=y.length===0?"[]":r?`[
708
+ ***************************************************************************** */function n(b,p,g,f){function y(C){return C instanceof g?C:new g(function(k){k(C)})}return new(g||(g=Promise))(function(C,k){function S(_){try{M(f.next(_))}catch(E){k(E)}}function A(_){try{M(f.throw(_))}catch(E){k(E)}}function M(_){_.done?C(_.value):y(_.value).then(S,A)}M((f=f.apply(b,[])).next())})}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=typeof Uint8Array>"u"?[]:new Uint8Array(256),t=0;t<e.length;t++)i[e.charCodeAt(t)]=t;var o=function(b){var p=new Uint8Array(b),g,f=p.length,y="";for(g=0;g<f;g+=3)y+=e[p[g]>>2],y+=e[(p[g]&3)<<4|p[g+1]>>4],y+=e[(p[g+1]&15)<<2|p[g+2]>>6],y+=e[p[g+2]&63];return f%3===2?y=y.substring(0,y.length-1)+"=":f%3===1&&(y=y.substring(0,y.length-2)+"=="),y};const s=new Map,r=new Map;function l(b,p,g){return n(this,void 0,void 0,function*(){const f=`${b}-${p}`;if("OffscreenCanvas"in globalThis){if(r.has(f))return r.get(f);const y=new OffscreenCanvas(b,p);y.getContext("2d");const k=yield(yield y.convertToBlob(g)).arrayBuffer(),S=o(k);return r.set(f,S),S}else return""})}const c=self;c.onmessage=function(b){return n(this,void 0,void 0,function*(){if("OffscreenCanvas"in globalThis){const{id:p,bitmap:g,width:f,height:y,dataURLOptions:C}=b.data,k=l(f,y,C),S=new OffscreenCanvas(f,y);S.getContext("2d").drawImage(g,0,0),g.close();const M=yield S.convertToBlob(C),_=M.type,E=yield M.arrayBuffer(),N=o(E);if(!s.has(p)&&(yield k)===N)return s.set(p,N),c.postMessage({id:p});if(s.get(p)===N)return c.postMessage({id:p});c.postMessage({id:p,type:_,base64:N,width:f,height:y}),s.set(p,N)}else return c.postMessage({id:b.data.id})})}})()});class er{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,b)=>{(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(b)};const{sampling:i="all",win:t,blockClass:o,blockSelector:s,recordCanvas:r,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,r&&i==="all"&&this.initCanvasMutationObserver(t,o,s),r&&typeof i=="number"&&this.initCanvasFPSObserver(i,t,o,s,{dataURLOptions:l})}initCanvasFPSObserver(e,i,t,o,s){const r=ho(i,t,o,!0),l=new Map,c=new Xa;c.onmessage=C=>{const{id:k}=C.data;if(l.set(k,!1),!("base64"in C.data))return;const{base64:S,type:A,width:M,height:_}=C.data;this.mutationCb({id:k,type:Bn["2D"],commands:[{property:"clearRect",args:[0,0,M,_]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:A}]},0,0]}]})};const b=1e3/e;let p=0,g;const f=()=>{const C=[];return i.document.querySelectorAll("canvas").forEach(k=>{_e(k,t,o,!0)||C.push(k)}),C},y=C=>{if(p&&C-p<b){g=requestAnimationFrame(y);return}p=C,f().forEach(k=>Va(this,void 0,void 0,function*(){var S;const A=this.mirror.getId(k);if(l.get(A)||k.width===0||k.height===0)return;if(l.set(A,!0),["webgl","webgl2"].includes(k.__context)){const _=k.getContext(k.__context);((S=_==null?void 0:_.getContextAttributes())===null||S===void 0?void 0:S.preserveDrawingBuffer)===!1&&_.clear(_.COLOR_BUFFER_BIT)}const M=yield createImageBitmap(k);c.postMessage({id:A,bitmap:M,width:k.width,height:k.height,dataURLOptions:s.dataURLOptions},[M])})),g=requestAnimationFrame(y)};g=requestAnimationFrame(y),this.resetObservers=()=>{r(),cancelAnimationFrame(g)}}initCanvasMutationObserver(e,i,t){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=ho(e,i,t,!1),s=Wa(this.processMutation.bind(this),e,i,t),r=Ja(this.processMutation.bind(this),e,i,t,this.mirror);this.resetObservers=()=>{o(),s(),r()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=i=>{this.rafStamps.latestId=i,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,i)=>{const t=this.mirror.getId(i);this.flushPendingCanvasMutationFor(i,t)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,i){if(this.frozen||this.locked)return;const t=this.pendingCanvasMutations.get(e);if(!t||i===-1)return;const o=t.map(r=>Ga(r,["type"])),{type:s}=t[0];this.mutationCb({id:i,type:s,commands:o}),this.pendingCanvasMutations.delete(e)}}class nr{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new ka,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,i){"_cssText"in i.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:i.id,attributes:i.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,i){if(e.length===0)return;const t={id:i,styleIds:[]},o=[];for(const s of e){let r;this.styleMirror.has(s)?r=this.styleMirror.getId(s):(r=this.styleMirror.add(s),o.push({styleId:r,rules:Array.from(s.rules||CSSRule,(l,c)=>({rule:Nt(l),index:c}))})),t.styleIds.push(r)}o.length>0&&(t.styles=o),this.adoptedStyleSheetCb(t)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class ir{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(e,i){const t=this.nodeMap.get(e);return t&&Array.from(t).some(o=>o!==i)}add(e,i){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(i))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function de(n){return Object.assign(Object.assign({},n),{timestamp:pi()})}let ae,ki,qi,wi=!1;const Oe=Js();function Jn(n={}){const{emit:e,checkoutEveryNms:i,checkoutEveryNth:t,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:r="rr-ignore",ignoreSelector:l=null,maskTextClass:c="rr-mask",maskTextSelector:b=null,inlineStylesheet:p=!0,maskAllInputs:g,maskInputOptions:f,slimDOMOptions:y,maskInputFn:C,maskTextFn:k,hooks:S,packFn:A,sampling:M={},dataURLOptions:_={},mousemoveWait:E,recordDOM:N=!0,recordCanvas:V=!1,recordCrossOriginIframes:F=!1,recordAfter:U=n.recordAfter==="DOMContentLoaded"?n.recordAfter:"load",userTriggeredOnInput:G=!1,collectFonts:oe=!1,inlineImages:fe=!1,plugins:K,keepIframeSrcFn:Ae=()=>!1,ignoreCSSAttributes:ue=new Set([]),errorHandler:Te}=n;Aa(Te);const Me=F?window.parent===window:!0;let Xe=!1;if(!Me)try{window.parent.document&&(Xe=!1)}catch{Xe=!0}if(Me&&!e)throw new Error("emit function is required");E!==void 0&&M.mousemove===void 0&&(M.mousemove=E),Oe.reset();const pn=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},en=y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:y==="all",headMetaDescKeywords:y==="all"}:y||{};ya();let Sn,bn=0;const Ee=B=>{for(const me of K||[])me.eventProcessor&&(B=me.eventProcessor(B));return A&&!Xe&&(B=A(B)),B};ae=(B,me)=>{var $;if(!(($=yn[0])===null||$===void 0)&&$.isFrozen()&&B.type!==W.FullSnapshot&&!(B.type===W.IncrementalSnapshot&&B.data.source===z.Mutation)&&yn.forEach(ge=>ge.unfreeze()),Me)e==null||e(Ee(B),me);else if(Xe){const ge={type:"rrweb",event:Ee(B),origin:window.location.origin,isCheckout:me};window.parent.postMessage(ge,"*")}if(B.type===W.FullSnapshot)Sn=B,bn=0;else if(B.type===W.IncrementalSnapshot){if(B.data.source===z.Mutation&&B.data.isAttachIframe)return;bn++;const ge=t&&bn>=t,We=i&&B.timestamp-Sn.timestamp>i;(ge||We)&&ki(!0)}};const nn=B=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Mutation},B)}))},_n=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Scroll},B)})),re=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.CanvasMutation},B)})),be=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.AdoptedStyleSheet},B)})),Re=new nr({mutationCb:nn,adoptedStyleSheetCb:be}),Pe=new Ka({mirror:Oe,mutationCb:nn,stylesheetManager:Re,recordCrossOriginIframes:F,wrappedEmit:ae});for(const B of K||[])B.getMirror&&B.getMirror({nodeMirror:Oe,crossOriginIframeMirror:Pe.crossOriginIframeMirror,crossOriginIframeStyleMirror:Pe.crossOriginIframeStyleMirror});const Ce=new ir;qi=new er({recordCanvas:V,mutationCb:re,win:window,blockClass:o,blockSelector:s,mirror:Oe,sampling:M.canvas,dataURLOptions:_});const qe=new ja({mutationCb:nn,scrollCb:_n,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:b,inlineStylesheet:p,maskInputOptions:pn,dataURLOptions:_,maskTextFn:k,maskInputFn:C,recordCanvas:V,inlineImages:fe,sampling:M,slimDOMOptions:en,iframeManager:Pe,stylesheetManager:Re,canvasManager:qi,keepIframeSrcFn:Ae,processedNodeManager:Ce},mirror:Oe});ki=(B=!1)=>{if(!N)return;ae(de({type:W.Meta,data:{href:window.location.href,width:Ft(),height:Vt()}}),B),Re.reset(),qe.init(),yn.forEach($=>$.lock());const me=fa(document,{mirror:Oe,blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:b,inlineStylesheet:p,maskAllInputs:pn,maskTextFn:k,slimDOM:en,dataURLOptions:_,recordCanvas:V,inlineImages:fe,onSerialize:$=>{Wt($,Oe)&&Pe.addIframe($),Zt($,Oe)&&Re.trackLinkElement($),Fi($)&&qe.addShadowRoot($.shadowRoot,document)},onIframeLoad:($,ge)=>{Pe.attachIframe($,ge),qe.observeAttachShadow($)},onStylesheetLoad:($,ge)=>{Re.attachLinkElement($,ge)},keepIframeSrcFn:Ae});if(!me)return console.warn("Failed to snapshot the document");ae(de({type:W.FullSnapshot,data:{node:me,initialOffset:Gt(window)}}),B),yn.forEach($=>$.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Re.adoptStyleSheets(document.adoptedStyleSheets,Oe.getId(document))};try{const B=[],me=ge=>{var We;return q(Ua)({mutationCb:nn,mousemoveCb:(Q,ni)=>ae(de({type:W.IncrementalSnapshot,data:{source:ni,positions:Q}})),mouseInteractionCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.MouseInteraction},Q)})),scrollCb:_n,viewportResizeCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.ViewportResize},Q)})),inputCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Input},Q)})),mediaInteractionCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.MediaInteraction},Q)})),styleSheetRuleCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.StyleSheetRule},Q)})),styleDeclarationCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.StyleDeclaration},Q)})),canvasMutationCb:re,fontCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Font},Q)})),selectionCb:Q=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Selection},Q)}))},customElementCb:Q=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.CustomElement},Q)}))},blockClass:o,ignoreClass:r,ignoreSelector:l,maskTextClass:c,maskTextSelector:b,maskInputOptions:pn,inlineStylesheet:p,sampling:M,recordDOM:N,recordCanvas:V,inlineImages:fe,userTriggeredOnInput:G,collectFonts:oe,doc:ge,maskInputFn:C,maskTextFn:k,keepIframeSrcFn:Ae,blockSelector:s,slimDOMOptions:en,dataURLOptions:_,mirror:Oe,iframeManager:Pe,stylesheetManager:Re,shadowDomManager:qe,processedNodeManager:Ce,canvasManager:qi,ignoreCSSAttributes:ue,plugins:((We=K==null?void 0:K.filter(Q=>Q.observer))===null||We===void 0?void 0:We.map(Q=>({observer:Q.observer,options:Q.options,callback:ni=>ae(de({type:W.Plugin,data:{plugin:Q.name,payload:ni}}))})))||[]},S)};Pe.addLoadListener(ge=>{try{B.push(me(ge.contentDocument))}catch(We){console.warn(We)}});const $=()=>{ki(),B.push(me(document)),wi=!0};return document.readyState==="interactive"||document.readyState==="complete"?$():(B.push(Se("DOMContentLoaded",()=>{ae(de({type:W.DomContentLoaded,data:{}})),U==="DOMContentLoaded"&&$()})),B.push(Se("load",()=>{ae(de({type:W.Load,data:{}})),U==="load"&&$()},window))),()=>{B.forEach(ge=>ge()),Ce.destroy(),wi=!1,Ma()}}catch(B){console.warn(B)}}Jn.addCustomEvent=(n,e)=>{if(!wi)throw new Error("please add custom event after start recording");ae(de({type:W.Custom,data:{tag:n,payload:e}}))},Jn.freezePage=()=>{yn.forEach(n=>n.freeze())},Jn.takeFullSnapshot=n=>{if(!wi)throw new Error("please take full snapshot after start recording");ki(n)},Jn.mirror=Oe;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||{}),Ve=(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))(Ve||{}),Je={DEBUG:!1,LIB_VERSION:"2.55.1"},R;if(typeof window>"u"){var vo={hostname:""};R={navigator:{userAgent:"",onLine:!0},document:{location:vo,referrer:""},screen:{width:0,height:0},location:vo}}else R=window;var $n=24*60*60*1e3,Wi=8*1e3,Ci=Array.prototype,tr=Function.prototype,fo=Object.prototype,rn=Ci.slice,Yn=fo.toString,Si=fo.hasOwnProperty,ce=R.console,ln=R.navigator,X=R.document,_i=R.opera,Ai=R.screen,Fe=ln.userAgent,Zi=tr.bind,go=Ci.forEach,yo=Ci.indexOf,ko=Ci.map,or=Array.isArray,Ji={},h={trim:function(n){return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},J={log:function(){if(Je.DEBUG&&!h.isUndefined(ce)&&ce)try{ce.log.apply(ce,arguments)}catch{h.each(arguments,function(e){ce.log(e)})}},warn:function(){if(Je.DEBUG&&!h.isUndefined(ce)&&ce){var n=["Mixpanel warning:"].concat(h.toArray(arguments));try{ce.warn.apply(ce,n)}catch{h.each(n,function(i){ce.warn(i)})}}},error:function(){if(Je.DEBUG&&!h.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(h.toArray(arguments));try{ce.error.apply(ce,n)}catch{h.each(n,function(i){ce.error(i)})}}},critical:function(){if(!h.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(h.toArray(arguments));try{ce.error.apply(ce,n)}catch{h.each(n,function(i){ce.error(i)})}}}},$i=function(n,e){return function(){return arguments[0]="["+e+"] "+arguments[0],n.apply(J,arguments)}},Mi=function(n){return{log:$i(J.log,n),error:$i(J.error,n),critical:$i(J.critical,n)}};h.bind=function(n,e){var i,t;if(Zi&&n.bind===Zi)return Zi.apply(n,rn.call(arguments,1));if(!h.isFunction(n))throw new TypeError;return i=rn.call(arguments,2),t=function(){if(!(this instanceof t))return n.apply(e,i.concat(rn.call(arguments)));var o={};o.prototype=n.prototype;var s=new o;o.prototype=null;var r=n.apply(s,i.concat(rn.call(arguments)));return Object(r)===r?r:s},t},h.each=function(n,e,i){if(n!=null){if(go&&n.forEach===go)n.forEach(e,i);else if(n.length===+n.length){for(var t=0,o=n.length;t<o;t++)if(t in n&&e.call(i,n[t],t,n)===Ji)return}else for(var s in n)if(Si.call(n,s)&&e.call(i,n[s],s,n)===Ji)return}},h.extend=function(n){return h.each(rn.call(arguments,1),function(e){for(var i in e)e[i]!==void 0&&(n[i]=e[i])}),n},h.isArray=or||function(n){return Yn.call(n)==="[object Array]"},h.isFunction=function(n){try{return/^\s*\bfunction\b/.test(n)}catch{return!1}},h.isArguments=function(n){return!!(n&&Si.call(n,"callee"))},h.toArray=function(n){return n?n.toArray?n.toArray():h.isArray(n)||h.isArguments(n)?rn.call(n):h.values(n):[]},h.map=function(n,e,i){if(ko&&n.map===ko)return n.map(e,i);var t=[];return h.each(n,function(o){t.push(e.call(i,o))}),t},h.keys=function(n){var e=[];return n===null||h.each(n,function(i,t){e[e.length]=t}),e},h.values=function(n){var e=[];return n===null||h.each(n,function(i){e[e.length]=i}),e},h.include=function(n,e){var i=!1;return n===null?i:yo&&n.indexOf===yo?n.indexOf(e)!=-1:(h.each(n,function(t){if(i||(i=t===e))return Ji}),i)},h.includes=function(n,e){return n.indexOf(e)!==-1},h.inherit=function(n,e){return n.prototype=new e,n.prototype.constructor=n,n.superclass=e.prototype,n},h.isObject=function(n){return n===Object(n)&&!h.isArray(n)},h.isEmptyObject=function(n){if(h.isObject(n)){for(var e in n)if(Si.call(n,e))return!1;return!0}return!1},h.isUndefined=function(n){return n===void 0},h.isString=function(n){return Yn.call(n)=="[object String]"},h.isDate=function(n){return Yn.call(n)=="[object Date]"},h.isNumber=function(n){return Yn.call(n)=="[object Number]"},h.isElement=function(n){return!!(n&&n.nodeType===1)},h.encodeDates=function(n){return h.each(n,function(e,i){h.isDate(e)?n[i]=h.formatDate(e):h.isObject(e)&&(n[i]=h.encodeDates(e))}),n},h.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},h.formatDate=function(n){function e(i){return i<10?"0"+i:i}return n.getUTCFullYear()+"-"+e(n.getUTCMonth()+1)+"-"+e(n.getUTCDate())+"T"+e(n.getUTCHours())+":"+e(n.getUTCMinutes())+":"+e(n.getUTCSeconds())},h.strip_empty_properties=function(n){var e={};return h.each(n,function(i,t){h.isString(i)&&i.length>0&&(e[t]=i)}),e},h.truncate=function(n,e){var i;return typeof n=="string"?i=n.slice(0,e):h.isArray(n)?(i=[],h.each(n,function(t){i.push(h.truncate(t,e))})):h.isObject(n)?(i={},h.each(n,function(t,o){i[o]=h.truncate(t,e)})):i=n,i},h.JSONEncode=function(){return function(n){var e=n,i=function(o){var s=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return s.lastIndex=0,s.test(o)?'"'+o.replace(s,function(l){var c=r[l];return typeof c=="string"?c:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+o+'"'},t=function(o,s){var r="",l=" ",c=0,b="",p="",g=0,f=r,y=[],C=s[o];switch(C&&typeof C=="object"&&typeof C.toJSON=="function"&&(C=C.toJSON(o)),typeof C){case"string":return i(C);case"number":return isFinite(C)?String(C):"null";case"boolean":case"null":return String(C);case"object":if(!C)return"null";if(r+=l,y=[],Yn.apply(C)==="[object Array]"){for(g=C.length,c=0;c<g;c+=1)y[c]=t(c,C)||"null";return p=y.length===0?"[]":r?`[
709
709
  `+r+y.join(`,
710
710
  `+r)+`
711
711
  `+f+"]":"["+y.join(",")+"]",r=f,p}for(b in C)Si.call(C,b)&&(p=t(b,C),p&&y.push(i(b)+(r?": ":":")+p));return p=y.length===0?"{}":r?"{"+y.join(",")+f+"}":"{"+y.join(",")+"}",r=f,p}};return t("",{"":e})}}(),h.JSONDecode=function(){var n,e,i={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
712
712
  `,r:"\r",t:" "},t,o=function(y){var C=new SyntaxError(y);throw C.at=n,C.text=t,C},s=function(y){return y&&y!==e&&o("Expected '"+y+"' instead of '"+e+"'"),e=t.charAt(n),n+=1,e},r=function(){var y,C="";for(e==="-"&&(C="-",s("-"));e>="0"&&e<="9";)C+=e,s();if(e===".")for(C+=".";s()&&e>="0"&&e<="9";)C+=e;if(e==="e"||e==="E")for(C+=e,s(),(e==="-"||e==="+")&&(C+=e,s());e>="0"&&e<="9";)C+=e,s();if(y=+C,!isFinite(y))o("Bad number");else return y},l=function(){var y,C,k="",S;if(e==='"')for(;s();){if(e==='"')return s(),k;if(e==="\\")if(s(),e==="u"){for(S=0,C=0;C<4&&(y=parseInt(s(),16),!!isFinite(y));C+=1)S=S*16+y;k+=String.fromCharCode(S)}else if(typeof i[e]=="string")k+=i[e];else break;else k+=e}o("Bad string")},c=function(){for(;e&&e<=" ";)s()},b=function(){switch(e){case"t":return s("t"),s("r"),s("u"),s("e"),!0;case"f":return s("f"),s("a"),s("l"),s("s"),s("e"),!1;case"n":return s("n"),s("u"),s("l"),s("l"),null}o('Unexpected "'+e+'"')},p,g=function(){var y=[];if(e==="["){if(s("["),c(),e==="]")return s("]"),y;for(;e;){if(y.push(p()),c(),e==="]")return s("]"),y;s(","),c()}}o("Bad array")},f=function(){var y,C={};if(e==="{"){if(s("{"),c(),e==="}")return s("}"),C;for(;e;){if(y=l(),c(),s(":"),Object.hasOwnProperty.call(C,y)&&o('Duplicate key "'+y+'"'),C[y]=p(),c(),e==="}")return s("}"),C;s(","),c()}}o("Bad object")};return p=function(){switch(c(),e){case"{":return f();case"[":return g();case'"':return l();case"-":return r();default:return e>="0"&&e<="9"?r():b()}},function(y){var C;return t=y,n=0,e=" ",C=p(),c(),e&&o("Syntax error"),C}}(),h.base64Encode=function(n){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i,t,o,s,r,l,c,b,p=0,g=0,f="",y=[];if(!n)return n;n=h.utf8Encode(n);do i=n.charCodeAt(p++),t=n.charCodeAt(p++),o=n.charCodeAt(p++),b=i<<16|t<<8|o,s=b>>18&63,r=b>>12&63,l=b>>6&63,c=b&63,y[g++]=e.charAt(s)+e.charAt(r)+e.charAt(l)+e.charAt(c);while(p<n.length);switch(f=y.join(""),n.length%3){case 1:f=f.slice(0,-2)+"==";break;case 2:f=f.slice(0,-1)+"=";break}return f},h.utf8Encode=function(n){n=(n+"").replace(/\r\n/g,`
713
713
  `).replace(/\r/g,`
714
- `);var e="",i,t,o=0,s;for(i=t=0,o=n.length,s=0;s<o;s++){var r=n.charCodeAt(s),l=null;r<128?t++:r>127&&r<2048?l=String.fromCharCode(r>>6|192,r&63|128):l=String.fromCharCode(r>>12|224,r>>6&63|128,r&63|128),l!==null&&(t>i&&(e+=n.substring(i,t)),e+=l,i=t=s+1)}return t>i&&(e+=n.substring(i,n.length)),e},h.UUID=function(){var n=function(){var t=1*new Date,o;if(R.performance&&R.performance.now)o=R.performance.now();else for(o=0;t==1*new Date;)o++;return t.toString(16)+Math.floor(o).toString(16)},e=function(){return Math.random().toString(16).replace(".","")},i=function(){var t=Fe,o,s,r=[],l=0;function c(b,p){var g,f=0;for(g=0;g<p.length;g++)f|=r[g]<<g*8;return b^f}for(o=0;o<t.length;o++)s=t.charCodeAt(o),r.unshift(s&255),r.length>=4&&(l=c(l,r),r=[]);return r.length>0&&(l=c(l,r)),l.toString(16)};return function(){var t=(Ai.height*Ai.width).toString(16);return n()+"-"+e()+"-"+i()+"-"+t+"-"+n()}}();var ko=["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"];h.isBlockedUA=function(n){var e;for(n=n.toLowerCase(),e=0;e<ko.length;e++)if(n.indexOf(ko[e])!==-1)return!0;return!1},h.HTTPBuildQuery=function(n,e){var i,t,o=[];return h.isUndefined(e)&&(e="&"),h.each(n,function(s,r){i=encodeURIComponent(s.toString()),t=encodeURIComponent(r),o[o.length]=t+"="+i}),o.join(e)},h.getQueryParam=function(n,e){e=e.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var i="[\\?&]"+e+"=([^&#]*)",t=new RegExp(i),o=t.exec(n);if(o===null||o&&typeof o[1]!="string"&&o[1].length)return"";var s=o[1];try{s=decodeURIComponent(s)}catch{J.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},h.cookie={get:function(n){for(var e=n+"=",i=X.cookie.split(";"),t=0;t<i.length;t++){for(var o=i[t];o.charAt(0)==" ";)o=o.substring(1,o.length);if(o.indexOf(e)===0)return decodeURIComponent(o.substring(e.length,o.length))}return null},parse:function(n){var e;try{e=h.JSONDecode(h.cookie.get(n))||{}}catch{}return e},set_seconds:function(n,e,i,t,o,s,r){var l="",c="",b="";if(r)l="; domain="+r;else if(t){var p=wo(X.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*1e3),c="; expires="+g.toGMTString()}s&&(o=!0,b="; SameSite=None"),o&&(b+="; secure"),X.cookie=n+"="+encodeURIComponent(e)+c+"; path=/"+l+b},set:function(n,e,i,t,o,s,r){var l="",c="",b="";if(r)l="; domain="+r;else if(t){var p=wo(X.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*24*60*60*1e3),c="; expires="+g.toGMTString()}s&&(o=!0,b="; SameSite=None"),o&&(b+="; secure");var f=n+"="+encodeURIComponent(e)+c+"; path=/"+l+b;return X.cookie=f,f},remove:function(n,e,i){h.cookie.set(n,"",-1,e,!1,!1,i)}};var Yi=null,xi=function(n,e){if(Yi!==null&&!e)return Yi;var i=!0;try{n=n||window.localStorage;var t="__mplss_"+Qi(8),o="xyz";n.setItem(t,o),n.getItem(t)!==o&&(i=!1),n.removeItem(t)}catch{i=!1}return Yi=i,i};h.localStorage={is_supported:function(n){var e=xi(null,n);return e||J.error("localStorage unsupported; falling back to cookie store"),e},error:function(n){J.error("localStorage error: "+n)},get:function(n){try{return window.localStorage.getItem(n)}catch(e){h.localStorage.error(e)}return null},parse:function(n){try{return h.JSONDecode(h.localStorage.get(n))||{}}catch{}return null},set:function(n,e){try{window.localStorage.setItem(n,e)}catch(i){h.localStorage.error(i)}},remove:function(n){try{window.localStorage.removeItem(n)}catch(e){h.localStorage.error(e)}}},h.register_event=function(){var n=function(t,o,s,r,l){if(!t){J.error("No valid element provided to register_event");return}if(t.addEventListener&&!r)t.addEventListener(o,s,!!l);else{var c="on"+o,b=t[c];t[c]=e(t,s,b)}};function e(t,o,s){var r=function(l){if(l=l||i(window.event),!!l){var c=!0,b,p;return h.isFunction(s)&&(b=s(l)),p=o.call(t,l),(b===!1||p===!1)&&(c=!1),c}};return r}function i(t){return t&&(t.preventDefault=i.preventDefault,t.stopPropagation=i.stopPropagation),t}return i.preventDefault=function(){this.returnValue=!1},i.stopPropagation=function(){this.cancelBubble=!0},n}();var sr=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');h.dom_query=function(){function n(o){return o.all?o.all:o.getElementsByTagName("*")}var e=/[\t\r\n]/g;function i(o,s){var r=" "+s+" ";return(" "+o.className+" ").replace(e," ").indexOf(r)>=0}function t(o){if(!X.getElementsByTagName)return[];var s=o.split(" "),r,l,c,b,p,g,f,y,C,k,S=[X];for(g=0;g<s.length;g++){if(r=s[g].replace(/^\s+/,"").replace(/\s+$/,""),r.indexOf("#")>-1){l=r.split("#"),c=l[0];var A=l[1],M=X.getElementById(A);if(!M||c&&M.nodeName.toLowerCase()!=c)return[];S=[M];continue}if(r.indexOf(".")>-1){l=r.split("."),c=l[0];var _=l[1];for(c||(c="*"),b=[],p=0,f=0;f<S.length;f++)for(c=="*"?C=n(S[f]):C=S[f].getElementsByTagName(c),y=0;y<C.length;y++)b[p++]=C[y];for(S=[],k=0,f=0;f<b.length;f++)b[f].className&&h.isString(b[f].className)&&i(b[f],_)&&(S[k++]=b[f]);continue}var E=r.match(sr);if(E){c=E[1];var N=E[2],V=E[3],F=E[4];for(c||(c="*"),b=[],p=0,f=0;f<S.length;f++)for(c=="*"?C=n(S[f]):C=S[f].getElementsByTagName(c),y=0;y<C.length;y++)b[p++]=C[y];S=[],k=0;var U;switch(V){case"=":U=function(G){return G.getAttribute(N)==F};break;case"~":U=function(G){return G.getAttribute(N).match(new RegExp("\\b"+F+"\\b"))};break;case"|":U=function(G){return G.getAttribute(N).match(new RegExp("^"+F+"-?"))};break;case"^":U=function(G){return G.getAttribute(N).indexOf(F)===0};break;case"$":U=function(G){return G.getAttribute(N).lastIndexOf(F)==G.getAttribute(N).length-F.length};break;case"*":U=function(G){return G.getAttribute(N).indexOf(F)>-1};break;default:U=function(G){return G.getAttribute(N)}}for(S=[],k=0,f=0;f<b.length;f++)U(b[f])&&(S[k++]=b[f]);continue}for(c=r,b=[],p=0,f=0;f<S.length;f++)for(C=S[f].getElementsByTagName(c),y=0;y<C.length;y++)b[p++]=C[y];S=b}return S}return function(o){return h.isElement(o)?[o]:h.isObject(o)&&!h.isUndefined(o.length)?o:t.call(this,o)}}();var ar=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],rr=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];h.info={campaignParams:function(n){var e="",i={};return h.each(ar,function(t){e=h.getQueryParam(X.URL,t),e.length?i[t]=e:n!==void 0&&(i[t]=n)}),i},clickParams:function(){var n="",e={};return h.each(rr,function(i){n=h.getQueryParam(X.URL,i),n.length&&(e[i]=n)}),e},marketingParams:function(){return h.extend(h.info.campaignParams(),h.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=h.info.searchEngine(n),i=e!="yahoo"?"q":"p",t={};if(e!==null){t.$search_engine=e;var o=h.getQueryParam(n,i);o.length&&(t.mp_keyword=o)}return t},browser:function(n,e,i){return e=e||"",i||h.includes(n," OPR/")?h.includes(n,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":h.includes(n,"IEMobile")||h.includes(n,"WPDesktop")?"Internet Explorer Mobile":h.includes(n,"SamsungBrowser/")?"Samsung Internet":h.includes(n,"Edge")||h.includes(n,"Edg/")?"Microsoft Edge":h.includes(n,"FBIOS")?"Facebook Mobile":h.includes(n,"Chrome")?"Chrome":h.includes(n,"CriOS")?"Chrome iOS":h.includes(n,"UCWEB")||h.includes(n,"UCBrowser")?"UC Browser":h.includes(n,"FxiOS")?"Firefox iOS":h.includes(e,"Apple")?h.includes(n,"Mobile")?"Mobile Safari":"Safari":h.includes(n,"Android")?"Android Mobile":h.includes(n,"Konqueror")?"Konqueror":h.includes(n,"Firefox")?"Firefox":h.includes(n,"MSIE")||h.includes(n,"Trident/")?"Internet Explorer":h.includes(n,"Gecko")?"Mozilla":""},browserVersion:function(n,e,i){var t=h.info.browser(n,e,i),o={"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+)?)/},s=o[t];if(s===void 0)return null;var r=n.match(s);return r?parseFloat(r[r.length-2]):null},os:function(){var n=Fe;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 R.location.href},properties:function(n){return typeof n!="object"&&(n={}),h.extend(h.strip_empty_properties({$os:h.info.os(),$browser:h.info.browser(Fe,ln.vendor,_i),$referrer:X.referrer,$referring_domain:h.info.referringDomain(X.referrer),$device:h.info.device(Fe)}),{$current_url:h.info.currentUrl(),$browser_version:h.info.browserVersion(Fe,ln.vendor,_i),$screen_height:Ai.height,$screen_width:Ai.width,mp_lib:"web",$lib_version:Je.LIB_VERSION,$insert_id:Qi(),time:h.timestamp()/1e3},h.strip_empty_properties(n))},people_properties:function(){return h.extend(h.strip_empty_properties({$os:h.info.os(),$browser:h.info.browser(Fe,ln.vendor,_i)}),{$browser_version:h.info.browserVersion(Fe,ln.vendor,_i)})},mpPageViewProperties:function(){return h.strip_empty_properties({current_page_title:X.title,current_domain:R.location.hostname,current_url_path:R.location.pathname,current_url_protocol:R.location.protocol,current_url_search:R.location.search})}};var Qi=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},lr=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,dr=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,wo=function(n){var e=dr,i=n.split("."),t=i[i.length-1];(t.length>4||t==="com"||t==="org")&&(e=lr);var o=n.match(e);return o?o[0]:""},cr=function(){var n=R.navigator.onLine;return h.isUndefined(n)||n},Li=null,Ti=null;typeof JSON<"u"&&(Li=JSON.stringify,Ti=JSON.parse),Li=Li||h.JSONEncode,Ti=Ti||h.JSONDecode,h.toArray=h.toArray,h.isObject=h.isObject,h.JSONEncode=h.JSONEncode,h.JSONDecode=h.JSONDecode,h.isBlockedUA=h.isBlockedUA,h.isEmptyObject=h.isEmptyObject,h.info=h.info,h.info.device=h.info.device,h.info.browser=h.info.browser,h.info.browserVersion=h.info.browserVersion,h.info.properties=h.info.properties;var ur="__mp_opt_in_out_";function mr(n,e){_o(!0,n,e)}function hr(n,e){_o(!1,n,e)}function pr(n,e){return So(n,e)==="1"}function Co(n,e){if(vr(e))return J.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 i=So(n,e)==="0";return i&&J.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),i}function dn(n){return nt(n,function(e){return this.get_config(e)})}function cn(n){return nt(n,function(e){return this._get_config(e)})}function Dn(n){return nt(n,function(e){return this._get_config(e)})}function br(n,e){e=e||{},Xi(e).remove(et(n,e),!!e.crossSubdomainCookie,e.cookieDomain)}function Xi(n){return n=n||{},n.persistenceType==="localStorage"?h.localStorage:h.cookie}function et(n,e){return e=e||{},(e.persistencePrefix||ur)+n}function So(n,e){return Xi(e).get(et(n,e))}function vr(n){if(n&&n.ignoreDnt)return!1;var e=n&&n.window||R,i=e.navigator||{},t=!1;return h.each([i.doNotTrack,i.msDoNotTrack,e.doNotTrack],function(o){h.includes([!0,1,"1","yes"],o)&&(t=!0)}),t}function _o(n,e,i){if(!h.isString(e)||!e.length){J.error("gdpr."+(n?"optIn":"optOut")+" called with an invalid token");return}i=i||{},Xi(i).set(et(e,i),n?1:0,h.isNumber(i.cookieExpiration)?i.cookieExpiration:null,!!i.crossSubdomainCookie,!!i.secureCookie,!!i.crossSiteCookie,i.cookieDomain),i.track&&n&&i.track(i.trackEventName||"$opt_in",i.trackProperties,{send_immediately:!0})}function nt(n,e){return function(){var i=!1;try{var t=e.call(this,"token"),o=e.call(this,"ignore_dnt"),s=e.call(this,"opt_out_tracking_persistence_type"),r=e.call(this,"opt_out_tracking_cookie_prefix"),l=e.call(this,"window");t&&(i=Co(t,{ignoreDnt:o,persistenceType:s,persistencePrefix:r,window:l}))}catch(b){J.error("Unexpected error when checking tracking opt-out status: "+b)}if(!i)return n.apply(this,arguments);var c=arguments[arguments.length-1];typeof c=="function"&&c(0)}}var fr=Mi("lock"),Ao=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3};Ao.prototype.withLock=function(n,e,i){!i&&typeof e!="function"&&(i=e,e=null);var t=i||new Date().getTime()+"|"+Math.random(),o=new Date().getTime(),s=this.storageKey,r=this.pollIntervalMS,l=this.timeoutMS,c=this.storage,b=s+":X",p=s+":Y",g=s+":Z",f=function(M){e&&e(M)},y=function(M){if(new Date().getTime()-o>l){fr.error("Timeout waiting for mutex on "+s+"; clearing lock. ["+t+"]"),c.removeItem(g),c.removeItem(p),S();return}setTimeout(function(){try{M()}catch(_){f(_)}},r*(Math.random()+.1))},C=function(M,_){M()?_():y(function(){C(M,_)})},k=function(){var M=c.getItem(p);if(M&&M!==t)return!1;if(c.setItem(p,t),c.getItem(p)===t)return!0;if(!xi(c,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},S=function(){c.setItem(b,t),C(k,function(){if(c.getItem(b)===t){A();return}y(function(){if(c.getItem(p)!==t){S();return}C(function(){return!c.getItem(g)},A)})})},A=function(){c.setItem(g,"1");try{n()}finally{c.removeItem(g),c.getItem(p)===t&&c.removeItem(p),c.getItem(b)===t&&c.removeItem(b)}};try{if(xi(c,!0))S();else throw new Error("localStorage support check failed")}catch(M){f(M)}};var Mo=Mi("batch"),un=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.reportError=e.errorReporter||h.bind(Mo.error,Mo),this.lock=new Ao(n,{storage:this.storage}),this.usePersistence=e.usePersistence,this.pid=e.pid||null,this.memQueue=[]};un.prototype.enqueue=function(n,e,i){var t={id:Qi(),flushAfter:new Date().getTime()+e*2,payload:n};this.usePersistence?this.lock.withLock(h.bind(function(){var s;try{var r=this.readFromStorage();r.push(t),s=this.saveToStorage(r),s&&this.memQueue.push(t)}catch{this.reportError("Error enqueueing item",n),s=!1}i&&i(s)},this),h.bind(function(s){this.reportError("Error acquiring storage lock",s),i&&i(!1)},this),this.pid):(this.memQueue.push(t),i&&i(!0))},un.prototype.fillBatch=function(n){var e=this.memQueue.slice(0,n);if(this.usePersistence&&e.length<n){var i=this.readFromStorage();if(i.length){var t={};h.each(e,function(r){t[r.id]=!0});for(var o=0;o<i.length;o++){var s=i[o];if(new Date().getTime()>s.flushAfter&&!t[s.id]&&(s.orphaned=!0,e.push(s),e.length>=n))break}}}return e};var xo=function(n,e){var i=[];return h.each(n,function(t){t.id&&!e[t.id]&&i.push(t)}),i};un.prototype.removeItemsByID=function(n,e){var i={};if(h.each(n,function(o){i[o]=!0}),this.memQueue=xo(this.memQueue,i),!this.usePersistence)e&&e(!0);else{var t=h.bind(function(){var o;try{var s=this.readFromStorage();if(s=xo(s,i),o=this.saveToStorage(s),o){s=this.readFromStorage();for(var r=0;r<s.length;r++){var l=s[r];if(l.id&&i[l.id])return this.reportError("Item not removed from storage"),!1}}}catch{this.reportError("Error removing items",n),o=!1}return o},this);this.lock.withLock(function(){var s=t();e&&e(s)},h.bind(function(s){var r=!1;if(this.reportError("Error acquiring storage lock",s),!xi(this.storage,!0)&&(r=t(),!r))try{this.storage.removeItem(this.storageKey)}catch(l){this.reportError("Error clearing queue",l)}e&&e(r)},this),this.pid)}};var Lo=function(n,e){var i=[];return h.each(n,function(t){var o=t.id;if(o in e){var s=e[o];s!==null&&(t.payload=s,i.push(t))}else i.push(t)}),i};un.prototype.updatePayloads=function(n,e){this.memQueue=Lo(this.memQueue,n),this.usePersistence?this.lock.withLock(h.bind(function(){var t;try{var o=this.readFromStorage();o=Lo(o,n),t=this.saveToStorage(o)}catch{this.reportError("Error updating items",n),t=!1}e&&e(t)},this),h.bind(function(t){this.reportError("Error acquiring storage lock",t),e&&e(!1)},this),this.pid):e&&e(!0)},un.prototype.readFromStorage=function(){var n;try{n=this.storage.getItem(this.storageKey),n&&(n=Ti(n),h.isArray(n)||(this.reportError("Invalid storage entry:",n),n=null))}catch(e){this.reportError("Error retrieving queue",e),n=null}return n||[]},un.prototype.saveToStorage=function(n){try{return this.storage.setItem(this.storageKey,Li(n)),!0}catch(e){return this.reportError("Error saving queue",e),!1}},un.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var gr=10*60*1e3,Qn=Mi("batch"),He=function(n,e){this.errorReporter=e.errorReporter,this.queue=new un(n,{errorReporter:h.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};He.prototype.enqueue=function(n,e){this.queue.enqueue(n,this.flushInterval,e)},He.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},He.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},He.prototype.clear=function(){this.queue.clear()},He.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},He.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},He.prototype.scheduleFlush=function(n){this.flushInterval=n,this.stopped||(this.timeoutID=setTimeout(h.bind(function(){this.stopped||this.flush()},this),this.flushInterval))},He.prototype.flush=function(n){try{if(this.requestInProgress){Qn.log("Flush: Request already in progress");return}n=n||{};var e=this.libConfig.batch_request_timeout_ms,i=new Date().getTime(),t=this.batchSize,o=this.queue.fillBatch(t),s=o.length===t,r=[],l={};if(h.each(o,function(p){var g=p.payload;if(this.beforeSendHook&&!p.orphaned&&(g=this.beforeSendHook(g)),g){g.event&&g.properties&&(g.properties=h.extend({},g.properties,{mp_sent_by_lib_version:Je.LIB_VERSION}));var f=!0,y=p.id;y?(this.itemIdsSentSuccessfully[y]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:p,batchSize:o.length,timesSent:this.itemIdsSentSuccessfully[y]}),f=!1):this.reportError("[dupe] found item with no ID",{item:p}),f&&r.push(g)}l[p.id]=g},this),r.length<1){this.resetFlush();return}this.requestInProgress=!0;var c=h.bind(function(p){this.requestInProgress=!1;try{var g=!1;if(n.unloading)this.queue.updatePayloads(l);else if(h.isObject(p)&&p.error==="timeout"&&new Date().getTime()-i>=e)this.reportError("Network timeout; retrying"),this.flush();else if(h.isObject(p)&&(p.httpStatusCode>=500||p.httpStatusCode===429||p.httpStatusCode<=0&&!cr()||p.error==="timeout")){var f=this.flushInterval*2;p.retryAfter&&(f=parseInt(p.retryAfter,10)*1e3||f),f=Math.min(gr,f),this.reportError("Error; retry in "+f+" ms"),this.scheduleFlush(f)}else if(h.isObject(p)&&p.httpStatusCode===413)if(o.length>1){var y=Math.max(1,Math.floor(t/2));this.batchSize=Math.min(this.batchSize,y,o.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",o),this.resetBatchSize(),g=!0;else g=!0;g&&(this.queue.removeItemsByID(h.map(o,function(C){return C.id}),h.bind(function(C){C?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!s?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)),h.each(o,h.bind(function(C){var k=C.id;k?(this.itemIdsSentSuccessfully[k]=this.itemIdsSentSuccessfully[k]||0,this.itemIdsSentSuccessfully[k]++,this.itemIdsSentSuccessfully[k]>5&&this.reportError("[dupe] item ID sent too many times",{item:C,batchSize:o.length,timesSent:this.itemIdsSentSuccessfully[k]})):this.reportError("[dupe] found item with no ID while removing",{item:C})},this)))}catch(C){this.reportError("Error handling API response",C),this.resetFlush()}},this),b={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};n.unloading&&(b.transport="sendBeacon"),Qn.log("MIXPANEL REQUEST:",r),this.sendRequest(r,b,c)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},He.prototype.reportError=function(n,e){if(Qn.error.apply(Qn.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(n)),this.errorReporter(n,e)}catch(i){Qn.error(i)}};var kn=Mi("recorder"),To=R.CompressionStream,yr={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},kr=new Set([Ve.MouseMove,Ve.MouseInteraction,Ve.Scroll,Ve.ViewportResize,Ve.Input,Ve.TouchMove,Ve.MediaInteraction,Ve.Drag,Ve.Selection]);function wr(n){return n.type===po.IncrementalSnapshot&&kr.has(n.data.source)}var Ue=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=$n,this.recordMinMs=0,this._initBatcher()};Ue.prototype._initBatcher=function(){this.batcher=new He("__mprec",{libConfig:yr,sendRequestFunc:h.bind(this.flushEventsWithOptOut,this),errorReporter:h.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},Ue.prototype.get_config=function(n){return this._mixpanel.get_config(n)},Ue.prototype.startRecording=function(n){if(this._stopRecording!==null){kn.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>$n&&(this.recordMaxMs=$n,kn.critical("record_max_ms cannot be greater than "+$n+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>Wi&&(this.recordMinMs=Wi,kn.critical("record_min_ms cannot be greater than "+Wi+"ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=new Date().getTime(),this.replayId=h.UUID(),n||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var e=h.bind(function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(h.bind(function(){kn.log("Idle timeout reached, restarting recording."),this.resetRecording()},this),this.get_config("record_idle_timeout_ms"))},this),i=this.get_config("record_block_selector");(i===""||i===null)&&(i=void 0),this._stopRecording=Jn({emit:h.bind(function(t){this.batcher.enqueue(t),wr(t)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),e())},this),blockClass:this.get_config("record_block_class"),blockSelector:i,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(h.bind(this.resetRecording,this),this.recordMaxMs)},Ue.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},Ue.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)},Ue.prototype.flushEventsWithOptOut=function(n,e,i){this._flushEvents(n,e,i,h.bind(this._onOptOut,this))},Ue.prototype._onOptOut=function(n){n===0&&(this.recEvents=[],this.stopRecording())},Ue.prototype._sendRequest=function(n,e,i,t){var o=h.bind(function(s,r){s.status===200&&this.replayId===n&&this.seqNo++,t({status:0,httpStatusCode:s.status,responseBody:r,retryAfter:s.headers.get("Retry-After")})},this);R.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:i}).then(function(s){s.json().then(function(r){o(s,r)}).catch(function(r){t({error:r})})}).catch(function(s){t({error:s,httpStatusCode:0})})},Ue.prototype._flushEvents=dn(function(n,e,i){const t=n.length;if(t>0){var o=this.replayId,s=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=s);var r=n[t-1].timestamp-this.replayStartTime,l={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:s/1e3,replay_id:o,replay_length_ms:r,replay_start_time:this.replayStartTime/1e3},c=h.JSONEncode(n),b=this._mixpanel.get_property("$device_id");b&&(l.$device_id=b);var p=this._mixpanel.get_property("$user_id");if(p&&(l.$user_id=p),To){var g=new Blob([c],{type:"application/json"}).stream(),f=g.pipeThrough(new To("gzip"));new Response(f).blob().then(h.bind(function(y){l.format="gzip",this._sendRequest(o,l,y,i)},this))}else l.format="body",this._sendRequest(o,l,c,i)}}),Ue.prototype.reportError=function(n,e){kn.error.apply(kn.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(i){kn.error(i)}},R.__mp_recorder=Ue;var $e=function(){};$e.prototype.create_properties=function(){},$e.prototype.event_handler=function(){},$e.prototype.after_track_handler=function(){},$e.prototype.init=function(n){return this.mp=n,this},$e.prototype.track=function(n,e,i,t){var o=this,s=h.dom_query(n);if(s.length===0){J.error("The DOM query ("+n+") returned 0 elements");return}return h.each(s,function(r){h.register_event(r,this.override_event,function(l){var c={},b=o.create_properties(i,this),p=o.mp.get_config("track_links_timeout");o.event_handler(l,this,c),window.setTimeout(o.track_callback(t,b,c,!0),p),o.mp.track(e,b,o.track_callback(t,b,c))})},this),!0},$e.prototype.track_callback=function(n,e,i,t){t=t||!1;var o=this;return function(){i.callback_fired||(i.callback_fired=!0,!(n&&n(t,e)===!1)&&o.after_track_handler(e,i,t))}},$e.prototype.create_properties=function(n,e){var i;return typeof n=="function"?i=n(e):i=h.extend({},n),i};var On=function(){this.override_event="click"};h.inherit(On,$e),On.prototype.create_properties=function(n,e){var i=On.superclass.create_properties.apply(this,arguments);return e.href&&(i.url=e.href),i},On.prototype.event_handler=function(n,e,i){i.new_tab=n.which===2||n.metaKey||n.ctrlKey||e.target==="_blank",i.href=e.href,i.new_tab||n.preventDefault()},On.prototype.after_track_handler=function(n,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var Ei=function(){this.override_event="submit"};h.inherit(Ei,$e),Ei.prototype.event_handler=function(n,e,i){i.element=e,n.preventDefault()},Ei.prototype.after_track_handler=function(n,e){setTimeout(function(){e.element.submit()},0)};var mn="$set",Hn="$set_once",Ke="$unset",wn="$add",ze="$append",Cn="$union",Ye="$remove",Cr="$delete",Eo={set_action:function(n,e){var i={},t={};return h.isObject(n)?h.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[mn]=t,i},unset_action:function(n){var e={},i=[];return h.isArray(n)||(n=[n]),h.each(n,function(t){this._is_reserved_property(t)||i.push(t)},this),e[Ke]=i,e},set_once_action:function(n,e){var i={},t={};return h.isObject(n)?h.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Hn]=t,i},union_action:function(n,e){var i={},t={};return h.isObject(n)?h.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=h.isArray(o)?o:[o])},this):t[n]=h.isArray(e)?e:[e],i[Cn]=t,i},append_action:function(n,e){var i={},t={};return h.isObject(n)?h.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[ze]=t,i},remove_action:function(n,e){var i={},t={};return h.isObject(n)?h.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Ye]=t,i},delete_action:function(){var n={};return n[Cr]="",n}},ie=function(){};h.extend(ie.prototype,Eo),ie.prototype._init=function(n,e,i){this._mixpanel=n,this._group_key=e,this._group_id=i},ie.prototype.set=Dn(function(n,e,i){var t=this.set_action(n,e);return h.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.set_once=Dn(function(n,e,i){var t=this.set_once_action(n,e);return h.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.unset=Dn(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),ie.prototype.union=Dn(function(n,e,i){h.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),ie.prototype.delete=Dn(function(n){var e=this.delete_action();return this._send_request(e,n)}),ie.prototype.remove=Dn(function(n,e,i){var t=this.remove_action(n,e);return this._send_request(t,i)}),ie.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 i=h.encodeDates(n);return this._mixpanel._track_or_batch({type:"groups",data:i,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},e)},ie.prototype._is_reserved_property=function(n){return n==="$group_key"||n==="$group_id"},ie.prototype._get_config=function(n){return this._mixpanel.get_config(n)},ie.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},ie.prototype.remove=ie.prototype.remove,ie.prototype.set=ie.prototype.set,ie.prototype.set_once=ie.prototype.set_once,ie.prototype.union=ie.prototype.union,ie.prototype.unset=ie.prototype.unset,ie.prototype.toString=ie.prototype.toString;var D=function(){};h.extend(D.prototype,Eo),D.prototype._init=function(n){this._mixpanel=n},D.prototype.set=cn(function(n,e,i){var t=this.set_action(n,e);return h.isObject(n)&&(i=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),t[mn]=h.extend({},h.info.people_properties(),t[mn]),this._send_request(t,i)}),D.prototype.set_once=cn(function(n,e,i){var t=this.set_once_action(n,e);return h.isObject(n)&&(i=e),this._send_request(t,i)}),D.prototype.unset=cn(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),D.prototype.increment=cn(function(n,e,i){var t={},o={};return h.isObject(n)?(h.each(n,function(s,r){if(!this._is_reserved_property(r))if(isNaN(parseFloat(s))){J.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else o[r]=s},this),i=e):(h.isUndefined(e)&&(e=1),o[n]=e),t[wn]=o,this._send_request(t,i)}),D.prototype.append=cn(function(n,e,i){h.isObject(n)&&(i=e);var t=this.append_action(n,e);return this._send_request(t,i)}),D.prototype.remove=cn(function(n,e,i){h.isObject(n)&&(i=e);var t=this.remove_action(n,e);return this._send_request(t,i)}),D.prototype.union=cn(function(n,e,i){h.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),D.prototype.track_charge=cn(function(n,e,i){if(!h.isNumber(n)&&(n=parseFloat(n),isNaN(n))){J.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",h.extend({$amount:n},e),i)}),D.prototype.clear_charges=function(n){return this.set("$transactions",[],n)},D.prototype.delete_user=function(){if(!this._identify_called()){J.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)},D.prototype.toString=function(){return this._mixpanel.toString()+".people"},D.prototype._send_request=function(n,e){n.$token=this._get_config("token"),n.$distinct_id=this._mixpanel.get_distinct_id();var i=this._mixpanel.get_property("$device_id"),t=this._mixpanel.get_property("$user_id"),o=this._mixpanel.get_property("$had_persisted_distinct_id");i&&(n.$device_id=i),t&&(n.$user_id=t),o&&(n.$had_persisted_distinct_id=o);var s=h.encodeDates(n);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:s,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},e):(this._enqueue(n),h.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),h.truncate(s,255))},D.prototype._get_config=function(n){return this._mixpanel.get_config(n)},D.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},D.prototype._enqueue=function(n){mn in n?this._mixpanel.persistence._add_to_people_queue(mn,n):Hn in n?this._mixpanel.persistence._add_to_people_queue(Hn,n):Ke in n?this._mixpanel.persistence._add_to_people_queue(Ke,n):wn in n?this._mixpanel.persistence._add_to_people_queue(wn,n):ze in n?this._mixpanel.persistence._add_to_people_queue(ze,n):Ye in n?this._mixpanel.persistence._add_to_people_queue(Ye,n):Cn in n?this._mixpanel.persistence._add_to_people_queue(Cn,n):J.error("Invalid call to _enqueue():",n)},D.prototype._flush_one_queue=function(n,e,i,t){var o=this,s=h.extend({},this._mixpanel.persistence.load_queue(n)),r=s;!h.isUndefined(s)&&h.isObject(s)&&!h.isEmptyObject(s)&&(o._mixpanel.persistence._pop_from_people_queue(n,s),o._mixpanel.persistence.save(),t&&(r=t(s)),e.call(o,r,function(l,c){l===0&&o._mixpanel.persistence._add_to_people_queue(n,s),h.isUndefined(i)||i(l,c)}))},D.prototype._flush=function(n,e,i,t,o,s,r){var l=this;this._flush_one_queue(mn,this.set,n),this._flush_one_queue(Hn,this.set_once,t),this._flush_one_queue(Ke,this.unset,s,function(S){return h.keys(S)}),this._flush_one_queue(wn,this.increment,e),this._flush_one_queue(Cn,this.union,o);var c=this._mixpanel.persistence.load_queue(ze);if(!h.isUndefined(c)&&h.isArray(c)&&c.length)for(var b,p=function(S,A){S===0&&l._mixpanel.persistence._add_to_people_queue(ze,b),h.isUndefined(i)||i(S,A)},g=c.length-1;g>=0;g--)c=this._mixpanel.persistence.load_queue(ze),b=c.pop(),l._mixpanel.persistence.save(),h.isEmptyObject(b)||l.append(b,p);var f=this._mixpanel.persistence.load_queue(Ye);if(!h.isUndefined(f)&&h.isArray(f)&&f.length)for(var y,C=function(S,A){S===0&&l._mixpanel.persistence._add_to_people_queue(Ye,y),h.isUndefined(r)||r(S,A)},k=f.length-1;k>=0;k--)f=this._mixpanel.persistence.load_queue(Ye),y=f.pop(),l._mixpanel.persistence.save(),h.isEmptyObject(y)||l.remove(y,C)},D.prototype._is_reserved_property=function(n){return n==="$distinct_id"||n==="$token"||n==="$device_id"||n==="$user_id"||n==="$had_persisted_distinct_id"},D.prototype.set=D.prototype.set,D.prototype.set_once=D.prototype.set_once,D.prototype.unset=D.prototype.unset,D.prototype.increment=D.prototype.increment,D.prototype.append=D.prototype.append,D.prototype.remove=D.prototype.remove,D.prototype.union=D.prototype.union,D.prototype.track_charge=D.prototype.track_charge,D.prototype.clear_charges=D.prototype.clear_charges,D.prototype.delete_user=D.prototype.delete_user,D.prototype.toString=D.prototype.toString;var it="__mps",tt="__mpso",ot="__mpus",st="__mpa",at="__mpap",rt="__mpr",lt="__mpu",Po="$people_distinct_id",Pi="__alias",Xn="__timers",Sr=[it,tt,ot,st,at,rt,lt,Po,Pi,Xn],j=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"&&(J.critical("Unknown persistence type "+e+"; falling back to cookie"),e=n.persistence="cookie"),e==="localStorage"&&h.localStorage.is_supported()?this.storage=h.localStorage:this.storage=h.cookie,this.load(),this.update_config(n),this.upgrade(),this.save()};j.prototype.properties=function(){var n={};return this.load(),h.each(this.props,function(e,i){h.include(Sr,i)||(n[i]=e)}),n},j.prototype.load=function(){if(!this.disabled){var n=this.storage.parse(this.name);n&&(this.props=h.extend({},n))}},j.prototype.upgrade=function(){var n,e;this.storage===h.localStorage?(n=h.cookie.parse(this.name),h.cookie.remove(this.name),h.cookie.remove(this.name,!0),n&&this.register_once(n)):this.storage===h.cookie&&(e=h.localStorage.parse(this.name),h.localStorage.remove(this.name),e&&this.register_once(e))},j.prototype.save=function(){this.disabled||this.storage.set(this.name,h.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},j.prototype.load_prop=function(n){return this.load(),this.props[n]},j.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},j.prototype.clear=function(){this.remove(),this.props={}},j.prototype.register_once=function(n,e,i){return h.isObject(n)?(typeof e>"u"&&(e="None"),this.expire_days=typeof i>"u"?this.default_expiry:i,this.load(),h.each(n,function(t,o){(!this.props.hasOwnProperty(o)||this.props[o]===e)&&(this.props[o]=t)},this),this.save(),!0):!1},j.prototype.register=function(n,e){return h.isObject(n)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),h.extend(this.props,n),this.save(),!0):!1},j.prototype.unregister=function(n){this.load(),n in this.props&&(delete this.props[n],this.save())},j.prototype.update_search_keyword=function(n){this.register(h.info.searchInfo(n))},j.prototype.update_referrer_info=function(n){this.register_once({$initial_referrer:n||"$direct",$initial_referring_domain:h.info.referringDomain(n)||"$direct"},"")},j.prototype.get_referrer_info=function(){return h.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},j.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)},j.prototype.set_disabled=function(n){this.disabled=n,this.disabled?this.remove():this.save()},j.prototype.set_cookie_domain=function(n){n!==this.cookie_domain&&(this.remove(),this.cookie_domain=n,this.save())},j.prototype.set_cross_site=function(n){n!==this.cross_site&&(this.cross_site=n,this.remove(),this.save())},j.prototype.set_cross_subdomain=function(n){n!==this.cross_subdomain&&(this.cross_subdomain=n,this.remove(),this.save())},j.prototype.get_cross_subdomain=function(){return this.cross_subdomain},j.prototype.set_secure=function(n){n!==this.secure&&(this.secure=!!n,this.remove(),this.save())},j.prototype._add_to_people_queue=function(n,e){var i=this._get_queue_key(n),t=e[n],o=this._get_or_create_queue(mn),s=this._get_or_create_queue(Hn),r=this._get_or_create_queue(Ke),l=this._get_or_create_queue(wn),c=this._get_or_create_queue(Cn),b=this._get_or_create_queue(Ye,[]),p=this._get_or_create_queue(ze,[]);i===it?(h.extend(o,t),this._pop_from_people_queue(wn,t),this._pop_from_people_queue(Cn,t),this._pop_from_people_queue(Ke,t)):i===tt?(h.each(t,function(g,f){f in s||(s[f]=g)}),this._pop_from_people_queue(Ke,t)):i===ot?h.each(t,function(g){h.each([o,s,l,c],function(f){g in f&&delete f[g]}),h.each(p,function(f){g in f&&delete f[g]}),r[g]=!0}):i===st?(h.each(t,function(g,f){f in o?o[f]+=g:(f in l||(l[f]=0),l[f]+=g)},this),this._pop_from_people_queue(Ke,t)):i===lt?(h.each(t,function(g,f){h.isArray(g)&&(f in c||(c[f]=[]),c[f]=c[f].concat(g))}),this._pop_from_people_queue(Ke,t)):i===rt?(b.push(t),this._pop_from_people_queue(ze,t)):i===at&&(p.push(t),this._pop_from_people_queue(Ke,t)),J.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),J.log(e),this.save()},j.prototype._pop_from_people_queue=function(n,e){var i=this.props[this._get_queue_key(n)];h.isUndefined(i)||h.each(e,function(t,o){n===ze||n===Ye?h.each(i,function(s){s[o]===t&&delete s[o]}):delete i[o]},this)},j.prototype.load_queue=function(n){return this.load_prop(this._get_queue_key(n))},j.prototype._get_queue_key=function(n){if(n===mn)return it;if(n===Hn)return tt;if(n===Ke)return ot;if(n===wn)return st;if(n===ze)return at;if(n===Ye)return rt;if(n===Cn)return lt;J.error("Invalid queue:",n)},j.prototype._get_or_create_queue=function(n,e){var i=this._get_queue_key(n);return e=h.isUndefined(e)?{}:e,this.props[i]||(this.props[i]=e)},j.prototype.set_event_timer=function(n,e){var i=this.load_prop(Xn)||{};i[n]=e,this.props[Xn]=i,this.save()},j.prototype.remove_event_timer=function(n){var e=this.load_prop(Xn)||{},i=e[n];return h.isUndefined(i)||(delete this.props[Xn][n],this.save()),i};var dt,No=function(n,e){throw new Error(n+" not available in this build.")},we,Io=0,_r=1,Ar=function(n){return n},ei=function(){},Be="mixpanel",Bo="base64",Mr="json",ct="$device:",Un=R.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,Ro=!Un&&Fe.indexOf("MSIE")===-1&&Fe.indexOf("Mozilla")===-1,Ni=null;ln.sendBeacon&&(Ni=function(){return ln.sendBeacon.apply(ln,arguments)});var Do={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},Oo={api_host:"https://api-js.mixpanel.com",api_routes:Do,api_method:"POST",api_transport:"XHR",api_payload_format:Bo,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:ei,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:ei,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:$n,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},Ho=!1,x=function(){},ut=function(n,e,i){var t,o=i===Be?we:we[i];if(o&&dt===Io)t=o;else{if(o&&!h.isArray(o)){J.error("You have already initialized "+i);return}t=new x}if(t._cached_groups={},t._init(n,e,i),t.people=new D,t.people._init(t),!t.get_config("skip_first_touch_marketing")){var s=h.info.campaignParams(null),r={},l=!1;h.each(s,function(c,b){r["initial_"+b]=c,c&&(l=!0)}),l&&t.people.set_once(r)}return Je.DEBUG=Je.DEBUG||t.get_config("debug"),!h.isUndefined(o)&&h.isArray(o)&&(t._execute_array.call(t.people,o.people),t._execute_array(o)),t};x.prototype.init=function(n,e,i){if(h.isUndefined(i)){this.report_error("You must name your new library: init(token, config, name)");return}if(i===Be){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var t=ut(n,e,i);return we[i]=t,t._loaded(),t},x.prototype._init=function(n,e,i){e=e||{},this.__loaded=!0,this.config={};var t={};if(!("api_payload_format"in e)){var o=e.api_host||Oo.api_host;o.match(/\.mixpanel\.com/)&&(t.api_payload_format=Mr)}if(this.set_config(h.extend({},Oo,t,e,{name:i,token:n,callback_fn:(i===Be?i:Be+"."+i)+"._jsc"})),this._jsc=ei,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(!h.localStorage.is_supported(!0)||!Un)this._batch_requests=!1,J.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),h.each(this.get_batcher_configs(),function(c){J.log("Clearing batch queue "+c.queue_key),h.localStorage.remove(c.queue_key)});else if(this.init_batchers(),Ni&&R.addEventListener){var s=h.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);R.addEventListener("pagehide",function(c){c.persisted&&s()}),R.addEventListener("visibilitychange",function(){X.visibilityState==="hidden"&&s()})}}this.persistence=this.cookie=new j(this.config),this.unpersisted_superprops={},this._gdpr_init();var r=h.UUID();this.get_distinct_id()||this.register_once({distinct_id:ct+r,$device_id:r},"");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()},x.prototype.start_session_recording=dn(function(){if(!R.MutationObserver){J.critical("Browser does not support MutationObserver; skipping session recording");return}var n=h.bind(function(){this._recorder=this._recorder||new R.__mp_recorder(this),this._recorder.startRecording()},this);h.isUndefined(R.__mp_recorder)?No(this.get_config("recorder_src"),n):n()}),x.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():J.critical("Session recorder module not loaded")},x.prototype.get_session_recording_properties=function(){var n={};if(this._recorder){var e=this._recorder.replayId;e&&(n.$mp_replay_id=e)}return n},x.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=h.info.campaignParams(null);h.each(n,(function(e,i){this.unregister(i)}).bind(this))}},x.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(X.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(h.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(X.referrer)},x.prototype._dom_loaded=function(){h.each(this.__dom_loaded_queue,function(n){this._track_dom.apply(this,n)},this),this.has_opted_out_tracking()||h.each(this.__request_queue,function(n){this._send_request.apply(this,n)},this),delete this.__dom_loaded_queue,delete this.__request_queue},x.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(!Ho)return this.__dom_loaded_queue.push([n,e]),!1;var i=new n().init(this);return i.track.apply(i,e)},x.prototype._init_url_change_tracking=function(n){var e="",i=this.track_pageview();if(i&&(e=h.info.currentUrl()),h.include(["full-url","url-with-path-and-query-string","url-with-path"],n)){R.addEventListener("popstate",function(){R.dispatchEvent(new Event("mp_locationchange"))}),R.addEventListener("hashchange",function(){R.dispatchEvent(new Event("mp_locationchange"))});var t=R.history.pushState;typeof t=="function"&&(R.history.pushState=function(s,r,l){t.call(R.history,s,r,l),R.dispatchEvent(new Event("mp_locationchange"))});var o=R.history.replaceState;typeof o=="function"&&(R.history.replaceState=function(s,r,l){o.call(R.history,s,r,l),R.dispatchEvent(new Event("mp_locationchange"))}),R.addEventListener("mp_locationchange",(function(){var s=h.info.currentUrl(),r=!1;if(n==="full-url"?r=s!==e:n==="url-with-path-and-query-string"?r=s.split("#")[0]!==e.split("#")[0]:n==="url-with-path"&&(r=s.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0]),r){var l=this.track_pageview();l&&(e=s)}}).bind(this))}},x.prototype._prepare_callback=function(n,e){if(h.isUndefined(n))return null;if(Un){var i=function(r){n(r,e)};return i}else{var t=this._jsc,o=""+Math.floor(Math.random()*1e8),s=this.get_config("callback_fn")+"["+o+"]";return t[o]=function(r){delete t[o],n(r,e)},s}},x.prototype._send_request=function(n,e,i,t){var o=!0;if(Ro)return this.__request_queue.push(arguments),o;var s={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},r=null;!t&&(h.isFunction(i)||typeof i=="string")&&(t=i,i=null),i=h.extend(s,i||{}),Un||(i.method="GET");var l=i.method==="POST",c=Ni&&l&&i.transport.toLowerCase()==="sendbeacon",b=i.verbose;e.verbose&&(b=!0),this.get_config("test")&&(e.test=1),b&&(e.verbose=1),this.get_config("img")&&(e.img=1),Un||(t?e.callback=t:(b||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),l&&(r="data="+encodeURIComponent(e.data),delete e.data),n+="?"+h.HTTPBuildQuery(e);var p=this;if("img"in e){var g=X.createElement("img");g.src=n,X.body.appendChild(g)}else if(c){try{o=Ni(n,r)}catch(A){p.report_error(A),o=!1}try{t&&t(o?1:0)}catch(A){p.report_error(A)}}else if(Un)try{var f=new XMLHttpRequest;f.open(i.method,n,!0);var y=this.get_config("xhr_headers");if(l&&(y["Content-Type"]="application/x-www-form-urlencoded"),h.each(y,function(A,M){f.setRequestHeader(M,A)}),i.timeout_ms&&typeof f.timeout<"u"){f.timeout=i.timeout_ms;var C=new Date().getTime()}f.withCredentials=!0,f.onreadystatechange=function(){if(f.readyState===4)if(f.status===200){if(t)if(b){var A;try{A=h.JSONDecode(f.responseText)}catch(E){if(p.report_error(E),i.ignore_json_errors)A=f.responseText;else return}t(A)}else t(Number(f.responseText))}else{var M;if(f.timeout&&!f.status&&new Date().getTime()-C>=f.timeout?M="timeout":M="Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(M),t)if(b){var _=f.responseHeaders||{};t({status:0,httpStatusCode:f.status,error:M,retryAfter:_["Retry-After"]})}else t(0)}},f.send(r)}catch(A){p.report_error(A),o=!1}else{var k=X.createElement("script");k.type="text/javascript",k.async=!0,k.defer=!0,k.src=n;var S=X.getElementsByTagName("script")[0];S.parentNode.insertBefore(k,S)}return o},x.prototype._execute_array=function(n){var e,i=[],t=[],o=[];h.each(n,function(r){r&&(e=r[0],h.isArray(e)?o.push(r):typeof r=="function"?r.call(this):h.isArray(r)&&e==="alias"?i.push(r):h.isArray(r)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?o.push(r):t.push(r))},this);var s=function(r,l){h.each(r,function(c){if(h.isArray(c[0])){var b=l;h.each(c,function(p){b=b[p[0]].apply(b,p.slice(1))})}else this[c[0]].apply(this,c.slice(1))},l)};s(i,this),s(t,this),s(o,this)},x.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},x.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},x.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var n=h.bind(function(i){return new He(i.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:h.bind(function(t,o,s){this._send_request(this.get_config("api_host")+i.endpoint,this._encode_data_for_request(t),o,this._prepare_callback(s,t))},this),beforeSendHook:h.bind(function(t){return this._run_hook("before_send_"+i.type,t)},this),stopAllBatchingFunc:h.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()},x.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,h.each(this.request_batchers,function(n){n.start()}))},x.prototype.stop_batch_senders=function(){this._batch_requests=!1,h.each(this.request_batchers,function(n){n.stop(),n.clear()})},x.prototype.push=function(n){this._execute_array([n])},x.prototype.disable=function(n){typeof n>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(n)},x.prototype._encode_data_for_request=function(n){var e=h.JSONEncode(n);return this.get_config("api_payload_format")===Bo&&(e=h.base64Encode(e)),{data:e}},x.prototype._track_or_batch=function(n,e){var i=h.truncate(n.data,255),t=n.endpoint,o=n.batcher,s=n.should_send_immediately,r=n.send_request_options||{};e=e||ei;var l=!0,c=h.bind(function(){return r.skip_hooks||(i=this._run_hook("before_send_"+n.type,i)),i?(J.log("MIXPANEL REQUEST:"),J.log(i),this._send_request(t,this._encode_data_for_request(i),r,this._prepare_callback(e,i))):null},this);return this._batch_requests&&!s?o.enqueue(i,function(b){b?e(1,i):c()}):l=c(),l&&i},x.prototype.track=dn(function(n,e,i,t){!t&&typeof i=="function"&&(t=i,i=null),i=i||{};var o=i.transport;o&&(i.transport=o);var s=i.send_immediately;if(typeof t!="function"&&(t=ei),h.isUndefined(n)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(n)){t(0);return}e=h.extend({},e),e.token=this.get_config("token");var r=this.persistence.remove_event_timer(n);if(!h.isUndefined(r)){var l=new Date().getTime()-r;e.$duration=parseFloat((l/1e3).toFixed(3))}this._set_default_superprops();var c=this.get_config("track_marketing")?h.info.marketingParams():{};e=h.extend({},h.info.properties({mp_loader:this.get_config("mp_loader")}),c,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),e);var b=this.get_config("property_blacklist");h.isArray(b)?h.each(b,function(f){delete e[f]}):this.report_error("Invalid value for property_blacklist config: "+b);var p={event:n,properties:e},g=this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:s,send_request_options:i},t);return g}),x.prototype.set_group=dn(function(n,e,i){h.isArray(e)||(e=[e]);var t={};return t[n]=e,this.register(t),this.people.set(n,e,i)}),x.prototype.add_group=dn(function(n,e,i){var t=this.get_property(n),o={};return t===void 0?(o[n]=[e],this.register(o)):t.indexOf(e)===-1&&(t.push(e),o[n]=t,this.register(o)),this.people.union(n,e,i)}),x.prototype.remove_group=dn(function(n,e,i){var t=this.get_property(n);if(t!==void 0){var o=t.indexOf(e);o>-1&&(t.splice(o,1),this.register({group_key:t})),t.length===0&&this.unregister(n)}return this.people.remove(n,e,i)}),x.prototype.track_with_groups=dn(function(n,e,i,t){var o=h.extend({},e||{});return h.each(i,function(s,r){s!=null&&(o[r]=s)}),this.track(n,o,t)}),x.prototype._create_map_key=function(n,e){return n+"_"+JSON.stringify(e)},x.prototype._remove_group_from_cache=function(n,e){delete this._cached_groups[this._create_map_key(n,e)]},x.prototype.get_group=function(n,e){var i=this._create_map_key(n,e),t=this._cached_groups[i];return(t===void 0||t._group_key!==n||t._group_id!==e)&&(t=new ie,t._init(this,n,e),this._cached_groups[i]=t),t},x.prototype.track_pageview=dn(function(n,e){typeof n!="object"&&(n={}),e=e||{};var i=e.event_name||"$mp_web_page_view",t=h.extend(h.info.mpPageViewProperties(),h.info.campaignParams(),h.info.clickParams()),o=h.extend({},t,n);return this.track(i,o)}),x.prototype.track_links=function(){return this._track_dom.call(this,On,arguments)},x.prototype.track_forms=function(){return this._track_dom.call(this,Ei,arguments)},x.prototype.time_event=function(n){if(h.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 xr={persistent:!0},mt=function(n){var e;return h.isObject(n)?e=n:h.isUndefined(n)?e={}:e={days:n},h.extend({},xr,e)};x.prototype.register=function(n,e){var i=mt(e);i.persistent?this.persistence.register(n,i.days):h.extend(this.unpersisted_superprops,n)},x.prototype.register_once=function(n,e,i){var t=mt(i);t.persistent?this.persistence.register_once(n,e,t.days):(typeof e>"u"&&(e="None"),h.each(n,function(o,s){(!this.unpersisted_superprops.hasOwnProperty(s)||this.unpersisted_superprops[s]===e)&&(this.unpersisted_superprops[s]=o)},this))},x.prototype.unregister=function(n,e){e=mt(e),e.persistent?this.persistence.unregister(n):delete this.unpersisted_superprops[n]},x.prototype._register_single=function(n,e){var i={};i[n]=e,this.register(i)},x.prototype.identify=function(n,e,i,t,o,s,r,l){var c=this.get_distinct_id();if(n&&c!==n){if(typeof n=="string"&&n.indexOf(ct)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:n})}if(!this.get_property("$device_id")){var b=c;this.register_once({$had_persisted_distinct_id:!0,$device_id:b},"")}n!==c&&n!==this.get_property(Pi)&&(this.unregister(Pi),this.register({distinct_id:n})),this._flags.identify_called=!0,this.people._flush(e,i,t,o,s,r,l),n!==c&&this.track("$identify",{distinct_id:n,$anon_distinct_id:c},{skip_hooks:!0})},x.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var n=h.UUID();this.register_once({distinct_id:ct+n,$device_id:n},"")},x.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},x.prototype.alias=function(n,e){if(n===this.get_property(Po))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var i=this;return h.isUndefined(e)&&(e=this.get_distinct_id()),n!==e?(this._register_single(Pi,n),this.track("$create_alias",{alias:n,distinct_id:e},{skip_hooks:!0},function(){i.identify(n)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(n),-1)},x.prototype.name_tag=function(n){this._register_single("mp_name_tag",n)},x.prototype.set_config=function(n){if(h.isObject(n)){h.extend(this.config,n);var e=n.batch_size;e&&h.each(this.request_batchers,function(i){i.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),Je.DEBUG=Je.DEBUG||this.get_config("debug")}},x.prototype.get_config=function(n){return this.config[n]},x.prototype._run_hook=function(n){var e=(this.config.hooks[n]||Ar).apply(this,rn.call(arguments,1));return typeof e>"u"&&(this.report_error(n+" hook did not return a value"),e=null),e},x.prototype.get_property=function(n){return this.persistence.load_prop([n])},x.prototype.toString=function(){var n=this.get_config("name");return n!==Be&&(n=Be+"."+n),n},x.prototype._event_is_disabled=function(n){return h.isBlockedUA(Fe)||this._flags.disable_all_events||h.include(this.__disabled_events,n)},x.prototype._gdpr_init=function(){var n=this.get_config("opt_out_tracking_persistence_type")==="localStorage";n&&h.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")||h.cookie.get("mp_optout"))&&(h.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},x.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()},x.prototype._gdpr_call_func=function(n,e){return e=h.extend({track:h.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),h.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})},x.prototype.opt_in_tracking=function(n){n=h.extend({enable_persistence:!0},n),this._gdpr_call_func(mr,n),this._gdpr_update_persistence(n)},x.prototype.opt_out_tracking=function(n){n=h.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(hr,n),this._gdpr_update_persistence(n)},x.prototype.has_opted_in_tracking=function(n){return this._gdpr_call_func(pr,n)},x.prototype.has_opted_out_tracking=function(n){return this._gdpr_call_func(Co,n)},x.prototype.clear_opt_in_out_tracking=function(n){n=h.extend({enable_persistence:!0},n),this._gdpr_call_func(br,n),this._gdpr_update_persistence(n)},x.prototype.report_error=function(n,e){J.error.apply(J.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(i){J.error(i)}},x.prototype.init=x.prototype.init,x.prototype.reset=x.prototype.reset,x.prototype.disable=x.prototype.disable,x.prototype.time_event=x.prototype.time_event,x.prototype.track=x.prototype.track,x.prototype.track_links=x.prototype.track_links,x.prototype.track_forms=x.prototype.track_forms,x.prototype.track_pageview=x.prototype.track_pageview,x.prototype.register=x.prototype.register,x.prototype.register_once=x.prototype.register_once,x.prototype.unregister=x.prototype.unregister,x.prototype.identify=x.prototype.identify,x.prototype.alias=x.prototype.alias,x.prototype.name_tag=x.prototype.name_tag,x.prototype.set_config=x.prototype.set_config,x.prototype.get_config=x.prototype.get_config,x.prototype.get_property=x.prototype.get_property,x.prototype.get_distinct_id=x.prototype.get_distinct_id,x.prototype.toString=x.prototype.toString,x.prototype.opt_out_tracking=x.prototype.opt_out_tracking,x.prototype.opt_in_tracking=x.prototype.opt_in_tracking,x.prototype.has_opted_out_tracking=x.prototype.has_opted_out_tracking,x.prototype.has_opted_in_tracking=x.prototype.has_opted_in_tracking,x.prototype.clear_opt_in_out_tracking=x.prototype.clear_opt_in_out_tracking,x.prototype.get_group=x.prototype.get_group,x.prototype.set_group=x.prototype.set_group,x.prototype.add_group=x.prototype.add_group,x.prototype.remove_group=x.prototype.remove_group,x.prototype.track_with_groups=x.prototype.track_with_groups,x.prototype.start_batch_senders=x.prototype.start_batch_senders,x.prototype.stop_batch_senders=x.prototype.stop_batch_senders,x.prototype.start_session_recording=x.prototype.start_session_recording,x.prototype.stop_session_recording=x.prototype.stop_session_recording,x.prototype.get_session_recording_properties=x.prototype.get_session_recording_properties,x.prototype.DEFAULT_API_ROUTES=Do,j.prototype.properties=j.prototype.properties,j.prototype.update_search_keyword=j.prototype.update_search_keyword,j.prototype.update_referrer_info=j.prototype.update_referrer_info,j.prototype.get_cross_subdomain=j.prototype.get_cross_subdomain,j.prototype.clear=j.prototype.clear;var Kn={},Lr=function(){h.each(Kn,function(n,e){e!==Be&&(we[e]=n)}),we._=h},Tr=function(){we.init=function(n,e,i){if(i)return we[i]||(we[i]=Kn[i]=ut(n,e,i),we[i]._loaded()),we[i];var t=we;Kn[Be]?t=Kn[Be]:n&&(t=ut(n,e,Be),t._loaded(),Kn[Be]=t),we=t,dt===_r&&(R[Be]=we),Lr()}},Er=function(){function n(){n.done||(n.done=!0,Ho=!0,Ro=!1,h.each(Kn,function(t){t._dom_loaded()}))}function e(){try{X.documentElement.doScroll("left")}catch{setTimeout(e,1);return}n()}if(X.addEventListener)X.readyState==="complete"?n():X.addEventListener("DOMContentLoaded",n,!1);else if(X.attachEvent){X.attachEvent("onreadystatechange",n);var i=!1;try{i=R.frameElement===null}catch{}X.documentElement.doScroll&&i&&e()}h.register_event(R,"load",n,!0)};function Pr(n){return No=n,dt=Io,we=new x,Tr(),we.init(),Er(),we}function Nr(n,e){e()}var P=Pr(Nr);const Uo=`<div id="checkoutConfirmationEnd">
714
+ `);var e="",i,t,o=0,s;for(i=t=0,o=n.length,s=0;s<o;s++){var r=n.charCodeAt(s),l=null;r<128?t++:r>127&&r<2048?l=String.fromCharCode(r>>6|192,r&63|128):l=String.fromCharCode(r>>12|224,r>>6&63|128,r&63|128),l!==null&&(t>i&&(e+=n.substring(i,t)),e+=l,i=t=s+1)}return t>i&&(e+=n.substring(i,n.length)),e},h.UUID=function(){var n=function(){var t=1*new Date,o;if(R.performance&&R.performance.now)o=R.performance.now();else for(o=0;t==1*new Date;)o++;return t.toString(16)+Math.floor(o).toString(16)},e=function(){return Math.random().toString(16).replace(".","")},i=function(){var t=Fe,o,s,r=[],l=0;function c(b,p){var g,f=0;for(g=0;g<p.length;g++)f|=r[g]<<g*8;return b^f}for(o=0;o<t.length;o++)s=t.charCodeAt(o),r.unshift(s&255),r.length>=4&&(l=c(l,r),r=[]);return r.length>0&&(l=c(l,r)),l.toString(16)};return function(){var t=(Ai.height*Ai.width).toString(16);return n()+"-"+e()+"-"+i()+"-"+t+"-"+n()}}();var wo=["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"];h.isBlockedUA=function(n){var e;for(n=n.toLowerCase(),e=0;e<wo.length;e++)if(n.indexOf(wo[e])!==-1)return!0;return!1},h.HTTPBuildQuery=function(n,e){var i,t,o=[];return h.isUndefined(e)&&(e="&"),h.each(n,function(s,r){i=encodeURIComponent(s.toString()),t=encodeURIComponent(r),o[o.length]=t+"="+i}),o.join(e)},h.getQueryParam=function(n,e){e=e.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var i="[\\?&]"+e+"=([^&#]*)",t=new RegExp(i),o=t.exec(n);if(o===null||o&&typeof o[1]!="string"&&o[1].length)return"";var s=o[1];try{s=decodeURIComponent(s)}catch{J.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},h.cookie={get:function(n){for(var e=n+"=",i=X.cookie.split(";"),t=0;t<i.length;t++){for(var o=i[t];o.charAt(0)==" ";)o=o.substring(1,o.length);if(o.indexOf(e)===0)return decodeURIComponent(o.substring(e.length,o.length))}return null},parse:function(n){var e;try{e=h.JSONDecode(h.cookie.get(n))||{}}catch{}return e},set_seconds:function(n,e,i,t,o,s,r){var l="",c="",b="";if(r)l="; domain="+r;else if(t){var p=Co(X.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*1e3),c="; expires="+g.toGMTString()}s&&(o=!0,b="; SameSite=None"),o&&(b+="; secure"),X.cookie=n+"="+encodeURIComponent(e)+c+"; path=/"+l+b},set:function(n,e,i,t,o,s,r){var l="",c="",b="";if(r)l="; domain="+r;else if(t){var p=Co(X.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*24*60*60*1e3),c="; expires="+g.toGMTString()}s&&(o=!0,b="; SameSite=None"),o&&(b+="; secure");var f=n+"="+encodeURIComponent(e)+c+"; path=/"+l+b;return X.cookie=f,f},remove:function(n,e,i){h.cookie.set(n,"",-1,e,!1,!1,i)}};var Yi=null,xi=function(n,e){if(Yi!==null&&!e)return Yi;var i=!0;try{n=n||window.localStorage;var t="__mplss_"+Qi(8),o="xyz";n.setItem(t,o),n.getItem(t)!==o&&(i=!1),n.removeItem(t)}catch{i=!1}return Yi=i,i};h.localStorage={is_supported:function(n){var e=xi(null,n);return e||J.error("localStorage unsupported; falling back to cookie store"),e},error:function(n){J.error("localStorage error: "+n)},get:function(n){try{return window.localStorage.getItem(n)}catch(e){h.localStorage.error(e)}return null},parse:function(n){try{return h.JSONDecode(h.localStorage.get(n))||{}}catch{}return null},set:function(n,e){try{window.localStorage.setItem(n,e)}catch(i){h.localStorage.error(i)}},remove:function(n){try{window.localStorage.removeItem(n)}catch(e){h.localStorage.error(e)}}},h.register_event=function(){var n=function(t,o,s,r,l){if(!t){J.error("No valid element provided to register_event");return}if(t.addEventListener&&!r)t.addEventListener(o,s,!!l);else{var c="on"+o,b=t[c];t[c]=e(t,s,b)}};function e(t,o,s){var r=function(l){if(l=l||i(window.event),!!l){var c=!0,b,p;return h.isFunction(s)&&(b=s(l)),p=o.call(t,l),(b===!1||p===!1)&&(c=!1),c}};return r}function i(t){return t&&(t.preventDefault=i.preventDefault,t.stopPropagation=i.stopPropagation),t}return i.preventDefault=function(){this.returnValue=!1},i.stopPropagation=function(){this.cancelBubble=!0},n}();var sr=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');h.dom_query=function(){function n(o){return o.all?o.all:o.getElementsByTagName("*")}var e=/[\t\r\n]/g;function i(o,s){var r=" "+s+" ";return(" "+o.className+" ").replace(e," ").indexOf(r)>=0}function t(o){if(!X.getElementsByTagName)return[];var s=o.split(" "),r,l,c,b,p,g,f,y,C,k,S=[X];for(g=0;g<s.length;g++){if(r=s[g].replace(/^\s+/,"").replace(/\s+$/,""),r.indexOf("#")>-1){l=r.split("#"),c=l[0];var A=l[1],M=X.getElementById(A);if(!M||c&&M.nodeName.toLowerCase()!=c)return[];S=[M];continue}if(r.indexOf(".")>-1){l=r.split("."),c=l[0];var _=l[1];for(c||(c="*"),b=[],p=0,f=0;f<S.length;f++)for(c=="*"?C=n(S[f]):C=S[f].getElementsByTagName(c),y=0;y<C.length;y++)b[p++]=C[y];for(S=[],k=0,f=0;f<b.length;f++)b[f].className&&h.isString(b[f].className)&&i(b[f],_)&&(S[k++]=b[f]);continue}var E=r.match(sr);if(E){c=E[1];var N=E[2],V=E[3],F=E[4];for(c||(c="*"),b=[],p=0,f=0;f<S.length;f++)for(c=="*"?C=n(S[f]):C=S[f].getElementsByTagName(c),y=0;y<C.length;y++)b[p++]=C[y];S=[],k=0;var U;switch(V){case"=":U=function(G){return G.getAttribute(N)==F};break;case"~":U=function(G){return G.getAttribute(N).match(new RegExp("\\b"+F+"\\b"))};break;case"|":U=function(G){return G.getAttribute(N).match(new RegExp("^"+F+"-?"))};break;case"^":U=function(G){return G.getAttribute(N).indexOf(F)===0};break;case"$":U=function(G){return G.getAttribute(N).lastIndexOf(F)==G.getAttribute(N).length-F.length};break;case"*":U=function(G){return G.getAttribute(N).indexOf(F)>-1};break;default:U=function(G){return G.getAttribute(N)}}for(S=[],k=0,f=0;f<b.length;f++)U(b[f])&&(S[k++]=b[f]);continue}for(c=r,b=[],p=0,f=0;f<S.length;f++)for(C=S[f].getElementsByTagName(c),y=0;y<C.length;y++)b[p++]=C[y];S=b}return S}return function(o){return h.isElement(o)?[o]:h.isObject(o)&&!h.isUndefined(o.length)?o:t.call(this,o)}}();var ar=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],rr=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];h.info={campaignParams:function(n){var e="",i={};return h.each(ar,function(t){e=h.getQueryParam(X.URL,t),e.length?i[t]=e:n!==void 0&&(i[t]=n)}),i},clickParams:function(){var n="",e={};return h.each(rr,function(i){n=h.getQueryParam(X.URL,i),n.length&&(e[i]=n)}),e},marketingParams:function(){return h.extend(h.info.campaignParams(),h.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=h.info.searchEngine(n),i=e!="yahoo"?"q":"p",t={};if(e!==null){t.$search_engine=e;var o=h.getQueryParam(n,i);o.length&&(t.mp_keyword=o)}return t},browser:function(n,e,i){return e=e||"",i||h.includes(n," OPR/")?h.includes(n,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":h.includes(n,"IEMobile")||h.includes(n,"WPDesktop")?"Internet Explorer Mobile":h.includes(n,"SamsungBrowser/")?"Samsung Internet":h.includes(n,"Edge")||h.includes(n,"Edg/")?"Microsoft Edge":h.includes(n,"FBIOS")?"Facebook Mobile":h.includes(n,"Chrome")?"Chrome":h.includes(n,"CriOS")?"Chrome iOS":h.includes(n,"UCWEB")||h.includes(n,"UCBrowser")?"UC Browser":h.includes(n,"FxiOS")?"Firefox iOS":h.includes(e,"Apple")?h.includes(n,"Mobile")?"Mobile Safari":"Safari":h.includes(n,"Android")?"Android Mobile":h.includes(n,"Konqueror")?"Konqueror":h.includes(n,"Firefox")?"Firefox":h.includes(n,"MSIE")||h.includes(n,"Trident/")?"Internet Explorer":h.includes(n,"Gecko")?"Mozilla":""},browserVersion:function(n,e,i){var t=h.info.browser(n,e,i),o={"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+)?)/},s=o[t];if(s===void 0)return null;var r=n.match(s);return r?parseFloat(r[r.length-2]):null},os:function(){var n=Fe;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 R.location.href},properties:function(n){return typeof n!="object"&&(n={}),h.extend(h.strip_empty_properties({$os:h.info.os(),$browser:h.info.browser(Fe,ln.vendor,_i),$referrer:X.referrer,$referring_domain:h.info.referringDomain(X.referrer),$device:h.info.device(Fe)}),{$current_url:h.info.currentUrl(),$browser_version:h.info.browserVersion(Fe,ln.vendor,_i),$screen_height:Ai.height,$screen_width:Ai.width,mp_lib:"web",$lib_version:Je.LIB_VERSION,$insert_id:Qi(),time:h.timestamp()/1e3},h.strip_empty_properties(n))},people_properties:function(){return h.extend(h.strip_empty_properties({$os:h.info.os(),$browser:h.info.browser(Fe,ln.vendor,_i)}),{$browser_version:h.info.browserVersion(Fe,ln.vendor,_i)})},mpPageViewProperties:function(){return h.strip_empty_properties({current_page_title:X.title,current_domain:R.location.hostname,current_url_path:R.location.pathname,current_url_protocol:R.location.protocol,current_url_search:R.location.search})}};var Qi=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},lr=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,dr=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,Co=function(n){var e=dr,i=n.split("."),t=i[i.length-1];(t.length>4||t==="com"||t==="org")&&(e=lr);var o=n.match(e);return o?o[0]:""},cr=function(){var n=R.navigator.onLine;return h.isUndefined(n)||n},Li=null,Ti=null;typeof JSON<"u"&&(Li=JSON.stringify,Ti=JSON.parse),Li=Li||h.JSONEncode,Ti=Ti||h.JSONDecode,h.toArray=h.toArray,h.isObject=h.isObject,h.JSONEncode=h.JSONEncode,h.JSONDecode=h.JSONDecode,h.isBlockedUA=h.isBlockedUA,h.isEmptyObject=h.isEmptyObject,h.info=h.info,h.info.device=h.info.device,h.info.browser=h.info.browser,h.info.browserVersion=h.info.browserVersion,h.info.properties=h.info.properties;var ur="__mp_opt_in_out_";function mr(n,e){Ao(!0,n,e)}function hr(n,e){Ao(!1,n,e)}function pr(n,e){return _o(n,e)==="1"}function So(n,e){if(vr(e))return J.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 i=_o(n,e)==="0";return i&&J.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),i}function dn(n){return nt(n,function(e){return this.get_config(e)})}function cn(n){return nt(n,function(e){return this._get_config(e)})}function Dn(n){return nt(n,function(e){return this._get_config(e)})}function br(n,e){e=e||{},Xi(e).remove(et(n,e),!!e.crossSubdomainCookie,e.cookieDomain)}function Xi(n){return n=n||{},n.persistenceType==="localStorage"?h.localStorage:h.cookie}function et(n,e){return e=e||{},(e.persistencePrefix||ur)+n}function _o(n,e){return Xi(e).get(et(n,e))}function vr(n){if(n&&n.ignoreDnt)return!1;var e=n&&n.window||R,i=e.navigator||{},t=!1;return h.each([i.doNotTrack,i.msDoNotTrack,e.doNotTrack],function(o){h.includes([!0,1,"1","yes"],o)&&(t=!0)}),t}function Ao(n,e,i){if(!h.isString(e)||!e.length){J.error("gdpr."+(n?"optIn":"optOut")+" called with an invalid token");return}i=i||{},Xi(i).set(et(e,i),n?1:0,h.isNumber(i.cookieExpiration)?i.cookieExpiration:null,!!i.crossSubdomainCookie,!!i.secureCookie,!!i.crossSiteCookie,i.cookieDomain),i.track&&n&&i.track(i.trackEventName||"$opt_in",i.trackProperties,{send_immediately:!0})}function nt(n,e){return function(){var i=!1;try{var t=e.call(this,"token"),o=e.call(this,"ignore_dnt"),s=e.call(this,"opt_out_tracking_persistence_type"),r=e.call(this,"opt_out_tracking_cookie_prefix"),l=e.call(this,"window");t&&(i=So(t,{ignoreDnt:o,persistenceType:s,persistencePrefix:r,window:l}))}catch(b){J.error("Unexpected error when checking tracking opt-out status: "+b)}if(!i)return n.apply(this,arguments);var c=arguments[arguments.length-1];typeof c=="function"&&c(0)}}var fr=Mi("lock"),Mo=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3};Mo.prototype.withLock=function(n,e,i){!i&&typeof e!="function"&&(i=e,e=null);var t=i||new Date().getTime()+"|"+Math.random(),o=new Date().getTime(),s=this.storageKey,r=this.pollIntervalMS,l=this.timeoutMS,c=this.storage,b=s+":X",p=s+":Y",g=s+":Z",f=function(M){e&&e(M)},y=function(M){if(new Date().getTime()-o>l){fr.error("Timeout waiting for mutex on "+s+"; clearing lock. ["+t+"]"),c.removeItem(g),c.removeItem(p),S();return}setTimeout(function(){try{M()}catch(_){f(_)}},r*(Math.random()+.1))},C=function(M,_){M()?_():y(function(){C(M,_)})},k=function(){var M=c.getItem(p);if(M&&M!==t)return!1;if(c.setItem(p,t),c.getItem(p)===t)return!0;if(!xi(c,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},S=function(){c.setItem(b,t),C(k,function(){if(c.getItem(b)===t){A();return}y(function(){if(c.getItem(p)!==t){S();return}C(function(){return!c.getItem(g)},A)})})},A=function(){c.setItem(g,"1");try{n()}finally{c.removeItem(g),c.getItem(p)===t&&c.removeItem(p),c.getItem(b)===t&&c.removeItem(b)}};try{if(xi(c,!0))S();else throw new Error("localStorage support check failed")}catch(M){f(M)}};var xo=Mi("batch"),un=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.reportError=e.errorReporter||h.bind(xo.error,xo),this.lock=new Mo(n,{storage:this.storage}),this.usePersistence=e.usePersistence,this.pid=e.pid||null,this.memQueue=[]};un.prototype.enqueue=function(n,e,i){var t={id:Qi(),flushAfter:new Date().getTime()+e*2,payload:n};this.usePersistence?this.lock.withLock(h.bind(function(){var s;try{var r=this.readFromStorage();r.push(t),s=this.saveToStorage(r),s&&this.memQueue.push(t)}catch{this.reportError("Error enqueueing item",n),s=!1}i&&i(s)},this),h.bind(function(s){this.reportError("Error acquiring storage lock",s),i&&i(!1)},this),this.pid):(this.memQueue.push(t),i&&i(!0))},un.prototype.fillBatch=function(n){var e=this.memQueue.slice(0,n);if(this.usePersistence&&e.length<n){var i=this.readFromStorage();if(i.length){var t={};h.each(e,function(r){t[r.id]=!0});for(var o=0;o<i.length;o++){var s=i[o];if(new Date().getTime()>s.flushAfter&&!t[s.id]&&(s.orphaned=!0,e.push(s),e.length>=n))break}}}return e};var Lo=function(n,e){var i=[];return h.each(n,function(t){t.id&&!e[t.id]&&i.push(t)}),i};un.prototype.removeItemsByID=function(n,e){var i={};if(h.each(n,function(o){i[o]=!0}),this.memQueue=Lo(this.memQueue,i),!this.usePersistence)e&&e(!0);else{var t=h.bind(function(){var o;try{var s=this.readFromStorage();if(s=Lo(s,i),o=this.saveToStorage(s),o){s=this.readFromStorage();for(var r=0;r<s.length;r++){var l=s[r];if(l.id&&i[l.id])return this.reportError("Item not removed from storage"),!1}}}catch{this.reportError("Error removing items",n),o=!1}return o},this);this.lock.withLock(function(){var s=t();e&&e(s)},h.bind(function(s){var r=!1;if(this.reportError("Error acquiring storage lock",s),!xi(this.storage,!0)&&(r=t(),!r))try{this.storage.removeItem(this.storageKey)}catch(l){this.reportError("Error clearing queue",l)}e&&e(r)},this),this.pid)}};var To=function(n,e){var i=[];return h.each(n,function(t){var o=t.id;if(o in e){var s=e[o];s!==null&&(t.payload=s,i.push(t))}else i.push(t)}),i};un.prototype.updatePayloads=function(n,e){this.memQueue=To(this.memQueue,n),this.usePersistence?this.lock.withLock(h.bind(function(){var t;try{var o=this.readFromStorage();o=To(o,n),t=this.saveToStorage(o)}catch{this.reportError("Error updating items",n),t=!1}e&&e(t)},this),h.bind(function(t){this.reportError("Error acquiring storage lock",t),e&&e(!1)},this),this.pid):e&&e(!0)},un.prototype.readFromStorage=function(){var n;try{n=this.storage.getItem(this.storageKey),n&&(n=Ti(n),h.isArray(n)||(this.reportError("Invalid storage entry:",n),n=null))}catch(e){this.reportError("Error retrieving queue",e),n=null}return n||[]},un.prototype.saveToStorage=function(n){try{return this.storage.setItem(this.storageKey,Li(n)),!0}catch(e){return this.reportError("Error saving queue",e),!1}},un.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var gr=10*60*1e3,Qn=Mi("batch"),He=function(n,e){this.errorReporter=e.errorReporter,this.queue=new un(n,{errorReporter:h.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};He.prototype.enqueue=function(n,e){this.queue.enqueue(n,this.flushInterval,e)},He.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},He.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},He.prototype.clear=function(){this.queue.clear()},He.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},He.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},He.prototype.scheduleFlush=function(n){this.flushInterval=n,this.stopped||(this.timeoutID=setTimeout(h.bind(function(){this.stopped||this.flush()},this),this.flushInterval))},He.prototype.flush=function(n){try{if(this.requestInProgress){Qn.log("Flush: Request already in progress");return}n=n||{};var e=this.libConfig.batch_request_timeout_ms,i=new Date().getTime(),t=this.batchSize,o=this.queue.fillBatch(t),s=o.length===t,r=[],l={};if(h.each(o,function(p){var g=p.payload;if(this.beforeSendHook&&!p.orphaned&&(g=this.beforeSendHook(g)),g){g.event&&g.properties&&(g.properties=h.extend({},g.properties,{mp_sent_by_lib_version:Je.LIB_VERSION}));var f=!0,y=p.id;y?(this.itemIdsSentSuccessfully[y]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:p,batchSize:o.length,timesSent:this.itemIdsSentSuccessfully[y]}),f=!1):this.reportError("[dupe] found item with no ID",{item:p}),f&&r.push(g)}l[p.id]=g},this),r.length<1){this.resetFlush();return}this.requestInProgress=!0;var c=h.bind(function(p){this.requestInProgress=!1;try{var g=!1;if(n.unloading)this.queue.updatePayloads(l);else if(h.isObject(p)&&p.error==="timeout"&&new Date().getTime()-i>=e)this.reportError("Network timeout; retrying"),this.flush();else if(h.isObject(p)&&(p.httpStatusCode>=500||p.httpStatusCode===429||p.httpStatusCode<=0&&!cr()||p.error==="timeout")){var f=this.flushInterval*2;p.retryAfter&&(f=parseInt(p.retryAfter,10)*1e3||f),f=Math.min(gr,f),this.reportError("Error; retry in "+f+" ms"),this.scheduleFlush(f)}else if(h.isObject(p)&&p.httpStatusCode===413)if(o.length>1){var y=Math.max(1,Math.floor(t/2));this.batchSize=Math.min(this.batchSize,y,o.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",o),this.resetBatchSize(),g=!0;else g=!0;g&&(this.queue.removeItemsByID(h.map(o,function(C){return C.id}),h.bind(function(C){C?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!s?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)),h.each(o,h.bind(function(C){var k=C.id;k?(this.itemIdsSentSuccessfully[k]=this.itemIdsSentSuccessfully[k]||0,this.itemIdsSentSuccessfully[k]++,this.itemIdsSentSuccessfully[k]>5&&this.reportError("[dupe] item ID sent too many times",{item:C,batchSize:o.length,timesSent:this.itemIdsSentSuccessfully[k]})):this.reportError("[dupe] found item with no ID while removing",{item:C})},this)))}catch(C){this.reportError("Error handling API response",C),this.resetFlush()}},this),b={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};n.unloading&&(b.transport="sendBeacon"),Qn.log("MIXPANEL REQUEST:",r),this.sendRequest(r,b,c)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},He.prototype.reportError=function(n,e){if(Qn.error.apply(Qn.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(n)),this.errorReporter(n,e)}catch(i){Qn.error(i)}};var kn=Mi("recorder"),Eo=R.CompressionStream,yr={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},kr=new Set([Ve.MouseMove,Ve.MouseInteraction,Ve.Scroll,Ve.ViewportResize,Ve.Input,Ve.TouchMove,Ve.MediaInteraction,Ve.Drag,Ve.Selection]);function wr(n){return n.type===bo.IncrementalSnapshot&&kr.has(n.data.source)}var Ue=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=$n,this.recordMinMs=0,this._initBatcher()};Ue.prototype._initBatcher=function(){this.batcher=new He("__mprec",{libConfig:yr,sendRequestFunc:h.bind(this.flushEventsWithOptOut,this),errorReporter:h.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},Ue.prototype.get_config=function(n){return this._mixpanel.get_config(n)},Ue.prototype.startRecording=function(n){if(this._stopRecording!==null){kn.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>$n&&(this.recordMaxMs=$n,kn.critical("record_max_ms cannot be greater than "+$n+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>Wi&&(this.recordMinMs=Wi,kn.critical("record_min_ms cannot be greater than "+Wi+"ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=new Date().getTime(),this.replayId=h.UUID(),n||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var e=h.bind(function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(h.bind(function(){kn.log("Idle timeout reached, restarting recording."),this.resetRecording()},this),this.get_config("record_idle_timeout_ms"))},this),i=this.get_config("record_block_selector");(i===""||i===null)&&(i=void 0),this._stopRecording=Jn({emit:h.bind(function(t){this.batcher.enqueue(t),wr(t)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),e())},this),blockClass:this.get_config("record_block_class"),blockSelector:i,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(h.bind(this.resetRecording,this),this.recordMaxMs)},Ue.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},Ue.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)},Ue.prototype.flushEventsWithOptOut=function(n,e,i){this._flushEvents(n,e,i,h.bind(this._onOptOut,this))},Ue.prototype._onOptOut=function(n){n===0&&(this.recEvents=[],this.stopRecording())},Ue.prototype._sendRequest=function(n,e,i,t){var o=h.bind(function(s,r){s.status===200&&this.replayId===n&&this.seqNo++,t({status:0,httpStatusCode:s.status,responseBody:r,retryAfter:s.headers.get("Retry-After")})},this);R.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:i}).then(function(s){s.json().then(function(r){o(s,r)}).catch(function(r){t({error:r})})}).catch(function(s){t({error:s,httpStatusCode:0})})},Ue.prototype._flushEvents=dn(function(n,e,i){const t=n.length;if(t>0){var o=this.replayId,s=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=s);var r=n[t-1].timestamp-this.replayStartTime,l={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:s/1e3,replay_id:o,replay_length_ms:r,replay_start_time:this.replayStartTime/1e3},c=h.JSONEncode(n),b=this._mixpanel.get_property("$device_id");b&&(l.$device_id=b);var p=this._mixpanel.get_property("$user_id");if(p&&(l.$user_id=p),Eo){var g=new Blob([c],{type:"application/json"}).stream(),f=g.pipeThrough(new Eo("gzip"));new Response(f).blob().then(h.bind(function(y){l.format="gzip",this._sendRequest(o,l,y,i)},this))}else l.format="body",this._sendRequest(o,l,c,i)}}),Ue.prototype.reportError=function(n,e){kn.error.apply(kn.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(i){kn.error(i)}},R.__mp_recorder=Ue;var $e=function(){};$e.prototype.create_properties=function(){},$e.prototype.event_handler=function(){},$e.prototype.after_track_handler=function(){},$e.prototype.init=function(n){return this.mp=n,this},$e.prototype.track=function(n,e,i,t){var o=this,s=h.dom_query(n);if(s.length===0){J.error("The DOM query ("+n+") returned 0 elements");return}return h.each(s,function(r){h.register_event(r,this.override_event,function(l){var c={},b=o.create_properties(i,this),p=o.mp.get_config("track_links_timeout");o.event_handler(l,this,c),window.setTimeout(o.track_callback(t,b,c,!0),p),o.mp.track(e,b,o.track_callback(t,b,c))})},this),!0},$e.prototype.track_callback=function(n,e,i,t){t=t||!1;var o=this;return function(){i.callback_fired||(i.callback_fired=!0,!(n&&n(t,e)===!1)&&o.after_track_handler(e,i,t))}},$e.prototype.create_properties=function(n,e){var i;return typeof n=="function"?i=n(e):i=h.extend({},n),i};var On=function(){this.override_event="click"};h.inherit(On,$e),On.prototype.create_properties=function(n,e){var i=On.superclass.create_properties.apply(this,arguments);return e.href&&(i.url=e.href),i},On.prototype.event_handler=function(n,e,i){i.new_tab=n.which===2||n.metaKey||n.ctrlKey||e.target==="_blank",i.href=e.href,i.new_tab||n.preventDefault()},On.prototype.after_track_handler=function(n,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var Ei=function(){this.override_event="submit"};h.inherit(Ei,$e),Ei.prototype.event_handler=function(n,e,i){i.element=e,n.preventDefault()},Ei.prototype.after_track_handler=function(n,e){setTimeout(function(){e.element.submit()},0)};var mn="$set",Hn="$set_once",Ke="$unset",wn="$add",ze="$append",Cn="$union",Ye="$remove",Cr="$delete",Po={set_action:function(n,e){var i={},t={};return h.isObject(n)?h.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[mn]=t,i},unset_action:function(n){var e={},i=[];return h.isArray(n)||(n=[n]),h.each(n,function(t){this._is_reserved_property(t)||i.push(t)},this),e[Ke]=i,e},set_once_action:function(n,e){var i={},t={};return h.isObject(n)?h.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Hn]=t,i},union_action:function(n,e){var i={},t={};return h.isObject(n)?h.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=h.isArray(o)?o:[o])},this):t[n]=h.isArray(e)?e:[e],i[Cn]=t,i},append_action:function(n,e){var i={},t={};return h.isObject(n)?h.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[ze]=t,i},remove_action:function(n,e){var i={},t={};return h.isObject(n)?h.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Ye]=t,i},delete_action:function(){var n={};return n[Cr]="",n}},ie=function(){};h.extend(ie.prototype,Po),ie.prototype._init=function(n,e,i){this._mixpanel=n,this._group_key=e,this._group_id=i},ie.prototype.set=Dn(function(n,e,i){var t=this.set_action(n,e);return h.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.set_once=Dn(function(n,e,i){var t=this.set_once_action(n,e);return h.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.unset=Dn(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),ie.prototype.union=Dn(function(n,e,i){h.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),ie.prototype.delete=Dn(function(n){var e=this.delete_action();return this._send_request(e,n)}),ie.prototype.remove=Dn(function(n,e,i){var t=this.remove_action(n,e);return this._send_request(t,i)}),ie.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 i=h.encodeDates(n);return this._mixpanel._track_or_batch({type:"groups",data:i,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},e)},ie.prototype._is_reserved_property=function(n){return n==="$group_key"||n==="$group_id"},ie.prototype._get_config=function(n){return this._mixpanel.get_config(n)},ie.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},ie.prototype.remove=ie.prototype.remove,ie.prototype.set=ie.prototype.set,ie.prototype.set_once=ie.prototype.set_once,ie.prototype.union=ie.prototype.union,ie.prototype.unset=ie.prototype.unset,ie.prototype.toString=ie.prototype.toString;var D=function(){};h.extend(D.prototype,Po),D.prototype._init=function(n){this._mixpanel=n},D.prototype.set=cn(function(n,e,i){var t=this.set_action(n,e);return h.isObject(n)&&(i=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),t[mn]=h.extend({},h.info.people_properties(),t[mn]),this._send_request(t,i)}),D.prototype.set_once=cn(function(n,e,i){var t=this.set_once_action(n,e);return h.isObject(n)&&(i=e),this._send_request(t,i)}),D.prototype.unset=cn(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),D.prototype.increment=cn(function(n,e,i){var t={},o={};return h.isObject(n)?(h.each(n,function(s,r){if(!this._is_reserved_property(r))if(isNaN(parseFloat(s))){J.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else o[r]=s},this),i=e):(h.isUndefined(e)&&(e=1),o[n]=e),t[wn]=o,this._send_request(t,i)}),D.prototype.append=cn(function(n,e,i){h.isObject(n)&&(i=e);var t=this.append_action(n,e);return this._send_request(t,i)}),D.prototype.remove=cn(function(n,e,i){h.isObject(n)&&(i=e);var t=this.remove_action(n,e);return this._send_request(t,i)}),D.prototype.union=cn(function(n,e,i){h.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),D.prototype.track_charge=cn(function(n,e,i){if(!h.isNumber(n)&&(n=parseFloat(n),isNaN(n))){J.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",h.extend({$amount:n},e),i)}),D.prototype.clear_charges=function(n){return this.set("$transactions",[],n)},D.prototype.delete_user=function(){if(!this._identify_called()){J.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)},D.prototype.toString=function(){return this._mixpanel.toString()+".people"},D.prototype._send_request=function(n,e){n.$token=this._get_config("token"),n.$distinct_id=this._mixpanel.get_distinct_id();var i=this._mixpanel.get_property("$device_id"),t=this._mixpanel.get_property("$user_id"),o=this._mixpanel.get_property("$had_persisted_distinct_id");i&&(n.$device_id=i),t&&(n.$user_id=t),o&&(n.$had_persisted_distinct_id=o);var s=h.encodeDates(n);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:s,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},e):(this._enqueue(n),h.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),h.truncate(s,255))},D.prototype._get_config=function(n){return this._mixpanel.get_config(n)},D.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},D.prototype._enqueue=function(n){mn in n?this._mixpanel.persistence._add_to_people_queue(mn,n):Hn in n?this._mixpanel.persistence._add_to_people_queue(Hn,n):Ke in n?this._mixpanel.persistence._add_to_people_queue(Ke,n):wn in n?this._mixpanel.persistence._add_to_people_queue(wn,n):ze in n?this._mixpanel.persistence._add_to_people_queue(ze,n):Ye in n?this._mixpanel.persistence._add_to_people_queue(Ye,n):Cn in n?this._mixpanel.persistence._add_to_people_queue(Cn,n):J.error("Invalid call to _enqueue():",n)},D.prototype._flush_one_queue=function(n,e,i,t){var o=this,s=h.extend({},this._mixpanel.persistence.load_queue(n)),r=s;!h.isUndefined(s)&&h.isObject(s)&&!h.isEmptyObject(s)&&(o._mixpanel.persistence._pop_from_people_queue(n,s),o._mixpanel.persistence.save(),t&&(r=t(s)),e.call(o,r,function(l,c){l===0&&o._mixpanel.persistence._add_to_people_queue(n,s),h.isUndefined(i)||i(l,c)}))},D.prototype._flush=function(n,e,i,t,o,s,r){var l=this;this._flush_one_queue(mn,this.set,n),this._flush_one_queue(Hn,this.set_once,t),this._flush_one_queue(Ke,this.unset,s,function(S){return h.keys(S)}),this._flush_one_queue(wn,this.increment,e),this._flush_one_queue(Cn,this.union,o);var c=this._mixpanel.persistence.load_queue(ze);if(!h.isUndefined(c)&&h.isArray(c)&&c.length)for(var b,p=function(S,A){S===0&&l._mixpanel.persistence._add_to_people_queue(ze,b),h.isUndefined(i)||i(S,A)},g=c.length-1;g>=0;g--)c=this._mixpanel.persistence.load_queue(ze),b=c.pop(),l._mixpanel.persistence.save(),h.isEmptyObject(b)||l.append(b,p);var f=this._mixpanel.persistence.load_queue(Ye);if(!h.isUndefined(f)&&h.isArray(f)&&f.length)for(var y,C=function(S,A){S===0&&l._mixpanel.persistence._add_to_people_queue(Ye,y),h.isUndefined(r)||r(S,A)},k=f.length-1;k>=0;k--)f=this._mixpanel.persistence.load_queue(Ye),y=f.pop(),l._mixpanel.persistence.save(),h.isEmptyObject(y)||l.remove(y,C)},D.prototype._is_reserved_property=function(n){return n==="$distinct_id"||n==="$token"||n==="$device_id"||n==="$user_id"||n==="$had_persisted_distinct_id"},D.prototype.set=D.prototype.set,D.prototype.set_once=D.prototype.set_once,D.prototype.unset=D.prototype.unset,D.prototype.increment=D.prototype.increment,D.prototype.append=D.prototype.append,D.prototype.remove=D.prototype.remove,D.prototype.union=D.prototype.union,D.prototype.track_charge=D.prototype.track_charge,D.prototype.clear_charges=D.prototype.clear_charges,D.prototype.delete_user=D.prototype.delete_user,D.prototype.toString=D.prototype.toString;var it="__mps",tt="__mpso",ot="__mpus",st="__mpa",at="__mpap",rt="__mpr",lt="__mpu",No="$people_distinct_id",Pi="__alias",Xn="__timers",Sr=[it,tt,ot,st,at,rt,lt,No,Pi,Xn],j=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"&&(J.critical("Unknown persistence type "+e+"; falling back to cookie"),e=n.persistence="cookie"),e==="localStorage"&&h.localStorage.is_supported()?this.storage=h.localStorage:this.storage=h.cookie,this.load(),this.update_config(n),this.upgrade(),this.save()};j.prototype.properties=function(){var n={};return this.load(),h.each(this.props,function(e,i){h.include(Sr,i)||(n[i]=e)}),n},j.prototype.load=function(){if(!this.disabled){var n=this.storage.parse(this.name);n&&(this.props=h.extend({},n))}},j.prototype.upgrade=function(){var n,e;this.storage===h.localStorage?(n=h.cookie.parse(this.name),h.cookie.remove(this.name),h.cookie.remove(this.name,!0),n&&this.register_once(n)):this.storage===h.cookie&&(e=h.localStorage.parse(this.name),h.localStorage.remove(this.name),e&&this.register_once(e))},j.prototype.save=function(){this.disabled||this.storage.set(this.name,h.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},j.prototype.load_prop=function(n){return this.load(),this.props[n]},j.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},j.prototype.clear=function(){this.remove(),this.props={}},j.prototype.register_once=function(n,e,i){return h.isObject(n)?(typeof e>"u"&&(e="None"),this.expire_days=typeof i>"u"?this.default_expiry:i,this.load(),h.each(n,function(t,o){(!this.props.hasOwnProperty(o)||this.props[o]===e)&&(this.props[o]=t)},this),this.save(),!0):!1},j.prototype.register=function(n,e){return h.isObject(n)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),h.extend(this.props,n),this.save(),!0):!1},j.prototype.unregister=function(n){this.load(),n in this.props&&(delete this.props[n],this.save())},j.prototype.update_search_keyword=function(n){this.register(h.info.searchInfo(n))},j.prototype.update_referrer_info=function(n){this.register_once({$initial_referrer:n||"$direct",$initial_referring_domain:h.info.referringDomain(n)||"$direct"},"")},j.prototype.get_referrer_info=function(){return h.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},j.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)},j.prototype.set_disabled=function(n){this.disabled=n,this.disabled?this.remove():this.save()},j.prototype.set_cookie_domain=function(n){n!==this.cookie_domain&&(this.remove(),this.cookie_domain=n,this.save())},j.prototype.set_cross_site=function(n){n!==this.cross_site&&(this.cross_site=n,this.remove(),this.save())},j.prototype.set_cross_subdomain=function(n){n!==this.cross_subdomain&&(this.cross_subdomain=n,this.remove(),this.save())},j.prototype.get_cross_subdomain=function(){return this.cross_subdomain},j.prototype.set_secure=function(n){n!==this.secure&&(this.secure=!!n,this.remove(),this.save())},j.prototype._add_to_people_queue=function(n,e){var i=this._get_queue_key(n),t=e[n],o=this._get_or_create_queue(mn),s=this._get_or_create_queue(Hn),r=this._get_or_create_queue(Ke),l=this._get_or_create_queue(wn),c=this._get_or_create_queue(Cn),b=this._get_or_create_queue(Ye,[]),p=this._get_or_create_queue(ze,[]);i===it?(h.extend(o,t),this._pop_from_people_queue(wn,t),this._pop_from_people_queue(Cn,t),this._pop_from_people_queue(Ke,t)):i===tt?(h.each(t,function(g,f){f in s||(s[f]=g)}),this._pop_from_people_queue(Ke,t)):i===ot?h.each(t,function(g){h.each([o,s,l,c],function(f){g in f&&delete f[g]}),h.each(p,function(f){g in f&&delete f[g]}),r[g]=!0}):i===st?(h.each(t,function(g,f){f in o?o[f]+=g:(f in l||(l[f]=0),l[f]+=g)},this),this._pop_from_people_queue(Ke,t)):i===lt?(h.each(t,function(g,f){h.isArray(g)&&(f in c||(c[f]=[]),c[f]=c[f].concat(g))}),this._pop_from_people_queue(Ke,t)):i===rt?(b.push(t),this._pop_from_people_queue(ze,t)):i===at&&(p.push(t),this._pop_from_people_queue(Ke,t)),J.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),J.log(e),this.save()},j.prototype._pop_from_people_queue=function(n,e){var i=this.props[this._get_queue_key(n)];h.isUndefined(i)||h.each(e,function(t,o){n===ze||n===Ye?h.each(i,function(s){s[o]===t&&delete s[o]}):delete i[o]},this)},j.prototype.load_queue=function(n){return this.load_prop(this._get_queue_key(n))},j.prototype._get_queue_key=function(n){if(n===mn)return it;if(n===Hn)return tt;if(n===Ke)return ot;if(n===wn)return st;if(n===ze)return at;if(n===Ye)return rt;if(n===Cn)return lt;J.error("Invalid queue:",n)},j.prototype._get_or_create_queue=function(n,e){var i=this._get_queue_key(n);return e=h.isUndefined(e)?{}:e,this.props[i]||(this.props[i]=e)},j.prototype.set_event_timer=function(n,e){var i=this.load_prop(Xn)||{};i[n]=e,this.props[Xn]=i,this.save()},j.prototype.remove_event_timer=function(n){var e=this.load_prop(Xn)||{},i=e[n];return h.isUndefined(i)||(delete this.props[Xn][n],this.save()),i};var dt,Io=function(n,e){throw new Error(n+" not available in this build.")},we,Bo=0,_r=1,Ar=function(n){return n},ei=function(){},Be="mixpanel",Ro="base64",Mr="json",ct="$device:",Un=R.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,Do=!Un&&Fe.indexOf("MSIE")===-1&&Fe.indexOf("Mozilla")===-1,Ni=null;ln.sendBeacon&&(Ni=function(){return ln.sendBeacon.apply(ln,arguments)});var Oo={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},Ho={api_host:"https://api-js.mixpanel.com",api_routes:Oo,api_method:"POST",api_transport:"XHR",api_payload_format:Ro,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:ei,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:ei,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:$n,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},Uo=!1,x=function(){},ut=function(n,e,i){var t,o=i===Be?we:we[i];if(o&&dt===Bo)t=o;else{if(o&&!h.isArray(o)){J.error("You have already initialized "+i);return}t=new x}if(t._cached_groups={},t._init(n,e,i),t.people=new D,t.people._init(t),!t.get_config("skip_first_touch_marketing")){var s=h.info.campaignParams(null),r={},l=!1;h.each(s,function(c,b){r["initial_"+b]=c,c&&(l=!0)}),l&&t.people.set_once(r)}return Je.DEBUG=Je.DEBUG||t.get_config("debug"),!h.isUndefined(o)&&h.isArray(o)&&(t._execute_array.call(t.people,o.people),t._execute_array(o)),t};x.prototype.init=function(n,e,i){if(h.isUndefined(i)){this.report_error("You must name your new library: init(token, config, name)");return}if(i===Be){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var t=ut(n,e,i);return we[i]=t,t._loaded(),t},x.prototype._init=function(n,e,i){e=e||{},this.__loaded=!0,this.config={};var t={};if(!("api_payload_format"in e)){var o=e.api_host||Ho.api_host;o.match(/\.mixpanel\.com/)&&(t.api_payload_format=Mr)}if(this.set_config(h.extend({},Ho,t,e,{name:i,token:n,callback_fn:(i===Be?i:Be+"."+i)+"._jsc"})),this._jsc=ei,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(!h.localStorage.is_supported(!0)||!Un)this._batch_requests=!1,J.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),h.each(this.get_batcher_configs(),function(c){J.log("Clearing batch queue "+c.queue_key),h.localStorage.remove(c.queue_key)});else if(this.init_batchers(),Ni&&R.addEventListener){var s=h.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);R.addEventListener("pagehide",function(c){c.persisted&&s()}),R.addEventListener("visibilitychange",function(){X.visibilityState==="hidden"&&s()})}}this.persistence=this.cookie=new j(this.config),this.unpersisted_superprops={},this._gdpr_init();var r=h.UUID();this.get_distinct_id()||this.register_once({distinct_id:ct+r,$device_id:r},"");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()},x.prototype.start_session_recording=dn(function(){if(!R.MutationObserver){J.critical("Browser does not support MutationObserver; skipping session recording");return}var n=h.bind(function(){this._recorder=this._recorder||new R.__mp_recorder(this),this._recorder.startRecording()},this);h.isUndefined(R.__mp_recorder)?Io(this.get_config("recorder_src"),n):n()}),x.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():J.critical("Session recorder module not loaded")},x.prototype.get_session_recording_properties=function(){var n={};if(this._recorder){var e=this._recorder.replayId;e&&(n.$mp_replay_id=e)}return n},x.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=h.info.campaignParams(null);h.each(n,(function(e,i){this.unregister(i)}).bind(this))}},x.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(X.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(h.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(X.referrer)},x.prototype._dom_loaded=function(){h.each(this.__dom_loaded_queue,function(n){this._track_dom.apply(this,n)},this),this.has_opted_out_tracking()||h.each(this.__request_queue,function(n){this._send_request.apply(this,n)},this),delete this.__dom_loaded_queue,delete this.__request_queue},x.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(!Uo)return this.__dom_loaded_queue.push([n,e]),!1;var i=new n().init(this);return i.track.apply(i,e)},x.prototype._init_url_change_tracking=function(n){var e="",i=this.track_pageview();if(i&&(e=h.info.currentUrl()),h.include(["full-url","url-with-path-and-query-string","url-with-path"],n)){R.addEventListener("popstate",function(){R.dispatchEvent(new Event("mp_locationchange"))}),R.addEventListener("hashchange",function(){R.dispatchEvent(new Event("mp_locationchange"))});var t=R.history.pushState;typeof t=="function"&&(R.history.pushState=function(s,r,l){t.call(R.history,s,r,l),R.dispatchEvent(new Event("mp_locationchange"))});var o=R.history.replaceState;typeof o=="function"&&(R.history.replaceState=function(s,r,l){o.call(R.history,s,r,l),R.dispatchEvent(new Event("mp_locationchange"))}),R.addEventListener("mp_locationchange",(function(){var s=h.info.currentUrl(),r=!1;if(n==="full-url"?r=s!==e:n==="url-with-path-and-query-string"?r=s.split("#")[0]!==e.split("#")[0]:n==="url-with-path"&&(r=s.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0]),r){var l=this.track_pageview();l&&(e=s)}}).bind(this))}},x.prototype._prepare_callback=function(n,e){if(h.isUndefined(n))return null;if(Un){var i=function(r){n(r,e)};return i}else{var t=this._jsc,o=""+Math.floor(Math.random()*1e8),s=this.get_config("callback_fn")+"["+o+"]";return t[o]=function(r){delete t[o],n(r,e)},s}},x.prototype._send_request=function(n,e,i,t){var o=!0;if(Do)return this.__request_queue.push(arguments),o;var s={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},r=null;!t&&(h.isFunction(i)||typeof i=="string")&&(t=i,i=null),i=h.extend(s,i||{}),Un||(i.method="GET");var l=i.method==="POST",c=Ni&&l&&i.transport.toLowerCase()==="sendbeacon",b=i.verbose;e.verbose&&(b=!0),this.get_config("test")&&(e.test=1),b&&(e.verbose=1),this.get_config("img")&&(e.img=1),Un||(t?e.callback=t:(b||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),l&&(r="data="+encodeURIComponent(e.data),delete e.data),n+="?"+h.HTTPBuildQuery(e);var p=this;if("img"in e){var g=X.createElement("img");g.src=n,X.body.appendChild(g)}else if(c){try{o=Ni(n,r)}catch(A){p.report_error(A),o=!1}try{t&&t(o?1:0)}catch(A){p.report_error(A)}}else if(Un)try{var f=new XMLHttpRequest;f.open(i.method,n,!0);var y=this.get_config("xhr_headers");if(l&&(y["Content-Type"]="application/x-www-form-urlencoded"),h.each(y,function(A,M){f.setRequestHeader(M,A)}),i.timeout_ms&&typeof f.timeout<"u"){f.timeout=i.timeout_ms;var C=new Date().getTime()}f.withCredentials=!0,f.onreadystatechange=function(){if(f.readyState===4)if(f.status===200){if(t)if(b){var A;try{A=h.JSONDecode(f.responseText)}catch(E){if(p.report_error(E),i.ignore_json_errors)A=f.responseText;else return}t(A)}else t(Number(f.responseText))}else{var M;if(f.timeout&&!f.status&&new Date().getTime()-C>=f.timeout?M="timeout":M="Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(M),t)if(b){var _=f.responseHeaders||{};t({status:0,httpStatusCode:f.status,error:M,retryAfter:_["Retry-After"]})}else t(0)}},f.send(r)}catch(A){p.report_error(A),o=!1}else{var k=X.createElement("script");k.type="text/javascript",k.async=!0,k.defer=!0,k.src=n;var S=X.getElementsByTagName("script")[0];S.parentNode.insertBefore(k,S)}return o},x.prototype._execute_array=function(n){var e,i=[],t=[],o=[];h.each(n,function(r){r&&(e=r[0],h.isArray(e)?o.push(r):typeof r=="function"?r.call(this):h.isArray(r)&&e==="alias"?i.push(r):h.isArray(r)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?o.push(r):t.push(r))},this);var s=function(r,l){h.each(r,function(c){if(h.isArray(c[0])){var b=l;h.each(c,function(p){b=b[p[0]].apply(b,p.slice(1))})}else this[c[0]].apply(this,c.slice(1))},l)};s(i,this),s(t,this),s(o,this)},x.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},x.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},x.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var n=h.bind(function(i){return new He(i.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:h.bind(function(t,o,s){this._send_request(this.get_config("api_host")+i.endpoint,this._encode_data_for_request(t),o,this._prepare_callback(s,t))},this),beforeSendHook:h.bind(function(t){return this._run_hook("before_send_"+i.type,t)},this),stopAllBatchingFunc:h.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()},x.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,h.each(this.request_batchers,function(n){n.start()}))},x.prototype.stop_batch_senders=function(){this._batch_requests=!1,h.each(this.request_batchers,function(n){n.stop(),n.clear()})},x.prototype.push=function(n){this._execute_array([n])},x.prototype.disable=function(n){typeof n>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(n)},x.prototype._encode_data_for_request=function(n){var e=h.JSONEncode(n);return this.get_config("api_payload_format")===Ro&&(e=h.base64Encode(e)),{data:e}},x.prototype._track_or_batch=function(n,e){var i=h.truncate(n.data,255),t=n.endpoint,o=n.batcher,s=n.should_send_immediately,r=n.send_request_options||{};e=e||ei;var l=!0,c=h.bind(function(){return r.skip_hooks||(i=this._run_hook("before_send_"+n.type,i)),i?(J.log("MIXPANEL REQUEST:"),J.log(i),this._send_request(t,this._encode_data_for_request(i),r,this._prepare_callback(e,i))):null},this);return this._batch_requests&&!s?o.enqueue(i,function(b){b?e(1,i):c()}):l=c(),l&&i},x.prototype.track=dn(function(n,e,i,t){!t&&typeof i=="function"&&(t=i,i=null),i=i||{};var o=i.transport;o&&(i.transport=o);var s=i.send_immediately;if(typeof t!="function"&&(t=ei),h.isUndefined(n)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(n)){t(0);return}e=h.extend({},e),e.token=this.get_config("token");var r=this.persistence.remove_event_timer(n);if(!h.isUndefined(r)){var l=new Date().getTime()-r;e.$duration=parseFloat((l/1e3).toFixed(3))}this._set_default_superprops();var c=this.get_config("track_marketing")?h.info.marketingParams():{};e=h.extend({},h.info.properties({mp_loader:this.get_config("mp_loader")}),c,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),e);var b=this.get_config("property_blacklist");h.isArray(b)?h.each(b,function(f){delete e[f]}):this.report_error("Invalid value for property_blacklist config: "+b);var p={event:n,properties:e},g=this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:s,send_request_options:i},t);return g}),x.prototype.set_group=dn(function(n,e,i){h.isArray(e)||(e=[e]);var t={};return t[n]=e,this.register(t),this.people.set(n,e,i)}),x.prototype.add_group=dn(function(n,e,i){var t=this.get_property(n),o={};return t===void 0?(o[n]=[e],this.register(o)):t.indexOf(e)===-1&&(t.push(e),o[n]=t,this.register(o)),this.people.union(n,e,i)}),x.prototype.remove_group=dn(function(n,e,i){var t=this.get_property(n);if(t!==void 0){var o=t.indexOf(e);o>-1&&(t.splice(o,1),this.register({group_key:t})),t.length===0&&this.unregister(n)}return this.people.remove(n,e,i)}),x.prototype.track_with_groups=dn(function(n,e,i,t){var o=h.extend({},e||{});return h.each(i,function(s,r){s!=null&&(o[r]=s)}),this.track(n,o,t)}),x.prototype._create_map_key=function(n,e){return n+"_"+JSON.stringify(e)},x.prototype._remove_group_from_cache=function(n,e){delete this._cached_groups[this._create_map_key(n,e)]},x.prototype.get_group=function(n,e){var i=this._create_map_key(n,e),t=this._cached_groups[i];return(t===void 0||t._group_key!==n||t._group_id!==e)&&(t=new ie,t._init(this,n,e),this._cached_groups[i]=t),t},x.prototype.track_pageview=dn(function(n,e){typeof n!="object"&&(n={}),e=e||{};var i=e.event_name||"$mp_web_page_view",t=h.extend(h.info.mpPageViewProperties(),h.info.campaignParams(),h.info.clickParams()),o=h.extend({},t,n);return this.track(i,o)}),x.prototype.track_links=function(){return this._track_dom.call(this,On,arguments)},x.prototype.track_forms=function(){return this._track_dom.call(this,Ei,arguments)},x.prototype.time_event=function(n){if(h.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 xr={persistent:!0},mt=function(n){var e;return h.isObject(n)?e=n:h.isUndefined(n)?e={}:e={days:n},h.extend({},xr,e)};x.prototype.register=function(n,e){var i=mt(e);i.persistent?this.persistence.register(n,i.days):h.extend(this.unpersisted_superprops,n)},x.prototype.register_once=function(n,e,i){var t=mt(i);t.persistent?this.persistence.register_once(n,e,t.days):(typeof e>"u"&&(e="None"),h.each(n,function(o,s){(!this.unpersisted_superprops.hasOwnProperty(s)||this.unpersisted_superprops[s]===e)&&(this.unpersisted_superprops[s]=o)},this))},x.prototype.unregister=function(n,e){e=mt(e),e.persistent?this.persistence.unregister(n):delete this.unpersisted_superprops[n]},x.prototype._register_single=function(n,e){var i={};i[n]=e,this.register(i)},x.prototype.identify=function(n,e,i,t,o,s,r,l){var c=this.get_distinct_id();if(n&&c!==n){if(typeof n=="string"&&n.indexOf(ct)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:n})}if(!this.get_property("$device_id")){var b=c;this.register_once({$had_persisted_distinct_id:!0,$device_id:b},"")}n!==c&&n!==this.get_property(Pi)&&(this.unregister(Pi),this.register({distinct_id:n})),this._flags.identify_called=!0,this.people._flush(e,i,t,o,s,r,l),n!==c&&this.track("$identify",{distinct_id:n,$anon_distinct_id:c},{skip_hooks:!0})},x.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var n=h.UUID();this.register_once({distinct_id:ct+n,$device_id:n},"")},x.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},x.prototype.alias=function(n,e){if(n===this.get_property(No))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var i=this;return h.isUndefined(e)&&(e=this.get_distinct_id()),n!==e?(this._register_single(Pi,n),this.track("$create_alias",{alias:n,distinct_id:e},{skip_hooks:!0},function(){i.identify(n)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(n),-1)},x.prototype.name_tag=function(n){this._register_single("mp_name_tag",n)},x.prototype.set_config=function(n){if(h.isObject(n)){h.extend(this.config,n);var e=n.batch_size;e&&h.each(this.request_batchers,function(i){i.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),Je.DEBUG=Je.DEBUG||this.get_config("debug")}},x.prototype.get_config=function(n){return this.config[n]},x.prototype._run_hook=function(n){var e=(this.config.hooks[n]||Ar).apply(this,rn.call(arguments,1));return typeof e>"u"&&(this.report_error(n+" hook did not return a value"),e=null),e},x.prototype.get_property=function(n){return this.persistence.load_prop([n])},x.prototype.toString=function(){var n=this.get_config("name");return n!==Be&&(n=Be+"."+n),n},x.prototype._event_is_disabled=function(n){return h.isBlockedUA(Fe)||this._flags.disable_all_events||h.include(this.__disabled_events,n)},x.prototype._gdpr_init=function(){var n=this.get_config("opt_out_tracking_persistence_type")==="localStorage";n&&h.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")||h.cookie.get("mp_optout"))&&(h.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},x.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()},x.prototype._gdpr_call_func=function(n,e){return e=h.extend({track:h.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),h.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})},x.prototype.opt_in_tracking=function(n){n=h.extend({enable_persistence:!0},n),this._gdpr_call_func(mr,n),this._gdpr_update_persistence(n)},x.prototype.opt_out_tracking=function(n){n=h.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(hr,n),this._gdpr_update_persistence(n)},x.prototype.has_opted_in_tracking=function(n){return this._gdpr_call_func(pr,n)},x.prototype.has_opted_out_tracking=function(n){return this._gdpr_call_func(So,n)},x.prototype.clear_opt_in_out_tracking=function(n){n=h.extend({enable_persistence:!0},n),this._gdpr_call_func(br,n),this._gdpr_update_persistence(n)},x.prototype.report_error=function(n,e){J.error.apply(J.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(i){J.error(i)}},x.prototype.init=x.prototype.init,x.prototype.reset=x.prototype.reset,x.prototype.disable=x.prototype.disable,x.prototype.time_event=x.prototype.time_event,x.prototype.track=x.prototype.track,x.prototype.track_links=x.prototype.track_links,x.prototype.track_forms=x.prototype.track_forms,x.prototype.track_pageview=x.prototype.track_pageview,x.prototype.register=x.prototype.register,x.prototype.register_once=x.prototype.register_once,x.prototype.unregister=x.prototype.unregister,x.prototype.identify=x.prototype.identify,x.prototype.alias=x.prototype.alias,x.prototype.name_tag=x.prototype.name_tag,x.prototype.set_config=x.prototype.set_config,x.prototype.get_config=x.prototype.get_config,x.prototype.get_property=x.prototype.get_property,x.prototype.get_distinct_id=x.prototype.get_distinct_id,x.prototype.toString=x.prototype.toString,x.prototype.opt_out_tracking=x.prototype.opt_out_tracking,x.prototype.opt_in_tracking=x.prototype.opt_in_tracking,x.prototype.has_opted_out_tracking=x.prototype.has_opted_out_tracking,x.prototype.has_opted_in_tracking=x.prototype.has_opted_in_tracking,x.prototype.clear_opt_in_out_tracking=x.prototype.clear_opt_in_out_tracking,x.prototype.get_group=x.prototype.get_group,x.prototype.set_group=x.prototype.set_group,x.prototype.add_group=x.prototype.add_group,x.prototype.remove_group=x.prototype.remove_group,x.prototype.track_with_groups=x.prototype.track_with_groups,x.prototype.start_batch_senders=x.prototype.start_batch_senders,x.prototype.stop_batch_senders=x.prototype.stop_batch_senders,x.prototype.start_session_recording=x.prototype.start_session_recording,x.prototype.stop_session_recording=x.prototype.stop_session_recording,x.prototype.get_session_recording_properties=x.prototype.get_session_recording_properties,x.prototype.DEFAULT_API_ROUTES=Oo,j.prototype.properties=j.prototype.properties,j.prototype.update_search_keyword=j.prototype.update_search_keyword,j.prototype.update_referrer_info=j.prototype.update_referrer_info,j.prototype.get_cross_subdomain=j.prototype.get_cross_subdomain,j.prototype.clear=j.prototype.clear;var Kn={},Lr=function(){h.each(Kn,function(n,e){e!==Be&&(we[e]=n)}),we._=h},Tr=function(){we.init=function(n,e,i){if(i)return we[i]||(we[i]=Kn[i]=ut(n,e,i),we[i]._loaded()),we[i];var t=we;Kn[Be]?t=Kn[Be]:n&&(t=ut(n,e,Be),t._loaded(),Kn[Be]=t),we=t,dt===_r&&(R[Be]=we),Lr()}},Er=function(){function n(){n.done||(n.done=!0,Uo=!0,Do=!1,h.each(Kn,function(t){t._dom_loaded()}))}function e(){try{X.documentElement.doScroll("left")}catch{setTimeout(e,1);return}n()}if(X.addEventListener)X.readyState==="complete"?n():X.addEventListener("DOMContentLoaded",n,!1);else if(X.attachEvent){X.attachEvent("onreadystatechange",n);var i=!1;try{i=R.frameElement===null}catch{}X.documentElement.doScroll&&i&&e()}h.register_event(R,"load",n,!0)};function Pr(n){return Io=n,dt=Bo,we=new x,Tr(),we.init(),Er(),we}function Nr(n,e){e()}var P=Pr(Nr);const Ko=`<div id="checkoutConfirmationEnd">
715
715
  <div class="w-full">
716
716
  <div id="otp-content" class=" grid gap-4">
717
717
  <h5 class="text-black" id="otp-message">
@@ -739,11 +739,11 @@ or you can use record.mirror to access the mirror instance during recording.`;le
739
739
  </div>
740
740
  </div>
741
741
  </div>
742
- </div>`;class Ko{constructor(e){m(this,"container");m(this,"onAction");m(this,"callBackUrl");m(this,"paymentResponse");m(this,"paymentResponseHeaders");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders}attachListeners(){const e=this.container.querySelector("#goback-to-merchant");e&&e.addEventListener("click",()=>{sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return Uo}}class Ir{constructor({amount:e,container:i,email:t,encryption:o,planId:s,token:r,currency:l,rdtCode:c,url:b,reference:p,onSuccess:g,callBackUrl:f,metadata:y,localCurrency:C,hidePaymentMethods:k,showPaymentMethods:S,onClose:A,restartTransactionProcess:M,retryingPayment:_}){m(this,"contents");m(this,"cardDetailForm");m(this,"cardOtpValidationForm");m(this,"merchantPlanDetail",{});m(this,"cardPinForm");m(this,"avsForm");m(this,"successScreen");m(this,"pageLoader");m(this,"warningScreen");m(this,"transactionIssuesScreen");m(this,"container");m(this,"onSuccess");m(this,"planId","");m(this,"email");m(this,"token");m(this,"amount");m(this,"encryption");m(this,"currency");m(this,"_currentStep");m(this,"activeRef");m(this,"rdtCode");m(this,"url");m(this,"reference");m(this,"callBackUrl");m(this,"metadata");m(this,"localCurrency");m(this,"hidePaymentMethods");m(this,"showPaymentMethods");m(this,"onClose");m(this,"cardResponse");m(this,"cardResponseHeader");m(this,"confirmationEnd");m(this,"restartTransactionProcess");m(this,"retryingPayment");m(this,"isMaxRetriesReached");m(this,"isMobile",!1);this.currency=l,this.onSuccess=g||(()=>null),this.container=i,this.encryption=o,this.token=r,this.email=t,this.planId=s,this.amount=e,this.rdtCode=c,this.url=b,this.reference=p,this.callBackUrl=f,this.metadata=y,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=S,this.onClose=A,this.restartTransactionProcess=M,this.retryingPayment=_,this.isMaxRetriesReached=!1,this.renderCardContent(),P.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()}async submitCardDetails(e,i){e.preventDefault(),P.track("input_cardDetails",{payment_method:"Card",authentication_type:"PIN"});const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#details-form-button-text"),s=await Ps(JSON.stringify(i),this.encryption);t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),(()=>{if(this.retryingPayment){const l={channel:"card",reference:this.reference,encryptedCard:s};return si(this.token,l,this.rdtCode,this.url)}else{const l={amount:this.amount,channel:"card",currency:this.currency||"USD",planId:this.planId,customer:{email:this.email},reference:this.reference,encryptedCard:s,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return fs(this.token,l,this.rdtCode,this.url)}})().then(({data:l,headers:c})=>{var b,p,g,f,y,C;if(l.status==="failed")this.currentStep=4,this.reference=l.reference,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.cardResponse=l,this.cardResponseHeader=c,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(!["success","successful"].includes(l.status)&&l.status!=="failed")if(this.cardResponse=l,this.cardResponseHeader=c,l!=null&&l.authorization){if(this.activeRef=l.reference,((b=l==null?void 0:l.authorization)==null?void 0:b.mode)==="pin"){this.currentStep=2;return}if(((p=l==null?void 0:l.authorization)==null?void 0:p.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);return}if(((y=l==null?void 0:l.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}if(((C=l==null?void 0:l.authorization)==null?void 0:C.mode)==="avs"){this.currentStep=7;return}}else this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Error with Payment");else["success","successful"].includes(l.status)&&(this.currentStep=5,this.cardResponse=l,this.cardResponseHeader=c,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"}),this.redirectTo(l,c,"success"))}).catch(l=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),l.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=4,l.message?this.warningScreen.setPaymentError(l.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue())}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}handlePinRequest(e){if(e.length===4){const i={authorization:{pin:e},reference:this.activeRef};P.track("input_cardPin",{payment_method:"Card",authentication_type:"PIN"}),setTimeout(()=>{const t=this.container.querySelector("#pin-loader"),o=this.container.querySelector("#cancel-payment");t&&(t.innerHTML=`<svg class="animate-spin" width="40" height="40" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
742
+ </div>`;class jo{constructor(e){m(this,"container");m(this,"onAction");m(this,"callBackUrl");m(this,"paymentResponse");m(this,"paymentResponseHeaders");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders}attachListeners(){const e=this.container.querySelector("#goback-to-merchant");e&&e.addEventListener("click",()=>{sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return Ko}}class Ir{constructor({amount:e,container:i,email:t,encryption:o,planId:s,token:r,currency:l,rdtCode:c,url:b,reference:p,onSuccess:g,callBackUrl:f,metadata:y,localCurrency:C,hidePaymentMethods:k,showPaymentMethods:S,onClose:A,restartTransactionProcess:M,retryingPayment:_}){m(this,"contents");m(this,"cardDetailForm");m(this,"cardOtpValidationForm");m(this,"merchantPlanDetail",{});m(this,"cardPinForm");m(this,"avsForm");m(this,"successScreen");m(this,"pageLoader");m(this,"warningScreen");m(this,"transactionIssuesScreen");m(this,"container");m(this,"onSuccess");m(this,"planId","");m(this,"email");m(this,"token");m(this,"amount");m(this,"encryption");m(this,"currency");m(this,"_currentStep");m(this,"activeRef");m(this,"rdtCode");m(this,"url");m(this,"reference");m(this,"callBackUrl");m(this,"metadata");m(this,"localCurrency");m(this,"hidePaymentMethods");m(this,"showPaymentMethods");m(this,"onClose");m(this,"cardResponse");m(this,"cardResponseHeader");m(this,"confirmationEnd");m(this,"restartTransactionProcess");m(this,"retryingPayment");m(this,"isMaxRetriesReached");m(this,"isMobile",!1);this.currency=l,this.onSuccess=g||(()=>null),this.container=i,this.encryption=o,this.token=r,this.email=t,this.planId=s,this.amount=e,this.rdtCode=c,this.url=b,this.reference=p,this.callBackUrl=f,this.metadata=y,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=S,this.onClose=A,this.restartTransactionProcess=M,this.retryingPayment=_,this.isMaxRetriesReached=!1,this.renderCardContent(),P.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()}async submitCardDetails(e,i){e.preventDefault(),P.track("input_cardDetails",{payment_method:"Card",authentication_type:"PIN"});const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#details-form-button-text"),s=await Ps(JSON.stringify(i),this.encryption);t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),(()=>{if(this.retryingPayment){const l={channel:"card",reference:this.reference,encryptedCard:s};return si(this.token,l,this.rdtCode,this.url)}else{const l={amount:this.amount,channel:"card",currency:this.currency||"USD",planId:this.planId,customer:{email:this.email},reference:this.reference,encryptedCard:s,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return fs(this.token,l,this.rdtCode,this.url)}})().then(({data:l,headers:c})=>{var b,p,g,f,y,C;if(l.status==="failed")this.currentStep=4,this.reference=l.reference,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.cardResponse=l,this.cardResponseHeader=c,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(!["success","successful"].includes(l.status)&&l.status!=="failed")if(this.cardResponse=l,this.cardResponseHeader=c,l!=null&&l.authorization){if(this.activeRef=l.reference,((b=l==null?void 0:l.authorization)==null?void 0:b.mode)==="pin"){this.currentStep=2;return}if(((p=l==null?void 0:l.authorization)==null?void 0:p.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);return}if(((y=l==null?void 0:l.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}if(((C=l==null?void 0:l.authorization)==null?void 0:C.mode)==="avs"){this.currentStep=7;return}}else this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Error with Payment");else["success","successful"].includes(l.status)&&(this.currentStep=5,this.cardResponse=l,this.cardResponseHeader=c,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"}),this.redirectTo(l,c,"success"))}).catch(l=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),l.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=4,l.message?this.warningScreen.setPaymentError(l.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue())}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}handlePinRequest(e){if(e.length===4){const i={authorization:{pin:e},reference:this.activeRef};P.track("input_cardPin",{payment_method:"Card",authentication_type:"PIN"}),setTimeout(()=>{const t=this.container.querySelector("#pin-loader"),o=this.container.querySelector("#cancel-payment");t&&(t.innerHTML=`<svg class="animate-spin" width="40" height="40" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
743
743
  <path
744
744
  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"
745
745
  stroke="black" stroke-width="4" stroke-linejoin="round" />
746
- </svg>`),o&&o.classList.add("hidden"),oi(this.token,i,this.rdtCode,this.url).then(({data:r,headers:l})=>{var c,b,p,g,f;if(r.status==="failed")P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.currentStep=4,r.providerMessage?this.warningScreen.setPaymentError(r.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(["success","successful","failed"].includes(r.status))this.currentStep=5,this.redirectTo(r,l,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"});else{if(((c=r==null?void 0:r.authorization)==null?void 0:c.mode)==="3DS"){(b=r==null?void 0:r.authorization)!=null&&b.redirectUrl&&this.redirectTo3DS((p=r==null?void 0:r.authorization)==null?void 0:p.redirectUrl);return}if(((g=r==null?void 0:r.authorization)==null?void 0:g.mode)==="otp"){this.cardResponse=r,this.currentStep=3;return}if(((f=r==null?void 0:r.authorization)==null?void 0:f.mode)==="avs"){this.currentStep=7;return}}}).catch(r=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),this.currentStep=4,r.message?this.warningScreen.setPaymentError(r.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()})},300)}}showLoader(){this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader()}pinErrorStates(e,i,t){const o=this.container.querySelector("#pin-error");o&&(o.innerHTML=e||"Payment Failed"),t&&t.classList.remove("hidden"),i&&(i.innerHTML="")}setPaymentError(e){const i=this.container.querySelector("#payment-warning-text"),t=this.container.querySelector(".warning-list");i&&(i.textContent=e),t&&[{text:"Try again with your card",action:"go-to-card"},{text:"Try again with transfer",action:"go-to-transfer"}].forEach(({action:s,text:r})=>{const l=document.createElement("button");l.textContent=r,l.setAttribute("id",s),l.classList.add("warning-button");const c=document.createElement("div");c.appendChild(l),t.appendChild(c)})}validatedAVS(e,i){e.stopPropagation(),e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#avs-form-button-text"),s={authorization:{avs:{state:i==null?void 0:i.state,city:i==null?void 0:i.city,country:i==null?void 0:i.country,address:i==null?void 0:i.address,zipCode:(i==null?void 0:i.code)||"-"}},reference:this.activeRef};P.track("input_address",{payment_method:"Card",authentication_type:"AVS"}),t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),oi(this.token,s,this.rdtCode,this.url).then(({data:l,headers:c})=>{var b,p,g,f,y;if(l.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"AVS"}),l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(["success","successful","failed"].includes(l.status))["success","successful"].includes(l.status)&&(this.currentStep=5,this.redirectTo(l,c,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"AVS"}));else{if(((b=l==null?void 0:l.authorization)==null?void 0:b.mode)==="pin"){this.currentStep=2;return}if(((p=l==null?void 0:l.authorization)==null?void 0:p.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),this.currentStep=6;return}if(((y=l==null?void 0:l.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}}}).catch(l=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"AVS"}),l.message?this.warningScreen.setPaymentError(l.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}submitOtp(e,i){e.preventDefault();const t={authorization:{otp:i},reference:this.activeRef};this.currentStep=6,this.showLoader(),P.track("input_cardOTP",{payment_method:"Card",authentication_type:"PIN+0TP"}),oi(this.token,t,this.rdtCode,this.url).then(({data:s,headers:r})=>{var l,c,b,p,g,f;if(s.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.providerMessage?this.warningScreen.setPaymentError(s.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(["success","successful","failed"].includes(s.status))["success","successful"].includes(s.status)&&(this.currentStep=5,this.redirectTo(s,r,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN+0TP"}));else{if(this.activeRef=s.reference,((l=s==null?void 0:s.authorization)==null?void 0:l.mode)==="pin"){this.currentStep=2;return}if(((c=s==null?void 0:s.authorization)==null?void 0:c.mode)==="3DS"){(b=s==null?void 0:s.authorization)!=null&&b.redirectUrl&&this.redirectTo3DS((p=s==null?void 0:s.authorization)==null?void 0:p.redirectUrl);return}if(((g=s==null?void 0:s.authorization)==null?void 0:g.mode)==="otp"){this.cardResponse=s,this.currentStep=3;return}if(((f=s==null?void 0:s.authorization)==null?void 0:f.mode)==="avs"){this.currentStep=7;return}this.currentStep=9}}).catch(s=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.message?this.warningScreen.setPaymentError(s.message):this.warningScreen.setPaymentError("Payment failed")})}redirectTo3DS(e){const i=window.open(e,"_blank");if(i){P.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const t=setInterval(()=>{i.closed&&(clearInterval(t),this.verifyPayment(({data:o,headers:s})=>{this.currentStep=5,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(o,s,"success")},({data:o})=>{this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment transaction failed"),P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}else alert("Please enable popups for this site to complete the authentication.")}async verifyPayment(e,i){try{const t=await vn(this.token,this.activeRef,void 0,this.rdtCode,this.url);t.data.status==="failed"?i(t):["success","successful"].includes(t.data.status)&&e(t)}catch{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"3DS"}),this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue()}}async verifyPaymentProcess(){try{const e=await vn(this.token,this.reference,void 0,this.rdtCode,this.url);this.cardResponse=e.data,this.cardResponseHeader=e.headers}catch{this.currentStep=4}}goBackToMerchant(){this.redirectTo(this.cardResponse,this.cardResponseHeader,this.callBackUrl)}renderCardContent(e){var t,o;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),i==null||i.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.cardDetailForm=new Tt({container:this.contents,onAction:r=>l=>this.submitCardDetails.bind(this)(r,l),merchantName:this.merchantPlanDetail.merchantName}),this.cardDetailForm.renderContent();break;case 2:this.cardPinForm=new Ds({container:this.contents,onClose:this.onClose,onAction:r=>this.handlePinRequest.bind(this)(r)}),this.cardPinForm.renderComponent();break;case 3:this.cardOtpValidationForm=new Bs({container:this.contents,onClose:this.onClose,onAction:r=>l=>this.submitOtp.bind(this)(r,l),otpMessage:((t=this.cardResponse)==null?void 0:t.providerMessage)||"Please enter your OTP sent to your phone"}),this.cardOtpValidationForm.renderComponent();break;case 4:this.warningScreen=new fn({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=8}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.successScreen=new Gn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(o=this.merchantPlanDetail)==null?void 0:o.rate.rate}),this.successScreen.renderComponent();break;case 6:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 7:this.avsForm=new Us({container:this.contents,onAction:r=>l=>this.validatedAVS.bind(this)(r,l)}),this.avsForm.renderComponent();break;case 8:this.transactionIssuesScreen=new di({container:this.contents,onAction:()=>{var r;this.currentStep=4,this.warningScreen.setPaymentError(((r=this.cardResponse)==null?void 0:r.providerMessage)||"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 Ko({container:this.contents,onAction:r=>{this.currentStep=r},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.confirmationEnd.renderComponent();break;default:this.cardDetailForm=new Tt({container:this.contents,onAction:r=>l=>this.submitCardDetails.bind(this)(r,l),merchantName:this.merchantPlanDetail.merchantName}),this.cardDetailForm.renderContent();break}this.displayButtonText();const s=this.container.querySelector("#card-currency");s&&(s.textContent=`${this.localCurrency?this.localCurrency:this.currency} Card`)}}redirectTo(e,i,t){const o=i.get("spf-redirect-url");this.callBackUrl=o||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):t==="success"&&this.onSuccess(e)}displayButtonText(e){var t,o,s,r;const i=this.container.querySelector("#details-form-button-text");if(i){const l=this.currency,c=l==="USD"?(o=(t=this.merchantPlanDetail)==null?void 0:t.rate)==null?void 0:o.from:l;e?i.textContent=e:i.textContent=`Continue to pay ${c} ${ke((this.amount||0)*(l==="USD"?(r=(s=this.merchantPlanDetail)==null?void 0:s.rate)==null?void 0:r.rate:1),2)}`}}}const Br=`<div>
746
+ </svg>`),o&&o.classList.add("hidden"),oi(this.token,i,this.rdtCode,this.url).then(({data:r,headers:l})=>{var c,b,p,g,f;if(r.status==="failed")P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.currentStep=4,r.providerMessage?this.warningScreen.setPaymentError(r.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(["success","successful","failed"].includes(r.status))this.currentStep=5,this.redirectTo(r,l,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"});else{if(((c=r==null?void 0:r.authorization)==null?void 0:c.mode)==="3DS"){(b=r==null?void 0:r.authorization)!=null&&b.redirectUrl&&this.redirectTo3DS((p=r==null?void 0:r.authorization)==null?void 0:p.redirectUrl);return}if(((g=r==null?void 0:r.authorization)==null?void 0:g.mode)==="otp"){this.cardResponse=r,this.currentStep=3;return}if(((f=r==null?void 0:r.authorization)==null?void 0:f.mode)==="avs"){this.currentStep=7;return}}}).catch(r=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),this.currentStep=4,r.message?this.warningScreen.setPaymentError(r.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()})},300)}}showLoader(){this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader()}pinErrorStates(e,i,t){const o=this.container.querySelector("#pin-error");o&&(o.innerHTML=e||"Payment Failed"),t&&t.classList.remove("hidden"),i&&(i.innerHTML="")}setPaymentError(e){const i=this.container.querySelector("#payment-warning-text"),t=this.container.querySelector(".warning-list");i&&(i.textContent=e),t&&[{text:"Try again with your card",action:"go-to-card"},{text:"Try again with transfer",action:"go-to-transfer"}].forEach(({action:s,text:r})=>{const l=document.createElement("button");l.textContent=r,l.setAttribute("id",s),l.classList.add("warning-button");const c=document.createElement("div");c.appendChild(l),t.appendChild(c)})}validatedAVS(e,i){e.stopPropagation(),e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#avs-form-button-text"),s={authorization:{avs:{state:i==null?void 0:i.state,city:i==null?void 0:i.city,country:i==null?void 0:i.country,address:i==null?void 0:i.address,zipCode:(i==null?void 0:i.code)||"-"}},reference:this.activeRef};P.track("input_address",{payment_method:"Card",authentication_type:"AVS"}),t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),oi(this.token,s,this.rdtCode,this.url).then(({data:l,headers:c})=>{var b,p,g,f,y;if(l.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"AVS"}),l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(["success","successful","failed"].includes(l.status))["success","successful"].includes(l.status)&&(this.currentStep=5,this.redirectTo(l,c,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"AVS"}));else{if(((b=l==null?void 0:l.authorization)==null?void 0:b.mode)==="pin"){this.currentStep=2;return}if(((p=l==null?void 0:l.authorization)==null?void 0:p.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),this.currentStep=6;return}if(((y=l==null?void 0:l.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}}}).catch(l=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"AVS"}),l.message?this.warningScreen.setPaymentError(l.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}submitOtp(e,i){e.preventDefault();const t={authorization:{otp:i},reference:this.activeRef};this.currentStep=6,this.showLoader(),P.track("input_cardOTP",{payment_method:"Card",authentication_type:"PIN+0TP"}),oi(this.token,t,this.rdtCode,this.url).then(({data:s,headers:r})=>{var l,c,b,p,g,f;if(s.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.providerMessage?this.warningScreen.setPaymentError(s.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(["success","successful","failed"].includes(s.status))["success","successful"].includes(s.status)&&(this.currentStep=5,this.redirectTo(s,r,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN+0TP"}));else{if(this.activeRef=s.reference,((l=s==null?void 0:s.authorization)==null?void 0:l.mode)==="pin"){this.currentStep=2;return}if(((c=s==null?void 0:s.authorization)==null?void 0:c.mode)==="3DS"){(b=s==null?void 0:s.authorization)!=null&&b.redirectUrl&&this.redirectTo3DS((p=s==null?void 0:s.authorization)==null?void 0:p.redirectUrl);return}if(((g=s==null?void 0:s.authorization)==null?void 0:g.mode)==="otp"){this.cardResponse=s,this.currentStep=3;return}if(((f=s==null?void 0:s.authorization)==null?void 0:f.mode)==="avs"){this.currentStep=7;return}this.currentStep=9}}).catch(s=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.message?this.warningScreen.setPaymentError(s.message):this.warningScreen.setPaymentError("Payment failed")})}redirectTo3DS(e){const i=window.open(e,"_blank");if(i){P.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const t=setInterval(()=>{i.closed&&(clearInterval(t),this.verifyPayment(({data:o,headers:s})=>{this.currentStep=5,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(o,s,"success")},({data:o})=>{this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment transaction failed"),P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}else alert("Please enable popups for this site to complete the authentication.")}async verifyPayment(e,i){try{const t=await vn(this.token,this.activeRef,void 0,this.rdtCode,this.url);t.data.status==="failed"?i(t):["success","successful"].includes(t.data.status)&&e(t)}catch{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"3DS"}),this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue()}}async verifyPaymentProcess(){try{const e=await vn(this.token,this.reference,void 0,this.rdtCode,this.url);this.cardResponse=e.data,this.cardResponseHeader=e.headers}catch{this.currentStep=4}}goBackToMerchant(){this.redirectTo(this.cardResponse,this.cardResponseHeader,this.callBackUrl)}renderCardContent(e){var t,o;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),i==null||i.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.cardDetailForm=new Et({container:this.contents,onAction:r=>l=>this.submitCardDetails.bind(this)(r,l),merchantName:this.merchantPlanDetail.merchantName}),this.cardDetailForm.renderContent();break;case 2:this.cardPinForm=new Ds({container:this.contents,onClose:this.onClose,onAction:r=>this.handlePinRequest.bind(this)(r)}),this.cardPinForm.renderComponent();break;case 3:this.cardOtpValidationForm=new Bs({container:this.contents,onClose:this.onClose,onAction:r=>l=>this.submitOtp.bind(this)(r,l),otpMessage:((t=this.cardResponse)==null?void 0:t.providerMessage)||"Please enter your OTP sent to your phone"}),this.cardOtpValidationForm.renderComponent();break;case 4:this.warningScreen=new fn({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=8}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.successScreen=new Gn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(o=this.merchantPlanDetail)==null?void 0:o.rate.rate}),this.successScreen.renderComponent();break;case 6:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 7:this.avsForm=new Us({container:this.contents,onAction:r=>l=>this.validatedAVS.bind(this)(r,l)}),this.avsForm.renderComponent();break;case 8:this.transactionIssuesScreen=new di({container:this.contents,onAction:()=>{var r;this.currentStep=4,this.warningScreen.setPaymentError(((r=this.cardResponse)==null?void 0:r.providerMessage)||"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 jo({container:this.contents,onAction:r=>{this.currentStep=r},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.confirmationEnd.renderComponent();break;default:this.cardDetailForm=new Et({container:this.contents,onAction:r=>l=>this.submitCardDetails.bind(this)(r,l),merchantName:this.merchantPlanDetail.merchantName}),this.cardDetailForm.renderContent();break}this.displayButtonText();const s=this.container.querySelector("#card-currency");s&&(s.textContent=`${this.localCurrency?this.localCurrency:this.currency} Card`)}}redirectTo(e,i,t){const o=i.get("spf-redirect-url");this.callBackUrl=o||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):t==="success"&&this.onSuccess(e)}displayButtonText(e){var t,o,s,r;const i=this.container.querySelector("#details-form-button-text");if(i){const l=this.currency,c=l==="USD"?(o=(t=this.merchantPlanDetail)==null?void 0:t.rate)==null?void 0:o.from:l;e?i.textContent=e:i.textContent=`Continue to pay ${c} ${ke((this.amount||0)*(l==="USD"?(r=(s=this.merchantPlanDetail)==null?void 0:s.rate)==null?void 0:r.rate:1),2)}`}}}const Br=`<div>
747
747
  <div class="container-center h-[40vh] hidden" id="loader">
748
748
  <img src="" alt="loader gif" />
749
749
  </div>
@@ -834,14 +834,14 @@ or you can use record.mirror to access the mirror instance during recording.`;le
834
834
  </div>
835
835
  </div>
836
836
  </div>
837
- </div>`;function Rr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var jo={exports:{}};/*!
837
+ </div>`;function Rr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Go={exports:{}};/*!
838
838
  * Pusher JavaScript Library v8.4.0
839
839
  * https://pusher.com/
840
840
  *
841
841
  * Copyright 2020, Pusher
842
842
  * Released under the MIT licence.
843
- */(function(n,e){(function(t,o){n.exports=o()})(window,function(){return function(i){var t={};function o(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return i[s].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=i,o.c=t,o.d=function(s,r,l){o.o(s,r)||Object.defineProperty(s,r,{enumerable:!0,get:l})},o.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},o.t=function(s,r){if(r&1&&(s=o(s)),r&8||r&4&&typeof s=="object"&&s&&s.__esModule)return s;var l=Object.create(null);if(o.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:s}),r&2&&typeof s!="string")for(var c in s)o.d(l,c,(function(b){return s[b]}).bind(null,c));return l},o.n=function(s){var r=s&&s.__esModule?function(){return s.default}:function(){return s};return o.d(r,"a",r),r},o.o=function(s,r){return Object.prototype.hasOwnProperty.call(s,r)},o.p="",o(o.s=2)}([function(i,t,o){var s=this&&this.__extends||function(){var k=function(S,A){return k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(M,_){M.__proto__=_}||function(M,_){for(var E in _)_.hasOwnProperty(E)&&(M[E]=_[E])},k(S,A)};return function(S,A){k(S,A);function M(){this.constructor=S}S.prototype=A===null?Object.create(A):(M.prototype=A.prototype,new M)}}();Object.defineProperty(t,"__esModule",{value:!0});var r=256,l=function(){function k(S){S===void 0&&(S="="),this._paddingCharacter=S}return k.prototype.encodedLength=function(S){return this._paddingCharacter?(S+2)/3*4|0:(S*8+5)/6|0},k.prototype.encode=function(S){for(var A="",M=0;M<S.length-2;M+=3){var _=S[M]<<16|S[M+1]<<8|S[M+2];A+=this._encodeByte(_>>>3*6&63),A+=this._encodeByte(_>>>2*6&63),A+=this._encodeByte(_>>>1*6&63),A+=this._encodeByte(_>>>0*6&63)}var E=S.length-M;if(E>0){var _=S[M]<<16|(E===2?S[M+1]<<8:0);A+=this._encodeByte(_>>>3*6&63),A+=this._encodeByte(_>>>2*6&63),E===2?A+=this._encodeByte(_>>>1*6&63):A+=this._paddingCharacter||"",A+=this._paddingCharacter||""}return A},k.prototype.maxDecodedLength=function(S){return this._paddingCharacter?S/4*3|0:(S*6+7)/8|0},k.prototype.decodedLength=function(S){return this.maxDecodedLength(S.length-this._getPaddingLength(S))},k.prototype.decode=function(S){if(S.length===0)return new Uint8Array(0);for(var A=this._getPaddingLength(S),M=S.length-A,_=new Uint8Array(this.maxDecodedLength(M)),E=0,N=0,V=0,F=0,U=0,G=0,oe=0;N<M-4;N+=4)F=this._decodeChar(S.charCodeAt(N+0)),U=this._decodeChar(S.charCodeAt(N+1)),G=this._decodeChar(S.charCodeAt(N+2)),oe=this._decodeChar(S.charCodeAt(N+3)),_[E++]=F<<2|U>>>4,_[E++]=U<<4|G>>>2,_[E++]=G<<6|oe,V|=F&r,V|=U&r,V|=G&r,V|=oe&r;if(N<M-1&&(F=this._decodeChar(S.charCodeAt(N)),U=this._decodeChar(S.charCodeAt(N+1)),_[E++]=F<<2|U>>>4,V|=F&r,V|=U&r),N<M-2&&(G=this._decodeChar(S.charCodeAt(N+2)),_[E++]=U<<4|G>>>2,V|=G&r),N<M-3&&(oe=this._decodeChar(S.charCodeAt(N+3)),_[E++]=G<<6|oe,V|=oe&r),V!==0)throw new Error("Base64Coder: incorrect characters for decoding");return _},k.prototype._encodeByte=function(S){var A=S;return A+=65,A+=25-S>>>8&6,A+=51-S>>>8&-75,A+=61-S>>>8&-15,A+=62-S>>>8&3,String.fromCharCode(A)},k.prototype._decodeChar=function(S){var A=r;return A+=(42-S&S-44)>>>8&-r+S-43+62,A+=(46-S&S-48)>>>8&-r+S-47+63,A+=(47-S&S-58)>>>8&-r+S-48+52,A+=(64-S&S-91)>>>8&-r+S-65+0,A+=(96-S&S-123)>>>8&-r+S-97+26,A},k.prototype._getPaddingLength=function(S){var A=0;if(this._paddingCharacter){for(var M=S.length-1;M>=0&&S[M]===this._paddingCharacter;M--)A++;if(S.length<4||A>2)throw new Error("Base64Coder: incorrect padding")}return A},k}();t.Coder=l;var c=new l;function b(k){return c.encode(k)}t.encode=b;function p(k){return c.decode(k)}t.decode=p;var g=function(k){s(S,k);function S(){return k!==null&&k.apply(this,arguments)||this}return S.prototype._encodeByte=function(A){var M=A;return M+=65,M+=25-A>>>8&6,M+=51-A>>>8&-75,M+=61-A>>>8&-13,M+=62-A>>>8&49,String.fromCharCode(M)},S.prototype._decodeChar=function(A){var M=r;return M+=(44-A&A-46)>>>8&-r+A-45+62,M+=(94-A&A-96)>>>8&-r+A-95+63,M+=(47-A&A-58)>>>8&-r+A-48+52,M+=(64-A&A-91)>>>8&-r+A-65+0,M+=(96-A&A-123)>>>8&-r+A-97+26,M},S}(l);t.URLSafeCoder=g;var f=new g;function y(k){return f.encode(k)}t.encodeURLSafe=y;function C(k){return f.decode(k)}t.decodeURLSafe=C,t.encodedLength=function(k){return c.encodedLength(k)},t.maxDecodedLength=function(k){return c.maxDecodedLength(k)},t.decodedLength=function(k){return c.decodedLength(k)}},function(i,t,o){Object.defineProperty(t,"__esModule",{value:!0});var s="utf8: invalid string",r="utf8: invalid source encoding";function l(p){for(var g=new Uint8Array(c(p)),f=0,y=0;y<p.length;y++){var C=p.charCodeAt(y);C<128?g[f++]=C:C<2048?(g[f++]=192|C>>6,g[f++]=128|C&63):C<55296?(g[f++]=224|C>>12,g[f++]=128|C>>6&63,g[f++]=128|C&63):(y++,C=(C&1023)<<10,C|=p.charCodeAt(y)&1023,C+=65536,g[f++]=240|C>>18,g[f++]=128|C>>12&63,g[f++]=128|C>>6&63,g[f++]=128|C&63)}return g}t.encode=l;function c(p){for(var g=0,f=0;f<p.length;f++){var y=p.charCodeAt(f);if(y<128)g+=1;else if(y<2048)g+=2;else if(y<55296)g+=3;else if(y<=57343){if(f>=p.length-1)throw new Error(s);f++,g+=4}else throw new Error(s)}return g}t.encodedLength=c;function b(p){for(var g=[],f=0;f<p.length;f++){var y=p[f];if(y&128){var C=void 0;if(y<224){if(f>=p.length)throw new Error(r);var k=p[++f];if((k&192)!==128)throw new Error(r);y=(y&31)<<6|k&63,C=128}else if(y<240){if(f>=p.length-1)throw new Error(r);var k=p[++f],S=p[++f];if((k&192)!==128||(S&192)!==128)throw new Error(r);y=(y&15)<<12|(k&63)<<6|S&63,C=2048}else if(y<248){if(f>=p.length-2)throw new Error(r);var k=p[++f],S=p[++f],A=p[++f];if((k&192)!==128||(S&192)!==128||(A&192)!==128)throw new Error(r);y=(y&15)<<18|(k&63)<<12|(S&63)<<6|A&63,C=65536}else throw new Error(r);if(y<C||y>=55296&&y<=57343)throw new Error(r);if(y>=65536){if(y>1114111)throw new Error(r);y-=65536,g.push(String.fromCharCode(55296|y>>10)),y=56320|y&1023}}g.push(String.fromCharCode(y))}return g.join("")}t.decode=b},function(i,t,o){i.exports=o(3).default},function(i,t,o){o.r(t);class s{constructor(a,d){this.lastId=0,this.prefix=a,this.name=d}create(a){this.lastId++;var d=this.lastId,v=this.prefix+d,w=this.name+"["+d+"]",L=!1,T=function(){L||(a.apply(null,arguments),L=!0)};return this[d]=T,{number:d,id:v,name:w,callback:T}}remove(a){delete this[a.number]}}var r=new s("_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 b{constructor(a){this.options=a,this.receivers=a.receivers||r,this.loading={}}load(a,d,v){var w=this;if(w.loading[a]&&w.loading[a].length>0)w.loading[a].push(v);else{w.loading[a]=[v];var L=H.createScriptRequest(w.getPath(a,d)),T=w.receivers.create(function(I){if(w.receivers.remove(T),w.loading[a]){var O=w.loading[a];delete w.loading[a];for(var Z=function(he){he||L.cleanup()},Y=0;Y<O.length;Y++)O[Y](I,Z)}});L.send(T)}}getRoot(a){var d,v=H.getDocument().location.protocol;return a&&a.useTLS||v==="https:"?d=this.options.cdn_https:d=this.options.cdn_http,d.replace(/\/*$/,"")+"/"+this.options.version}getPath(a,d){return this.getRoot(d)+"/"+a+this.options.suffix+".js"}}var p=new s("_pusher_dependencies","Pusher.DependenciesReceivers"),g=new b({cdn_http:c.cdn_http,cdn_https:c.cdn_https,version:c.VERSION,suffix:c.dependency_suffix,receivers:p});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 C={buildLogSuffix:function(u){const a="See:",d=f.urls[u];if(!d)return"";let v;return d.fullUrl?v=d.fullUrl:d.path&&(v=f.baseUrl+d.path),v?`${a} ${v}`:""}},k;(function(u){u.UserAuthentication="user-authentication",u.ChannelAuthorization="channel-authorization"})(k||(k={}));class S extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class A extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class _ extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class E extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class N extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class V extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class F extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class U extends Error{constructor(a,d){super(d),this.status=a,Object.setPrototypeOf(this,new.target.prototype)}}var oe=function(u,a,d,v,w){const L=H.createXHR();L.open("POST",d.endpoint,!0),L.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var T in d.headers)L.setRequestHeader(T,d.headers[T]);if(d.headersProvider!=null){let I=d.headersProvider();for(var T in I)L.setRequestHeader(T,I[T])}return L.onreadystatechange=function(){if(L.readyState===4)if(L.status===200){let I,O=!1;try{I=JSON.parse(L.responseText),O=!0}catch{w(new U(200,`JSON returned from ${v.toString()} endpoint was invalid, yet status code was 200. Data was: ${L.responseText}`),null)}O&&w(null,I)}else{let I="";switch(v){case k.UserAuthentication:I=C.buildLogSuffix("authenticationEndpoint");break;case k.ChannelAuthorization:I=`Clients must be authorized to join private or presence channels. ${C.buildLogSuffix("authorizationEndpoint")}`;break}w(new U(L.status,`Unable to retrieve auth string from ${v.toString()} endpoint - received status: ${L.status} from ${d.endpoint}. ${I}`),null)}},L.send(a),L};function fe(u){return Xe(Te(u))}var K=String.fromCharCode,Ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ue=function(u){var a=u.charCodeAt(0);return a<128?u:a<2048?K(192|a>>>6)+K(128|a&63):K(224|a>>>12&15)+K(128|a>>>6&63)+K(128|a&63)},Te=function(u){return u.replace(/[^\x00-\x7F]/g,ue)},Me=function(u){var a=[0,2,1][u.length%3],d=u.charCodeAt(0)<<16|(u.length>1?u.charCodeAt(1):0)<<8|(u.length>2?u.charCodeAt(2):0),v=[Ae.charAt(d>>>18),Ae.charAt(d>>>12&63),a>=2?"=":Ae.charAt(d>>>6&63),a>=1?"=":Ae.charAt(d&63)];return v.join("")},Xe=window.btoa||function(u){return u.replace(/[\s\S]{1,3}/g,Me)};class pn{constructor(a,d,v,w){this.clear=d,this.timer=a(()=>{this.timer&&(this.timer=w(this.timer))},v)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var en=pn;function Sn(u){window.clearTimeout(u)}function bn(u){window.clearInterval(u)}class Ee extends en{constructor(a,d){super(setTimeout,Sn,a,function(v){return d(),null})}}class nn extends en{constructor(a,d){super(setInterval,bn,a,function(v){return d(),v})}}var _n={now(){return Date.now?Date.now():new Date().valueOf()},defer(u){return new Ee(0,u)},method(u,...a){var d=Array.prototype.slice.call(arguments,1);return function(v){return v[u].apply(v,d.concat(arguments))}}},re=_n;function be(u,...a){for(var d=0;d<a.length;d++){var v=a[d];for(var w in v)v[w]&&v[w].constructor&&v[w].constructor===Object?u[w]=be(u[w]||{},v[w]):u[w]=v[w]}return u}function Re(){for(var u=["Pusher"],a=0;a<arguments.length;a++)typeof arguments[a]=="string"?u.push(arguments[a]):u.push(Bi(arguments[a]));return u.join(" : ")}function Pe(u,a){var d=Array.prototype.indexOf;if(u===null)return-1;if(d&&u.indexOf===d)return u.indexOf(a);for(var v=0,w=u.length;v<w;v++)if(u[v]===a)return v;return-1}function Ce(u,a){for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&a(u[d],d,u)}function qe(u){var a=[];return Ce(u,function(d,v){a.push(v)}),a}function B(u){var a=[];return Ce(u,function(d){a.push(d)}),a}function me(u,a,d){for(var v=0;v<u.length;v++)a.call(d||window,u[v],v,u)}function $(u,a){for(var d=[],v=0;v<u.length;v++)d.push(a(u[v],v,u,d));return d}function ge(u,a){var d={};return Ce(u,function(v,w){d[w]=a(v)}),d}function We(u,a){a=a||function(w){return!!w};for(var d=[],v=0;v<u.length;v++)a(u[v],v,u,d)&&d.push(u[v]);return d}function Q(u,a){var d={};return Ce(u,function(v,w){(a&&a(v,w,u,d)||v)&&(d[w]=v)}),d}function ni(u){var a=[];return Ce(u,function(d,v){a.push([v,d])}),a}function Jo(u,a){for(var d=0;d<u.length;d++)if(a(u[d],d,u))return!0;return!1}function fl(u,a){for(var d=0;d<u.length;d++)if(!a(u[d],d,u))return!1;return!0}function gl(u){return ge(u,function(a){return typeof a=="object"&&(a=Bi(a)),encodeURIComponent(fe(a.toString()))})}function yl(u){var a=Q(u,function(v){return v!==void 0}),d=$(ni(gl(a)),re.method("join","=")).join("&");return d}function kl(u){var a=[],d=[];return function v(w,L){var T,I,O;switch(typeof w){case"object":if(!w)return null;for(T=0;T<a.length;T+=1)if(a[T]===w)return{$ref:d[T]};if(a.push(w),d.push(L),Object.prototype.toString.apply(w)==="[object Array]")for(O=[],T=0;T<w.length;T+=1)O[T]=v(w[T],L+"["+T+"]");else{O={};for(I in w)Object.prototype.hasOwnProperty.call(w,I)&&(O[I]=v(w[I],L+"["+JSON.stringify(I)+"]"))}return O;case"number":case"string":case"boolean":return w}}(u,"$")}function Bi(u){try{return JSON.stringify(u)}catch{return JSON.stringify(kl(u))}}class wl{constructor(){this.globalLog=a=>{window.console&&window.console.log&&window.console.log(a)}}debug(...a){this.log(this.globalLog,a)}warn(...a){this.log(this.globalLogWarn,a)}error(...a){this.log(this.globalLogError,a)}globalLogWarn(a){window.console&&window.console.warn?window.console.warn(a):this.globalLog(a)}globalLogError(a){window.console&&window.console.error?window.console.error(a):this.globalLogWarn(a)}log(a,...d){var v=Re.apply(this,arguments);_t.log?_t.log(v):_t.logToConsole&&a.bind(this)(v)}}var se=new wl,Cl=function(u,a,d,v,w){(d.headers!==void 0||d.headersProvider!=null)&&se.warn(`To send headers with the ${v.toString()} request, you must use AJAX, rather than JSONP.`);var L=u.nextAuthCallbackID.toString();u.nextAuthCallbackID++;var T=u.getDocument(),I=T.createElement("script");u.auth_callbacks[L]=function(Y){w(null,Y)};var O="Pusher.auth_callbacks['"+L+"']";I.src=d.endpoint+"?callback="+encodeURIComponent(O)+"&"+a;var Z=T.getElementsByTagName("head")[0]||T.documentElement;Z.insertBefore(I,Z.firstChild)},Sl=Cl;class _l{constructor(a){this.src=a}send(a){var d=this,v="Error loading "+d.src;d.script=document.createElement("script"),d.script.id=a.id,d.script.src=d.src,d.script.type="text/javascript",d.script.charset="UTF-8",d.script.addEventListener?(d.script.onerror=function(){a.callback(v)},d.script.onload=function(){a.callback(null)}):d.script.onreadystatechange=function(){(d.script.readyState==="loaded"||d.script.readyState==="complete")&&a.callback(null)},d.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(d.errorScript=document.createElement("script"),d.errorScript.id=a.id+"_error",d.errorScript.text=a.name+"('"+v+"');",d.script.async=d.errorScript.async=!1):d.script.async=!0;var w=document.getElementsByTagName("head")[0];w.insertBefore(d.script,w.firstChild),d.errorScript&&w.insertBefore(d.errorScript,d.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 Al{constructor(a,d){this.url=a,this.data=d}send(a){if(!this.request){var d=yl(this.data),v=this.url+"/"+a.number+"?"+d;this.request=H.createScriptRequest(v),this.request.send(a)}}cleanup(){this.request&&this.request.cleanup()}}var Ml=function(u,a){return function(d,v){var w="http"+(a?"s":"")+"://",L=w+(u.host||u.options.host)+u.options.path,T=H.createJSONPRequest(L,d),I=H.ScriptReceivers.create(function(O,Z){r.remove(I),T.cleanup(),Z&&Z.host&&(u.host=Z.host),v&&v(O,Z)});T.send(I)}},xl={name:"jsonp",getAgent:Ml},Ll=xl;function pt(u,a,d){var v=u+(a.useTLS?"s":""),w=a.useTLS?a.hostTLS:a.hostNonTLS;return v+"://"+w+d}function bt(u,a){var d="/app/"+u,v="?protocol="+c.PROTOCOL+"&client=js&version="+c.VERSION+(a?"&"+a:"");return d+v}var Tl={getInitial:function(u,a){var d=(a.httpPath||"")+bt(u,"flash=false");return pt("ws",a,d)}},El={getInitial:function(u,a){var d=(a.httpPath||"/pusher")+bt(u);return pt("http",a,d)}},Pl={getInitial:function(u,a){return pt("http",a,a.httpPath||"/pusher")},getPath:function(u,a){return bt(u)}};class Nl{constructor(){this._callbacks={}}get(a){return this._callbacks[vt(a)]}add(a,d,v){var w=vt(a);this._callbacks[w]=this._callbacks[w]||[],this._callbacks[w].push({fn:d,context:v})}remove(a,d,v){if(!a&&!d&&!v){this._callbacks={};return}var w=a?[vt(a)]:qe(this._callbacks);d||v?this.removeCallback(w,d,v):this.removeAllCallbacks(w)}removeCallback(a,d,v){me(a,function(w){this._callbacks[w]=We(this._callbacks[w]||[],function(L){return d&&d!==L.fn||v&&v!==L.context}),this._callbacks[w].length===0&&delete this._callbacks[w]},this)}removeAllCallbacks(a){me(a,function(d){delete this._callbacks[d]},this)}}function vt(u){return"_"+u}class tn{constructor(a){this.callbacks=new Nl,this.global_callbacks=[],this.failThrough=a}bind(a,d,v){return this.callbacks.add(a,d,v),this}bind_global(a){return this.global_callbacks.push(a),this}unbind(a,d,v){return this.callbacks.remove(a,d,v),this}unbind_global(a){return a?(this.global_callbacks=We(this.global_callbacks||[],d=>d!==a),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(a,d,v){for(var w=0;w<this.global_callbacks.length;w++)this.global_callbacks[w](a,d);var L=this.callbacks.get(a),T=[];if(v?T.push(d,v):d&&T.push(d),L&&L.length>0)for(var w=0;w<L.length;w++)L[w].fn.apply(L[w].context||window,T);else this.failThrough&&this.failThrough(a,d);return this}}class Il extends tn{constructor(a,d,v,w,L){super(),this.initialize=H.transportConnectionInitializer,this.hooks=a,this.name=d,this.priority=v,this.key=w,this.options=L,this.state="new",this.timeline=L.timeline,this.activityTimeout=L.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 a=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(a,this.options)}catch(d){return re.defer(()=>{this.onError(d),this.changeState("closed")}),!1}return this.bindListeners(),se.debug("Connecting",{transport:this.name,url:a}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(a){return this.state==="open"?(re.defer(()=>{this.socket&&this.socket.send(a)}),!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(a){this.emit("error",{type:"WebSocketError",error:a}),this.timeline.error(this.buildTimelineMessage({error:a.toString()}))}onClose(a){a?this.changeState("closed",{code:a.code,reason:a.reason,wasClean:a.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(a){this.emit("message",a)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=a=>{this.onError(a)},this.socket.onclose=a=>{this.onClose(a)},this.socket.onmessage=a=>{this.onMessage(a)},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(a,d){this.state=a,this.timeline.info(this.buildTimelineMessage({state:a,params:d})),this.emit(a,d)}buildTimelineMessage(a){return be({cid:this.id},a)}}class jn{constructor(a){this.hooks=a}isSupported(a){return this.hooks.isSupported(a)}createConnection(a,d,v,w){return new Il(this.hooks,a,d,v,w)}}var Bl=new jn({urls:Tl,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!H.getWebSocketAPI()},isSupported:function(){return!!H.getWebSocketAPI()},getSocket:function(u){return H.createWebSocket(u)}}),$o={urls:El,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Yo=be({getSocket:function(u){return H.HTTPFactory.createStreamingSocket(u)}},$o),Qo=be({getSocket:function(u){return H.HTTPFactory.createPollingSocket(u)}},$o),Xo={isSupported:function(){return H.isXHRSupported()}},Rl=new jn(be({},Yo,Xo)),Dl=new jn(be({},Qo,Xo)),Ol={ws:Bl,xhr_streaming:Rl,xhr_polling:Dl},Ri=Ol,Hl=new jn({file:"sockjs",urls:Pl,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(u,a){return new window.SockJS(u,null,{js_path:g.getPath("sockjs",{useTLS:a.useTLS}),ignore_null_origin:a.ignoreNullOrigin})},beforeOpen:function(u,a){u.send(JSON.stringify({path:a}))}}),es={isSupported:function(u){var a=H.isXDRSupported(u.useTLS);return a}},Ul=new jn(be({},Yo,es)),Kl=new jn(be({},Qo,es));Ri.xdr_streaming=Ul,Ri.xdr_polling=Kl,Ri.sockjs=Hl;var jl=Ri;class Gl extends tn{constructor(){super();var a=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){a.emit("online")},!1),window.addEventListener("offline",function(){a.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Vl=new Gl;class Fl{constructor(a,d,v){this.manager=a,this.transport=d,this.minPingDelay=v.minPingDelay,this.maxPingDelay=v.maxPingDelay,this.pingDelay=void 0}createConnection(a,d,v,w){w=be({},w,{activityTimeout:this.pingDelay});var L=this.transport.createConnection(a,d,v,w),T=null,I=function(){L.unbind("open",I),L.bind("closed",O),T=re.now()},O=Z=>{if(L.unbind("closed",O),Z.code===1002||Z.code===1003)this.manager.reportDeath();else if(!Z.wasClean&&T){var Y=re.now()-T;Y<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(Y/2,this.minPingDelay))}};return L.bind("open",I),L}isSupported(a){return this.manager.isAlive()&&this.transport.isSupported(a)}}const ns={decodeMessage:function(u){try{var a=JSON.parse(u.data),d=a.data;if(typeof d=="string")try{d=JSON.parse(a.data)}catch{}var v={event:a.event,channel:a.channel,data:d};return a.user_id&&(v.user_id=a.user_id),v}catch(w){throw{type:"MessageParseError",error:w,data:u.data}}},encodeMessage:function(u){return JSON.stringify(u)},processHandshake:function(u){var a=ns.decodeMessage(u);if(a.event==="pusher:connection_established"){if(!a.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:a.data.socket_id,activityTimeout:a.data.activity_timeout*1e3}}else{if(a.event==="pusher:error")return{action:this.getCloseAction(a.data),error:this.getCloseError(a.data)};throw"Invalid handshake"}},getCloseAction:function(u){return u.code<4e3?u.code>=1002&&u.code<=1004?"backoff":null:u.code===4e3?"tls_only":u.code<4100?"refused":u.code<4200?"backoff":u.code<4300?"retry":"refused"},getCloseError:function(u){return u.code!==1e3&&u.code!==1001?{type:"PusherError",data:{code:u.code,message:u.reason||u.message}}:null}};var An=ns;class zl extends tn{constructor(a,d){super(),this.id=a,this.transport=d,this.activityTimeout=d.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(a){return this.transport.send(a)}send_event(a,d,v){var w={event:a,data:d};return v&&(w.channel=v),se.debug("Event sent",w),this.send(An.encodeMessage(w))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var a={message:v=>{var w;try{w=An.decodeMessage(v)}catch(L){this.emit("error",{type:"MessageParseError",error:L,data:v.data})}if(w!==void 0){switch(se.debug("Event recd",w),w.event){case"pusher:error":this.emit("error",{type:"PusherError",data:w.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",w)}},activity:()=>{this.emit("activity")},error:v=>{this.emit("error",v)},closed:v=>{d(),v&&v.code&&this.handleCloseEvent(v),this.transport=null,this.emit("closed")}},d=()=>{Ce(a,(v,w)=>{this.transport.unbind(w,v)})};Ce(a,(v,w)=>{this.transport.bind(w,v)})}handleCloseEvent(a){var d=An.getCloseAction(a),v=An.getCloseError(a);v&&this.emit("error",v),d&&this.emit(d,{action:d,error:v})}}class ql{constructor(a,d){this.transport=a,this.callback=d,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=a=>{this.unbindListeners();var d;try{d=An.processHandshake(a)}catch(v){this.finish("error",{error:v}),this.transport.close();return}d.action==="connected"?this.finish("connected",{connection:new zl(d.id,this.transport),activityTimeout:d.activityTimeout}):(this.finish(d.action,{error:d.error}),this.transport.close())},this.onClosed=a=>{this.unbindListeners();var d=An.getCloseAction(a)||"backoff",v=An.getCloseError(a);this.finish(d,{error:v})},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(a,d){this.callback(be({transport:this.transport,action:a},d))}}class Wl{constructor(a,d){this.timeline=a,this.options=d||{}}send(a,d){this.timeline.isEmpty()||this.timeline.send(H.TimelineTransport.getAgent(this,a),d)}}class ft extends tn{constructor(a,d){super(function(v,w){se.debug("No callbacks on "+a+" for "+v)}),this.name=a,this.pusher=d,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(a,d){return d(null,{auth:""})}trigger(a,d){if(a.indexOf("client-")!==0)throw new S("Event '"+a+"' does not start with 'client-'");if(!this.subscribed){var v=C.buildLogSuffix("triggeringClientEvents");se.warn(`Client event triggered before channel 'subscription_succeeded' event . ${v}`)}return this.pusher.send_event(a,d,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(a){var d=a.event,v=a.data;if(d==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(a);else if(d==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(a);else if(d.indexOf("pusher_internal:")!==0){var w={};this.emit(d,v,w)}}handleSubscriptionSucceededEvent(a){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",a.data)}handleSubscriptionCountEvent(a){a.data.subscription_count&&(this.subscriptionCount=a.data.subscription_count),this.emit("pusher:subscription_count",a.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(a,d)=>{a?(this.subscriptionPending=!1,se.error(a.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:a.message},a instanceof U?{status:a.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:d.auth,channel_data:d.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 gt extends ft{authorize(a,d){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:a},d)}}class Zl{constructor(){this.reset()}get(a){return Object.prototype.hasOwnProperty.call(this.members,a)?{id:a,info:this.members[a]}:null}each(a){Ce(this.members,(d,v)=>{a(this.get(v))})}setMyID(a){this.myID=a}onSubscription(a){this.members=a.presence.hash,this.count=a.presence.count,this.me=this.get(this.myID)}addMember(a){return this.get(a.user_id)===null&&this.count++,this.members[a.user_id]=a.user_info,this.get(a.user_id)}removeMember(a){var d=this.get(a.user_id);return d&&(delete this.members[a.user_id],this.count--),d}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Jl=function(u,a,d,v){function w(L){return L instanceof d?L:new d(function(T){T(L)})}return new(d||(d=Promise))(function(L,T){function I(Y){try{Z(v.next(Y))}catch(he){T(he)}}function O(Y){try{Z(v.throw(Y))}catch(he){T(he)}}function Z(Y){Y.done?L(Y.value):w(Y.value).then(I,O)}Z((v=v.apply(u,a||[])).next())})};class $l extends gt{constructor(a,d){super(a,d),this.members=new Zl}authorize(a,d){super.authorize(a,(v,w)=>Jl(this,void 0,void 0,function*(){if(!v)if(w=w,w.channel_data!=null){var L=JSON.parse(w.channel_data);this.members.setMyID(L.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 T=C.buildLogSuffix("authorizationEndpoint");se.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${T}, or the user should be signed in.`),d("Invalid auth response");return}d(v,w)}))}handleEvent(a){var d=a.event;if(d.indexOf("pusher_internal:")===0)this.handleInternalEvent(a);else{var v=a.data,w={};a.user_id&&(w.user_id=a.user_id),this.emit(d,v,w)}}handleInternalEvent(a){var d=a.event,v=a.data;switch(d){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(a);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(a);break;case"pusher_internal:member_added":var w=this.members.addMember(v);this.emit("pusher:member_added",w);break;case"pusher_internal:member_removed":var L=this.members.removeMember(v);L&&this.emit("pusher:member_removed",L);break}}handleSubscriptionSucceededEvent(a){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(a.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Yl=o(1),yt=o(0);class Ql extends gt{constructor(a,d,v){super(a,d),this.key=null,this.nacl=v}authorize(a,d){super.authorize(a,(v,w)=>{if(v){d(v,w);return}let L=w.shared_secret;if(!L){d(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(yt.decode)(L),delete w.shared_secret,d(null,w)})}trigger(a,d){throw new N("Client events are not currently supported for encrypted channels")}handleEvent(a){var d=a.event,v=a.data;if(d.indexOf("pusher_internal:")===0||d.indexOf("pusher:")===0){super.handleEvent(a);return}this.handleEncryptedEvent(d,v)}handleEncryptedEvent(a,d){if(!this.key){se.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!d.ciphertext||!d.nonce){se.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+d);return}let v=Object(yt.decode)(d.ciphertext);if(v.length<this.nacl.secretbox.overheadLength){se.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${v.length}`);return}let w=Object(yt.decode)(d.nonce);if(w.length<this.nacl.secretbox.nonceLength){se.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${w.length}`);return}let L=this.nacl.secretbox.open(v,w,this.key);if(L===null){se.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,(T,I)=>{if(T){se.error(`Failed to make a request to the authEndpoint: ${I}. Unable to fetch new key, so dropping encrypted event`);return}if(L=this.nacl.secretbox.open(v,w,this.key),L===null){se.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(a,this.getDataToEmit(L))});return}this.emit(a,this.getDataToEmit(L))}getDataToEmit(a){let d=Object(Yl.decode)(a);try{return JSON.parse(d)}catch{return d}}}class Xl extends tn{constructor(a,d){super(),this.state="initialized",this.connection=null,this.key=a,this.options=d,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 v=H.getNetwork();v.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),v.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(a){return this.connection?this.connection.send(a):!1}send_event(a,d,v){return this.connection?this.connection.send_event(a,d,v):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var a=(d,v)=>{d?this.runner=this.strategy.connect(0,a):v.action==="error"?(this.emit("error",{type:"HandshakeError",error:v.error}),this.timeline.error({handshakeError:v.error})):(this.abortConnecting(),this.handshakeCallbacks[v.action](v))};this.runner=this.strategy.connect(0,a)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var a=this.abandonConnection();a.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(a){this.timeline.info({action:"retry",delay:a}),a>0&&this.emit("connecting_in",Math.round(a/1e3)),this.retryTimer=new Ee(a||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Ee(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Ee(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 Ee(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(a){return be({},a,{message:d=>{this.resetActivityCheck(),this.emit("message",d)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:d=>{this.emit("error",d)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(a){return be({},a,{connected:d=>{this.activityTimeout=Math.min(this.options.activityTimeout,d.activityTimeout,d.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(d.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let a=d=>v=>{v.error&&this.emit("error",{type:"WebSocketError",error:v.error}),d(v)};return{tls_only:a(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:a(()=>{this.disconnect()}),backoff:a(()=>{this.retryIn(1e3)}),retry:a(()=>{this.retryIn(0)})}}setConnection(a){this.connection=a;for(var d in this.connectionCallbacks)this.connection.bind(d,this.connectionCallbacks[d]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var a in this.connectionCallbacks)this.connection.unbind(a,this.connectionCallbacks[a]);var d=this.connection;return this.connection=null,d}}updateState(a,d){var v=this.state;if(this.state=a,v!==a){var w=a;w==="connected"&&(w+=" with new socket ID "+d.socket_id),se.debug("State changed",v+" -> "+w),this.timeline.info({state:a,params:d}),this.emit("state_change",{previous:v,current:a}),this.emit(a,d)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class ed{constructor(){this.channels={}}add(a,d){return this.channels[a]||(this.channels[a]=nd(a,d)),this.channels[a]}all(){return B(this.channels)}find(a){return this.channels[a]}remove(a){var d=this.channels[a];return delete this.channels[a],d}disconnect(){Ce(this.channels,function(a){a.disconnect()})}}function nd(u,a){if(u.indexOf("private-encrypted-")===0){if(a.config.nacl)return on.createEncryptedChannel(u,a,a.config.nacl);let d="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",v=C.buildLogSuffix("encryptedChannelSupport");throw new N(`${d}. ${v}`)}else{if(u.indexOf("private-")===0)return on.createPrivateChannel(u,a);if(u.indexOf("presence-")===0)return on.createPresenceChannel(u,a);if(u.indexOf("#")===0)throw new A('Cannot create a channel with name "'+u+'".');return on.createChannel(u,a)}}var id={createChannels(){return new ed},createConnectionManager(u,a){return new Xl(u,a)},createChannel(u,a){return new ft(u,a)},createPrivateChannel(u,a){return new gt(u,a)},createPresenceChannel(u,a){return new $l(u,a)},createEncryptedChannel(u,a,d){return new Ql(u,a,d)},createTimelineSender(u,a){return new Wl(u,a)},createHandshake(u,a){return new ql(u,a)},createAssistantToTheTransportManager(u,a,d){return new Fl(u,a,d)}},on=id;class is{constructor(a){this.options=a||{},this.livesLeft=this.options.lives||1/0}getAssistant(a){return on.createAssistantToTheTransportManager(this,a,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Mn{constructor(a,d){this.strategies=a,this.loop=!!d.loop,this.failFast=!!d.failFast,this.timeout=d.timeout,this.timeoutLimit=d.timeoutLimit}isSupported(){return Jo(this.strategies,re.method("isSupported"))}connect(a,d){var v=this.strategies,w=0,L=this.timeout,T=null,I=(O,Z)=>{Z?d(null,Z):(w=w+1,this.loop&&(w=w%v.length),w<v.length?(L&&(L=L*2,this.timeoutLimit&&(L=Math.min(L,this.timeoutLimit))),T=this.tryStrategy(v[w],a,{timeout:L,failFast:this.failFast},I)):d(!0))};return T=this.tryStrategy(v[w],a,{timeout:L,failFast:this.failFast},I),{abort:function(){T.abort()},forceMinPriority:function(O){a=O,T&&T.forceMinPriority(O)}}}tryStrategy(a,d,v,w){var L=null,T=null;return v.timeout>0&&(L=new Ee(v.timeout,function(){T.abort(),w(!0)})),T=a.connect(d,function(I,O){I&&L&&L.isRunning()&&!v.failFast||(L&&L.ensureAborted(),w(I,O))}),{abort:function(){L&&L.ensureAborted(),T.abort()},forceMinPriority:function(I){T.forceMinPriority(I)}}}}class kt{constructor(a){this.strategies=a}isSupported(){return Jo(this.strategies,re.method("isSupported"))}connect(a,d){return td(this.strategies,a,function(v,w){return function(L,T){if(w[v].error=L,L){od(w)&&d(!0);return}me(w,function(I){I.forceMinPriority(T.transport.priority)}),d(null,T)}})}}function td(u,a,d){var v=$(u,function(w,L,T,I){return w.connect(a,d(L,I))});return{abort:function(){me(v,sd)},forceMinPriority:function(w){me(v,function(L){L.forceMinPriority(w)})}}}function od(u){return fl(u,function(a){return!!a.error})}function sd(u){!u.error&&!u.aborted&&(u.abort(),u.aborted=!0)}class ad{constructor(a,d,v){this.strategy=a,this.transports=d,this.ttl=v.ttl||1800*1e3,this.usingTLS=v.useTLS,this.timeline=v.timeline}isSupported(){return this.strategy.isSupported()}connect(a,d){var v=this.usingTLS,w=rd(v),L=w&&w.cacheSkipCount?w.cacheSkipCount:0,T=[this.strategy];if(w&&w.timestamp+this.ttl>=re.now()){var I=this.transports[w.transport];I&&(["ws","wss"].includes(w.transport)||L>3?(this.timeline.info({cached:!0,transport:w.transport,latency:w.latency}),T.push(new Mn([I],{timeout:w.latency*2+1e3,failFast:!0}))):L++)}var O=re.now(),Z=T.pop().connect(a,function Y(he,Hi){he?(ts(v),T.length>0?(O=re.now(),Z=T.pop().connect(a,Y)):d(he)):(ld(v,Hi.transport.name,re.now()-O,L),d(null,Hi))});return{abort:function(){Z.abort()},forceMinPriority:function(Y){a=Y,Z&&Z.forceMinPriority(Y)}}}}function wt(u){return"pusherTransport"+(u?"TLS":"NonTLS")}function rd(u){var a=H.getLocalStorage();if(a)try{var d=a[wt(u)];if(d)return JSON.parse(d)}catch{ts(u)}return null}function ld(u,a,d,v){var w=H.getLocalStorage();if(w)try{w[wt(u)]=Bi({timestamp:re.now(),transport:a,latency:d,cacheSkipCount:v})}catch{}}function ts(u){var a=H.getLocalStorage();if(a)try{delete a[wt(u)]}catch{}}class Di{constructor(a,{delay:d}){this.strategy=a,this.options={delay:d}}isSupported(){return this.strategy.isSupported()}connect(a,d){var v=this.strategy,w,L=new Ee(this.options.delay,function(){w=v.connect(a,d)});return{abort:function(){L.ensureAborted(),w&&w.abort()},forceMinPriority:function(T){a=T,w&&w.forceMinPriority(T)}}}}class ii{constructor(a,d,v){this.test=a,this.trueBranch=d,this.falseBranch=v}isSupported(){var a=this.test()?this.trueBranch:this.falseBranch;return a.isSupported()}connect(a,d){var v=this.test()?this.trueBranch:this.falseBranch;return v.connect(a,d)}}class dd{constructor(a){this.strategy=a}isSupported(){return this.strategy.isSupported()}connect(a,d){var v=this.strategy.connect(a,function(w,L){L&&v.abort(),d(w,L)});return v}}function ti(u){return function(){return u.isSupported()}}var cd=function(u,a,d){var v={};function w(ps,dc,cc,uc,mc){var bs=d(u,ps,dc,cc,uc,mc);return v[ps]=bs,bs}var L=Object.assign({},a,{hostNonTLS:u.wsHost+":"+u.wsPort,hostTLS:u.wsHost+":"+u.wssPort,httpPath:u.wsPath}),T=Object.assign({},L,{useTLS:!0}),I=Object.assign({},a,{hostNonTLS:u.httpHost+":"+u.httpPort,hostTLS:u.httpHost+":"+u.httpsPort,httpPath:u.httpPath}),O={loop:!0,timeout:15e3,timeoutLimit:6e4},Z=new is({minPingDelay:1e4,maxPingDelay:u.activityTimeout}),Y=new is({lives:2,minPingDelay:1e4,maxPingDelay:u.activityTimeout}),he=w("ws","ws",3,L,Z),Hi=w("wss","ws",3,T,Z),oc=w("sockjs","sockjs",1,I),ls=w("xhr_streaming","xhr_streaming",1,I,Y),sc=w("xdr_streaming","xdr_streaming",1,I,Y),ds=w("xhr_polling","xhr_polling",1,I),ac=w("xdr_polling","xdr_polling",1,I),cs=new Mn([he],O),rc=new Mn([Hi],O),lc=new Mn([oc],O),us=new Mn([new ii(ti(ls),ls,sc)],O),ms=new Mn([new ii(ti(ds),ds,ac)],O),hs=new Mn([new ii(ti(us),new kt([us,new Di(ms,{delay:4e3})]),ms)],O),At=new ii(ti(hs),hs,lc),Mt;return a.useTLS?Mt=new kt([cs,new Di(At,{delay:2e3})]):Mt=new kt([cs,new Di(rc,{delay:2e3}),new Di(At,{delay:5e3})]),new ad(new dd(new ii(ti(he),Mt,At)),v,{ttl:18e5,timeline:a.timeline,useTLS:a.useTLS})},ud=cd,md=function(){var u=this;u.timeline.info(u.buildTimelineMessage({transport:u.name+(u.options.useTLS?"s":"")})),u.hooks.isInitialized()?u.changeState("initialized"):u.hooks.file?(u.changeState("initializing"),g.load(u.hooks.file,{useTLS:u.options.useTLS},function(a,d){u.hooks.isInitialized()?(u.changeState("initialized"),d(!0)):(a&&u.onError(a),u.onClose(),d(!1))})):u.onClose()},hd={getRequest:function(u){var a=new window.XDomainRequest;return a.ontimeout=function(){u.emit("error",new M),u.close()},a.onerror=function(d){u.emit("error",d),u.close()},a.onprogress=function(){a.responseText&&a.responseText.length>0&&u.onChunk(200,a.responseText)},a.onload=function(){a.responseText&&a.responseText.length>0&&u.onChunk(200,a.responseText),u.emit("finished",200),u.close()},a},abortRequest:function(u){u.ontimeout=u.onerror=u.onprogress=u.onload=null,u.abort()}},pd=hd;const bd=256*1024;class vd extends tn{constructor(a,d,v){super(),this.hooks=a,this.method=d,this.url=v}start(a){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},H.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(a)}close(){this.unloader&&(H.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(a,d){for(;;){var v=this.advanceBuffer(d);if(v)this.emit("chunk",{status:a,data:v});else break}this.isBufferTooLong(d)&&this.emit("buffer_too_long")}advanceBuffer(a){var d=a.slice(this.position),v=d.indexOf(`
844
- `);return v!==-1?(this.position+=v+1,d.slice(0,v)):null}isBufferTooLong(a){return this.position===a.length&&a.length>bd}}var Ct;(function(u){u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=3]="CLOSED"})(Ct||(Ct={}));var xn=Ct,fd=1;class gd{constructor(a,d){this.hooks=a,this.session=ss(1e3)+"/"+Cd(8),this.location=yd(d),this.readyState=xn.CONNECTING,this.openStream()}send(a){return this.sendRaw(JSON.stringify([a]))}ping(){this.hooks.sendHeartbeat(this)}close(a,d){this.onClose(a,d,!0)}sendRaw(a){if(this.readyState===xn.OPEN)try{return H.createSocketRequest("POST",os(kd(this.location,this.session))).start(a),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(a,d,v){this.closeStream(),this.readyState=xn.CLOSED,this.onclose&&this.onclose({code:a,reason:d,wasClean:v})}onChunk(a){if(a.status===200){this.readyState===xn.OPEN&&this.onActivity();var d,v=a.data.slice(0,1);switch(v){case"o":d=JSON.parse(a.data.slice(1)||"{}"),this.onOpen(d);break;case"a":d=JSON.parse(a.data.slice(1)||"[]");for(var w=0;w<d.length;w++)this.onEvent(d[w]);break;case"m":d=JSON.parse(a.data.slice(1)||"null"),this.onEvent(d);break;case"h":this.hooks.onHeartbeat(this);break;case"c":d=JSON.parse(a.data.slice(1)||"[]"),this.onClose(d[0],d[1],!0);break}}}onOpen(a){this.readyState===xn.CONNECTING?(a&&a.hostname&&(this.location.base=wd(this.location.base,a.hostname)),this.readyState=xn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(a){this.readyState===xn.OPEN&&this.onmessage&&this.onmessage({data:a})}onActivity(){this.onactivity&&this.onactivity()}onError(a){this.onerror&&this.onerror(a)}openStream(){this.stream=H.createSocketRequest("POST",os(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",a=>{this.onChunk(a)}),this.stream.bind("finished",a=>{this.hooks.onFinished(this,a)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(a){re.defer(()=>{this.onError(a),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function yd(u){var a=/([^\?]*)\/*(\??.*)/.exec(u);return{base:a[1],queryString:a[2]}}function kd(u,a){return u.base+"/"+a+"/xhr_send"}function os(u){var a=u.indexOf("?")===-1?"?":"&";return u+a+"t="+ +new Date+"&n="+fd++}function wd(u,a){var d=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(u);return d[1]+a+d[3]}function ss(u){return H.randomInt(u)}function Cd(u){for(var a=[],d=0;d<u;d++)a.push(ss(32).toString(32));return a.join("")}var Sd=gd,_d={getReceiveURL:function(u,a){return u.base+"/"+a+"/xhr_streaming"+u.queryString},onHeartbeat:function(u){u.sendRaw("[]")},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,a){u.onClose(1006,"Connection interrupted ("+a+")",!1)}},Ad=_d,Md={getReceiveURL:function(u,a){return u.base+"/"+a+"/xhr"+u.queryString},onHeartbeat:function(){},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,a){a===200?u.reconnect():u.onClose(1006,"Connection interrupted ("+a+")",!1)}},xd=Md,Ld={getRequest:function(u){var a=H.getXHRAPI(),d=new a;return d.onreadystatechange=d.onprogress=function(){switch(d.readyState){case 3:d.responseText&&d.responseText.length>0&&u.onChunk(d.status,d.responseText);break;case 4:d.responseText&&d.responseText.length>0&&u.onChunk(d.status,d.responseText),u.emit("finished",d.status),u.close();break}},d},abortRequest:function(u){u.onreadystatechange=null,u.abort()}},Td=Ld,Ed={createStreamingSocket(u){return this.createSocket(Ad,u)},createPollingSocket(u){return this.createSocket(xd,u)},createSocket(u,a){return new Sd(u,a)},createXHR(u,a){return this.createRequest(Td,u,a)},createRequest(u,a,d){return new vd(u,a,d)}},as=Ed;as.createXDR=function(u,a){return this.createRequest(pd,u,a)};var Pd=as,Nd={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:r,DependenciesReceivers:p,getDefaultStrategy:ud,Transports:jl,transportConnectionInitializer:md,HTTPFactory:Pd,TimelineTransport:Ll,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(u){window.Pusher=u;var a=()=>{this.onDocumentBody(u.ready)};window.JSON?a():g.load("json2",{},a)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:oe,jsonp:Sl}},onDocumentBody(u){document.body?u():setTimeout(()=>{this.onDocumentBody(u)},0)},createJSONPRequest(u,a){return new Al(u,a)},createScriptRequest(u){return new _l(u)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var u=this.getXHRAPI();return new u},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Vl},createWebSocket(u){var a=this.getWebSocketAPI();return new a(u)},createSocketRequest(u,a){if(this.isXHRSupported())return this.HTTPFactory.createXHR(u,a);if(this.isXDRSupported(a.indexOf("https:")===0))return this.HTTPFactory.createXDR(u,a);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var u=this.getXHRAPI();return!!u&&new u().withCredentials!==void 0},isXDRSupported(u){var a=u?"https:":"http:",d=this.getProtocol();return!!window.XDomainRequest&&d===a},addUnloadListener(u){window.addEventListener!==void 0?window.addEventListener("unload",u,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",u)},removeUnloadListener(u){window.addEventListener!==void 0?window.removeEventListener("unload",u,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",u)},randomInt(u){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*u)}},H=Nd,St;(function(u){u[u.ERROR=3]="ERROR",u[u.INFO=6]="INFO",u[u.DEBUG=7]="DEBUG"})(St||(St={}));var Oi=St;class Id{constructor(a,d,v){this.key=a,this.session=d,this.events=[],this.options=v||{},this.sent=0,this.uniqueID=0}log(a,d){a<=this.options.level&&(this.events.push(be({},d,{timestamp:re.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(a){this.log(Oi.ERROR,a)}info(a){this.log(Oi.INFO,a)}debug(a){this.log(Oi.DEBUG,a)}isEmpty(){return this.events.length===0}send(a,d){var v=be({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=[],a(v,(w,L)=>{w||this.sent++,d&&d(w,L)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class Bd{constructor(a,d,v,w){this.name=a,this.priority=d,this.transport=v,this.options=w||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(a,d){if(this.isSupported()){if(this.priority<a)return rs(new _,d)}else return rs(new F,d);var v=!1,w=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),L=null,T=function(){w.unbind("initialized",T),w.connect()},I=function(){L=on.createHandshake(w,function(he){v=!0,Y(),d(null,he)})},O=function(he){Y(),d(he)},Z=function(){Y();var he;he=Bi(w),d(new E(he))},Y=function(){w.unbind("initialized",T),w.unbind("open",I),w.unbind("error",O),w.unbind("closed",Z)};return w.bind("initialized",T),w.bind("open",I),w.bind("error",O),w.bind("closed",Z),w.initialize(),{abort:()=>{v||(Y(),L?L.close():w.close())},forceMinPriority:he=>{v||this.priority<he&&(L?L.close():w.close())}}}}function rs(u,a){return re.defer(function(){a(u)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Rd}=H;var Dd=function(u,a,d,v,w,L){var T=Rd[d];if(!T)throw new V(d);var I=(!u.enabledTransports||Pe(u.enabledTransports,a)!==-1)&&(!u.disabledTransports||Pe(u.disabledTransports,a)===-1),O;return I?(w=Object.assign({ignoreNullOrigin:u.ignoreNullOrigin},w),O=new Bd(a,v,L?L.getAssistant(T):T,w)):O=Od,O},Od={isSupported:function(){return!1},connect:function(u,a){var d=re.defer(function(){a(new F)});return{abort:function(){d.ensureAborted()},forceMinPriority:function(){}}}};function Hd(u){if(u==null)throw"You must pass an options object";if(u.cluster==null)throw"Options object must provide a cluster";"disableStats"in u&&se.warn("The disableStats option is deprecated in favor of enableStats")}const Ud=(u,a)=>{var d="socket_id="+encodeURIComponent(u.socketId);for(var v in a.params)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(a.params[v]);if(a.paramsProvider!=null){let w=a.paramsProvider();for(var v in w)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(w[v])}return d};var Kd=u=>{if(typeof H.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(a,d)=>{const v=Ud(a,u);H.getAuthorizers()[u.transport](H,v,u,k.UserAuthentication,d)}};const jd=(u,a)=>{var d="socket_id="+encodeURIComponent(u.socketId);d+="&channel_name="+encodeURIComponent(u.channelName);for(var v in a.params)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(a.params[v]);if(a.paramsProvider!=null){let w=a.paramsProvider();for(var v in w)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(w[v])}return d};var Gd=u=>{if(typeof H.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(a,d)=>{const v=jd(a,u);H.getAuthorizers()[u.transport](H,v,u,k.ChannelAuthorization,d)}};const Vd=(u,a,d)=>{const v={authTransport:a.transport,authEndpoint:a.endpoint,auth:{params:a.params,headers:a.headers}};return(w,L)=>{const T=u.channel(w.channelName);d(T,v).authorize(w.socketId,L)}};function Fd(u,a){let d={activityTimeout:u.activityTimeout||c.activityTimeout,cluster:u.cluster,httpPath:u.httpPath||c.httpPath,httpPort:u.httpPort||c.httpPort,httpsPort:u.httpsPort||c.httpsPort,pongTimeout:u.pongTimeout||c.pongTimeout,statsHost:u.statsHost||c.stats_host,unavailableTimeout:u.unavailableTimeout||c.unavailableTimeout,wsPath:u.wsPath||c.wsPath,wsPort:u.wsPort||c.wsPort,wssPort:u.wssPort||c.wssPort,enableStats:Jd(u),httpHost:zd(u),useTLS:Zd(u),wsHost:qd(u),userAuthenticator:$d(u),channelAuthorizer:Qd(u,a)};return"disabledTransports"in u&&(d.disabledTransports=u.disabledTransports),"enabledTransports"in u&&(d.enabledTransports=u.enabledTransports),"ignoreNullOrigin"in u&&(d.ignoreNullOrigin=u.ignoreNullOrigin),"timelineParams"in u&&(d.timelineParams=u.timelineParams),"nacl"in u&&(d.nacl=u.nacl),d}function zd(u){return u.httpHost?u.httpHost:u.cluster?`sockjs-${u.cluster}.pusher.com`:c.httpHost}function qd(u){return u.wsHost?u.wsHost:Wd(u.cluster)}function Wd(u){return`ws-${u}.pusher.com`}function Zd(u){return H.getProtocol()==="https:"?!0:u.forceTLS!==!1}function Jd(u){return"enableStats"in u?u.enableStats:"disableStats"in u?!u.disableStats:!1}function $d(u){const a=Object.assign(Object.assign({},c.userAuthentication),u.userAuthentication);return"customHandler"in a&&a.customHandler!=null?a.customHandler:Kd(a)}function Yd(u,a){let d;return"channelAuthorization"in u?d=Object.assign(Object.assign({},c.channelAuthorization),u.channelAuthorization):(d={transport:u.authTransport||c.authTransport,endpoint:u.authEndpoint||c.authEndpoint},"auth"in u&&("params"in u.auth&&(d.params=u.auth.params),"headers"in u.auth&&(d.headers=u.auth.headers)),"authorizer"in u&&(d.customHandler=Vd(a,d,u.authorizer))),d}function Qd(u,a){const d=Yd(u,a);return"customHandler"in d&&d.customHandler!=null?d.customHandler:Gd(d)}class Xd extends tn{constructor(a){super(function(d,v){se.debug(`No callbacks on watchlist events for ${d}`)}),this.pusher=a,this.bindWatchlistInternalEvent()}handleEvent(a){a.data.events.forEach(d=>{this.emit(d.name,d)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",a=>{var d=a.event;d==="pusher_internal:watchlist_events"&&this.handleEvent(a)})}}function ec(){let u,a;return{promise:new Promise((v,w)=>{u=v,a=w}),resolve:u,reject:a}}var nc=ec;class ic extends tn{constructor(a){super(function(d,v){se.debug("No callbacks on user for "+d)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(d,v)=>{if(d){se.warn(`Error during signin: ${d}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:v.auth,user_data:v.user_data})},this.pusher=a,this.pusher.connection.bind("state_change",({previous:d,current:v})=>{d!=="connected"&&v==="connected"&&this._signin(),d==="connected"&&v!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Xd(a),this.pusher.connection.bind("message",d=>{var v=d.event;v==="pusher:signin_success"&&this._onSigninSuccess(d.data),this.serverToUserChannel&&this.serverToUserChannel.name===d.channel&&this.serverToUserChannel.handleEvent(d)})}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(a){try{this.user_data=JSON.parse(a.user_data)}catch{se.error(`Failed parsing user data after signin: ${a.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){se.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const a=d=>{d.subscriptionPending&&d.subscriptionCancelled?d.reinstateSubscription():!d.subscriptionPending&&this.pusher.connection.state==="connected"&&d.subscribe()};this.serverToUserChannel=new ft(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((d,v)=>{d.indexOf("pusher_internal:")===0||d.indexOf("pusher:")===0||this.emit(d,v)}),a(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:a,resolve:d,reject:v}=nc();a.done=!1;const w=()=>{a.done=!0};a.then(w).catch(w),this.signinDonePromise=a,this._signinDoneResolve=d}}class ye{static ready(){ye.isReady=!0;for(var a=0,d=ye.instances.length;a<d;a++)ye.instances[a].connect()}static getClientFeatures(){return qe(Q({ws:H.Transports.ws},function(a){return a.isSupported({})}))}constructor(a,d){tc(a),Hd(d),this.key=a,this.config=Fd(d,this),this.channels=on.createChannels(),this.global_emitter=new tn,this.sessionID=H.randomInt(1e9),this.timeline=new Id(this.key,this.sessionID,{cluster:this.config.cluster,features:ye.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Oi.INFO,version:c.VERSION}),this.config.enableStats&&(this.timelineSender=on.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+H.TimelineTransport.name}));var v=w=>H.getDefaultStrategy(this.config,w,Dd);this.connection=on.createConnectionManager(this.key,{getStrategy:v,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",w=>{var L=w.event,T=L.indexOf("pusher_internal:")===0;if(w.channel){var I=this.channel(w.channel);I&&I.handleEvent(w)}T||this.global_emitter.emit(w.event,w.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",w=>{se.warn(w)}),ye.instances.push(this),this.timeline.info({instances:ye.instances.length}),this.user=new ic(this),ye.isReady&&this.connect()}channel(a){return this.channels.find(a)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var a=this.connection.isUsingTLS(),d=this.timelineSender;this.timelineSenderTimer=new nn(6e4,function(){d.send(a)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(a,d,v){return this.global_emitter.bind(a,d,v),this}unbind(a,d,v){return this.global_emitter.unbind(a,d,v),this}bind_global(a){return this.global_emitter.bind_global(a),this}unbind_global(a){return this.global_emitter.unbind_global(a),this}unbind_all(a){return this.global_emitter.unbind_all(),this}subscribeAll(){var a;for(a in this.channels.channels)this.channels.channels.hasOwnProperty(a)&&this.subscribe(a)}subscribe(a){var d=this.channels.add(a,this);return d.subscriptionPending&&d.subscriptionCancelled?d.reinstateSubscription():!d.subscriptionPending&&this.connection.state==="connected"&&d.subscribe(),d}unsubscribe(a){var d=this.channels.find(a);d&&d.subscriptionPending?d.cancelSubscription():(d=this.channels.remove(a),d&&d.subscribed&&d.unsubscribe())}send_event(a,d,v){return this.connection.send_event(a,d,v)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}ye.instances=[],ye.isReady=!1,ye.logToConsole=!1,ye.Runtime=H,ye.ScriptReceivers=H.ScriptReceivers,ye.DependenciesReceivers=H.DependenciesReceivers,ye.auth_callbacks=H.auth_callbacks;var _t=t.default=ye;function tc(u){if(u==null)throw"You must pass your app key when you instantiate Pusher."}H.setup(ye)}])})})(jo);var Dr=jo.exports;const Or=Rr(Dr);class Go{constructor(e){m(this,"container");m(this,"onAction");m(this,"onFail");m(this,"initialTime");m(this,"timeLeft");m(this,"timerId");m(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"),i=this.container.querySelector("#copy-acn"),t=this.container.querySelector("#acn-tooltip"),o=this.container.querySelector("#transfer-amount"),s=this.container.querySelector("#copy-amount"),r=this.container.querySelector("#amount-tooltip"),l=this.container.querySelector("#transfer-button");i&&e&&i.addEventListener("click",()=>{P.track("copy_transferBank",{payment_method:"Transfer",payment_process:"Payment Started"}),t&&this.copyToClipboard(e.innerHTML,t)}),s&&o&&s.addEventListener("click",()=>{P.track("copy_transferAmount",{payment_method:"Transfer"}),r&&this.copyToClipboard(o.innerHTML.split(" ")[1].replace(/,/g,""),r)}),l&&l.addEventListener("click",()=>{this.onAction(5)})}startTimer(e){this.stopTimer(),this.timerId=window.setInterval(()=>{if(this.timeLeft>0){this.timeLeft-=1;const i=this.container.querySelector("#time-left");i&&(i.innerHTML=ri(this.timeLeft))}else this.stopTimer(),e==="check"&&this.onAction(2)},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}copyToClipboard(e,i){navigator.clipboard.writeText(e).then(()=>{i.innerHTML="Copied!"}).catch(()=>{i.innerHTML="Failed to copy"})}renderComponent(e){var g,f,y,C,k,S;e&&(this.payment=e),this.container.innerHTML=this.render();const i=this.container.querySelector("#transfer-amount"),t=this.container.querySelector("#transfer-bank"),o=this.container.querySelector("#account-name"),s=this.container.querySelector("#transfer-acn"),r=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(i&&(i.innerHTML=`${c} ${ke(l==="USD"?(y=this.payment)==null?void 0:y.localAmount:(C=this.payment)==null?void 0:C.amount,2)}`),t&&this.payment.bankDetails&&(t.innerHTML=(k=this.payment.bankDetails)==null?void 0:k.bankName),o&&this.payment.bankDetails&&(o.innerHTML=(S=this.payment.bankDetails)==null?void 0:S.accountName),s&&this.payment.bankDetails&&(s.innerHTML=this.payment.bankDetails.accountNumber),r&&(r.innerHTML=ri(this.initialTime)),this.startTimer("poll"),e.status==="inProgress"){const A="45654f3ce4c9512ea9a4",M="us2";var b=new Or(A,{cluster:M}),p=b.subscribe(e.reference);p.bind("payment_status",_=>{_.status==="successful"?(clearInterval(this.timerId||void 0),this.onAction(6),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Success"}),_!=null&&_.redirectUrl&&setTimeout(()=>{const E=new URL(_.redirectUrl);E.searchParams.append("status",_.status),E.searchParams.append("reference",_.reference),window.location.href=E.toString()},1800)):_.status==="failed"&&(clearInterval(this.timerId||void 0),this.onFail(7,"Transfer failed"),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Failed"}))})}this.attachListener()}render(){return Br}}const Hr=`<div id="trasferConfirmationProgress">
843
+ */(function(n,e){(function(t,o){n.exports=o()})(window,function(){return function(i){var t={};function o(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return i[s].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=i,o.c=t,o.d=function(s,r,l){o.o(s,r)||Object.defineProperty(s,r,{enumerable:!0,get:l})},o.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},o.t=function(s,r){if(r&1&&(s=o(s)),r&8||r&4&&typeof s=="object"&&s&&s.__esModule)return s;var l=Object.create(null);if(o.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:s}),r&2&&typeof s!="string")for(var c in s)o.d(l,c,(function(b){return s[b]}).bind(null,c));return l},o.n=function(s){var r=s&&s.__esModule?function(){return s.default}:function(){return s};return o.d(r,"a",r),r},o.o=function(s,r){return Object.prototype.hasOwnProperty.call(s,r)},o.p="",o(o.s=2)}([function(i,t,o){var s=this&&this.__extends||function(){var k=function(S,A){return k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(M,_){M.__proto__=_}||function(M,_){for(var E in _)_.hasOwnProperty(E)&&(M[E]=_[E])},k(S,A)};return function(S,A){k(S,A);function M(){this.constructor=S}S.prototype=A===null?Object.create(A):(M.prototype=A.prototype,new M)}}();Object.defineProperty(t,"__esModule",{value:!0});var r=256,l=function(){function k(S){S===void 0&&(S="="),this._paddingCharacter=S}return k.prototype.encodedLength=function(S){return this._paddingCharacter?(S+2)/3*4|0:(S*8+5)/6|0},k.prototype.encode=function(S){for(var A="",M=0;M<S.length-2;M+=3){var _=S[M]<<16|S[M+1]<<8|S[M+2];A+=this._encodeByte(_>>>3*6&63),A+=this._encodeByte(_>>>2*6&63),A+=this._encodeByte(_>>>1*6&63),A+=this._encodeByte(_>>>0*6&63)}var E=S.length-M;if(E>0){var _=S[M]<<16|(E===2?S[M+1]<<8:0);A+=this._encodeByte(_>>>3*6&63),A+=this._encodeByte(_>>>2*6&63),E===2?A+=this._encodeByte(_>>>1*6&63):A+=this._paddingCharacter||"",A+=this._paddingCharacter||""}return A},k.prototype.maxDecodedLength=function(S){return this._paddingCharacter?S/4*3|0:(S*6+7)/8|0},k.prototype.decodedLength=function(S){return this.maxDecodedLength(S.length-this._getPaddingLength(S))},k.prototype.decode=function(S){if(S.length===0)return new Uint8Array(0);for(var A=this._getPaddingLength(S),M=S.length-A,_=new Uint8Array(this.maxDecodedLength(M)),E=0,N=0,V=0,F=0,U=0,G=0,oe=0;N<M-4;N+=4)F=this._decodeChar(S.charCodeAt(N+0)),U=this._decodeChar(S.charCodeAt(N+1)),G=this._decodeChar(S.charCodeAt(N+2)),oe=this._decodeChar(S.charCodeAt(N+3)),_[E++]=F<<2|U>>>4,_[E++]=U<<4|G>>>2,_[E++]=G<<6|oe,V|=F&r,V|=U&r,V|=G&r,V|=oe&r;if(N<M-1&&(F=this._decodeChar(S.charCodeAt(N)),U=this._decodeChar(S.charCodeAt(N+1)),_[E++]=F<<2|U>>>4,V|=F&r,V|=U&r),N<M-2&&(G=this._decodeChar(S.charCodeAt(N+2)),_[E++]=U<<4|G>>>2,V|=G&r),N<M-3&&(oe=this._decodeChar(S.charCodeAt(N+3)),_[E++]=G<<6|oe,V|=oe&r),V!==0)throw new Error("Base64Coder: incorrect characters for decoding");return _},k.prototype._encodeByte=function(S){var A=S;return A+=65,A+=25-S>>>8&6,A+=51-S>>>8&-75,A+=61-S>>>8&-15,A+=62-S>>>8&3,String.fromCharCode(A)},k.prototype._decodeChar=function(S){var A=r;return A+=(42-S&S-44)>>>8&-r+S-43+62,A+=(46-S&S-48)>>>8&-r+S-47+63,A+=(47-S&S-58)>>>8&-r+S-48+52,A+=(64-S&S-91)>>>8&-r+S-65+0,A+=(96-S&S-123)>>>8&-r+S-97+26,A},k.prototype._getPaddingLength=function(S){var A=0;if(this._paddingCharacter){for(var M=S.length-1;M>=0&&S[M]===this._paddingCharacter;M--)A++;if(S.length<4||A>2)throw new Error("Base64Coder: incorrect padding")}return A},k}();t.Coder=l;var c=new l;function b(k){return c.encode(k)}t.encode=b;function p(k){return c.decode(k)}t.decode=p;var g=function(k){s(S,k);function S(){return k!==null&&k.apply(this,arguments)||this}return S.prototype._encodeByte=function(A){var M=A;return M+=65,M+=25-A>>>8&6,M+=51-A>>>8&-75,M+=61-A>>>8&-13,M+=62-A>>>8&49,String.fromCharCode(M)},S.prototype._decodeChar=function(A){var M=r;return M+=(44-A&A-46)>>>8&-r+A-45+62,M+=(94-A&A-96)>>>8&-r+A-95+63,M+=(47-A&A-58)>>>8&-r+A-48+52,M+=(64-A&A-91)>>>8&-r+A-65+0,M+=(96-A&A-123)>>>8&-r+A-97+26,M},S}(l);t.URLSafeCoder=g;var f=new g;function y(k){return f.encode(k)}t.encodeURLSafe=y;function C(k){return f.decode(k)}t.decodeURLSafe=C,t.encodedLength=function(k){return c.encodedLength(k)},t.maxDecodedLength=function(k){return c.maxDecodedLength(k)},t.decodedLength=function(k){return c.decodedLength(k)}},function(i,t,o){Object.defineProperty(t,"__esModule",{value:!0});var s="utf8: invalid string",r="utf8: invalid source encoding";function l(p){for(var g=new Uint8Array(c(p)),f=0,y=0;y<p.length;y++){var C=p.charCodeAt(y);C<128?g[f++]=C:C<2048?(g[f++]=192|C>>6,g[f++]=128|C&63):C<55296?(g[f++]=224|C>>12,g[f++]=128|C>>6&63,g[f++]=128|C&63):(y++,C=(C&1023)<<10,C|=p.charCodeAt(y)&1023,C+=65536,g[f++]=240|C>>18,g[f++]=128|C>>12&63,g[f++]=128|C>>6&63,g[f++]=128|C&63)}return g}t.encode=l;function c(p){for(var g=0,f=0;f<p.length;f++){var y=p.charCodeAt(f);if(y<128)g+=1;else if(y<2048)g+=2;else if(y<55296)g+=3;else if(y<=57343){if(f>=p.length-1)throw new Error(s);f++,g+=4}else throw new Error(s)}return g}t.encodedLength=c;function b(p){for(var g=[],f=0;f<p.length;f++){var y=p[f];if(y&128){var C=void 0;if(y<224){if(f>=p.length)throw new Error(r);var k=p[++f];if((k&192)!==128)throw new Error(r);y=(y&31)<<6|k&63,C=128}else if(y<240){if(f>=p.length-1)throw new Error(r);var k=p[++f],S=p[++f];if((k&192)!==128||(S&192)!==128)throw new Error(r);y=(y&15)<<12|(k&63)<<6|S&63,C=2048}else if(y<248){if(f>=p.length-2)throw new Error(r);var k=p[++f],S=p[++f],A=p[++f];if((k&192)!==128||(S&192)!==128||(A&192)!==128)throw new Error(r);y=(y&15)<<18|(k&63)<<12|(S&63)<<6|A&63,C=65536}else throw new Error(r);if(y<C||y>=55296&&y<=57343)throw new Error(r);if(y>=65536){if(y>1114111)throw new Error(r);y-=65536,g.push(String.fromCharCode(55296|y>>10)),y=56320|y&1023}}g.push(String.fromCharCode(y))}return g.join("")}t.decode=b},function(i,t,o){i.exports=o(3).default},function(i,t,o){o.r(t);class s{constructor(a,d){this.lastId=0,this.prefix=a,this.name=d}create(a){this.lastId++;var d=this.lastId,v=this.prefix+d,w=this.name+"["+d+"]",L=!1,T=function(){L||(a.apply(null,arguments),L=!0)};return this[d]=T,{number:d,id:v,name:w,callback:T}}remove(a){delete this[a.number]}}var r=new s("_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 b{constructor(a){this.options=a,this.receivers=a.receivers||r,this.loading={}}load(a,d,v){var w=this;if(w.loading[a]&&w.loading[a].length>0)w.loading[a].push(v);else{w.loading[a]=[v];var L=H.createScriptRequest(w.getPath(a,d)),T=w.receivers.create(function(I){if(w.receivers.remove(T),w.loading[a]){var O=w.loading[a];delete w.loading[a];for(var Z=function(he){he||L.cleanup()},Y=0;Y<O.length;Y++)O[Y](I,Z)}});L.send(T)}}getRoot(a){var d,v=H.getDocument().location.protocol;return a&&a.useTLS||v==="https:"?d=this.options.cdn_https:d=this.options.cdn_http,d.replace(/\/*$/,"")+"/"+this.options.version}getPath(a,d){return this.getRoot(d)+"/"+a+this.options.suffix+".js"}}var p=new s("_pusher_dependencies","Pusher.DependenciesReceivers"),g=new b({cdn_http:c.cdn_http,cdn_https:c.cdn_https,version:c.VERSION,suffix:c.dependency_suffix,receivers:p});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 C={buildLogSuffix:function(u){const a="See:",d=f.urls[u];if(!d)return"";let v;return d.fullUrl?v=d.fullUrl:d.path&&(v=f.baseUrl+d.path),v?`${a} ${v}`:""}},k;(function(u){u.UserAuthentication="user-authentication",u.ChannelAuthorization="channel-authorization"})(k||(k={}));class S extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class A extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class _ extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class E extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class N extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class V extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class F extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class U extends Error{constructor(a,d){super(d),this.status=a,Object.setPrototypeOf(this,new.target.prototype)}}var oe=function(u,a,d,v,w){const L=H.createXHR();L.open("POST",d.endpoint,!0),L.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var T in d.headers)L.setRequestHeader(T,d.headers[T]);if(d.headersProvider!=null){let I=d.headersProvider();for(var T in I)L.setRequestHeader(T,I[T])}return L.onreadystatechange=function(){if(L.readyState===4)if(L.status===200){let I,O=!1;try{I=JSON.parse(L.responseText),O=!0}catch{w(new U(200,`JSON returned from ${v.toString()} endpoint was invalid, yet status code was 200. Data was: ${L.responseText}`),null)}O&&w(null,I)}else{let I="";switch(v){case k.UserAuthentication:I=C.buildLogSuffix("authenticationEndpoint");break;case k.ChannelAuthorization:I=`Clients must be authorized to join private or presence channels. ${C.buildLogSuffix("authorizationEndpoint")}`;break}w(new U(L.status,`Unable to retrieve auth string from ${v.toString()} endpoint - received status: ${L.status} from ${d.endpoint}. ${I}`),null)}},L.send(a),L};function fe(u){return Xe(Te(u))}var K=String.fromCharCode,Ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ue=function(u){var a=u.charCodeAt(0);return a<128?u:a<2048?K(192|a>>>6)+K(128|a&63):K(224|a>>>12&15)+K(128|a>>>6&63)+K(128|a&63)},Te=function(u){return u.replace(/[^\x00-\x7F]/g,ue)},Me=function(u){var a=[0,2,1][u.length%3],d=u.charCodeAt(0)<<16|(u.length>1?u.charCodeAt(1):0)<<8|(u.length>2?u.charCodeAt(2):0),v=[Ae.charAt(d>>>18),Ae.charAt(d>>>12&63),a>=2?"=":Ae.charAt(d>>>6&63),a>=1?"=":Ae.charAt(d&63)];return v.join("")},Xe=window.btoa||function(u){return u.replace(/[\s\S]{1,3}/g,Me)};class pn{constructor(a,d,v,w){this.clear=d,this.timer=a(()=>{this.timer&&(this.timer=w(this.timer))},v)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var en=pn;function Sn(u){window.clearTimeout(u)}function bn(u){window.clearInterval(u)}class Ee extends en{constructor(a,d){super(setTimeout,Sn,a,function(v){return d(),null})}}class nn extends en{constructor(a,d){super(setInterval,bn,a,function(v){return d(),v})}}var _n={now(){return Date.now?Date.now():new Date().valueOf()},defer(u){return new Ee(0,u)},method(u,...a){var d=Array.prototype.slice.call(arguments,1);return function(v){return v[u].apply(v,d.concat(arguments))}}},re=_n;function be(u,...a){for(var d=0;d<a.length;d++){var v=a[d];for(var w in v)v[w]&&v[w].constructor&&v[w].constructor===Object?u[w]=be(u[w]||{},v[w]):u[w]=v[w]}return u}function Re(){for(var u=["Pusher"],a=0;a<arguments.length;a++)typeof arguments[a]=="string"?u.push(arguments[a]):u.push(Bi(arguments[a]));return u.join(" : ")}function Pe(u,a){var d=Array.prototype.indexOf;if(u===null)return-1;if(d&&u.indexOf===d)return u.indexOf(a);for(var v=0,w=u.length;v<w;v++)if(u[v]===a)return v;return-1}function Ce(u,a){for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&a(u[d],d,u)}function qe(u){var a=[];return Ce(u,function(d,v){a.push(v)}),a}function B(u){var a=[];return Ce(u,function(d){a.push(d)}),a}function me(u,a,d){for(var v=0;v<u.length;v++)a.call(d||window,u[v],v,u)}function $(u,a){for(var d=[],v=0;v<u.length;v++)d.push(a(u[v],v,u,d));return d}function ge(u,a){var d={};return Ce(u,function(v,w){d[w]=a(v)}),d}function We(u,a){a=a||function(w){return!!w};for(var d=[],v=0;v<u.length;v++)a(u[v],v,u,d)&&d.push(u[v]);return d}function Q(u,a){var d={};return Ce(u,function(v,w){(a&&a(v,w,u,d)||v)&&(d[w]=v)}),d}function ni(u){var a=[];return Ce(u,function(d,v){a.push([v,d])}),a}function Jo(u,a){for(var d=0;d<u.length;d++)if(a(u[d],d,u))return!0;return!1}function fl(u,a){for(var d=0;d<u.length;d++)if(!a(u[d],d,u))return!1;return!0}function gl(u){return ge(u,function(a){return typeof a=="object"&&(a=Bi(a)),encodeURIComponent(fe(a.toString()))})}function yl(u){var a=Q(u,function(v){return v!==void 0}),d=$(ni(gl(a)),re.method("join","=")).join("&");return d}function kl(u){var a=[],d=[];return function v(w,L){var T,I,O;switch(typeof w){case"object":if(!w)return null;for(T=0;T<a.length;T+=1)if(a[T]===w)return{$ref:d[T]};if(a.push(w),d.push(L),Object.prototype.toString.apply(w)==="[object Array]")for(O=[],T=0;T<w.length;T+=1)O[T]=v(w[T],L+"["+T+"]");else{O={};for(I in w)Object.prototype.hasOwnProperty.call(w,I)&&(O[I]=v(w[I],L+"["+JSON.stringify(I)+"]"))}return O;case"number":case"string":case"boolean":return w}}(u,"$")}function Bi(u){try{return JSON.stringify(u)}catch{return JSON.stringify(kl(u))}}class wl{constructor(){this.globalLog=a=>{window.console&&window.console.log&&window.console.log(a)}}debug(...a){this.log(this.globalLog,a)}warn(...a){this.log(this.globalLogWarn,a)}error(...a){this.log(this.globalLogError,a)}globalLogWarn(a){window.console&&window.console.warn?window.console.warn(a):this.globalLog(a)}globalLogError(a){window.console&&window.console.error?window.console.error(a):this.globalLogWarn(a)}log(a,...d){var v=Re.apply(this,arguments);At.log?At.log(v):At.logToConsole&&a.bind(this)(v)}}var se=new wl,Cl=function(u,a,d,v,w){(d.headers!==void 0||d.headersProvider!=null)&&se.warn(`To send headers with the ${v.toString()} request, you must use AJAX, rather than JSONP.`);var L=u.nextAuthCallbackID.toString();u.nextAuthCallbackID++;var T=u.getDocument(),I=T.createElement("script");u.auth_callbacks[L]=function(Y){w(null,Y)};var O="Pusher.auth_callbacks['"+L+"']";I.src=d.endpoint+"?callback="+encodeURIComponent(O)+"&"+a;var Z=T.getElementsByTagName("head")[0]||T.documentElement;Z.insertBefore(I,Z.firstChild)},Sl=Cl;class _l{constructor(a){this.src=a}send(a){var d=this,v="Error loading "+d.src;d.script=document.createElement("script"),d.script.id=a.id,d.script.src=d.src,d.script.type="text/javascript",d.script.charset="UTF-8",d.script.addEventListener?(d.script.onerror=function(){a.callback(v)},d.script.onload=function(){a.callback(null)}):d.script.onreadystatechange=function(){(d.script.readyState==="loaded"||d.script.readyState==="complete")&&a.callback(null)},d.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(d.errorScript=document.createElement("script"),d.errorScript.id=a.id+"_error",d.errorScript.text=a.name+"('"+v+"');",d.script.async=d.errorScript.async=!1):d.script.async=!0;var w=document.getElementsByTagName("head")[0];w.insertBefore(d.script,w.firstChild),d.errorScript&&w.insertBefore(d.errorScript,d.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 Al{constructor(a,d){this.url=a,this.data=d}send(a){if(!this.request){var d=yl(this.data),v=this.url+"/"+a.number+"?"+d;this.request=H.createScriptRequest(v),this.request.send(a)}}cleanup(){this.request&&this.request.cleanup()}}var Ml=function(u,a){return function(d,v){var w="http"+(a?"s":"")+"://",L=w+(u.host||u.options.host)+u.options.path,T=H.createJSONPRequest(L,d),I=H.ScriptReceivers.create(function(O,Z){r.remove(I),T.cleanup(),Z&&Z.host&&(u.host=Z.host),v&&v(O,Z)});T.send(I)}},xl={name:"jsonp",getAgent:Ml},Ll=xl;function bt(u,a,d){var v=u+(a.useTLS?"s":""),w=a.useTLS?a.hostTLS:a.hostNonTLS;return v+"://"+w+d}function vt(u,a){var d="/app/"+u,v="?protocol="+c.PROTOCOL+"&client=js&version="+c.VERSION+(a?"&"+a:"");return d+v}var Tl={getInitial:function(u,a){var d=(a.httpPath||"")+vt(u,"flash=false");return bt("ws",a,d)}},El={getInitial:function(u,a){var d=(a.httpPath||"/pusher")+vt(u);return bt("http",a,d)}},Pl={getInitial:function(u,a){return bt("http",a,a.httpPath||"/pusher")},getPath:function(u,a){return vt(u)}};class Nl{constructor(){this._callbacks={}}get(a){return this._callbacks[ft(a)]}add(a,d,v){var w=ft(a);this._callbacks[w]=this._callbacks[w]||[],this._callbacks[w].push({fn:d,context:v})}remove(a,d,v){if(!a&&!d&&!v){this._callbacks={};return}var w=a?[ft(a)]:qe(this._callbacks);d||v?this.removeCallback(w,d,v):this.removeAllCallbacks(w)}removeCallback(a,d,v){me(a,function(w){this._callbacks[w]=We(this._callbacks[w]||[],function(L){return d&&d!==L.fn||v&&v!==L.context}),this._callbacks[w].length===0&&delete this._callbacks[w]},this)}removeAllCallbacks(a){me(a,function(d){delete this._callbacks[d]},this)}}function ft(u){return"_"+u}class tn{constructor(a){this.callbacks=new Nl,this.global_callbacks=[],this.failThrough=a}bind(a,d,v){return this.callbacks.add(a,d,v),this}bind_global(a){return this.global_callbacks.push(a),this}unbind(a,d,v){return this.callbacks.remove(a,d,v),this}unbind_global(a){return a?(this.global_callbacks=We(this.global_callbacks||[],d=>d!==a),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(a,d,v){for(var w=0;w<this.global_callbacks.length;w++)this.global_callbacks[w](a,d);var L=this.callbacks.get(a),T=[];if(v?T.push(d,v):d&&T.push(d),L&&L.length>0)for(var w=0;w<L.length;w++)L[w].fn.apply(L[w].context||window,T);else this.failThrough&&this.failThrough(a,d);return this}}class Il extends tn{constructor(a,d,v,w,L){super(),this.initialize=H.transportConnectionInitializer,this.hooks=a,this.name=d,this.priority=v,this.key=w,this.options=L,this.state="new",this.timeline=L.timeline,this.activityTimeout=L.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 a=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(a,this.options)}catch(d){return re.defer(()=>{this.onError(d),this.changeState("closed")}),!1}return this.bindListeners(),se.debug("Connecting",{transport:this.name,url:a}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(a){return this.state==="open"?(re.defer(()=>{this.socket&&this.socket.send(a)}),!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(a){this.emit("error",{type:"WebSocketError",error:a}),this.timeline.error(this.buildTimelineMessage({error:a.toString()}))}onClose(a){a?this.changeState("closed",{code:a.code,reason:a.reason,wasClean:a.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(a){this.emit("message",a)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=a=>{this.onError(a)},this.socket.onclose=a=>{this.onClose(a)},this.socket.onmessage=a=>{this.onMessage(a)},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(a,d){this.state=a,this.timeline.info(this.buildTimelineMessage({state:a,params:d})),this.emit(a,d)}buildTimelineMessage(a){return be({cid:this.id},a)}}class jn{constructor(a){this.hooks=a}isSupported(a){return this.hooks.isSupported(a)}createConnection(a,d,v,w){return new Il(this.hooks,a,d,v,w)}}var Bl=new jn({urls:Tl,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!H.getWebSocketAPI()},isSupported:function(){return!!H.getWebSocketAPI()},getSocket:function(u){return H.createWebSocket(u)}}),$o={urls:El,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Yo=be({getSocket:function(u){return H.HTTPFactory.createStreamingSocket(u)}},$o),Qo=be({getSocket:function(u){return H.HTTPFactory.createPollingSocket(u)}},$o),Xo={isSupported:function(){return H.isXHRSupported()}},Rl=new jn(be({},Yo,Xo)),Dl=new jn(be({},Qo,Xo)),Ol={ws:Bl,xhr_streaming:Rl,xhr_polling:Dl},Ri=Ol,Hl=new jn({file:"sockjs",urls:Pl,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(u,a){return new window.SockJS(u,null,{js_path:g.getPath("sockjs",{useTLS:a.useTLS}),ignore_null_origin:a.ignoreNullOrigin})},beforeOpen:function(u,a){u.send(JSON.stringify({path:a}))}}),es={isSupported:function(u){var a=H.isXDRSupported(u.useTLS);return a}},Ul=new jn(be({},Yo,es)),Kl=new jn(be({},Qo,es));Ri.xdr_streaming=Ul,Ri.xdr_polling=Kl,Ri.sockjs=Hl;var jl=Ri;class Gl extends tn{constructor(){super();var a=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){a.emit("online")},!1),window.addEventListener("offline",function(){a.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Vl=new Gl;class Fl{constructor(a,d,v){this.manager=a,this.transport=d,this.minPingDelay=v.minPingDelay,this.maxPingDelay=v.maxPingDelay,this.pingDelay=void 0}createConnection(a,d,v,w){w=be({},w,{activityTimeout:this.pingDelay});var L=this.transport.createConnection(a,d,v,w),T=null,I=function(){L.unbind("open",I),L.bind("closed",O),T=re.now()},O=Z=>{if(L.unbind("closed",O),Z.code===1002||Z.code===1003)this.manager.reportDeath();else if(!Z.wasClean&&T){var Y=re.now()-T;Y<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(Y/2,this.minPingDelay))}};return L.bind("open",I),L}isSupported(a){return this.manager.isAlive()&&this.transport.isSupported(a)}}const ns={decodeMessage:function(u){try{var a=JSON.parse(u.data),d=a.data;if(typeof d=="string")try{d=JSON.parse(a.data)}catch{}var v={event:a.event,channel:a.channel,data:d};return a.user_id&&(v.user_id=a.user_id),v}catch(w){throw{type:"MessageParseError",error:w,data:u.data}}},encodeMessage:function(u){return JSON.stringify(u)},processHandshake:function(u){var a=ns.decodeMessage(u);if(a.event==="pusher:connection_established"){if(!a.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:a.data.socket_id,activityTimeout:a.data.activity_timeout*1e3}}else{if(a.event==="pusher:error")return{action:this.getCloseAction(a.data),error:this.getCloseError(a.data)};throw"Invalid handshake"}},getCloseAction:function(u){return u.code<4e3?u.code>=1002&&u.code<=1004?"backoff":null:u.code===4e3?"tls_only":u.code<4100?"refused":u.code<4200?"backoff":u.code<4300?"retry":"refused"},getCloseError:function(u){return u.code!==1e3&&u.code!==1001?{type:"PusherError",data:{code:u.code,message:u.reason||u.message}}:null}};var An=ns;class zl extends tn{constructor(a,d){super(),this.id=a,this.transport=d,this.activityTimeout=d.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(a){return this.transport.send(a)}send_event(a,d,v){var w={event:a,data:d};return v&&(w.channel=v),se.debug("Event sent",w),this.send(An.encodeMessage(w))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var a={message:v=>{var w;try{w=An.decodeMessage(v)}catch(L){this.emit("error",{type:"MessageParseError",error:L,data:v.data})}if(w!==void 0){switch(se.debug("Event recd",w),w.event){case"pusher:error":this.emit("error",{type:"PusherError",data:w.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",w)}},activity:()=>{this.emit("activity")},error:v=>{this.emit("error",v)},closed:v=>{d(),v&&v.code&&this.handleCloseEvent(v),this.transport=null,this.emit("closed")}},d=()=>{Ce(a,(v,w)=>{this.transport.unbind(w,v)})};Ce(a,(v,w)=>{this.transport.bind(w,v)})}handleCloseEvent(a){var d=An.getCloseAction(a),v=An.getCloseError(a);v&&this.emit("error",v),d&&this.emit(d,{action:d,error:v})}}class ql{constructor(a,d){this.transport=a,this.callback=d,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=a=>{this.unbindListeners();var d;try{d=An.processHandshake(a)}catch(v){this.finish("error",{error:v}),this.transport.close();return}d.action==="connected"?this.finish("connected",{connection:new zl(d.id,this.transport),activityTimeout:d.activityTimeout}):(this.finish(d.action,{error:d.error}),this.transport.close())},this.onClosed=a=>{this.unbindListeners();var d=An.getCloseAction(a)||"backoff",v=An.getCloseError(a);this.finish(d,{error:v})},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(a,d){this.callback(be({transport:this.transport,action:a},d))}}class Wl{constructor(a,d){this.timeline=a,this.options=d||{}}send(a,d){this.timeline.isEmpty()||this.timeline.send(H.TimelineTransport.getAgent(this,a),d)}}class gt extends tn{constructor(a,d){super(function(v,w){se.debug("No callbacks on "+a+" for "+v)}),this.name=a,this.pusher=d,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(a,d){return d(null,{auth:""})}trigger(a,d){if(a.indexOf("client-")!==0)throw new S("Event '"+a+"' does not start with 'client-'");if(!this.subscribed){var v=C.buildLogSuffix("triggeringClientEvents");se.warn(`Client event triggered before channel 'subscription_succeeded' event . ${v}`)}return this.pusher.send_event(a,d,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(a){var d=a.event,v=a.data;if(d==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(a);else if(d==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(a);else if(d.indexOf("pusher_internal:")!==0){var w={};this.emit(d,v,w)}}handleSubscriptionSucceededEvent(a){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",a.data)}handleSubscriptionCountEvent(a){a.data.subscription_count&&(this.subscriptionCount=a.data.subscription_count),this.emit("pusher:subscription_count",a.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(a,d)=>{a?(this.subscriptionPending=!1,se.error(a.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:a.message},a instanceof U?{status:a.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:d.auth,channel_data:d.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 yt extends gt{authorize(a,d){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:a},d)}}class Zl{constructor(){this.reset()}get(a){return Object.prototype.hasOwnProperty.call(this.members,a)?{id:a,info:this.members[a]}:null}each(a){Ce(this.members,(d,v)=>{a(this.get(v))})}setMyID(a){this.myID=a}onSubscription(a){this.members=a.presence.hash,this.count=a.presence.count,this.me=this.get(this.myID)}addMember(a){return this.get(a.user_id)===null&&this.count++,this.members[a.user_id]=a.user_info,this.get(a.user_id)}removeMember(a){var d=this.get(a.user_id);return d&&(delete this.members[a.user_id],this.count--),d}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Jl=function(u,a,d,v){function w(L){return L instanceof d?L:new d(function(T){T(L)})}return new(d||(d=Promise))(function(L,T){function I(Y){try{Z(v.next(Y))}catch(he){T(he)}}function O(Y){try{Z(v.throw(Y))}catch(he){T(he)}}function Z(Y){Y.done?L(Y.value):w(Y.value).then(I,O)}Z((v=v.apply(u,a||[])).next())})};class $l extends yt{constructor(a,d){super(a,d),this.members=new Zl}authorize(a,d){super.authorize(a,(v,w)=>Jl(this,void 0,void 0,function*(){if(!v)if(w=w,w.channel_data!=null){var L=JSON.parse(w.channel_data);this.members.setMyID(L.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 T=C.buildLogSuffix("authorizationEndpoint");se.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${T}, or the user should be signed in.`),d("Invalid auth response");return}d(v,w)}))}handleEvent(a){var d=a.event;if(d.indexOf("pusher_internal:")===0)this.handleInternalEvent(a);else{var v=a.data,w={};a.user_id&&(w.user_id=a.user_id),this.emit(d,v,w)}}handleInternalEvent(a){var d=a.event,v=a.data;switch(d){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(a);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(a);break;case"pusher_internal:member_added":var w=this.members.addMember(v);this.emit("pusher:member_added",w);break;case"pusher_internal:member_removed":var L=this.members.removeMember(v);L&&this.emit("pusher:member_removed",L);break}}handleSubscriptionSucceededEvent(a){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(a.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Yl=o(1),kt=o(0);class Ql extends yt{constructor(a,d,v){super(a,d),this.key=null,this.nacl=v}authorize(a,d){super.authorize(a,(v,w)=>{if(v){d(v,w);return}let L=w.shared_secret;if(!L){d(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(kt.decode)(L),delete w.shared_secret,d(null,w)})}trigger(a,d){throw new N("Client events are not currently supported for encrypted channels")}handleEvent(a){var d=a.event,v=a.data;if(d.indexOf("pusher_internal:")===0||d.indexOf("pusher:")===0){super.handleEvent(a);return}this.handleEncryptedEvent(d,v)}handleEncryptedEvent(a,d){if(!this.key){se.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!d.ciphertext||!d.nonce){se.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+d);return}let v=Object(kt.decode)(d.ciphertext);if(v.length<this.nacl.secretbox.overheadLength){se.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${v.length}`);return}let w=Object(kt.decode)(d.nonce);if(w.length<this.nacl.secretbox.nonceLength){se.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${w.length}`);return}let L=this.nacl.secretbox.open(v,w,this.key);if(L===null){se.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,(T,I)=>{if(T){se.error(`Failed to make a request to the authEndpoint: ${I}. Unable to fetch new key, so dropping encrypted event`);return}if(L=this.nacl.secretbox.open(v,w,this.key),L===null){se.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(a,this.getDataToEmit(L))});return}this.emit(a,this.getDataToEmit(L))}getDataToEmit(a){let d=Object(Yl.decode)(a);try{return JSON.parse(d)}catch{return d}}}class Xl extends tn{constructor(a,d){super(),this.state="initialized",this.connection=null,this.key=a,this.options=d,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 v=H.getNetwork();v.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),v.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(a){return this.connection?this.connection.send(a):!1}send_event(a,d,v){return this.connection?this.connection.send_event(a,d,v):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var a=(d,v)=>{d?this.runner=this.strategy.connect(0,a):v.action==="error"?(this.emit("error",{type:"HandshakeError",error:v.error}),this.timeline.error({handshakeError:v.error})):(this.abortConnecting(),this.handshakeCallbacks[v.action](v))};this.runner=this.strategy.connect(0,a)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var a=this.abandonConnection();a.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(a){this.timeline.info({action:"retry",delay:a}),a>0&&this.emit("connecting_in",Math.round(a/1e3)),this.retryTimer=new Ee(a||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Ee(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Ee(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 Ee(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(a){return be({},a,{message:d=>{this.resetActivityCheck(),this.emit("message",d)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:d=>{this.emit("error",d)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(a){return be({},a,{connected:d=>{this.activityTimeout=Math.min(this.options.activityTimeout,d.activityTimeout,d.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(d.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let a=d=>v=>{v.error&&this.emit("error",{type:"WebSocketError",error:v.error}),d(v)};return{tls_only:a(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:a(()=>{this.disconnect()}),backoff:a(()=>{this.retryIn(1e3)}),retry:a(()=>{this.retryIn(0)})}}setConnection(a){this.connection=a;for(var d in this.connectionCallbacks)this.connection.bind(d,this.connectionCallbacks[d]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var a in this.connectionCallbacks)this.connection.unbind(a,this.connectionCallbacks[a]);var d=this.connection;return this.connection=null,d}}updateState(a,d){var v=this.state;if(this.state=a,v!==a){var w=a;w==="connected"&&(w+=" with new socket ID "+d.socket_id),se.debug("State changed",v+" -> "+w),this.timeline.info({state:a,params:d}),this.emit("state_change",{previous:v,current:a}),this.emit(a,d)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class ed{constructor(){this.channels={}}add(a,d){return this.channels[a]||(this.channels[a]=nd(a,d)),this.channels[a]}all(){return B(this.channels)}find(a){return this.channels[a]}remove(a){var d=this.channels[a];return delete this.channels[a],d}disconnect(){Ce(this.channels,function(a){a.disconnect()})}}function nd(u,a){if(u.indexOf("private-encrypted-")===0){if(a.config.nacl)return on.createEncryptedChannel(u,a,a.config.nacl);let d="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",v=C.buildLogSuffix("encryptedChannelSupport");throw new N(`${d}. ${v}`)}else{if(u.indexOf("private-")===0)return on.createPrivateChannel(u,a);if(u.indexOf("presence-")===0)return on.createPresenceChannel(u,a);if(u.indexOf("#")===0)throw new A('Cannot create a channel with name "'+u+'".');return on.createChannel(u,a)}}var id={createChannels(){return new ed},createConnectionManager(u,a){return new Xl(u,a)},createChannel(u,a){return new gt(u,a)},createPrivateChannel(u,a){return new yt(u,a)},createPresenceChannel(u,a){return new $l(u,a)},createEncryptedChannel(u,a,d){return new Ql(u,a,d)},createTimelineSender(u,a){return new Wl(u,a)},createHandshake(u,a){return new ql(u,a)},createAssistantToTheTransportManager(u,a,d){return new Fl(u,a,d)}},on=id;class is{constructor(a){this.options=a||{},this.livesLeft=this.options.lives||1/0}getAssistant(a){return on.createAssistantToTheTransportManager(this,a,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Mn{constructor(a,d){this.strategies=a,this.loop=!!d.loop,this.failFast=!!d.failFast,this.timeout=d.timeout,this.timeoutLimit=d.timeoutLimit}isSupported(){return Jo(this.strategies,re.method("isSupported"))}connect(a,d){var v=this.strategies,w=0,L=this.timeout,T=null,I=(O,Z)=>{Z?d(null,Z):(w=w+1,this.loop&&(w=w%v.length),w<v.length?(L&&(L=L*2,this.timeoutLimit&&(L=Math.min(L,this.timeoutLimit))),T=this.tryStrategy(v[w],a,{timeout:L,failFast:this.failFast},I)):d(!0))};return T=this.tryStrategy(v[w],a,{timeout:L,failFast:this.failFast},I),{abort:function(){T.abort()},forceMinPriority:function(O){a=O,T&&T.forceMinPriority(O)}}}tryStrategy(a,d,v,w){var L=null,T=null;return v.timeout>0&&(L=new Ee(v.timeout,function(){T.abort(),w(!0)})),T=a.connect(d,function(I,O){I&&L&&L.isRunning()&&!v.failFast||(L&&L.ensureAborted(),w(I,O))}),{abort:function(){L&&L.ensureAborted(),T.abort()},forceMinPriority:function(I){T.forceMinPriority(I)}}}}class wt{constructor(a){this.strategies=a}isSupported(){return Jo(this.strategies,re.method("isSupported"))}connect(a,d){return td(this.strategies,a,function(v,w){return function(L,T){if(w[v].error=L,L){od(w)&&d(!0);return}me(w,function(I){I.forceMinPriority(T.transport.priority)}),d(null,T)}})}}function td(u,a,d){var v=$(u,function(w,L,T,I){return w.connect(a,d(L,I))});return{abort:function(){me(v,sd)},forceMinPriority:function(w){me(v,function(L){L.forceMinPriority(w)})}}}function od(u){return fl(u,function(a){return!!a.error})}function sd(u){!u.error&&!u.aborted&&(u.abort(),u.aborted=!0)}class ad{constructor(a,d,v){this.strategy=a,this.transports=d,this.ttl=v.ttl||1800*1e3,this.usingTLS=v.useTLS,this.timeline=v.timeline}isSupported(){return this.strategy.isSupported()}connect(a,d){var v=this.usingTLS,w=rd(v),L=w&&w.cacheSkipCount?w.cacheSkipCount:0,T=[this.strategy];if(w&&w.timestamp+this.ttl>=re.now()){var I=this.transports[w.transport];I&&(["ws","wss"].includes(w.transport)||L>3?(this.timeline.info({cached:!0,transport:w.transport,latency:w.latency}),T.push(new Mn([I],{timeout:w.latency*2+1e3,failFast:!0}))):L++)}var O=re.now(),Z=T.pop().connect(a,function Y(he,Hi){he?(ts(v),T.length>0?(O=re.now(),Z=T.pop().connect(a,Y)):d(he)):(ld(v,Hi.transport.name,re.now()-O,L),d(null,Hi))});return{abort:function(){Z.abort()},forceMinPriority:function(Y){a=Y,Z&&Z.forceMinPriority(Y)}}}}function Ct(u){return"pusherTransport"+(u?"TLS":"NonTLS")}function rd(u){var a=H.getLocalStorage();if(a)try{var d=a[Ct(u)];if(d)return JSON.parse(d)}catch{ts(u)}return null}function ld(u,a,d,v){var w=H.getLocalStorage();if(w)try{w[Ct(u)]=Bi({timestamp:re.now(),transport:a,latency:d,cacheSkipCount:v})}catch{}}function ts(u){var a=H.getLocalStorage();if(a)try{delete a[Ct(u)]}catch{}}class Di{constructor(a,{delay:d}){this.strategy=a,this.options={delay:d}}isSupported(){return this.strategy.isSupported()}connect(a,d){var v=this.strategy,w,L=new Ee(this.options.delay,function(){w=v.connect(a,d)});return{abort:function(){L.ensureAborted(),w&&w.abort()},forceMinPriority:function(T){a=T,w&&w.forceMinPriority(T)}}}}class ii{constructor(a,d,v){this.test=a,this.trueBranch=d,this.falseBranch=v}isSupported(){var a=this.test()?this.trueBranch:this.falseBranch;return a.isSupported()}connect(a,d){var v=this.test()?this.trueBranch:this.falseBranch;return v.connect(a,d)}}class dd{constructor(a){this.strategy=a}isSupported(){return this.strategy.isSupported()}connect(a,d){var v=this.strategy.connect(a,function(w,L){L&&v.abort(),d(w,L)});return v}}function ti(u){return function(){return u.isSupported()}}var cd=function(u,a,d){var v={};function w(ps,dc,cc,uc,mc){var bs=d(u,ps,dc,cc,uc,mc);return v[ps]=bs,bs}var L=Object.assign({},a,{hostNonTLS:u.wsHost+":"+u.wsPort,hostTLS:u.wsHost+":"+u.wssPort,httpPath:u.wsPath}),T=Object.assign({},L,{useTLS:!0}),I=Object.assign({},a,{hostNonTLS:u.httpHost+":"+u.httpPort,hostTLS:u.httpHost+":"+u.httpsPort,httpPath:u.httpPath}),O={loop:!0,timeout:15e3,timeoutLimit:6e4},Z=new is({minPingDelay:1e4,maxPingDelay:u.activityTimeout}),Y=new is({lives:2,minPingDelay:1e4,maxPingDelay:u.activityTimeout}),he=w("ws","ws",3,L,Z),Hi=w("wss","ws",3,T,Z),oc=w("sockjs","sockjs",1,I),ls=w("xhr_streaming","xhr_streaming",1,I,Y),sc=w("xdr_streaming","xdr_streaming",1,I,Y),ds=w("xhr_polling","xhr_polling",1,I),ac=w("xdr_polling","xdr_polling",1,I),cs=new Mn([he],O),rc=new Mn([Hi],O),lc=new Mn([oc],O),us=new Mn([new ii(ti(ls),ls,sc)],O),ms=new Mn([new ii(ti(ds),ds,ac)],O),hs=new Mn([new ii(ti(us),new wt([us,new Di(ms,{delay:4e3})]),ms)],O),Mt=new ii(ti(hs),hs,lc),xt;return a.useTLS?xt=new wt([cs,new Di(Mt,{delay:2e3})]):xt=new wt([cs,new Di(rc,{delay:2e3}),new Di(Mt,{delay:5e3})]),new ad(new dd(new ii(ti(he),xt,Mt)),v,{ttl:18e5,timeline:a.timeline,useTLS:a.useTLS})},ud=cd,md=function(){var u=this;u.timeline.info(u.buildTimelineMessage({transport:u.name+(u.options.useTLS?"s":"")})),u.hooks.isInitialized()?u.changeState("initialized"):u.hooks.file?(u.changeState("initializing"),g.load(u.hooks.file,{useTLS:u.options.useTLS},function(a,d){u.hooks.isInitialized()?(u.changeState("initialized"),d(!0)):(a&&u.onError(a),u.onClose(),d(!1))})):u.onClose()},hd={getRequest:function(u){var a=new window.XDomainRequest;return a.ontimeout=function(){u.emit("error",new M),u.close()},a.onerror=function(d){u.emit("error",d),u.close()},a.onprogress=function(){a.responseText&&a.responseText.length>0&&u.onChunk(200,a.responseText)},a.onload=function(){a.responseText&&a.responseText.length>0&&u.onChunk(200,a.responseText),u.emit("finished",200),u.close()},a},abortRequest:function(u){u.ontimeout=u.onerror=u.onprogress=u.onload=null,u.abort()}},pd=hd;const bd=256*1024;class vd extends tn{constructor(a,d,v){super(),this.hooks=a,this.method=d,this.url=v}start(a){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},H.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(a)}close(){this.unloader&&(H.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(a,d){for(;;){var v=this.advanceBuffer(d);if(v)this.emit("chunk",{status:a,data:v});else break}this.isBufferTooLong(d)&&this.emit("buffer_too_long")}advanceBuffer(a){var d=a.slice(this.position),v=d.indexOf(`
844
+ `);return v!==-1?(this.position+=v+1,d.slice(0,v)):null}isBufferTooLong(a){return this.position===a.length&&a.length>bd}}var St;(function(u){u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=3]="CLOSED"})(St||(St={}));var xn=St,fd=1;class gd{constructor(a,d){this.hooks=a,this.session=ss(1e3)+"/"+Cd(8),this.location=yd(d),this.readyState=xn.CONNECTING,this.openStream()}send(a){return this.sendRaw(JSON.stringify([a]))}ping(){this.hooks.sendHeartbeat(this)}close(a,d){this.onClose(a,d,!0)}sendRaw(a){if(this.readyState===xn.OPEN)try{return H.createSocketRequest("POST",os(kd(this.location,this.session))).start(a),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(a,d,v){this.closeStream(),this.readyState=xn.CLOSED,this.onclose&&this.onclose({code:a,reason:d,wasClean:v})}onChunk(a){if(a.status===200){this.readyState===xn.OPEN&&this.onActivity();var d,v=a.data.slice(0,1);switch(v){case"o":d=JSON.parse(a.data.slice(1)||"{}"),this.onOpen(d);break;case"a":d=JSON.parse(a.data.slice(1)||"[]");for(var w=0;w<d.length;w++)this.onEvent(d[w]);break;case"m":d=JSON.parse(a.data.slice(1)||"null"),this.onEvent(d);break;case"h":this.hooks.onHeartbeat(this);break;case"c":d=JSON.parse(a.data.slice(1)||"[]"),this.onClose(d[0],d[1],!0);break}}}onOpen(a){this.readyState===xn.CONNECTING?(a&&a.hostname&&(this.location.base=wd(this.location.base,a.hostname)),this.readyState=xn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(a){this.readyState===xn.OPEN&&this.onmessage&&this.onmessage({data:a})}onActivity(){this.onactivity&&this.onactivity()}onError(a){this.onerror&&this.onerror(a)}openStream(){this.stream=H.createSocketRequest("POST",os(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",a=>{this.onChunk(a)}),this.stream.bind("finished",a=>{this.hooks.onFinished(this,a)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(a){re.defer(()=>{this.onError(a),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function yd(u){var a=/([^\?]*)\/*(\??.*)/.exec(u);return{base:a[1],queryString:a[2]}}function kd(u,a){return u.base+"/"+a+"/xhr_send"}function os(u){var a=u.indexOf("?")===-1?"?":"&";return u+a+"t="+ +new Date+"&n="+fd++}function wd(u,a){var d=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(u);return d[1]+a+d[3]}function ss(u){return H.randomInt(u)}function Cd(u){for(var a=[],d=0;d<u;d++)a.push(ss(32).toString(32));return a.join("")}var Sd=gd,_d={getReceiveURL:function(u,a){return u.base+"/"+a+"/xhr_streaming"+u.queryString},onHeartbeat:function(u){u.sendRaw("[]")},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,a){u.onClose(1006,"Connection interrupted ("+a+")",!1)}},Ad=_d,Md={getReceiveURL:function(u,a){return u.base+"/"+a+"/xhr"+u.queryString},onHeartbeat:function(){},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,a){a===200?u.reconnect():u.onClose(1006,"Connection interrupted ("+a+")",!1)}},xd=Md,Ld={getRequest:function(u){var a=H.getXHRAPI(),d=new a;return d.onreadystatechange=d.onprogress=function(){switch(d.readyState){case 3:d.responseText&&d.responseText.length>0&&u.onChunk(d.status,d.responseText);break;case 4:d.responseText&&d.responseText.length>0&&u.onChunk(d.status,d.responseText),u.emit("finished",d.status),u.close();break}},d},abortRequest:function(u){u.onreadystatechange=null,u.abort()}},Td=Ld,Ed={createStreamingSocket(u){return this.createSocket(Ad,u)},createPollingSocket(u){return this.createSocket(xd,u)},createSocket(u,a){return new Sd(u,a)},createXHR(u,a){return this.createRequest(Td,u,a)},createRequest(u,a,d){return new vd(u,a,d)}},as=Ed;as.createXDR=function(u,a){return this.createRequest(pd,u,a)};var Pd=as,Nd={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:r,DependenciesReceivers:p,getDefaultStrategy:ud,Transports:jl,transportConnectionInitializer:md,HTTPFactory:Pd,TimelineTransport:Ll,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(u){window.Pusher=u;var a=()=>{this.onDocumentBody(u.ready)};window.JSON?a():g.load("json2",{},a)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:oe,jsonp:Sl}},onDocumentBody(u){document.body?u():setTimeout(()=>{this.onDocumentBody(u)},0)},createJSONPRequest(u,a){return new Al(u,a)},createScriptRequest(u){return new _l(u)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var u=this.getXHRAPI();return new u},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Vl},createWebSocket(u){var a=this.getWebSocketAPI();return new a(u)},createSocketRequest(u,a){if(this.isXHRSupported())return this.HTTPFactory.createXHR(u,a);if(this.isXDRSupported(a.indexOf("https:")===0))return this.HTTPFactory.createXDR(u,a);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var u=this.getXHRAPI();return!!u&&new u().withCredentials!==void 0},isXDRSupported(u){var a=u?"https:":"http:",d=this.getProtocol();return!!window.XDomainRequest&&d===a},addUnloadListener(u){window.addEventListener!==void 0?window.addEventListener("unload",u,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",u)},removeUnloadListener(u){window.addEventListener!==void 0?window.removeEventListener("unload",u,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",u)},randomInt(u){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*u)}},H=Nd,_t;(function(u){u[u.ERROR=3]="ERROR",u[u.INFO=6]="INFO",u[u.DEBUG=7]="DEBUG"})(_t||(_t={}));var Oi=_t;class Id{constructor(a,d,v){this.key=a,this.session=d,this.events=[],this.options=v||{},this.sent=0,this.uniqueID=0}log(a,d){a<=this.options.level&&(this.events.push(be({},d,{timestamp:re.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(a){this.log(Oi.ERROR,a)}info(a){this.log(Oi.INFO,a)}debug(a){this.log(Oi.DEBUG,a)}isEmpty(){return this.events.length===0}send(a,d){var v=be({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=[],a(v,(w,L)=>{w||this.sent++,d&&d(w,L)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class Bd{constructor(a,d,v,w){this.name=a,this.priority=d,this.transport=v,this.options=w||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(a,d){if(this.isSupported()){if(this.priority<a)return rs(new _,d)}else return rs(new F,d);var v=!1,w=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),L=null,T=function(){w.unbind("initialized",T),w.connect()},I=function(){L=on.createHandshake(w,function(he){v=!0,Y(),d(null,he)})},O=function(he){Y(),d(he)},Z=function(){Y();var he;he=Bi(w),d(new E(he))},Y=function(){w.unbind("initialized",T),w.unbind("open",I),w.unbind("error",O),w.unbind("closed",Z)};return w.bind("initialized",T),w.bind("open",I),w.bind("error",O),w.bind("closed",Z),w.initialize(),{abort:()=>{v||(Y(),L?L.close():w.close())},forceMinPriority:he=>{v||this.priority<he&&(L?L.close():w.close())}}}}function rs(u,a){return re.defer(function(){a(u)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Rd}=H;var Dd=function(u,a,d,v,w,L){var T=Rd[d];if(!T)throw new V(d);var I=(!u.enabledTransports||Pe(u.enabledTransports,a)!==-1)&&(!u.disabledTransports||Pe(u.disabledTransports,a)===-1),O;return I?(w=Object.assign({ignoreNullOrigin:u.ignoreNullOrigin},w),O=new Bd(a,v,L?L.getAssistant(T):T,w)):O=Od,O},Od={isSupported:function(){return!1},connect:function(u,a){var d=re.defer(function(){a(new F)});return{abort:function(){d.ensureAborted()},forceMinPriority:function(){}}}};function Hd(u){if(u==null)throw"You must pass an options object";if(u.cluster==null)throw"Options object must provide a cluster";"disableStats"in u&&se.warn("The disableStats option is deprecated in favor of enableStats")}const Ud=(u,a)=>{var d="socket_id="+encodeURIComponent(u.socketId);for(var v in a.params)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(a.params[v]);if(a.paramsProvider!=null){let w=a.paramsProvider();for(var v in w)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(w[v])}return d};var Kd=u=>{if(typeof H.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(a,d)=>{const v=Ud(a,u);H.getAuthorizers()[u.transport](H,v,u,k.UserAuthentication,d)}};const jd=(u,a)=>{var d="socket_id="+encodeURIComponent(u.socketId);d+="&channel_name="+encodeURIComponent(u.channelName);for(var v in a.params)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(a.params[v]);if(a.paramsProvider!=null){let w=a.paramsProvider();for(var v in w)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(w[v])}return d};var Gd=u=>{if(typeof H.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(a,d)=>{const v=jd(a,u);H.getAuthorizers()[u.transport](H,v,u,k.ChannelAuthorization,d)}};const Vd=(u,a,d)=>{const v={authTransport:a.transport,authEndpoint:a.endpoint,auth:{params:a.params,headers:a.headers}};return(w,L)=>{const T=u.channel(w.channelName);d(T,v).authorize(w.socketId,L)}};function Fd(u,a){let d={activityTimeout:u.activityTimeout||c.activityTimeout,cluster:u.cluster,httpPath:u.httpPath||c.httpPath,httpPort:u.httpPort||c.httpPort,httpsPort:u.httpsPort||c.httpsPort,pongTimeout:u.pongTimeout||c.pongTimeout,statsHost:u.statsHost||c.stats_host,unavailableTimeout:u.unavailableTimeout||c.unavailableTimeout,wsPath:u.wsPath||c.wsPath,wsPort:u.wsPort||c.wsPort,wssPort:u.wssPort||c.wssPort,enableStats:Jd(u),httpHost:zd(u),useTLS:Zd(u),wsHost:qd(u),userAuthenticator:$d(u),channelAuthorizer:Qd(u,a)};return"disabledTransports"in u&&(d.disabledTransports=u.disabledTransports),"enabledTransports"in u&&(d.enabledTransports=u.enabledTransports),"ignoreNullOrigin"in u&&(d.ignoreNullOrigin=u.ignoreNullOrigin),"timelineParams"in u&&(d.timelineParams=u.timelineParams),"nacl"in u&&(d.nacl=u.nacl),d}function zd(u){return u.httpHost?u.httpHost:u.cluster?`sockjs-${u.cluster}.pusher.com`:c.httpHost}function qd(u){return u.wsHost?u.wsHost:Wd(u.cluster)}function Wd(u){return`ws-${u}.pusher.com`}function Zd(u){return H.getProtocol()==="https:"?!0:u.forceTLS!==!1}function Jd(u){return"enableStats"in u?u.enableStats:"disableStats"in u?!u.disableStats:!1}function $d(u){const a=Object.assign(Object.assign({},c.userAuthentication),u.userAuthentication);return"customHandler"in a&&a.customHandler!=null?a.customHandler:Kd(a)}function Yd(u,a){let d;return"channelAuthorization"in u?d=Object.assign(Object.assign({},c.channelAuthorization),u.channelAuthorization):(d={transport:u.authTransport||c.authTransport,endpoint:u.authEndpoint||c.authEndpoint},"auth"in u&&("params"in u.auth&&(d.params=u.auth.params),"headers"in u.auth&&(d.headers=u.auth.headers)),"authorizer"in u&&(d.customHandler=Vd(a,d,u.authorizer))),d}function Qd(u,a){const d=Yd(u,a);return"customHandler"in d&&d.customHandler!=null?d.customHandler:Gd(d)}class Xd extends tn{constructor(a){super(function(d,v){se.debug(`No callbacks on watchlist events for ${d}`)}),this.pusher=a,this.bindWatchlistInternalEvent()}handleEvent(a){a.data.events.forEach(d=>{this.emit(d.name,d)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",a=>{var d=a.event;d==="pusher_internal:watchlist_events"&&this.handleEvent(a)})}}function ec(){let u,a;return{promise:new Promise((v,w)=>{u=v,a=w}),resolve:u,reject:a}}var nc=ec;class ic extends tn{constructor(a){super(function(d,v){se.debug("No callbacks on user for "+d)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(d,v)=>{if(d){se.warn(`Error during signin: ${d}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:v.auth,user_data:v.user_data})},this.pusher=a,this.pusher.connection.bind("state_change",({previous:d,current:v})=>{d!=="connected"&&v==="connected"&&this._signin(),d==="connected"&&v!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Xd(a),this.pusher.connection.bind("message",d=>{var v=d.event;v==="pusher:signin_success"&&this._onSigninSuccess(d.data),this.serverToUserChannel&&this.serverToUserChannel.name===d.channel&&this.serverToUserChannel.handleEvent(d)})}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(a){try{this.user_data=JSON.parse(a.user_data)}catch{se.error(`Failed parsing user data after signin: ${a.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){se.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const a=d=>{d.subscriptionPending&&d.subscriptionCancelled?d.reinstateSubscription():!d.subscriptionPending&&this.pusher.connection.state==="connected"&&d.subscribe()};this.serverToUserChannel=new gt(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((d,v)=>{d.indexOf("pusher_internal:")===0||d.indexOf("pusher:")===0||this.emit(d,v)}),a(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:a,resolve:d,reject:v}=nc();a.done=!1;const w=()=>{a.done=!0};a.then(w).catch(w),this.signinDonePromise=a,this._signinDoneResolve=d}}class ye{static ready(){ye.isReady=!0;for(var a=0,d=ye.instances.length;a<d;a++)ye.instances[a].connect()}static getClientFeatures(){return qe(Q({ws:H.Transports.ws},function(a){return a.isSupported({})}))}constructor(a,d){tc(a),Hd(d),this.key=a,this.config=Fd(d,this),this.channels=on.createChannels(),this.global_emitter=new tn,this.sessionID=H.randomInt(1e9),this.timeline=new Id(this.key,this.sessionID,{cluster:this.config.cluster,features:ye.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Oi.INFO,version:c.VERSION}),this.config.enableStats&&(this.timelineSender=on.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+H.TimelineTransport.name}));var v=w=>H.getDefaultStrategy(this.config,w,Dd);this.connection=on.createConnectionManager(this.key,{getStrategy:v,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",w=>{var L=w.event,T=L.indexOf("pusher_internal:")===0;if(w.channel){var I=this.channel(w.channel);I&&I.handleEvent(w)}T||this.global_emitter.emit(w.event,w.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",w=>{se.warn(w)}),ye.instances.push(this),this.timeline.info({instances:ye.instances.length}),this.user=new ic(this),ye.isReady&&this.connect()}channel(a){return this.channels.find(a)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var a=this.connection.isUsingTLS(),d=this.timelineSender;this.timelineSenderTimer=new nn(6e4,function(){d.send(a)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(a,d,v){return this.global_emitter.bind(a,d,v),this}unbind(a,d,v){return this.global_emitter.unbind(a,d,v),this}bind_global(a){return this.global_emitter.bind_global(a),this}unbind_global(a){return this.global_emitter.unbind_global(a),this}unbind_all(a){return this.global_emitter.unbind_all(),this}subscribeAll(){var a;for(a in this.channels.channels)this.channels.channels.hasOwnProperty(a)&&this.subscribe(a)}subscribe(a){var d=this.channels.add(a,this);return d.subscriptionPending&&d.subscriptionCancelled?d.reinstateSubscription():!d.subscriptionPending&&this.connection.state==="connected"&&d.subscribe(),d}unsubscribe(a){var d=this.channels.find(a);d&&d.subscriptionPending?d.cancelSubscription():(d=this.channels.remove(a),d&&d.subscribed&&d.unsubscribe())}send_event(a,d,v){return this.connection.send_event(a,d,v)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}ye.instances=[],ye.isReady=!1,ye.logToConsole=!1,ye.Runtime=H,ye.ScriptReceivers=H.ScriptReceivers,ye.DependenciesReceivers=H.DependenciesReceivers,ye.auth_callbacks=H.auth_callbacks;var At=t.default=ye;function tc(u){if(u==null)throw"You must pass your app key when you instantiate Pusher."}H.setup(ye)}])})})(Go);var Dr=Go.exports;const Or=Rr(Dr);class Vo{constructor(e){m(this,"container");m(this,"onAction");m(this,"onFail");m(this,"initialTime");m(this,"timeLeft");m(this,"timerId");m(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"),i=this.container.querySelector("#copy-acn"),t=this.container.querySelector("#acn-tooltip"),o=this.container.querySelector("#transfer-amount"),s=this.container.querySelector("#copy-amount"),r=this.container.querySelector("#amount-tooltip"),l=this.container.querySelector("#transfer-button");i&&e&&i.addEventListener("click",()=>{P.track("copy_transferBank",{payment_method:"Transfer",payment_process:"Payment Started"}),t&&this.copyToClipboard(e.innerHTML,t)}),s&&o&&s.addEventListener("click",()=>{P.track("copy_transferAmount",{payment_method:"Transfer"}),r&&this.copyToClipboard(o.innerHTML.split(" ")[1].replace(/,/g,""),r)}),l&&l.addEventListener("click",()=>{this.onAction(5)})}startTimer(e){this.stopTimer(),this.timerId=window.setInterval(()=>{if(this.timeLeft>0){this.timeLeft-=1;const i=this.container.querySelector("#time-left");i&&(i.innerHTML=ri(this.timeLeft))}else this.stopTimer(),e==="check"&&this.onAction(2)},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}copyToClipboard(e,i){navigator.clipboard.writeText(e).then(()=>{i.innerHTML="Copied!"}).catch(()=>{i.innerHTML="Failed to copy"})}renderComponent(e){var g,f,y,C,k,S;e&&(this.payment=e),this.container.innerHTML=this.render();const i=this.container.querySelector("#transfer-amount"),t=this.container.querySelector("#transfer-bank"),o=this.container.querySelector("#account-name"),s=this.container.querySelector("#transfer-acn"),r=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(i&&(i.innerHTML=`${c} ${ke(l==="USD"?(y=this.payment)==null?void 0:y.localAmount:(C=this.payment)==null?void 0:C.amount,2)}`),t&&this.payment.bankDetails&&(t.innerHTML=(k=this.payment.bankDetails)==null?void 0:k.bankName),o&&this.payment.bankDetails&&(o.innerHTML=(S=this.payment.bankDetails)==null?void 0:S.accountName),s&&this.payment.bankDetails&&(s.innerHTML=this.payment.bankDetails.accountNumber),r&&(r.innerHTML=ri(this.initialTime)),this.startTimer("poll"),e.status==="inProgress"){const A="45654f3ce4c9512ea9a4",M="us2";var b=new Or(A,{cluster:M}),p=b.subscribe(e.reference);p.bind("payment_status",_=>{_.status==="successful"?(clearInterval(this.timerId||void 0),this.onAction(6),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Success"}),_!=null&&_.redirectUrl&&setTimeout(()=>{const E=new URL(_.redirectUrl);E.searchParams.append("status",_.status),E.searchParams.append("reference",_.reference),window.location.href=E.toString()},1800)):_.status==="failed"&&(clearInterval(this.timerId||void 0),this.onFail(7,"Transfer failed"),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Failed"}))})}this.attachListener()}render(){return Br}}const Hr=`<div id="trasferConfirmationProgress">
845
845
  <div>
846
846
  <div>
847
847
  <div class=" grid grid-rows-[auto_1fr] gap-4 mx-5">
@@ -945,7 +945,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
945
945
  </div> -->
946
946
  </div>
947
947
  </div>
948
- </div>`;class jr{constructor(e){m(this,"container");this.container=e.container}attachListeners(){}renderComponent(){this.container.innerHTML=this.render()}render(){return Kr}}class Gr{constructor({amount:e,closeModal:i,container:t,email:o,token:s,currency:r,rdtCode:l,url:c,reference:b,callBackUrl:p,metadata:g,localCurrency:f,disablePaymentMethods:y,restartTransactionProcess:C,hidePaymentMethods:k,retryingPayment:S}){m(this,"container");m(this,"contents");m(this,"closeModal");m(this,"email");m(this,"transferDetails");m(this,"transferConfirmationProgress");m(this,"transferConfirmationEnd");m(this,"transferExpired");m(this,"mainLoader");m(this,"warningScreen");m(this,"successScreen");m(this,"merchantPlanDetail",{});m(this,"token");m(this,"currency");m(this,"amount");m(this,"rdtCode");m(this,"url");m(this,"reference");m(this,"_currentStep");m(this,"activeRef");m(this,"paymentResponse");m(this,"timerId");m(this,"abortController",null);m(this,"callBackUrl");m(this,"metadata");m(this,"localCurrency");m(this,"transactionIssuesScreen");m(this,"disablePaymentMethods");m(this,"paymentResponseHeaders");m(this,"restartTransactionProcess");m(this,"hidePaymentMethods");m(this,"retryingPayment");m(this,"isMaxRetriesReached");m(this,"isMobile",!1);this.currency=r,this.container=t,this.contents=this.container.querySelector("#payment-content-view"),this.closeModal=i,this.token=s,this.email=o,this.amount=e,this.rdtCode=l,this.url=c,this.reference=b,this._currentStep=1,this.callBackUrl=p,this.metadata=g,this.localCurrency=f,this.disablePaymentMethods=y,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=C,this.hidePaymentMethods=k,this.retryingPayment=S,this.isMaxRetriesReached=!1,this.renderTransferContent(),this.paymentResponse={},this.activeRef="",this.timerId=null,this.mainLoader=new Ie(this.contents),P.track("transfer_opens",{payment_method:"Transfer"}),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"),i=this.container.querySelector("#transfer-sent"),t=this.container.querySelector(".success-button");e&&e.addEventListener("click",()=>{this.currentStep=1}),i&&i.addEventListener("click",()=>{this.abortController&&(this.abortController.abort(),this.currentStep=5)}),t&&t.addEventListener("click",()=>{this.closeModal(),P.track("checkout_closes")})}onSentVerify(e){e!==2?this.abortController&&(this.abortController.abort(),this.currentStep=e):this.currentStep=2}async verifyTransfer(){try{const e=await vn(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"),i=this.container.querySelector("#details-content");i&&(this.mainLoader=new Ie(this.contents),this.mainLoader.mountLoader("25dvh"),i.classList.add("hidden")),P.track("start_transferProcess",{payment_method:"Transfer"}),(()=>{if(this.retryingPayment){const o={channel:"bank_transfer",reference:this.reference};return si(this.token,o,this.rdtCode,this.url)}else{const o={amount:this.amount,channel:"bank_transfer",currency:this.currency,customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return xt(this.token,o,this.rdtCode,this.url)}})().then(({data:o,headers:s})=>{this.paymentResponse=o,this.paymentResponseHeaders=s,o.status==="failed"?(this.currentStep=7,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment failed"),P.track("stop_transferProcess",{payment_method:"Transfer",verification_status:"Failed"})):(e&&i&&(e.classList.add("hidden"),i.classList.remove("hidden")),this.activeRef=o.reference,this.paymentResponse=o,o.bankDetails&&o.bankDetails.accountNumber?(this.transferDetails=new Go({container:this.contents,onAction:r=>{this.onSentVerify.bind(this)(r)},onFail:(r,l)=>{this.currentStep=r,r===7&&l&&this.warningScreen.setPaymentError(l)}}),this.transferDetails.renderComponent(this.paymentResponse||o)):(this.currentStep=7,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Error fetching bank details")))}).catch(o=>{P.track("verify_payment",{payment_method:"Transfer",verification_status:"Null"}),o.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyTransfer(),this.currentStep=7,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=7,o.message?this.warningScreen.setPaymentError(o.message):this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue()})})}goBackToMerchant(){sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderTransferContent(e){var t;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.isMobile&&this.hidePaymentMethods(),this.currentStep!==1?(i==null||i.classList.add("hidden"),this.disablePaymentMethods("bank_transfer")):i==null||i.addEventListener("click",()=>{this.restartTransactionProcess()}),this.contents){switch(this.currentStep){case 1:this.transferDetails=new Go({container:this.contents,onAction:o=>{this.onSentVerify.bind(this)(o)},onFail:(o,s)=>{this.currentStep=o,o===7&&s&&this.warningScreen.setPaymentError(s)}});break;case 2:this.transferExpired=new jr({container:this.contents}),this.transferExpired.renderComponent();break;case 5:this.transferConfirmationProgress=new Ur({container:this.contents,onAction:(o,s)=>{this.currentStep=o,o===7&&s&&this.warningScreen.setPaymentError(s)},ref:this.activeRef,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(o,s)=>{this.paymentResponse=o,this.paymentResponseHeaders=s}}),this.transferConfirmationProgress.renderComponent(this.paymentResponse);break;case 6:this.successScreen=new Gn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(t=this.merchantPlanDetail)==null?void 0:t.rate.rate}),this.successScreen.renderComponent();break;case 7:this.warningScreen=new fn({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 Ko({container:this.contents,onAction:o=>{this.currentStep=o},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transferConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new di({container:this.contents,onAction:()=>{var o;this.currentStep=7,this.warningScreen.setPaymentError(((o=this.paymentResponse)==null?void 0:o.providerMessage)||"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,i){navigator.clipboard.writeText(e).then(()=>{i.innerHTML="Copied!"}).catch(()=>{i.innerHTML="Failed to copy"})}destroyTimer(){this.stopTimer()}stopPolling(){this.abortController&&this.abortController.abort()}}function Vo(){return function(n,e){let i=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:()=>i,set:s=>{i=s}})}}class te extends Error{constructor(e,i){super(e),this.status=i,this.name="FetchError"}}class Qe extends Error{constructor(e){super(e),this.name="AuthorizationError"}}class ht{constructor(e){m(this,"token");m(this,"baseurl","https://api.spotflow.co/api/v1");m(this,"headers");m(this,"rdtCode");m(this,"url");m(this,"getHeaders",(e,i)=>{if(!e)throw new Qe("Missing authorization token");const t=new Headers;return t.append("Content-Type","application/json"),t.append("Authorization",`Bearer ${e}`),i&&t.append("Spotflow-Payment-Code",i),t});this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.headers=this.getHeaders(this.token,this.rdtCode)}}class Fo extends ht{constructor(e){super(e)}async createCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async createUssdPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return{data:await i.json(),headers:i.headers}}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async validateCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments/validate`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async authorizeCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments/authorize`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async createTransferPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async verifyPayment(e,i){try{const t=await fetch(`${ve(this.baseurl,this.url)}/payments/verify?reference=${e}`,{method:"GET",headers:this.headers,signal:i});if(!t.ok){const s=await t.json();throw s.message?new te(s.message,t.status):new te("Network response was not ok",t.status)}return{data:await t.json(),headers:t.headers}}catch(t){throw t instanceof te?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof Qe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class Vr extends ht{constructor(e){super(e)}async getMerchantConfig(e,i){try{const t=await fetch(`${ve(this.baseurl,this.url)}/checkout-configurations?currency=${i}&planId=${e||""}`,{headers:this.headers,method:"GET"});if(!t.ok){const o=await t.json();throw o.message?new te(o.message,t.status):new te("Network response was not ok",t.status)}return t.json()}catch(t){throw t instanceof te?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof Qe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class Fr extends ht{constructor(e){super(e)}async getBankList(){try{const e=await fetch(`${ve(this.baseurl,this.url)}/banks?ussd=true`,{headers:this.headers,method:"GET"});if(!e.ok){const i=await e.json();throw i.message?new te(i.message,e.status):new te("Network response was not ok",e.status)}return e.json()}catch(e){throw e instanceof te?(li.showToast(e.message,"error",9e3),console.error(`FetchError: ${e.message} (status: ${e.status})`)):e instanceof Qe?console.error(`AuthorizationError: ${e.message}`):console.error(`Unexpected error: ${e}`),e}}}const zr=`<form id="ussdBanks">
948
+ </div>`;class jr{constructor(e){m(this,"container");this.container=e.container}attachListeners(){}renderComponent(){this.container.innerHTML=this.render()}render(){return Kr}}class Gr{constructor({amount:e,closeModal:i,container:t,email:o,token:s,currency:r,rdtCode:l,url:c,reference:b,callBackUrl:p,metadata:g,localCurrency:f,disablePaymentMethods:y,restartTransactionProcess:C,hidePaymentMethods:k,retryingPayment:S}){m(this,"container");m(this,"contents");m(this,"closeModal");m(this,"email");m(this,"transferDetails");m(this,"transferConfirmationProgress");m(this,"transferConfirmationEnd");m(this,"transferExpired");m(this,"mainLoader");m(this,"warningScreen");m(this,"successScreen");m(this,"merchantPlanDetail",{});m(this,"token");m(this,"currency");m(this,"amount");m(this,"rdtCode");m(this,"url");m(this,"reference");m(this,"_currentStep");m(this,"activeRef");m(this,"paymentResponse");m(this,"timerId");m(this,"abortController",null);m(this,"callBackUrl");m(this,"metadata");m(this,"localCurrency");m(this,"transactionIssuesScreen");m(this,"disablePaymentMethods");m(this,"paymentResponseHeaders");m(this,"restartTransactionProcess");m(this,"hidePaymentMethods");m(this,"retryingPayment");m(this,"isMaxRetriesReached");m(this,"isMobile",!1);this.currency=r,this.container=t,this.contents=this.container.querySelector("#payment-content-view"),this.closeModal=i,this.token=s,this.email=o,this.amount=e,this.rdtCode=l,this.url=c,this.reference=b,this._currentStep=1,this.callBackUrl=p,this.metadata=g,this.localCurrency=f,this.disablePaymentMethods=y,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=C,this.hidePaymentMethods=k,this.retryingPayment=S,this.isMaxRetriesReached=!1,this.renderTransferContent(),this.paymentResponse={},this.activeRef="",this.timerId=null,this.mainLoader=new Ie(this.contents),P.track("transfer_opens",{payment_method:"Transfer"}),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"),i=this.container.querySelector("#transfer-sent"),t=this.container.querySelector(".success-button");e&&e.addEventListener("click",()=>{this.currentStep=1}),i&&i.addEventListener("click",()=>{this.abortController&&(this.abortController.abort(),this.currentStep=5)}),t&&t.addEventListener("click",()=>{this.closeModal(),P.track("checkout_closes")})}onSentVerify(e){e!==2?this.abortController&&(this.abortController.abort(),this.currentStep=e):this.currentStep=2}async verifyTransfer(){try{const e=await vn(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"),i=this.container.querySelector("#details-content");i&&(this.mainLoader=new Ie(this.contents),this.mainLoader.mountLoader("25dvh"),i.classList.add("hidden")),P.track("start_transferProcess",{payment_method:"Transfer"}),(()=>{if(this.retryingPayment){const o={channel:"bank_transfer",reference:this.reference};return si(this.token,o,this.rdtCode,this.url)}else{const o={amount:this.amount,channel:"bank_transfer",currency:this.currency,customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return Lt(this.token,o,this.rdtCode,this.url)}})().then(({data:o,headers:s})=>{this.paymentResponse=o,this.paymentResponseHeaders=s,o.status==="failed"?(this.currentStep=7,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment failed"),P.track("stop_transferProcess",{payment_method:"Transfer",verification_status:"Failed"})):(e&&i&&(e.classList.add("hidden"),i.classList.remove("hidden")),this.activeRef=o.reference,this.paymentResponse=o,o.bankDetails&&o.bankDetails.accountNumber?(this.transferDetails=new Vo({container:this.contents,onAction:r=>{this.onSentVerify.bind(this)(r)},onFail:(r,l)=>{this.currentStep=r,r===7&&l&&this.warningScreen.setPaymentError(l)}}),this.transferDetails.renderComponent(this.paymentResponse||o)):(this.currentStep=7,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Error fetching bank details")))}).catch(o=>{P.track("verify_payment",{payment_method:"Transfer",verification_status:"Null"}),o.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyTransfer(),this.currentStep=7,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=7,o.message?this.warningScreen.setPaymentError(o.message):this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue()})})}goBackToMerchant(){sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderTransferContent(e){var t;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.isMobile&&this.hidePaymentMethods(),this.currentStep!==1?(i==null||i.classList.add("hidden"),this.disablePaymentMethods("bank_transfer")):i==null||i.addEventListener("click",()=>{this.restartTransactionProcess()}),this.contents){switch(this.currentStep){case 1:this.transferDetails=new Vo({container:this.contents,onAction:o=>{this.onSentVerify.bind(this)(o)},onFail:(o,s)=>{this.currentStep=o,o===7&&s&&this.warningScreen.setPaymentError(s)}});break;case 2:this.transferExpired=new jr({container:this.contents}),this.transferExpired.renderComponent();break;case 5:this.transferConfirmationProgress=new Ur({container:this.contents,onAction:(o,s)=>{this.currentStep=o,o===7&&s&&this.warningScreen.setPaymentError(s)},ref:this.activeRef,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(o,s)=>{this.paymentResponse=o,this.paymentResponseHeaders=s}}),this.transferConfirmationProgress.renderComponent(this.paymentResponse);break;case 6:this.successScreen=new Gn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(t=this.merchantPlanDetail)==null?void 0:t.rate.rate}),this.successScreen.renderComponent();break;case 7:this.warningScreen=new fn({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 jo({container:this.contents,onAction:o=>{this.currentStep=o},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transferConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new di({container:this.contents,onAction:()=>{var o;this.currentStep=7,this.warningScreen.setPaymentError(((o=this.paymentResponse)==null?void 0:o.providerMessage)||"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,i){navigator.clipboard.writeText(e).then(()=>{i.innerHTML="Copied!"}).catch(()=>{i.innerHTML="Failed to copy"})}destroyTimer(){this.stopTimer()}stopPolling(){this.abortController&&this.abortController.abort()}}function Fo(){return function(n,e){let i=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:()=>i,set:s=>{i=s}})}}class te extends Error{constructor(e,i){super(e),this.status=i,this.name="FetchError"}}class Qe extends Error{constructor(e){super(e),this.name="AuthorizationError"}}class ht{constructor(e){m(this,"token");m(this,"baseurl","https://api.spotflow.co/api/v1");m(this,"headers");m(this,"rdtCode");m(this,"url");m(this,"getHeaders",(e,i)=>{if(!e)throw new Qe("Missing authorization token");const t=new Headers;return t.append("Content-Type","application/json"),t.append("Authorization",`Bearer ${e}`),i&&t.append("Spotflow-Payment-Code",i),t});this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.headers=this.getHeaders(this.token,this.rdtCode)}}class zo extends ht{constructor(e){super(e)}async createCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async createUssdPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return{data:await i.json(),headers:i.headers}}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async validateCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments/validate`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async authorizeCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments/authorize`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async createTransferPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async verifyPayment(e,i){try{const t=await fetch(`${ve(this.baseurl,this.url)}/payments/verify?reference=${e}`,{method:"GET",headers:this.headers,signal:i});if(!t.ok){const s=await t.json();throw s.message?new te(s.message,t.status):new te("Network response was not ok",t.status)}return{data:await t.json(),headers:t.headers}}catch(t){throw t instanceof te?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof Qe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class Vr extends ht{constructor(e){super(e)}async getMerchantConfig(e,i){try{const t=await fetch(`${ve(this.baseurl,this.url)}/checkout-configurations?currency=${i}&planId=${e||""}`,{headers:this.headers,method:"GET"});if(!t.ok){const o=await t.json();throw o.message?new te(o.message,t.status):new te("Network response was not ok",t.status)}return t.json()}catch(t){throw t instanceof te?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof Qe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class Fr extends ht{constructor(e){super(e)}async getBankList(){try{const e=await fetch(`${ve(this.baseurl,this.url)}/banks?ussd=true`,{headers:this.headers,method:"GET"});if(!e.ok){const i=await e.json();throw i.message?new te(i.message,e.status):new te("Network response was not ok",e.status)}return e.json()}catch(e){throw e instanceof te?(li.showToast(e.message,"error",9e3),console.error(`FetchError: ${e.message} (status: ${e.status})`)):e instanceof Qe?console.error(`AuthorizationError: ${e.message}`):console.error(`Unexpected error: ${e}`),e}}}const zr=`<form id="ussdBanks">
949
949
  <div>
950
950
  <h5 class="text-grey-400 font-semibold text-sm">Please choose your bank to begin payment</h5>
951
951
  <div class="mt-2">
@@ -980,7 +980,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
980
980
  </div>
981
981
  </div>
982
982
  </div>
983
- </form>`;class zo{constructor(e){m(this,"container");m(this,"bank_service");m(this,"bank_list");m(this,"onAction");m(this,"selectedBank");m(this,"currency");m(this,"localCurrency");m(this,"rate");m(this,"amount");this.container=e.container,this.currency=e.currency,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.bank_list=[],this.bank_service=new Fr({token:e.merchantKey,rdtCode:e.rdtCode,url:e.url}),this.selectedBank={code:"",name:""},this.onAction=e.onAction?e.onAction:()=>null}attachListerner(){const e=document.getElementById("bank-search-input"),i=document.querySelectorAll(".select-option-tag"),t=document.querySelector("#ussd-bank-button"),o=document.querySelector("#ussdBanks");e&&e.addEventListener("change",s=>{var r,l;if(s.stopPropagation(),this.selectedBank={code:e.value,name:((l=(r=this.bank_list.filter(c=>c.code==e.value))==null?void 0:r[0])==null?void 0:l.name)||""},this.validateForm())t&&t.removeAttribute("disabled");else if(t){if(t.disabled)return;t.setAttribute("disabled","")}}),i&&Array.from(i).forEach(r=>{r.addEventListener("click",function(l){P.track("select_bank",{payment_method:"USSD"}),l.stopPropagation()})}),o&&o.addEventListener("submit",s=>{s.preventDefault(),this.onAction(this.selectedBank)})}validateForm(){return!!this.selectedBank.code}displayButtonText(e){const i=this.container.querySelector("#ussd-bank-button-text");i&&(this.localCurrency&&this.localCurrency!==this.currency?i.textContent=`Continue to pay ${this.localCurrency} ${ke((this.amount||0)*(this.rate||1),2)}`:i.textContent=`Continue to pay ${this.currency} ${ke(this.amount||0,2)}`)}renderContent(){this.container.innerHTML=this.render();const e=this.container.querySelector("#bank-search-input");if(e){const i=new Option("Select your bank","",!0,!0);i.disabled=!0,e.appendChild(i),e.classList.remove("text-tone-100"),e.classList.add("text-tone-50")}this.bank_service.getBankList().then(i=>{this.bank_list=i,e&&i.forEach(t=>{const o=new Option(t.name,t.code);e.appendChild(o),e.classList.remove("text-tone-50"),e.classList.add("text-tone-100")})}),this.displayButtonText(),this.attachListerner()}render(){return zr}}const qr=`<div id="viewCode">
983
+ </form>`;class qo{constructor(e){m(this,"container");m(this,"bank_service");m(this,"bank_list");m(this,"onAction");m(this,"selectedBank");m(this,"currency");m(this,"localCurrency");m(this,"rate");m(this,"amount");this.container=e.container,this.currency=e.currency,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.bank_list=[],this.bank_service=new Fr({token:e.merchantKey,rdtCode:e.rdtCode,url:e.url}),this.selectedBank={code:"",name:""},this.onAction=e.onAction?e.onAction:()=>null}attachListerner(){const e=document.getElementById("bank-search-input"),i=document.querySelectorAll(".select-option-tag"),t=document.querySelector("#ussd-bank-button"),o=document.querySelector("#ussdBanks");e&&e.addEventListener("change",s=>{var r,l;if(s.stopPropagation(),this.selectedBank={code:e.value,name:((l=(r=this.bank_list.filter(c=>c.code==e.value))==null?void 0:r[0])==null?void 0:l.name)||""},this.validateForm())t&&t.removeAttribute("disabled");else if(t){if(t.disabled)return;t.setAttribute("disabled","")}}),i&&Array.from(i).forEach(r=>{r.addEventListener("click",function(l){P.track("select_bank",{payment_method:"USSD"}),l.stopPropagation()})}),o&&o.addEventListener("submit",s=>{s.preventDefault(),this.onAction(this.selectedBank)})}validateForm(){return!!this.selectedBank.code}displayButtonText(e){const i=this.container.querySelector("#ussd-bank-button-text");i&&(this.localCurrency&&this.localCurrency!==this.currency?i.textContent=`Continue to pay ${this.localCurrency} ${ke((this.amount||0)*(this.rate||1),2)}`:i.textContent=`Continue to pay ${this.currency} ${ke(this.amount||0,2)}`)}renderContent(){this.container.innerHTML=this.render();const e=this.container.querySelector("#bank-search-input");if(e){const i=new Option("Select your bank","",!0,!0);i.disabled=!0,e.appendChild(i),e.classList.remove("text-tone-100"),e.classList.add("text-tone-50")}this.bank_service.getBankList().then(i=>{this.bank_list=i,e&&i.forEach(t=>{const o=new Option(t.name,t.code);e.appendChild(o),e.classList.remove("text-tone-50"),e.classList.add("text-tone-100")})}),this.displayButtonText(),this.attachListerner()}render(){return zr}}const qr=`<div id="viewCode">
984
984
  <div class="grid gap-4">
985
985
  <div class="text-center">
986
986
  <div class="md:w-4/5 mx-auto grid gap-3">
@@ -1017,7 +1017,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1017
1017
  payment</button>
1018
1018
  </div>
1019
1019
  </div>
1020
- </div>`;class Wr{constructor(e){m(this,"container");m(this,"selected");m(this,"secret");m(this,"onAction");m(this,"paymentService");m(this,"currency");m(this,"amount");m(this,"ussd_detail");m(this,"reference");m(this,"email");m(this,"abortController");m(this,"activeRef","");m(this,"pageLoader");m(this,"callBackUrl");m(this,"metadata");m(this,"localCurrency");m(this,"onError");this.container=e.container,this.selected=e.selected,this.onAction=e.onAction,this.secret=e.secret,this.abortController=new AbortController,this.paymentService=new Fo({token:this.secret,rdtCode:e.rdtCode,url:e.url}),this.currency=e.currency,this.amount=e.amount||0,this.email=e.email,this.reference=e.reference,this.callBackUrl=e.callBackUrl,this.metadata=e.metadata,this.localCurrency=e.localCurrency,this.onError=e.onError??(()=>null),this.pageLoader=new Ie(this.container),this.pageLoader.mountLoader("25dvh"),this.pageLoader.updateMessage("Fetching selected bank code detail")}makePayment(){var e;P.track("start_ussdProcess",{payment_method:"USSD"}),this.paymentService.createUssdPayment({amount:this.amount,currency:this.currency,channel:"ussd",customer:{email:this.email},bank:{code:((e=this.selected)==null?void 0:e.code)||""},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0}).then(({data:i,headers:t})=>{var o;if(this.ussd_detail=i.ussd,this.activeRef=i.reference||"",i.status==="failed"){this.onError(i.providerMessage||"Payment failed"),P.track("stop_ussdProcess",{payment_method:"USSD"});const s=t.get("spf-redirect-url");this.callBackUrl=s||this.callBackUrl,this.callBackUrl&&setTimeout(()=>{const r=new URL(this.callBackUrl);r.searchParams.append("status",i.status),r.searchParams.append("reference",i.reference),window.location.href=r.toString()},1800);return}else if(i.status!=="success")if(i.ussd){this.container.innerHTML=this.render();const s=this.container.querySelectorAll(".bank-dial-code"),r=this.container.querySelector("#bank-dial-code");r&&(r.innerHTML=((o=i==null?void 0:i.ussd)==null?void 0:o.paymentCode)||"");const l=this.container.querySelector("#bank-name-ussd");l&&(l.innerHTML=this.selected.name),Array.from(s).forEach(b=>{var p;b.innerHTML=((p=i==null?void 0:i.ussd)==null?void 0:p.code)||""}),this.attachListener();return}else if(i.providerMessage){this.onError(i.providerMessage);return}else{this.onError("Unable to fetch bank details");return}this.container.innerHTML=this.render(),this.attachListener()}).catch(i=>{i!=null&&i.message?this.onError(i.message):this.onError("Payment failed")})}attachListener(){const e=this.container.querySelectorAll(".copy-code-button"),i=this.container.querySelectorAll(".copy-code-button-1"),t=this.container.querySelector("#bank-completed-payment");Array.from(e).forEach(r=>{r.addEventListener("click",l=>{var c;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((c=this.ussd_detail)==null?void 0:c.code)||"")})}),Array.from(i).forEach(r=>{r.addEventListener("click",l=>{var c;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((c=this.ussd_detail)==null?void 0:c.code)||"")})}),t&&t.addEventListener("click",r=>{r.preventDefault(),this.onAction(this.selected,this.activeRef)})}verifyPayment(){let e;this.abortController?e=this.abortController.signal:e=new AbortController().signal,console.log({signal:e})}renderComponent(){this.makePayment(),this.attachListener()}render(){return qr}}var Zr=Object.defineProperty,Jr=(n,e,i,t)=>{for(var o=void 0,s=n.length-1,r;s>=0;s--)(r=n[s])&&(o=r(e,i,o)||o);return o&&Zr(e,i,o),o};class qo{constructor({container:e,onSuccess:i,secret:t,amount:o,currency:s,email:r,reference:l,rdtCode:c,url:b,callBackUrl:p,metadata:g,localCurrency:f,hidePaymentMethods:y,showPaymentMethods:C,disablePaymentMethods:k}){m(this,"contents");m(this,"selectedCode");m(this,"secret");m(this,"amount");m(this,"currency");m(this,"email");m(this,"pageLoader");m(this,"reference");m(this,"onSuccess");m(this,"warningScreen");m(this,"bankDetail");m(this,"viewUssdCode");m(this,"_currentStep");m(this,"container");m(this,"paymentService");m(this,"successScreen");m(this,"activeRef","");m(this,"abortController");m(this,"_retry_count",10);m(this,"intervalPayment");m(this,"rdtCode");m(this,"url");m(this,"callBackUrl");m(this,"metadata");m(this,"localCurrency");m(this,"merchantDetails");m(this,"hidePaymentMethods");m(this,"showPaymentMethods");m(this,"disablePaymentMethods");this.onSuccess=i||(()=>null),this.container=e,this.secret=t,this.amount=o,this.currency=s,this.reference=l,this.email=r,this.rdtCode=c,this.url=b,this.callBackUrl=p,this.metadata=g,this.localCurrency=f,this.merchantDetails={},this.hidePaymentMethods=y,this.showPaymentMethods=C,this.disablePaymentMethods=k,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.paymentService=new Fo({token:this.secret,rdtCode:this.rdtCode,url:this.url}),P.track("ussd_opens",{payment_method:"USSD"})}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderUssdContent()}onCodeSelect(e){this.selectedCode=e||"",this.currentStep=2}validate(){let e;if(this.abortController?e=this.abortController.signal:(this.abortController=new AbortController,e=this.abortController.signal),this._retry_count<=0){clearInterval(this.intervalPayment),this.currentStep=3,P.track("verify_payment",{payment_method:"USSD",verification_status:"In Progress"});return}this.paymentService.verifyPayment(this.activeRef,e||this.abortController.signal).then(({data:i,headers:t})=>{i.status==="failed"?(this.currentStep=3,clearInterval(this.intervalPayment),this.redirectTo(i,t,"failed")):["successful","failed"].includes(i.status)?i.status==="inProgress"?this._retry_count-=1:["success","successful"].includes(i.status)&&(this.currentStep=5,clearInterval(this.intervalPayment),P.track("verify_payment",{payment_method:"USSD",verification_status:"Success"}),this.redirectTo(i,t,"success")):this._retry_count-=1}).catch(i=>{i.message?this.warningScreen.setPaymentError(i.message):this.warningScreen.setPaymentError("Payment failed"),this.currentStep=3,clearInterval(this.intervalPayment),P.track("verify_payment",{payment_method:"USSD",verification_status:"Failed"})})}redirectTo(e,i,t){const o=i.get("spf-redirect-url");this.callBackUrl=o||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):t==="success"&&this.onSuccess(e)}renderUssdContent(e){var i;if(e&&(this.merchantDetails=e),this.currentStep===3||this.currentStep===5?this.hidePaymentMethods():this.showPaymentMethods(),this.currentStep===2&&this.disablePaymentMethods("ussd"),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){case 1:this.bankDetail=new zo({container:this.contents,merchantKey:this.secret,onAction:this.onCodeSelect.bind(this),rdtCode:this.rdtCode,url:this.url,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate,amount:this.amount}),this.bankDetail.renderContent();break;case 2:this.viewUssdCode=new Wr({container:this.contents,onAction:(t,o)=>{this.activeRef=o,this.currentStep=4,this.intervalPayment=setInterval(()=>{this.validate()},5e3)},selected:this.selectedCode||{},secret:this.secret,amount:this.amount,currency:this.currency,email:this.email||"",onError:t=>{this.currentStep=3,this.warningScreen.setPaymentError(t)},reference:this.reference,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency}),this.viewUssdCode.renderComponent();break;case 3:this.contents.innerHTML=Et,this.warningScreen=new fn({container:this.contents});break;case 4:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader("25vh"),this.pageLoader.updateMessage("We are confirming transaction status. This might take a few seconds.","Please do not refresh this page");break;case 5:this.successScreen=new Gn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(i=this.merchantDetails)==null?void 0:i.rate.rate}),this.successScreen.renderComponent();break;default:this.bankDetail=new zo({container:this.contents,merchantKey:this.secret,onAction:this.onCodeSelect.bind(this),rdtCode:this.rdtCode,url:this.url,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate,amount:this.amount}),this.bankDetail.renderContent();break}}handleSelectChange(e){setTimeout(()=>{this.currentStep=2},400),this.currentStep=2}}Jr([Vo(),Vo()],qo.prototype,"selectedCode");const $r={NGN:"Nigerian Naira",USD:"US Dollar",GHS:"Ghanaian Cedi",GBP:"Pounds",ZAF:"South African Rand",USDT:"Tether",KSH:"Kenyan Shilling"},Yr=n=>n==null?void 0:n.replace(/_/g," ");function Qr(n){return n.split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}const Ii=n=>{if(n){const e=Yr(n);return Qr(e)}return""},Xr=`<div>
1020
+ </div>`;class Wr{constructor(e){m(this,"container");m(this,"selected");m(this,"secret");m(this,"onAction");m(this,"paymentService");m(this,"currency");m(this,"amount");m(this,"ussd_detail");m(this,"reference");m(this,"email");m(this,"abortController");m(this,"activeRef","");m(this,"pageLoader");m(this,"callBackUrl");m(this,"metadata");m(this,"localCurrency");m(this,"onError");this.container=e.container,this.selected=e.selected,this.onAction=e.onAction,this.secret=e.secret,this.abortController=new AbortController,this.paymentService=new zo({token:this.secret,rdtCode:e.rdtCode,url:e.url}),this.currency=e.currency,this.amount=e.amount||0,this.email=e.email,this.reference=e.reference,this.callBackUrl=e.callBackUrl,this.metadata=e.metadata,this.localCurrency=e.localCurrency,this.onError=e.onError??(()=>null),this.pageLoader=new Ie(this.container),this.pageLoader.mountLoader("25dvh"),this.pageLoader.updateMessage("Fetching selected bank code detail")}makePayment(){var e;P.track("start_ussdProcess",{payment_method:"USSD"}),this.paymentService.createUssdPayment({amount:this.amount,currency:this.currency,channel:"ussd",customer:{email:this.email},bank:{code:((e=this.selected)==null?void 0:e.code)||""},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0}).then(({data:i,headers:t})=>{var o;if(this.ussd_detail=i.ussd,this.activeRef=i.reference||"",i.status==="failed"){this.onError(i.providerMessage||"Payment failed"),P.track("stop_ussdProcess",{payment_method:"USSD"});const s=t.get("spf-redirect-url");this.callBackUrl=s||this.callBackUrl,this.callBackUrl&&setTimeout(()=>{const r=new URL(this.callBackUrl);r.searchParams.append("status",i.status),r.searchParams.append("reference",i.reference),window.location.href=r.toString()},1800);return}else if(i.status!=="success")if(i.ussd){this.container.innerHTML=this.render();const s=this.container.querySelectorAll(".bank-dial-code"),r=this.container.querySelector("#bank-dial-code");r&&(r.innerHTML=((o=i==null?void 0:i.ussd)==null?void 0:o.paymentCode)||"");const l=this.container.querySelector("#bank-name-ussd");l&&(l.innerHTML=this.selected.name),Array.from(s).forEach(b=>{var p;b.innerHTML=((p=i==null?void 0:i.ussd)==null?void 0:p.code)||""}),this.attachListener();return}else if(i.providerMessage){this.onError(i.providerMessage);return}else{this.onError("Unable to fetch bank details");return}this.container.innerHTML=this.render(),this.attachListener()}).catch(i=>{i!=null&&i.message?this.onError(i.message):this.onError("Payment failed")})}attachListener(){const e=this.container.querySelectorAll(".copy-code-button"),i=this.container.querySelectorAll(".copy-code-button-1"),t=this.container.querySelector("#bank-completed-payment");Array.from(e).forEach(r=>{r.addEventListener("click",l=>{var c;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((c=this.ussd_detail)==null?void 0:c.code)||"")})}),Array.from(i).forEach(r=>{r.addEventListener("click",l=>{var c;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((c=this.ussd_detail)==null?void 0:c.code)||"")})}),t&&t.addEventListener("click",r=>{r.preventDefault(),this.onAction(this.selected,this.activeRef)})}verifyPayment(){let e;this.abortController?e=this.abortController.signal:e=new AbortController().signal,console.log({signal:e})}renderComponent(){this.makePayment(),this.attachListener()}render(){return qr}}var Zr=Object.defineProperty,Jr=(n,e,i,t)=>{for(var o=void 0,s=n.length-1,r;s>=0;s--)(r=n[s])&&(o=r(e,i,o)||o);return o&&Zr(e,i,o),o};class Wo{constructor({container:e,onSuccess:i,secret:t,amount:o,currency:s,email:r,reference:l,rdtCode:c,url:b,callBackUrl:p,metadata:g,localCurrency:f,hidePaymentMethods:y,showPaymentMethods:C,disablePaymentMethods:k}){m(this,"contents");m(this,"selectedCode");m(this,"secret");m(this,"amount");m(this,"currency");m(this,"email");m(this,"pageLoader");m(this,"reference");m(this,"onSuccess");m(this,"warningScreen");m(this,"bankDetail");m(this,"viewUssdCode");m(this,"_currentStep");m(this,"container");m(this,"paymentService");m(this,"successScreen");m(this,"activeRef","");m(this,"abortController");m(this,"_retry_count",10);m(this,"intervalPayment");m(this,"rdtCode");m(this,"url");m(this,"callBackUrl");m(this,"metadata");m(this,"localCurrency");m(this,"merchantDetails");m(this,"hidePaymentMethods");m(this,"showPaymentMethods");m(this,"disablePaymentMethods");this.onSuccess=i||(()=>null),this.container=e,this.secret=t,this.amount=o,this.currency=s,this.reference=l,this.email=r,this.rdtCode=c,this.url=b,this.callBackUrl=p,this.metadata=g,this.localCurrency=f,this.merchantDetails={},this.hidePaymentMethods=y,this.showPaymentMethods=C,this.disablePaymentMethods=k,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.paymentService=new zo({token:this.secret,rdtCode:this.rdtCode,url:this.url}),P.track("ussd_opens",{payment_method:"USSD"})}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderUssdContent()}onCodeSelect(e){this.selectedCode=e||"",this.currentStep=2}validate(){let e;if(this.abortController?e=this.abortController.signal:(this.abortController=new AbortController,e=this.abortController.signal),this._retry_count<=0){clearInterval(this.intervalPayment),this.currentStep=3,P.track("verify_payment",{payment_method:"USSD",verification_status:"In Progress"});return}this.paymentService.verifyPayment(this.activeRef,e||this.abortController.signal).then(({data:i,headers:t})=>{i.status==="failed"?(this.currentStep=3,clearInterval(this.intervalPayment),this.redirectTo(i,t,"failed")):["successful","failed"].includes(i.status)?i.status==="inProgress"?this._retry_count-=1:["success","successful"].includes(i.status)&&(this.currentStep=5,clearInterval(this.intervalPayment),P.track("verify_payment",{payment_method:"USSD",verification_status:"Success"}),this.redirectTo(i,t,"success")):this._retry_count-=1}).catch(i=>{i.message?this.warningScreen.setPaymentError(i.message):this.warningScreen.setPaymentError("Payment failed"),this.currentStep=3,clearInterval(this.intervalPayment),P.track("verify_payment",{payment_method:"USSD",verification_status:"Failed"})})}redirectTo(e,i,t){const o=i.get("spf-redirect-url");this.callBackUrl=o||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):t==="success"&&this.onSuccess(e)}renderUssdContent(e){var i;if(e&&(this.merchantDetails=e),this.currentStep===3||this.currentStep===5?this.hidePaymentMethods():this.showPaymentMethods(),this.currentStep===2&&this.disablePaymentMethods("ussd"),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){case 1:this.bankDetail=new qo({container:this.contents,merchantKey:this.secret,onAction:this.onCodeSelect.bind(this),rdtCode:this.rdtCode,url:this.url,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate,amount:this.amount}),this.bankDetail.renderContent();break;case 2:this.viewUssdCode=new Wr({container:this.contents,onAction:(t,o)=>{this.activeRef=o,this.currentStep=4,this.intervalPayment=setInterval(()=>{this.validate()},5e3)},selected:this.selectedCode||{},secret:this.secret,amount:this.amount,currency:this.currency,email:this.email||"",onError:t=>{this.currentStep=3,this.warningScreen.setPaymentError(t)},reference:this.reference,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency}),this.viewUssdCode.renderComponent();break;case 3:this.contents.innerHTML=Pt,this.warningScreen=new fn({container:this.contents});break;case 4:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader("25vh"),this.pageLoader.updateMessage("We are confirming transaction status. This might take a few seconds.","Please do not refresh this page");break;case 5:this.successScreen=new Gn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(i=this.merchantDetails)==null?void 0:i.rate.rate}),this.successScreen.renderComponent();break;default:this.bankDetail=new qo({container:this.contents,merchantKey:this.secret,onAction:this.onCodeSelect.bind(this),rdtCode:this.rdtCode,url:this.url,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate,amount:this.amount}),this.bankDetail.renderContent();break}}handleSelectChange(e){setTimeout(()=>{this.currentStep=2},400),this.currentStep=2}}Jr([Fo(),Fo()],Wo.prototype,"selectedCode");const $r={NGN:"Nigerian Naira",USD:"US Dollar",GHS:"Ghanaian Cedi",GBP:"Pounds",ZAF:"South African Rand",USDT:"Tether",KSH:"Kenyan Shilling"},Yr=n=>n==null?void 0:n.replace(/_/g," ");function Qr(n){return n.split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}const Ii=n=>{if(n){const e=Yr(n);return Qr(e)}return""},Xr=`<div>
1021
1021
  <button id="go-back" class="md:hidden" aria-label="Go back">
1022
1022
  </button>
1023
1023
  </div>
@@ -1334,7 +1334,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1334
1334
  <path
1335
1335
  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"
1336
1336
  stroke="black" stroke-width="4" stroke-linejoin="round" />
1337
- </svg>`),t&&t.classList.add("hidden"),i&&i.setAttribute("disabled","true"),e&&(e.value="",this.momoOtp="",e.setAttribute("disabled","true")),this.onClose(!1)})}handleOtpInput(e,i){const t=e.target,o=e.data;o&&this.momoOtp.length<6?this.momoOtp+=o:e.inputType==="deleteContentBackward"&&(this.momoOtp=this.momoOtp.slice(0,-1)),t.value="*".repeat(this.momoOtp.length),this.momoOtp.length>=6&&i&&i.removeAttribute("disabled");const s=this.container.querySelector("#otp-error");this.momoOtp.length<6&&(i&&i.setAttribute("disabled","true"),s&&(s.innerHTML=""))}renderComponent(){this.container.innerHTML=this.render();const e=this.container.querySelector("#otp-message");e&&(e.innerHTML=this.otpMessage),this.attachListener()}render(){return rl}}class dl{constructor(e){m(this,"container");m(this,"onAction");m(this,"callBackUrl");m(this,"paymentResponse");m(this,"paymentResponseHeaders");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders}attachListeners(){const e=this.container.querySelector(".details-form-button");e&&e.addEventListener("click",()=>{sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return Uo}}class cl{constructor({container:e,merchantKey:i,localCurrency:t,metadata:o,callBackUrl:s,rdtCode:r,reference:l,onSuccess:c,url:b,email:p,amount:g,token:f,currency:y,disablePaymentMethods:C,hidePaymentMethods:k,showPaymentMethods:S,onClose:A,restartTransactionProcess:M,retryingPayment:_}){m(this,"contents");m(this,"mobileMoneyForm");m(this,"mobileMoneyValidationForm");m(this,"onSuccess");m(this,"mobileMoneyConfirmation");m(this,"mobileMoneyConfirmationEnd");m(this,"transactionIssuesScreen");m(this,"container");m(this,"pageLoader");m(this,"mainLoader");m(this,"_currentStep");m(this,"successScreen");m(this,"email");m(this,"activeRef");m(this,"warningScreen");m(this,"amount");m(this,"url");m(this,"reference");m(this,"metadata");m(this,"currency");m(this,"localCurrency");m(this,"token");m(this,"callBackUrl");m(this,"rdtCode");m(this,"merchantDetails");m(this,"onClose");m(this,"hidePaymentMethods");m(this,"showPaymentMethods");m(this,"disablePaymentMethods");m(this,"paymentResponse");m(this,"paymentResponseHeaders");m(this,"restartTransactionProcess");m(this,"retryingPayment");m(this,"isMaxRetriesReached");m(this,"isMobile",!1);this.container=e,this.onSuccess=c||(()=>null),this.token=f,this.currency=y,this.amount=g,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.activeRef="",this.token=i,this.email=p,this.metadata=o,this.localCurrency=t,this.callBackUrl=s,this.localCurrency=t,this.rdtCode=r,this.url=b,this.reference=l,this.merchantDetails={},this.disablePaymentMethods=C,this.hidePaymentMethods=k,this.showPaymentMethods=S,this.onClose=A,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=M,this.retryingPayment=_,this.isMaxRetriesReached=!1,P.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,i){e.stopPropagation(),e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#mobile-money-button-text");t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),(()=>{if(this.retryingPayment){const r={channel:"mobile_money",reference:this.reference,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber}};return si(this.token,r,this.rdtCode,this.url)}else{const r={amount:this.amount,channel:"mobile_money",currency:this.currency||"USD",customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber},...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return gs(this.token,r,this.rdtCode,this.url)}})().then(({data:r,headers:l})=>{var c;if(this.paymentResponse=r,this.paymentResponseHeaders=l,r.status==="failed"){this.currentStep=5,r.providerMessage?this.warningScreen.setPaymentError(r.providerMessage):this.warningScreen.setPaymentError("Payment failed"),P.track("start_payment",{payment_method:"Mobile Money",verification_status:"Failed"});return}else if(((c=r==null?void 0:r.authorization)==null?void 0:c.mode)==="otp"){this.activeRef=r.reference,this.currentStep=6;return}else this.currentStep=3}).catch(r=>{P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Null"}),r.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=5,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=5,r.message?this.warningScreen.setPaymentError(r.message):this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}showLoader(){this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader()}submitOtp(e,i){e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#mobile-money-button-text"),s={authorization:{otp:i},reference:this.activeRef};P.track("input_MobileMoneyOTP",{payment_method:"Mobile Money",authentication_type:"0TP"}),t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),oi(this.token,s,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(l=>{P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Failed",authentication_type:"OTP"});const c=this.container.querySelector("#otp-error");l.code==="invalid_otp"?c&&(c.innerHTML=l.message):this.currentStep=3}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}async verifyPaymentProcess(){try{const e=await vn(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=5}}goBackToMerchant(){sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderMobileMoneyContent(e){var i,t;if(e&&(this.merchantDetails=e),this.currentStep===3&&this.disablePaymentMethods("mobile_money"),this.currentStep!==1){const o=document.getElementById("go-back");o&&(o.classList.remove("flex","items-center","gap-2","mb-2"),o.innerHTML="")}switch(this.currentStep===6?this.hidePaymentMethods():this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.currentStep){case 1:this.mobileMoneyForm=new al({container:this.contents,merchantKey:this.token,url:this.url,onAction:o=>s=>this.createMobileMoney.bind(this)(o,s),ref:this.activeRef,switchScreen:o=>{this.currentStep=o},rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,rate:e==null?void 0:e.rate.rate,restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.mobileMoneyForm.renderContent();break;case 2:this.mainLoader=new Ie(this.contents),this.mainLoader.mountLoader("25dvh"),this.mainLoader.updateMessage("Please wait");break;case 3:this.mobileMoneyConfirmation=new ol({container:this.contents,onAction:o=>{this.currentStep=o},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(o,s)=>{this.paymentResponse=o,this.paymentResponseHeaders=s}}),this.mobileMoneyConfirmation.renderComponent();break;case 4:this.successScreen=new Gn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(i=this.merchantDetails)==null?void 0:i.rate.rate}),this.successScreen.renderComponent();break;case 5:this.warningScreen=new fn({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 ll({container:this.contents,onClose:this.onClose,onAction:o=>s=>this.submitOtp.bind(this)(o,s),otpMessage:((t=this.paymentResponse)==null?void 0:t.providerMessage)||"Please enter your OTP sent to your phone"}),this.mobileMoneyValidationForm.renderComponent();break;case 7:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 8:this.mobileMoneyConfirmationEnd=new dl({container:this.contents,onAction:o=>{this.currentStep=o},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}),this.mobileMoneyConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new di({container:this.contents,onAction:()=>{var o;this.currentStep=5,this.warningScreen.setPaymentError(((o=this.paymentResponse)==null?void 0:o.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 ul=`<div id="eft-authenticate-container">
1337
+ </svg>`),t&&t.classList.add("hidden"),i&&i.setAttribute("disabled","true"),e&&(e.value="",this.momoOtp="",e.setAttribute("disabled","true")),this.onClose(!1)})}handleOtpInput(e,i){const t=e.target,o=e.data;o&&this.momoOtp.length<6?this.momoOtp+=o:e.inputType==="deleteContentBackward"&&(this.momoOtp=this.momoOtp.slice(0,-1)),t.value="*".repeat(this.momoOtp.length),this.momoOtp.length>=6&&i&&i.removeAttribute("disabled");const s=this.container.querySelector("#otp-error");this.momoOtp.length<6&&(i&&i.setAttribute("disabled","true"),s&&(s.innerHTML=""))}renderComponent(){this.container.innerHTML=this.render();const e=this.container.querySelector("#otp-message");e&&(e.innerHTML=this.otpMessage),this.attachListener()}render(){return rl}}class dl{constructor(e){m(this,"container");m(this,"onAction");m(this,"callBackUrl");m(this,"paymentResponse");m(this,"paymentResponseHeaders");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders}attachListeners(){const e=this.container.querySelector(".details-form-button");e&&e.addEventListener("click",()=>{sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return Ko}}class cl{constructor({container:e,merchantKey:i,localCurrency:t,metadata:o,callBackUrl:s,rdtCode:r,reference:l,onSuccess:c,url:b,email:p,amount:g,token:f,currency:y,disablePaymentMethods:C,hidePaymentMethods:k,showPaymentMethods:S,onClose:A,restartTransactionProcess:M,retryingPayment:_}){m(this,"contents");m(this,"mobileMoneyForm");m(this,"mobileMoneyValidationForm");m(this,"onSuccess");m(this,"mobileMoneyConfirmation");m(this,"mobileMoneyConfirmationEnd");m(this,"transactionIssuesScreen");m(this,"container");m(this,"pageLoader");m(this,"mainLoader");m(this,"_currentStep");m(this,"successScreen");m(this,"email");m(this,"activeRef");m(this,"warningScreen");m(this,"amount");m(this,"url");m(this,"reference");m(this,"metadata");m(this,"currency");m(this,"localCurrency");m(this,"token");m(this,"callBackUrl");m(this,"rdtCode");m(this,"merchantDetails");m(this,"onClose");m(this,"hidePaymentMethods");m(this,"showPaymentMethods");m(this,"disablePaymentMethods");m(this,"paymentResponse");m(this,"paymentResponseHeaders");m(this,"restartTransactionProcess");m(this,"retryingPayment");m(this,"isMaxRetriesReached");m(this,"isMobile",!1);this.container=e,this.onSuccess=c||(()=>null),this.token=f,this.currency=y,this.amount=g,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.activeRef="",this.token=i,this.email=p,this.metadata=o,this.localCurrency=t,this.callBackUrl=s,this.localCurrency=t,this.rdtCode=r,this.url=b,this.reference=l,this.merchantDetails={},this.disablePaymentMethods=C,this.hidePaymentMethods=k,this.showPaymentMethods=S,this.onClose=A,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=M,this.retryingPayment=_,this.isMaxRetriesReached=!1,P.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,i){e.stopPropagation(),e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#mobile-money-button-text");t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),(()=>{if(this.retryingPayment){const r={channel:"mobile_money",reference:this.reference,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber}};return si(this.token,r,this.rdtCode,this.url)}else{const r={amount:this.amount,channel:"mobile_money",currency:this.currency||"USD",customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber},...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return gs(this.token,r,this.rdtCode,this.url)}})().then(({data:r,headers:l})=>{var c;if(this.paymentResponse=r,this.paymentResponseHeaders=l,r.status==="failed"){this.currentStep=5,r.providerMessage?this.warningScreen.setPaymentError(r.providerMessage):this.warningScreen.setPaymentError("Payment failed"),P.track("start_payment",{payment_method:"Mobile Money",verification_status:"Failed"});return}else if(((c=r==null?void 0:r.authorization)==null?void 0:c.mode)==="otp"){this.activeRef=r.reference,this.currentStep=6;return}else this.currentStep=3}).catch(r=>{P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Null"}),r.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=5,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=5,r.message?this.warningScreen.setPaymentError(r.message):this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}showLoader(){this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader()}submitOtp(e,i){e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#mobile-money-button-text"),s={authorization:{otp:i},reference:this.activeRef};P.track("input_MobileMoneyOTP",{payment_method:"Mobile Money",authentication_type:"0TP"}),t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),oi(this.token,s,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(l=>{P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Failed",authentication_type:"OTP"});const c=this.container.querySelector("#otp-error");l.code==="invalid_otp"?c&&(c.innerHTML=l.message):this.currentStep=3}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}async verifyPaymentProcess(){try{const e=await vn(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=5}}goBackToMerchant(){sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderMobileMoneyContent(e){var i,t;if(e&&(this.merchantDetails=e),this.currentStep===3&&this.disablePaymentMethods("mobile_money"),this.currentStep!==1){const o=document.getElementById("go-back");o&&(o.classList.remove("flex","items-center","gap-2","mb-2"),o.innerHTML="")}switch(this.currentStep===6?this.hidePaymentMethods():this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.currentStep){case 1:this.mobileMoneyForm=new al({container:this.contents,merchantKey:this.token,url:this.url,onAction:o=>s=>this.createMobileMoney.bind(this)(o,s),ref:this.activeRef,switchScreen:o=>{this.currentStep=o},rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,rate:e==null?void 0:e.rate.rate,restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.mobileMoneyForm.renderContent();break;case 2:this.mainLoader=new Ie(this.contents),this.mainLoader.mountLoader("25dvh"),this.mainLoader.updateMessage("Please wait");break;case 3:this.mobileMoneyConfirmation=new ol({container:this.contents,onAction:o=>{this.currentStep=o},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(o,s)=>{this.paymentResponse=o,this.paymentResponseHeaders=s}}),this.mobileMoneyConfirmation.renderComponent();break;case 4:this.successScreen=new Gn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(i=this.merchantDetails)==null?void 0:i.rate.rate}),this.successScreen.renderComponent();break;case 5:this.warningScreen=new fn({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 ll({container:this.contents,onClose:this.onClose,onAction:o=>s=>this.submitOtp.bind(this)(o,s),otpMessage:((t=this.paymentResponse)==null?void 0:t.providerMessage)||"Please enter your OTP sent to your phone"}),this.mobileMoneyValidationForm.renderComponent();break;case 7:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 8:this.mobileMoneyConfirmationEnd=new dl({container:this.contents,onAction:o=>{this.currentStep=o},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}),this.mobileMoneyConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new di({container:this.contents,onAction:()=>{var o;this.currentStep=5,this.warningScreen.setPaymentError(((o=this.paymentResponse)==null?void 0:o.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 ul=`<div id="eft-authenticate-container">
1338
1338
  <div class="pt-3">
1339
1339
  <div class="container-center">
1340
1340
  <svg width="98" height="32" viewBox="0 0 98 32" fill="none" xmlns="http://www.w3.org/2000/svg"
@@ -1371,12 +1371,12 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1371
1371
  </div>
1372
1372
  </div>
1373
1373
 
1374
- </div>`;class Wo{constructor(e){m(this,"container");m(this,"payment");m(this,"warningError");m(this,"pageLoader");m(this,"localCurrency");m(this,"rate");m(this,"amount");m(this,"merchantKey");m(this,"rdtCode");m(this,"url");m(this,"currency");m(this,"onAction");m(this,"restartTransactionProcess");this.container=e.container,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.url=e.url,this.merchantKey=e.merchantKey,this.rdtCode=e.rdtCode,this.currency=e.currency,this.onAction=e.onAction,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new fn({container:this.container,onAction:this.restartTransactionProcess.bind(this)})}attachListener(){const e=this.container.querySelector("#authenticate-btn");e&&e.addEventListener("click",()=>{this.onAction(),P.track("start_payment",{payment_method:"EFT"})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return ul}}class ml{constructor({amount:e,container:i,email:t,token:o,currency:s,rdtCode:r,url:l,reference:c,callBackUrl:b,metadata:p,localCurrency:g,hidePaymentMethods:f,showPaymentMethods:y,restartTransactionProcess:C,retryingPayment:k}){m(this,"contents");m(this,"eftAuthenticate");m(this,"successScreen");m(this,"pageLoader");m(this,"warningScreen");m(this,"transactionIssuesScreen");m(this,"container");m(this,"email");m(this,"token");m(this,"amount");m(this,"currency");m(this,"_currentStep");m(this,"activeRef");m(this,"rdtCode");m(this,"url");m(this,"reference");m(this,"callBackUrl");m(this,"metadata");m(this,"localCurrency");m(this,"hidePaymentMethods");m(this,"showPaymentMethods");m(this,"merchantPlanDetail",{});m(this,"restartTransactionProcess");m(this,"retryingPayment");m(this,"isMaxRetriesReached");m(this,"isMobile",!1);m(this,"paymentResponse");m(this,"paymentResponseHeaders");this.currency=s,this.container=i,this.token=o,this.email=t,this.amount=e,this.rdtCode=r,this.url=l,this.reference=c,this.callBackUrl=b,this.metadata=p,this.localCurrency=g,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.hidePaymentMethods=f,this.showPaymentMethods=y,this.restartTransactionProcess=C,this.retryingPayment=k,this.isMaxRetriesReached=!1,this.paymentResponse={},this.paymentResponseHeaders={},this.renderEftContent(),P.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 Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment")}setPaymentError(e){const i=this.container.querySelector("#payment-warning-text");i&&(i.textContent=e)}goBackToMerchant(){sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}async createEftPayment(){const e=this.container.querySelector(".spinner"),i=this.container.querySelector("#authenticate-button-text");e&&i&&(e.classList.remove("hidden"),i.classList.add("hidden")),(()=>{if(this.retryingPayment){const o={channel:"eft",reference:this.reference};return si(this.token,o,this.rdtCode,this.url)}else{const o={amount:this.amount,channel:"eft",currency:this.currency,customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return xt(this.token,o,this.rdtCode,this.url)}})().then(({data:o,headers:s})=>{var r,l,c;if(this.paymentResponse=o,this.paymentResponseHeaders=s,o.status==="failed"){this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment failed"),P.track("start_payment",{payment_method:"EFT",verification_status:"Failed"});return}else if(((r=o==null?void 0:o.authorization)==null?void 0:r.mode)==="redirect"){this.activeRef=o.reference,(l=o==null?void 0:o.authorization)!=null&&l.redirectUrl&&this.redirectToOzow((c=o==null?void 0:o.authorization)==null?void 0:c.redirectUrl);return}else this.currentStep=4,o!=null&&o.providerMessage?this.warningScreen.setPaymentError(o==null?void 0:o.providerMessage):this.warningScreen.setPaymentError("Unable to get redirect URL")}).catch(o=>{o.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=4,o.message?this.warningScreen.setPaymentError(o.message):this.warningScreen.setPaymentError("Payment failed"))}).finally(()=>{e&&i&&(e.classList.add("hidden"),i.classList.remove("hidden"))})}redirectToOzow(e){const i=window.open(e,"_blank");if(i){P.track("auth_redirect",{payment_method:"EFT",authentication_type:"Redirect",verification_status:"In Progress"}),this.currentStep=3,this.showLoader();const t=setInterval(()=>{i.closed&&(clearInterval(t),this.verifyPaymentProcess())},2e3)}}async verifyPaymentProcess(){try{const e=await vn(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers;const i=this.paymentResponse.status;i==="successful"?(this.currentStep=2,P.track("verify_payment",{payment_method:"EFT",verification_status:"Success"}),sn(this.paymentResponse,this.paymentResponseHeaders,"success")):i==="failed"?(this.currentStep=4,P.track("verify_payment",{payment_method:"EFT",verification_status:"Failed"}),this.paymentResponse.providerMessage?this.warningScreen.setPaymentError(this.paymentResponse.providerMessage):this.warningScreen.setPaymentError("Payment failed")):i==="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")}}renderEftContent(e){var t;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),i==null||i.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.eftAuthenticate=new Wo({container:this.contents,merchantKey:this.token,url:this.url,onAction:this.createEftPayment.bind(this),ref:this.activeRef,rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,rate:e==null?void 0:e.rate.rate,restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break;case 2:this.successScreen=new Gn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(t=this.merchantPlanDetail)==null?void 0:t.rate.rate}),this.successScreen.renderComponent();break;case 3:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 4:this.warningScreen=new fn({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 di({container:this.contents,onAction:()=>{var s;this.currentStep=4,this.warningScreen.setPaymentError(((s=this.paymentResponse)==null?void 0:s.providerMessage)||"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 Wo({container:this.contents,merchantKey:this.token,url:this.url,onAction:this.createEftPayment.bind(this),ref:this.activeRef,rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,rate:e==null?void 0:e.rate.rate,restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break}const o=this.container.querySelector("#card-currency");o&&(o.textContent=`${this.localCurrency?this.localCurrency:this.currency} Card`)}}}class hl{constructor({container:e,email:i,phoneNumber:t,code:o,encryption:s,merchantKey:r,modalContainer:l,amount:c,planId:b,rdtCode:p,url:g,reference:f,callBackUrl:y,metadata:C,localCurrency:k,closePayment:S}){m(this,"validChannels",[]);m(this,"disabledChannels",[]);m(this,"selectedChannel");m(this,"modalContainer");m(this,"currentPaymentMethod");m(this,"mainLayout");m(this,"mainHeader");m(this,"mainFooter");m(this,"merchantPlanDetail",{});m(this,"mainScreen");m(this,"currency");m(this,"card");m(this,"transfer");m(this,"ussd");m(this,"mobileMoney");m(this,"eft");m(this,"encryption");m(this,"merchantKey");m(this,"planId");m(this,"email");m(this,"phoneNumber");m(this,"code");m(this,"amount",0);m(this,"rdtCode");m(this,"url");m(this,"reference");m(this,"isMobile",!1);m(this,"callBackUrl");m(this,"metadata");m(this,"localCurrency");m(this,"closePayment");m(this,"retryingPayment");this.validChannels=[],this.disabledChannels=[],this.selectedChannel="",this.modalContainer=l,this.encryption=s,this.planId=b||"",this.merchantKey=r,this.email=i,this.phoneNumber=t,this.code=o,this.amount=c||0,this.rdtCode=p||"",this.url=g||"",this.reference=f,this.mainLayout=e,this.callBackUrl=y,this.metadata=C||{},this.localCurrency=k||"",this.isMobile=window.matchMedia("(max-width: 767px)").matches,this.currentPaymentMethod="",this.currency="",this.closePayment=S,this.retryingPayment=!1}mountScreen(e,i,t,o){var r,l;t&&(this.validChannels=t),o&&(this.disabledChannels=o),this.mainLayout.innerHTML=this.render(),this.merchantPlanDetail=e,this.currency=i;const s=(l=(r=this.merchantPlanDetail.plan)==null?void 0:r.pricingOptions)==null?void 0:l.find(c=>c.currency===this.currency);this.amount=(s==null?void 0:s.amount)||this.amount,this.mainHeader=new el({container:document.getElementById("main-header"),email:this.email,amount:this.amount,metadata:this.metadata,currency:this.currency,localCurrency:this.localCurrency,merchantDetail:e,onAction:this.switchTab.bind(this),isMobile:this.isMobile,onClose:c=>{this.closeBTN.bind(this)(c)},currentPaymentMethod:this.currentPaymentMethod}),this.mainHeader.renderComponent(),this.mainFooter=new il({container:document.getElementById("main-footer")}),this.mainFooter.renderComponent(),this.setupPaymentMethodButtons(),this.selectedChannel&&(this.currentPaymentMethod=this.selectedChannel),this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.renderPaymentMethodContent(),this.setCurrentPaymentMethod(this.currentPaymentMethod)}setupPaymentMethodButtons(){const e=document.querySelectorAll(".tab-button");e.forEach(t=>{t.removeAttribute("disabled"),t.classList.remove("hidden","disabled","limit-exceeded");const o=t.querySelector(".disabled-indicator");o&&t.removeChild(o)});const i=[...this.validChannels,...this.disabledChannels];e.forEach(t=>{const o=t.getAttribute("data-name");o&&!i.includes(o)&&t.classList.add("hidden")}),this.disabledChannels.forEach(t=>{const o=Array.from(e).find(s=>s.getAttribute("data-name")===t);if(o){o.setAttribute("disabled","true"),o.classList.add("disabled","limit-exceeded"),o.setAttribute("title","Transaction amount exceeds limit for this payment method");const s=document.createElement("span");s.classList.add("disabled-indicator"),s.style.fontSize="10px",s.style.color="#FF5733",s.style.display="block",o.appendChild(s)}})}attachListeners(){const e=document.getElementById("go-back"),i=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">
1374
+ </div>`;class Zo{constructor(e){m(this,"container");m(this,"payment");m(this,"warningError");m(this,"pageLoader");m(this,"localCurrency");m(this,"rate");m(this,"amount");m(this,"merchantKey");m(this,"rdtCode");m(this,"url");m(this,"currency");m(this,"onAction");m(this,"restartTransactionProcess");this.container=e.container,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.url=e.url,this.merchantKey=e.merchantKey,this.rdtCode=e.rdtCode,this.currency=e.currency,this.onAction=e.onAction,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new fn({container:this.container,onAction:this.restartTransactionProcess.bind(this)})}attachListener(){const e=this.container.querySelector("#authenticate-btn");e&&e.addEventListener("click",()=>{this.onAction(),P.track("start_payment",{payment_method:"EFT"})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return ul}}class ml{constructor({amount:e,container:i,email:t,token:o,currency:s,rdtCode:r,url:l,reference:c,callBackUrl:b,metadata:p,localCurrency:g,hidePaymentMethods:f,showPaymentMethods:y,restartTransactionProcess:C,retryingPayment:k}){m(this,"contents");m(this,"eftAuthenticate");m(this,"successScreen");m(this,"pageLoader");m(this,"warningScreen");m(this,"transactionIssuesScreen");m(this,"container");m(this,"email");m(this,"token");m(this,"amount");m(this,"currency");m(this,"_currentStep");m(this,"activeRef");m(this,"rdtCode");m(this,"url");m(this,"reference");m(this,"callBackUrl");m(this,"metadata");m(this,"localCurrency");m(this,"hidePaymentMethods");m(this,"showPaymentMethods");m(this,"merchantPlanDetail",{});m(this,"restartTransactionProcess");m(this,"retryingPayment");m(this,"isMaxRetriesReached");m(this,"isMobile",!1);m(this,"paymentResponse");m(this,"paymentResponseHeaders");this.currency=s,this.container=i,this.token=o,this.email=t,this.amount=e,this.rdtCode=r,this.url=l,this.reference=c,this.callBackUrl=b,this.metadata=p,this.localCurrency=g,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.hidePaymentMethods=f,this.showPaymentMethods=y,this.restartTransactionProcess=C,this.retryingPayment=k,this.isMaxRetriesReached=!1,this.paymentResponse={},this.paymentResponseHeaders={},this.renderEftContent(),P.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 Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment")}setPaymentError(e){const i=this.container.querySelector("#payment-warning-text");i&&(i.textContent=e)}goBackToMerchant(){sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}async createEftPayment(){const e=this.container.querySelector(".spinner"),i=this.container.querySelector("#authenticate-button-text");e&&i&&(e.classList.remove("hidden"),i.classList.add("hidden")),(()=>{if(this.retryingPayment){const o={channel:"eft",reference:this.reference};return si(this.token,o,this.rdtCode,this.url)}else{const o={amount:this.amount,channel:"eft",currency:this.currency,customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return Lt(this.token,o,this.rdtCode,this.url)}})().then(({data:o,headers:s})=>{var r,l,c;if(this.paymentResponse=o,this.paymentResponseHeaders=s,o.status==="failed"){this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment failed"),P.track("start_payment",{payment_method:"EFT",verification_status:"Failed"});return}else if(((r=o==null?void 0:o.authorization)==null?void 0:r.mode)==="redirect"){this.activeRef=o.reference,(l=o==null?void 0:o.authorization)!=null&&l.redirectUrl&&this.redirectToOzow((c=o==null?void 0:o.authorization)==null?void 0:c.redirectUrl);return}else this.currentStep=4,o!=null&&o.providerMessage?this.warningScreen.setPaymentError(o==null?void 0:o.providerMessage):this.warningScreen.setPaymentError("Unable to get redirect URL")}).catch(o=>{o.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=4,o.message?this.warningScreen.setPaymentError(o.message):this.warningScreen.setPaymentError("Payment failed"))}).finally(()=>{e&&i&&(e.classList.add("hidden"),i.classList.remove("hidden"))})}redirectToOzow(e){const i=window.open(e,"_blank");if(i){P.track("auth_redirect",{payment_method:"EFT",authentication_type:"Redirect",verification_status:"In Progress"}),this.currentStep=3,this.showLoader();const t=setInterval(()=>{i.closed&&(clearInterval(t),this.verifyPaymentProcess())},2e3)}}async verifyPaymentProcess(){try{const e=await vn(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers;const i=this.paymentResponse.status;i==="successful"?(this.currentStep=2,P.track("verify_payment",{payment_method:"EFT",verification_status:"Success"}),sn(this.paymentResponse,this.paymentResponseHeaders,"success")):i==="failed"?(this.currentStep=4,P.track("verify_payment",{payment_method:"EFT",verification_status:"Failed"}),this.paymentResponse.providerMessage?this.warningScreen.setPaymentError(this.paymentResponse.providerMessage):this.warningScreen.setPaymentError("Payment failed")):i==="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")}}renderEftContent(e){var t;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),i==null||i.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.eftAuthenticate=new Zo({container:this.contents,merchantKey:this.token,url:this.url,onAction:this.createEftPayment.bind(this),ref:this.activeRef,rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,rate:e==null?void 0:e.rate.rate,restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break;case 2:this.successScreen=new Gn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(t=this.merchantPlanDetail)==null?void 0:t.rate.rate}),this.successScreen.renderComponent();break;case 3:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 4:this.warningScreen=new fn({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 di({container:this.contents,onAction:()=>{var s;this.currentStep=4,this.warningScreen.setPaymentError(((s=this.paymentResponse)==null?void 0:s.providerMessage)||"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 Zo({container:this.contents,merchantKey:this.token,url:this.url,onAction:this.createEftPayment.bind(this),ref:this.activeRef,rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,rate:e==null?void 0:e.rate.rate,restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break}const o=this.container.querySelector("#card-currency");o&&(o.textContent=`${this.localCurrency?this.localCurrency:this.currency} Card`)}}}class hl{constructor({container:e,email:i,phoneNumber:t,code:o,encryption:s,merchantKey:r,modalContainer:l,amount:c,planId:b,rdtCode:p,url:g,reference:f,callBackUrl:y,metadata:C,localCurrency:k,closePayment:S}){m(this,"validChannels",[]);m(this,"disabledChannels",[]);m(this,"selectedChannel");m(this,"modalContainer");m(this,"currentPaymentMethod");m(this,"mainLayout");m(this,"mainHeader");m(this,"mainFooter");m(this,"merchantPlanDetail",{});m(this,"mainScreen");m(this,"currency");m(this,"card");m(this,"transfer");m(this,"ussd");m(this,"mobileMoney");m(this,"eft");m(this,"encryption");m(this,"merchantKey");m(this,"planId");m(this,"email");m(this,"phoneNumber");m(this,"code");m(this,"amount",0);m(this,"rdtCode");m(this,"url");m(this,"reference");m(this,"isMobile",!1);m(this,"callBackUrl");m(this,"metadata");m(this,"localCurrency");m(this,"closePayment");m(this,"retryingPayment");this.validChannels=[],this.disabledChannels=[],this.selectedChannel="",this.modalContainer=l,this.encryption=s,this.planId=b||"",this.merchantKey=r,this.email=i,this.phoneNumber=t,this.code=o,this.amount=c||0,this.rdtCode=p||"",this.url=g||"",this.reference=f,this.mainLayout=e,this.callBackUrl=y,this.metadata=C||{},this.localCurrency=k||"",this.isMobile=window.matchMedia("(max-width: 767px)").matches,this.currentPaymentMethod="",this.currency="",this.closePayment=S,this.retryingPayment=!1}mountScreen(e,i,t,o){var r,l;t&&(this.validChannels=t),o&&(this.disabledChannels=o),this.mainLayout.innerHTML=this.render(),this.merchantPlanDetail=e,this.currency=i;const s=(l=(r=this.merchantPlanDetail.plan)==null?void 0:r.pricingOptions)==null?void 0:l.find(c=>c.currency===this.currency);this.amount=(s==null?void 0:s.amount)||this.amount,this.mainHeader=new el({container:document.getElementById("main-header"),email:this.email,amount:this.amount,metadata:this.metadata,currency:this.currency,localCurrency:this.localCurrency,merchantDetail:e,onAction:this.switchTab.bind(this),isMobile:this.isMobile,onClose:c=>{this.closeBTN.bind(this)(c)},currentPaymentMethod:this.currentPaymentMethod}),this.mainHeader.renderComponent(),this.mainFooter=new il({container:document.getElementById("main-footer")}),this.mainFooter.renderComponent(),this.setupPaymentMethodButtons(),this.selectedChannel&&(this.currentPaymentMethod=this.selectedChannel),this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.renderPaymentMethodContent(),this.setCurrentPaymentMethod(this.currentPaymentMethod)}setupPaymentMethodButtons(){const e=document.querySelectorAll(".tab-button");e.forEach(t=>{t.removeAttribute("disabled"),t.classList.remove("hidden","disabled","limit-exceeded");const o=t.querySelector(".disabled-indicator");o&&t.removeChild(o)});const i=[...this.validChannels,...this.disabledChannels];e.forEach(t=>{const o=t.getAttribute("data-name");o&&!i.includes(o)&&t.classList.add("hidden")}),this.disabledChannels.forEach(t=>{const o=Array.from(e).find(s=>s.getAttribute("data-name")===t);if(o){o.setAttribute("disabled","true"),o.classList.add("disabled","limit-exceeded"),o.setAttribute("title","Transaction amount exceeds limit for this payment method");const s=document.createElement("span");s.classList.add("disabled-indicator"),s.style.fontSize="10px",s.style.color="#FF5733",s.style.display="block",o.appendChild(s)}})}attachListeners(){const e=document.getElementById("go-back"),i=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">
1375
1375
  <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"/>
1376
1376
  </svg>
1377
1377
  <span class="text-tone-100 font-semibold">
1378
1378
  Go back
1379
- </span>`),i&&(i.innerHTML="Selected")):(e&&(e.classList.remove("flex","items-center","gap-2","mb-2"),e.innerHTML=""),i&&(i.innerHTML="Select your preferred")))}closeBTN(e){(()=>{this.cleanup(),e?(P.track("checkout_closes"),this.closeModal()):this.closePayment()})()}updatePaymentMethodView(e,i,t,o){switch(this.currentPaymentMethod){case"card":return this.card=new Ir({container:this.modalContainer,amount:t,currency:o,token:e,email:i,planId:this.planId,rdtCode:this.rdtCode,url:this.url,reference:this.reference,encryption:this.encryption,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,switchTab:()=>this.switchTab("card"),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});case"bank_transfer":return this.transfer=new Gr({amount:t,currency:o,closeModal:this.closeModal.bind(this),token:e,container:this.modalContainer,email:i,rdtCode:this.rdtCode,url:this.url,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),hidePaymentMethods:this.hidePaymentMethods.bind(this),retryingPayment:this.retryingPayment});case"ussd":return this.ussd=new qo({container:this.modalContainer,amount:t,currency:o,secret:this.merchantKey,rdtCode:this.rdtCode,url:this.url,email:this.email,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,closeModal:()=>this.closeModal(),switchTab:s=>this.switchTab.bind(s),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)}});case"mobile_money":return this.mobileMoney=new cl({container:this.modalContainer,email:this.email,currency:o,rdtCode:this.rdtCode,url:this.url,token:e,amount:this.amount,metadata:this.metadata,localCurrency:this.localCurrency,phoneNumber:this.phoneNumber,code:this.code,callBackUrl:this.callBackUrl,merchantKey:this.merchantKey,reference:this.reference,closeModal:()=>this.closeModal(),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)},onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});case"eft":return this.eft=new ml({container:this.modalContainer,amount:t,currency:o,token:e,email:i,rdtCode:this.rdtCode,url:this.url,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,switchTab:()=>this.switchTab("eft"),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});default:return null}}renderPaymentMethodContent(){return(()=>{switch(this.currentPaymentMethod){case"card":return this.card.renderCardContent(this.merchantPlanDetail);case"bank_transfer":return this.transfer.renderTransferContent(this.merchantPlanDetail);case"ussd":return this.ussd.renderUssdContent(this.merchantPlanDetail);case"mobile_money":return this.mobileMoney.renderMobileMoneyContent(this.merchantPlanDetail);case"eft":return this.eft.renderEftContent(this.merchantPlanDetail);default:return this.defaultToEmptyContainer()}})()}setCurrentPaymentMethod(e){this.currentPaymentMethod=e;const i=document.querySelectorAll(".tab-button");i.forEach(o=>o.classList.remove("active"));const t=Array.from(i).find(o=>o.getAttribute("data-name")===e);t&&t.classList.add("active")}setToDefaultEmptyContainer(){this.currentPaymentMethod="",this.retryingPayment=!0,this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.cleanup(),this.switchTab(""),this.showPaymentMethods(),this.setupPaymentMethodButtons(),this.renderPaymentMethodContent(),P.track("retry_payment")}defaultToEmptyContainer(){const e=document.querySelector("#payment-content-view");e.innerHTML=""}switchTab(e){this.currentPaymentMethod===e&&e!==""||(this.currentPaymentMethod==="bank_transfer"&&this.currentPaymentMethod!==e&&this.setToDefaultEmptyContainer(),this.setCurrentPaymentMethod(e),this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.cleanup(),this.showPaymentMethods(),this.renderPaymentMethodContent(),this.attachListeners(),this.isMobile&&(document.querySelectorAll(".tab-button").forEach(t=>{const o=t.getAttribute("data-name");this.disabledChannels.includes(o)||t.removeAttribute("disabled")}),e?document.querySelectorAll(".tab-button").forEach(o=>{o.getAttribute("data-name")!==e&&o.classList.add("hidden")}):document.querySelectorAll(".tab-button").forEach(o=>{const s=o.getAttribute("data-name");[...this.validChannels,...this.disabledChannels].includes(s)&&o.classList.remove("hidden")})))}disablePaymentMethods(e){this.currentPaymentMethod=e;const i=document.querySelectorAll(".tab-button");i.forEach(o=>o.setAttribute("disabled","true"));const t=Array.from(i).find(o=>o.getAttribute("data-name")===e);t&&t.removeAttribute("disabled")}enablePaymentMethods(){const e=document.querySelectorAll(".tab-button");e.forEach(t=>{const o=t.getAttribute("data-name");o&&!this.disabledChannels.includes(o)&&t.removeAttribute("disabled")});const i=Array.from(e).find(t=>t.getAttribute("data-name")===this.currentPaymentMethod);i&&!this.disabledChannels.includes(this.currentPaymentMethod)&&i.removeAttribute("disabled")}hidePaymentMethods(){const e=document.querySelector("#payment-methods-container");e&&e.classList.add("hidden")}showPaymentMethods(){const e=document.querySelector("#payment-methods-container");e&&e.classList.remove("hidden")}cleanup(){this.transfer&&this.transfer.destroyTimer()}closeModal(e){this.modalContainer&&this.modalContainer.parentNode&&document.body.removeChild(this.modalContainer),e&&e()}setupParent(e){e&&e()}render(){return vs}}class Zo{constructor(e){m(this,"container");this.container=e}renderContent(e){var t;this.container.innerHTML=this.render();const i=document.getElementById("error-action-container");e&&i&&(i.classList.remove("hidden"),(t=i.querySelector("#go-back"))==null||t.addEventListener("click",()=>{window.location.href=e}))}render(){return`
1379
+ </span>`),i&&(i.innerHTML="Selected")):(e&&(e.classList.remove("flex","items-center","gap-2","mb-2"),e.innerHTML=""),i&&(i.innerHTML="Select your preferred")))}closeBTN(e){(()=>{this.cleanup(),e?(P.track("checkout_closes"),this.closeModal()):this.closePayment()})()}updatePaymentMethodView(e,i,t,o){switch(this.currentPaymentMethod){case"card":return this.card=new Ir({container:this.modalContainer,amount:t,currency:o,token:e,email:i,planId:this.planId,rdtCode:this.rdtCode,url:this.url,reference:this.reference,encryption:this.encryption,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,switchTab:()=>this.switchTab("card"),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});case"bank_transfer":return this.transfer=new Gr({amount:t,currency:o,closeModal:this.closeModal.bind(this),token:e,container:this.modalContainer,email:i,rdtCode:this.rdtCode,url:this.url,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),hidePaymentMethods:this.hidePaymentMethods.bind(this),retryingPayment:this.retryingPayment});case"ussd":return this.ussd=new Wo({container:this.modalContainer,amount:t,currency:o,secret:this.merchantKey,rdtCode:this.rdtCode,url:this.url,email:this.email,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,closeModal:()=>this.closeModal(),switchTab:s=>this.switchTab.bind(s),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)}});case"mobile_money":return this.mobileMoney=new cl({container:this.modalContainer,email:this.email,currency:o,rdtCode:this.rdtCode,url:this.url,token:e,amount:this.amount,metadata:this.metadata,localCurrency:this.localCurrency,phoneNumber:this.phoneNumber,code:this.code,callBackUrl:this.callBackUrl,merchantKey:this.merchantKey,reference:this.reference,closeModal:()=>this.closeModal(),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)},onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});case"eft":return this.eft=new ml({container:this.modalContainer,amount:t,currency:o,token:e,email:i,rdtCode:this.rdtCode,url:this.url,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,switchTab:()=>this.switchTab("eft"),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});default:return null}}renderPaymentMethodContent(){return(()=>{switch(this.currentPaymentMethod){case"card":return this.card.renderCardContent(this.merchantPlanDetail);case"bank_transfer":return this.transfer.renderTransferContent(this.merchantPlanDetail);case"ussd":return this.ussd.renderUssdContent(this.merchantPlanDetail);case"mobile_money":return this.mobileMoney.renderMobileMoneyContent(this.merchantPlanDetail);case"eft":return this.eft.renderEftContent(this.merchantPlanDetail);default:return this.defaultToEmptyContainer()}})()}setCurrentPaymentMethod(e){this.currentPaymentMethod=e;const i=document.querySelectorAll(".tab-button");i.forEach(o=>o.classList.remove("active"));const t=Array.from(i).find(o=>o.getAttribute("data-name")===e);t&&t.classList.add("active")}setToDefaultEmptyContainer(){this.currentPaymentMethod="",this.retryingPayment=!0,this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.cleanup(),this.switchTab(""),this.showPaymentMethods(),this.setupPaymentMethodButtons(),this.renderPaymentMethodContent(),P.track("retry_payment")}defaultToEmptyContainer(){const e=document.querySelector("#payment-content-view");e.innerHTML=""}switchTab(e){this.currentPaymentMethod===e&&e!==""||(this.currentPaymentMethod==="bank_transfer"&&this.currentPaymentMethod!==e&&this.setToDefaultEmptyContainer(),this.setCurrentPaymentMethod(e),this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.cleanup(),this.showPaymentMethods(),this.renderPaymentMethodContent(),this.attachListeners(),this.isMobile&&(document.querySelectorAll(".tab-button").forEach(t=>{const o=t.getAttribute("data-name");this.disabledChannels.includes(o)||t.removeAttribute("disabled")}),e?document.querySelectorAll(".tab-button").forEach(o=>{o.getAttribute("data-name")!==e&&o.classList.add("hidden")}):document.querySelectorAll(".tab-button").forEach(o=>{const s=o.getAttribute("data-name");[...this.validChannels,...this.disabledChannels].includes(s)&&o.classList.remove("hidden")})))}disablePaymentMethods(e){this.currentPaymentMethod=e;const i=document.querySelectorAll(".tab-button");i.forEach(o=>o.setAttribute("disabled","true"));const t=Array.from(i).find(o=>o.getAttribute("data-name")===e);t&&t.removeAttribute("disabled")}enablePaymentMethods(){const e=document.querySelectorAll(".tab-button");e.forEach(t=>{const o=t.getAttribute("data-name");o&&!this.disabledChannels.includes(o)&&t.removeAttribute("disabled")});const i=Array.from(e).find(t=>t.getAttribute("data-name")===this.currentPaymentMethod);i&&!this.disabledChannels.includes(this.currentPaymentMethod)&&i.removeAttribute("disabled")}hidePaymentMethods(){const e=document.querySelector("#payment-methods-container");e&&e.classList.add("hidden")}showPaymentMethods(){const e=document.querySelector("#payment-methods-container");e&&e.classList.remove("hidden")}cleanup(){this.transfer&&this.transfer.destroyTimer()}closeModal(e){this.modalContainer&&this.modalContainer.parentNode&&document.body.removeChild(this.modalContainer),e&&e()}setupParent(e){e&&e()}render(){return vs}}class pt{constructor(e){m(this,"container");this.container=e}renderContent(e){var t;this.container.innerHTML=this.render();const i=document.getElementById("error-action-container");e&&i&&(i.classList.remove("hidden"),(t=i.querySelector("#go-back"))==null||t.addEventListener("click",()=>{window.location.href=e}))}render(){return`
1380
1380
  <div class="box-container">
1381
1381
 
1382
1382
  <div class="container-center h-[40vh] hidden mx-auto" id="shared-error-container">
@@ -1410,4 +1410,4 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1410
1410
 
1411
1411
  </div>
1412
1412
  </div>
1413
- `}}class vl{constructor(){m(this,"modalContainer");m(this,"mainLayout");m(this,"encryption");m(this,"mainScreen");m(this,"merchantConfigService");m(this,"mainError");m(this,"mainLoader");m(this,"merchantPlanDetail",{});m(this,"merchantKey");m(this,"planId");m(this,"email");m(this,"amount");m(this,"rdtCode");m(this,"url");m(this,"phoneNumber");m(this,"code");m(this,"reference");m(this,"currency");m(this,"callBackUrl");m(this,"metadata");m(this,"localCurrency");this.merchantKey="",this.email="",this.amount=0,this.planId="",this.encryption="",this.phoneNumber="",this.code="",this.modalContainer=document.createElement("div"),this.rdtCode="",this.reference="",this.currency="",this.url="",this.callBackUrl="",this.metadata={},this.localCurrency="",this.modalContainer.innerHTML=Ln,P.init("11162d9a0801daeaf786f1200cd3112b",{debug:!1}),document.body.appendChild(this.modalContainer);const i=document.getElementById("main-layout-container-screen");if(!i)throw new Error("SDK Layout not available");this.mainLayout=i}closePayment(){const e={reference:this.reference};ks(this.merchantKey,e,this.rdtCode,this.url).then(({headers:t})=>{const o=t.get("spf-redirect-url");this.callBackUrl=o||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status","cancelled"),s.searchParams.append("reference",this.reference),window.location.href=s.toString()},1800):this.closeModal(),P.track("canel_payment",{verification_status:"Cancelled"}),P.track("checkout_closes")}).catch(t=>{li.showToast(t.message,"error")})}getDeviceType(){const e=navigator.userAgent;return/mobile/i.test(e)?"Mobile":/tablet/i.test(e)?"Tablet":"Desktop"}setup(e){const{email:i,encryptionKey:t,merchantKey:o,planId:s,amount:r,rdtCode:l,reference:c,currency:b,url:p,callBackUrl:g,metadata:f,localCurrency:y}=e;if(this.merchantKey=o||"",this.email=i||"",this.amount=r||0,this.encryption=t||"",this.planId=s||"",this.rdtCode=l||"",this.reference=c||_s(),this.url=p||"",this.callBackUrl=g||"",this.metadata=f||{},!o||!i)throw this.mainError=new Zo(this.mainLayout),this.mainError.renderContent(this.callBackUrl),this.showErrorIcon(),new Error("Merchant key or email is required");this.currency=b||"",this.merchantConfigService=new Vr({token:this.merchantKey,rdtCode:this.rdtCode,url:this.url}),this.localCurrency=y||"",this.mainScreen=new hl({container:this.mainLayout,modalContainer:this.modalContainer,merchantKey:o,email:i,encryption:this.encryption,planId:this.planId,amount:this.amount,rdtCode:this.rdtCode,url:this.url,phoneNumber:this.phoneNumber,code:this.code,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,closePayment:this.closePayment.bind(this)}),this.mainLoader=new Ie(this.mainLayout),this.mainError=new Zo(this.mainLayout),this.mainLoader.mountLoader(),this.getPlanDetails()}getAvailableChannels(){var s,r;const e=((s=this.merchantPlanDetail)==null?void 0:s.paymentMethods)??[],i=((r=this.merchantPlanDetail)==null?void 0:r.limits)??[],t=[],o=[];return e.forEach(l=>{const c=i.find(b=>b.channel===l);!c||this.amount<=c.amount?t.push(l):o.push(l)}),{validChannels:t,disabledChannels:o}}async getPlanDetails(){const e=this.currency==="USD"?this.localCurrency:this.currency;this.merchantConfigService.getMerchantConfig(this.planId,e).then(i=>{var s;this.merchantPlanDetail=i,P.register({device_type:this.getDeviceType(),session_id:this.reference,env:"Test",checkout_env:this.rdtCode?"Redirect":"SDK",merchant:this.merchantPlanDetail.merchantName}),P.track("checkout_opens");const{validChannels:t,disabledChannels:o}=this.getAvailableChannels();if(t.length===0){const r=new bl(this.mainLayout);this.mainError=r;let l=0;throw(s=this.merchantPlanDetail)!=null&&s.limits&&this.merchantPlanDetail.limits.length>0&&(l=Math.max(...this.merchantPlanDetail.limits.map(c=>c.amount))),r.setLimitInfo(e,l),this.mainError.renderContent(this.callBackUrl),this.showErrorIcon(),new Error("Transaction limit reached")}i.rate?this.mainScreen.mountScreen(this.merchantPlanDetail,this.currency,t,o):(this.mainError.renderContent(this.callBackUrl),this.showErrorIcon())}).catch(i=>{throw this.mainError.renderContent(this.callBackUrl),this.showErrorIcon(),new Error(i)})}showErrorIcon(){var i;const e=this.mainLayout.querySelector("#shared-error-container");e&&(e.classList.remove("hidden"),e.parentElement.classList.add("mx-auto"),e.classList.add("flex","flex-col","items-center","gap-2"),(i=e.querySelector("img"))==null||i.setAttribute("src",pl))}closeModal(){this.modalContainer&&this.modalContainer.parentNode&&document.body.removeChild(this.modalContainer),this.mainScreen.closeModal()}}Ne.CheckoutForm=vl,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})});
1413
+ `}}class vl{constructor(){m(this,"modalContainer");m(this,"mainLayout");m(this,"encryption");m(this,"mainScreen");m(this,"merchantConfigService");m(this,"mainError");m(this,"mainLoader");m(this,"merchantPlanDetail",{});m(this,"merchantKey");m(this,"planId");m(this,"email");m(this,"amount");m(this,"rdtCode");m(this,"url");m(this,"phoneNumber");m(this,"code");m(this,"reference");m(this,"currency");m(this,"callBackUrl");m(this,"metadata");m(this,"localCurrency");this.merchantKey="",this.email="",this.amount=0,this.planId="",this.encryption="",this.phoneNumber="",this.code="",this.modalContainer=document.createElement("div"),this.rdtCode="",this.reference="",this.currency="",this.url="",this.callBackUrl="",this.metadata={},this.localCurrency="",this.modalContainer.innerHTML=Ln,P.init("11162d9a0801daeaf786f1200cd3112b",{debug:!1}),document.body.appendChild(this.modalContainer);const i=document.getElementById("main-layout-container-screen");if(!i)throw new Error("SDK Layout not available");this.mainLayout=i}closePayment(){const e={reference:this.reference};ks(this.merchantKey,e,this.rdtCode,this.url).then(({headers:t})=>{const o=t.get("spf-redirect-url");this.callBackUrl=o||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status","cancelled"),s.searchParams.append("reference",this.reference),window.location.href=s.toString()},1800):this.closeModal(),P.track("canel_payment",{verification_status:"Cancelled"}),P.track("checkout_closes")}).catch(t=>{li.showToast(t.message,"error")})}getDeviceType(){const e=navigator.userAgent;return/mobile/i.test(e)?"Mobile":/tablet/i.test(e)?"Tablet":"Desktop"}setup(e){const{email:i,encryptionKey:t,merchantKey:o,planId:s,amount:r,rdtCode:l,reference:c,currency:b,url:p,callBackUrl:g,metadata:f,localCurrency:y}=e;if(this.merchantKey=o||"",this.email=i||"",this.amount=r||0,this.encryption=t||"",this.planId=s||"",this.rdtCode=l||"",this.reference=c||_s(),this.url=p||"",this.callBackUrl=g||"",this.metadata=f||{},!o||!i)throw this.mainError=new pt(this.mainLayout),this.mainError.renderContent(this.callBackUrl),this.showErrorIcon(),new Error("Merchant key or email is required");if(b==="ZAR"||y==="ZAR")throw this.mainError=new pt(this.mainLayout),this.mainError.renderContent(this.callBackUrl),this.showErrorIcon(),new Error("ZAR payments are not supported yet");this.currency=b||"",this.merchantConfigService=new Vr({token:this.merchantKey,rdtCode:this.rdtCode,url:this.url}),this.localCurrency=y||"",this.mainScreen=new hl({container:this.mainLayout,modalContainer:this.modalContainer,merchantKey:o,email:i,encryption:this.encryption,planId:this.planId,amount:this.amount,rdtCode:this.rdtCode,url:this.url,phoneNumber:this.phoneNumber,code:this.code,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,closePayment:this.closePayment.bind(this)}),this.mainLoader=new Ie(this.mainLayout),this.mainError=new pt(this.mainLayout),this.mainLoader.mountLoader(),this.getPlanDetails()}getAvailableChannels(){var s,r;const e=((s=this.merchantPlanDetail)==null?void 0:s.paymentMethods)??[],i=((r=this.merchantPlanDetail)==null?void 0:r.limits)??[],t=[],o=[];return e.forEach(l=>{const c=i.find(b=>b.channel===l);!c||this.amount<=c.amount?t.push(l):o.push(l)}),{validChannels:t,disabledChannels:o}}async getPlanDetails(){const e=this.currency==="USD"?this.localCurrency:this.currency;this.merchantConfigService.getMerchantConfig(this.planId,e).then(i=>{var s;this.merchantPlanDetail=i,P.register({device_type:this.getDeviceType(),session_id:this.reference,env:"Test",checkout_env:this.rdtCode?"Redirect":"SDK",merchant:this.merchantPlanDetail.merchantName}),P.track("checkout_opens");const{validChannels:t,disabledChannels:o}=this.getAvailableChannels();if(t.length===0||t[0]==="ussd"&&t.length===1){const r=new bl(this.mainLayout);this.mainError=r;let l=0;throw(s=this.merchantPlanDetail)!=null&&s.limits&&this.merchantPlanDetail.limits.length>0&&(l=Math.max(...this.merchantPlanDetail.limits.map(c=>c.amount))),r.setLimitInfo(e,l),this.mainError.renderContent(this.callBackUrl),this.showErrorIcon(),new Error("Transaction limit reached")}i.rate?this.mainScreen.mountScreen(this.merchantPlanDetail,this.currency,t,o):(this.mainError.renderContent(this.callBackUrl),this.showErrorIcon())}).catch(i=>{throw this.mainError.renderContent(this.callBackUrl),this.showErrorIcon(),new Error(i)})}showErrorIcon(){var i;const e=this.mainLayout.querySelector("#shared-error-container");e&&(e.classList.remove("hidden"),e.parentElement.classList.add("mx-auto"),e.classList.add("flex","flex-col","items-center","gap-2"),(i=e.querySelector("img"))==null||i.setAttribute("src",pl))}closeModal(){this.modalContainer&&this.modalContainer.parentNode&&document.body.removeChild(this.modalContainer),this.mainScreen.closeModal()}}Ne.CheckoutForm=vl,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})});