@spot-flow/checkout-inline-js 0.1.42-dev.3 → 0.1.43-dev.1

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.
@@ -46,7 +46,7 @@
46
46
  </div>
47
47
  <!-- end of footer -->
48
48
  </div>
49
- </div>`,ve=(n,e)=>e||n;let Y=class extends Error{constructor(e,i){super(e),this.status=i,this.name="FetchError"}},Be=class extends Error{constructor(e){super(e),this.name="AuthorizationError"}};const Oe=(n,e,i)=>{if(!n)throw new Be("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},Ve="https://api.spotflow.co/api/v1",As=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ve,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},di=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ve,t)}/payments/authorize`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Bt=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ve,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},xs=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ve,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?new Y(l.message,s.status):new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`UnexpectedError: ${o}`),o}},an=async(n,e,i,t,o)=>{try{const s=Oe(n,t),a=await fetch(`${ve(Ve,o)}/payments/verify?reference=${e}`,{method:"GET",headers:s,signal:i});if(!a.ok){const d=await a.json();throw d.message?new Y(d.message,a.status):new Y("Network response was not ok",a.status)}return{data:await a.json(),headers:a.headers}}catch(s){throw s instanceof Y?console.error(`FetchError: ${s.message} (status: ${s.status})`):s instanceof Be?console.error(`AuthorizationError: ${s.message}`):console.error(`Unexpected error: ${s}`),s}};async function Ls(n,e,i,t,o){const s=Oe(n,i);try{const a=await fetch(`${ve(Ve,t)}/mobile-money/providers?currency=${o||e}`,{headers:s,method:"GET"});if(!a.ok){const l=await a.json();throw l.message?new Y(l.message,a.status):new Y("Network response was not okay",a.status)}return await a.json()}catch(a){throw a instanceof Y?console.error(`FetchError: ${a.message} (status: ${a.status})`):a instanceof Be?console.error(`AuthorizationError: ${a.message}`):console.error(`Unexpected error: ${a}`),a}}const Ts=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ve,t)}/payments/cancel`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const a=await s.json();throw a.message?new Y(a.message,s.status):new Y("Network response was not ok",s.status)}return{headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Es=async(n,e,i,t)=>{try{const o=Oe(n,i,!0),s=await fetch(`${ve(Ve,t)}/disputes/upload-documents`,{method:"POST",headers:o,body:e});if(!s.ok){const a=await s.json();throw a.message?new Y(a.message,s.status):new Y("Network response was not ok",s.status)}return s.json()}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Ps=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ve,t)}/disputes/reference`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const a=await s.json();throw a.message?new Y(a.message,s.status):new Y("Network response was not ok",s.status)}return s.json()}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},ci=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ve,t)}/payments/retry`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}};async function Is(n,e,i,t,o){try{const s=Oe(n,t),a=await fetch(`${ve(Ve,o)}/payments/tax-quotes?amount=${e||""}&currency=${i||""}`,{headers:s,method:"GET"});if(!a.ok){const l=await a.json();throw l.message?new Y(l.message,a.status):new Y("Network response was not ok",a.status)}return a.json()}catch(s){throw s instanceof Y?console.error(`FetchError: ${s.message} (status: ${s.status})`):s instanceof Be?console.error(`AuthorizationError: ${s.message}`):console.error(`Unexpected error: ${s}`),s}}const xe=(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)},be={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">
49
+ </div>`,ve=(n,e)=>e||n;let Y=class extends Error{constructor(e,i){super(e),this.status=i,this.name="FetchError"}},Be=class extends Error{constructor(e){super(e),this.name="AuthorizationError"}};const Oe=(n,e,i)=>{if(!n)throw new Be("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},Ue="https://api.spotflow.co/api/v1",As=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},di=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments/authorize`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Nt=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},xs=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?new Y(l.message,s.status):new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`UnexpectedError: ${o}`),o}},an=async(n,e,i,t,o)=>{try{const s=Oe(n,t),a=await fetch(`${ve(Ue,o)}/payments/verify?reference=${e}`,{method:"GET",headers:s,signal:i});if(!a.ok){const d=await a.json();throw d.message?new Y(d.message,a.status):new Y("Network response was not ok",a.status)}return{data:await a.json(),headers:a.headers}}catch(s){throw s instanceof Y?console.error(`FetchError: ${s.message} (status: ${s.status})`):s instanceof Be?console.error(`AuthorizationError: ${s.message}`):console.error(`Unexpected error: ${s}`),s}};async function Ls(n,e,i,t,o){const s=Oe(n,i);try{const a=await fetch(`${ve(Ue,t)}/mobile-money/providers?currency=${o||e}`,{headers:s,method:"GET"});if(!a.ok){const l=await a.json();throw l.message?new Y(l.message,a.status):new Y("Network response was not okay",a.status)}return await a.json()}catch(a){throw a instanceof Y?console.error(`FetchError: ${a.message} (status: ${a.status})`):a instanceof Be?console.error(`AuthorizationError: ${a.message}`):console.error(`Unexpected error: ${a}`),a}}const Ts=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments/cancel`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const a=await s.json();throw a.message?new Y(a.message,s.status):new Y("Network response was not ok",s.status)}return{headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Es=async(n,e,i,t)=>{try{const o=Oe(n,i,!0),s=await fetch(`${ve(Ue,t)}/disputes/upload-documents`,{method:"POST",headers:o,body:e});if(!s.ok){const a=await s.json();throw a.message?new Y(a.message,s.status):new Y("Network response was not ok",s.status)}return s.json()}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Ps=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/disputes/reference`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const a=await s.json();throw a.message?new Y(a.message,s.status):new Y("Network response was not ok",s.status)}return s.json()}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},ci=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments/retry`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}};async function Is(n,e,i,t,o){try{const s=Oe(n,t),a=await fetch(`${ve(Ue,o)}/payments/tax-quotes?amount=${e||""}&currency=${i||""}`,{headers:s,method:"GET"});if(!a.ok){const l=await a.json();throw l.message?new Y(l.message,a.status):new Y("Network response was not ok",a.status)}return a.json()}catch(s){throw s instanceof Y?console.error(`FetchError: ${s.message} (status: ${s.status})`):s instanceof Be?console.error(`AuthorizationError: ${s.message}`):console.error(`Unexpected error: ${s}`),s}}const xe=(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)},be={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">
50
50
  <path d="M1.83398 6.16992H15.1673" stroke="currentColor" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
51
51
  <path d="M4.5 11.5034H5.83333" stroke="currentColor" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
52
52
  <path d="M7.5 11.5034H10.1667" stroke="currentColor" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
@@ -81,7 +81,7 @@
81
81
  <path d="M13.834 12.0002V7.3335" stroke="#0D0716" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
82
82
  <path d="M1.16602 14.6665H15.8327" stroke="#0D0716" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
83
83
  <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"/>
84
- </svg>`}};be.card.label,be.card.icon,be.card.key,be.bank_transfer.label,be.bank_transfer.icon,be.bank_transfer.key,be.ussd.label,be.ussd.icon,be.ussd.key,be.mobile_money.label,be.mobile_money.icon,be.mobile_money.key,be.eft.label,be.eft.icon,be.eft.key;const Nt=[{name:"MasterCard",icon:`<svg width="24" height="14" viewBox="0 0 24 14" fill="none" xmlns="http://www.w3.org/2000/svg">
84
+ </svg>`}};be.card.label,be.card.icon,be.card.key,be.bank_transfer.label,be.bank_transfer.icon,be.bank_transfer.key,be.ussd.label,be.ussd.icon,be.ussd.key,be.mobile_money.label,be.mobile_money.icon,be.mobile_money.key,be.eft.label,be.eft.icon,be.eft.key;const Ht=[{name:"MasterCard",icon:`<svg width="24" height="14" viewBox="0 0 24 14" fill="none" xmlns="http://www.w3.org/2000/svg">
85
85
  <path d="M15.3295 1.73883H8.91364V12.2617H15.3295V1.73883Z" fill="#FF5F00"/>
86
86
  <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"/>
87
87
  <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"/>
@@ -472,17 +472,17 @@
472
472
  accordance with their terms.
473
473
  </p>
474
474
  </div>
475
- </div>`,Bs=()=>{const n=Date.now().toString(36),e="xxxx-xxxx-xxx-xxxx".replace(/[x]/g,()=>Math.floor(Math.random()*16).toString(16));return`SPF-${n}-${e}`.toUpperCase()},ui=(n="")=>n.replace(/\D+/g,""),Ns=n=>n.replace(/\D/g,""),Hs=n=>n.replace(/\D/g,"").replace(/(\d{4})(?=\d)/g,"$1 ").trim(),Rs=n=>ui(n).slice(0,3),Os=n=>{const e=ui(n);return e.length>=3?`${e.slice(0,2)}/${e.slice(2,4)}`:e},zn=n=>{const e=Math.floor(n/60),i=n%60;return`${String(e).padStart(2,"0")}:${String(i).padStart(2,"0")}`},Vs=n=>{n=n.replace(/\D/g,"");const e={Visa:/^4/,MasterCard:/^5[1-5]|^2(2[2-9]|[3-6]|7[01])/,"American Express":/^3[47]/,Discover:/^6(?:011|5[0-9]{2})[0-9]{12}$/,UnionPay:/^62/,Verve:/^((506(0|1))|(507(8|9))|(6500))[0-9]{12,15}$/,"Diners Club":/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/};for(const[i,t]of Object.entries(e))if(t.test(n))return i;return"Unknown"},Us={Visa:[16],MasterCard:[16],"American Express":[15],Discover:[16],UnionPay:[16],Verve:[16,17,18,19]},pn=class pn{};h(pn,"createToast",(e,i)=>{const t=document.createElement("div");t.classList.add("toast",i,"grid","grid-cols-[1fr_auto]");const o=document.createElement("span");o.classList.add("flex","items-center","gap-2","text-[10px]","justify-self-center"),o.innerHTML=["error","warning","info"].includes(i)?`<svg class=" inline-block mr-1" width="18" height="19" viewBox="0 0 18 19" fill="none"
475
+ </div>`,Bs=()=>{const n=Date.now().toString(36),e="xxxx-xxxx-xxx-xxxx".replace(/[x]/g,()=>Math.floor(Math.random()*16).toString(16));return`SPF-${n}-${e}`.toUpperCase()},ui=(n="")=>n.replace(/\D+/g,""),Ns=n=>n.replace(/\D/g,""),Hs=n=>n.replace(/\D/g,"").replace(/(\d{4})(?=\d)/g,"$1 ").trim(),Rs=n=>ui(n).slice(0,3),Os=n=>{const e=ui(n);return e.length>=3?`${e.slice(0,2)}/${e.slice(2,4)}`:e},zn=n=>{const e=Math.floor(n/60),i=n%60;return`${String(e).padStart(2,"0")}:${String(i).padStart(2,"0")}`},Us=n=>{n=n.replace(/\D/g,"");const e={Visa:/^4/,MasterCard:/^5[1-5]|^2(2[2-9]|[3-6]|7[01])/,"American Express":/^3[47]/,Discover:/^6(?:011|5[0-9]{2})[0-9]{12}$/,UnionPay:/^62/,Verve:/^((506(0|1))|(507(8|9))|(6500))[0-9]{12,15}$/,"Diners Club":/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/};for(const[i,t]of Object.entries(e))if(t.test(n))return i;return"Unknown"},Vs={Visa:[16],MasterCard:[16],"American Express":[15],Discover:[16],UnionPay:[16],Verve:[16,17,18,19]},pn=class pn{};h(pn,"createToast",(e,i)=>{const t=document.createElement("div");t.classList.add("toast",i,"grid","grid-cols-[1fr_auto]");const o=document.createElement("span");o.classList.add("flex","items-center","gap-2","text-[10px]","justify-self-center"),o.innerHTML=["error","warning","info"].includes(i)?`<svg class=" inline-block mr-1" width="18" height="19" viewBox="0 0 18 19" fill="none"
476
476
  xmlns="http://www.w3.org/2000/svg">
477
477
  <path fill-rule="evenodd" clip-rule="evenodd"
478
478
  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"
479
479
  fill="white" />
480
480
  </svg>
481
- <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=()=>pn.removeToast(t),t.appendChild(s),t}),h(pn,"showToast",(e,i,t=3e3)=>{const o=document.getElementById("toast-container");if(o){const s=pn.createToast(e,i);o.appendChild(s),s.offsetHeight,s.classList.add("show"),setTimeout(()=>pn.removeToast(s),t)}}),h(pn,"removeToast",e=>{e.classList.remove("show"),e.addEventListener("transitionend",()=>{e.parentElement&&e.parentElement.removeChild(e)})});let hi=pn;class Ht{constructor(e){h(this,"container");h(this,"onAction");h(this,"cardDetailsValues");h(this,"creditCardTypes");h(this,"merchantName");h(this,"currency");this.container=e.container,this.onAction=e.onAction,this.creditCardTypes=[...Nt],this.cardDetailsValues={number:"",expiry:"",cvv:"",name:""},this.merchantName=e.merchantName,this.currency=e.currency}attachListener(){const e=document.querySelector("#pci-dss");e&&e.classList.remove("hidden");const i=document.querySelector('input[name="number"]'),t=document.querySelector('input[name="expiry"]'),o=document.querySelector('input[name="cvv"]'),s=document.querySelector('input[name="name"]'),a=document.querySelector(".details-form-button"),l=document.querySelector("#checkoutcard");i&&i.addEventListener("input",d=>this.handleInputChange(d,a)),t&&t.addEventListener("input",d=>this.handleInputChange(d,a)),o&&o.addEventListener("input",d=>this.handleInputChange(d,a)),s&&s.addEventListener("input",d=>this.handleInputChange(d,a)),l&&l.addEventListener("submit",d=>{var v,p,g;d.preventDefault(),this.onAction(d)({pan:Ns(this.cardDetailsValues.number),cvv:this.cardDetailsValues.cvv,expiryMonth:(v=this.cardDetailsValues)==null?void 0:v.expiry.split("/")[0].trim(),expiryYear:(p=this.cardDetailsValues)==null?void 0:p.expiry.split("/")[1].trim(),...this.currency==="ZAR"&&{cardHolderName:(g=this.cardDetailsValues)==null?void 0:g.name}})})}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,d,v;const t=e.target,{name:o,value:s}=t;let a=s;if(s.trim()===""){this.emptyCardState(t,o);return}if(o==="number"){a=Hs(s);const p=a.replace(/\s+/g,""),g=this.validateCreditCard(p);this.filterCreditCardType(s);const f=(l=this.creditCardTypes[0])==null?void 0:l.name;f&&Pn.map(y=>{if(y.name===this.currency)if(y.cardTypes.includes(f)){const k=Us[f];if(k.length>1){const C=k.some(S=>p.length===S);this.checkInputValidity(g,t,"Your card number is invalid",C)}else p.length===k[0]&&this.checkInputValidity(g,t,"Your card number is invalid",p.length>=14&&p.length<=19)}else this.checkInputValidity(!1,t,"Invalid card. Only locally issued cards are accepted.",s.trim().length>=14&&s.trim().length<=19)})}else if(o==="expiry"){const p=new Date;a=Os(s);const g=a.split("/"),f=(d=g[0])==null?void 0:d.trim(),y=(v=g[1])==null?void 0:v.trim(),k=new Date().getFullYear()%100,C=p.getMonth()+1;let S=!0;(parseInt(y)===k&&parseInt(f)<C||parseInt(y)<k)&&(S=!1),(y==null?void 0:y.length)===2&&this.checkInputValidity(S,t,"Your card has expired",g.join("").length===4)}else o==="cvv"?a=Rs(s):o==="name"&&(a=s);if(this.cardDetailsValues={...this.cardDetailsValues,[o]:a},t.value=a,this.validateCard())i&&i.removeAttribute("disabled");else if(i){if(i.disabled)return;i.setAttribute("disabled","")}}hideCardHolderInput(){const e=document.querySelector("#card-name");this.currency==="ZAR"?e&&(e.style.display="block"):e&&(e.style.display="none")}validateCard(){if(this.cardDetailsValues.expiry.split("/").length===2){const e=this.cardDetailsValues.expiry.split("/")[1].trim();return!!this.cardDetailsValues.number&&this.cardDetailsValues.number.length>15&&!!this.cardDetailsValues.expiry&&this.cardDetailsValues.expiry.length>3&&!!this.cardDetailsValues.cvv&&this.cardDetailsValues.cvv.length>2&&e.length===2&&(this.currency==="ZAR"?this.cardDetailsValues.name.trim()!=="":!0)}}displayCardTypes(){requestAnimationFrame(()=>{const e=this.container.querySelector("#card-type");e.innerHTML="",this.creditCardTypes.length>0?this.creditCardTypes.forEach(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">
481
+ <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=()=>pn.removeToast(t),t.appendChild(s),t}),h(pn,"showToast",(e,i,t=3e3)=>{const o=document.getElementById("toast-container");if(o){const s=pn.createToast(e,i);o.appendChild(s),s.offsetHeight,s.classList.add("show"),setTimeout(()=>pn.removeToast(s),t)}}),h(pn,"removeToast",e=>{e.classList.remove("show"),e.addEventListener("transitionend",()=>{e.parentElement&&e.parentElement.removeChild(e)})});let hi=pn;class Rt{constructor(e){h(this,"container");h(this,"onAction");h(this,"cardDetailsValues");h(this,"creditCardTypes");h(this,"merchantName");h(this,"currency");this.container=e.container,this.onAction=e.onAction,this.creditCardTypes=[...Ht],this.cardDetailsValues={number:"",expiry:"",cvv:"",name:""},this.merchantName=e.merchantName,this.currency=e.currency}attachListener(){const e=document.querySelector("#pci-dss");e&&e.classList.remove("hidden");const i=document.querySelector('input[name="number"]'),t=document.querySelector('input[name="expiry"]'),o=document.querySelector('input[name="cvv"]'),s=document.querySelector('input[name="name"]'),a=document.querySelector(".details-form-button"),l=document.querySelector("#checkoutcard");i&&i.addEventListener("input",d=>this.handleInputChange(d,a)),t&&t.addEventListener("input",d=>this.handleInputChange(d,a)),o&&o.addEventListener("input",d=>this.handleInputChange(d,a)),s&&s.addEventListener("input",d=>this.handleInputChange(d,a)),l&&l.addEventListener("submit",d=>{var v,p,g;d.preventDefault(),this.onAction(d)({pan:Ns(this.cardDetailsValues.number),cvv:this.cardDetailsValues.cvv,expiryMonth:(v=this.cardDetailsValues)==null?void 0:v.expiry.split("/")[0].trim(),expiryYear:(p=this.cardDetailsValues)==null?void 0:p.expiry.split("/")[1].trim(),...this.currency==="ZAR"&&{cardHolderName:(g=this.cardDetailsValues)==null?void 0:g.name}})})}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,d,v;const t=e.target,{name:o,value:s}=t;let a=s;if(s.trim()===""){this.emptyCardState(t,o);return}if(o==="number"){a=Hs(s);const p=a.replace(/\s+/g,""),g=this.validateCreditCard(p);this.filterCreditCardType(s);const f=(l=this.creditCardTypes[0])==null?void 0:l.name;f&&Pn.map(y=>{if(y.name===this.currency)if(y.cardTypes.includes(f)){const k=Vs[f];if(k.length>1){const C=k.some(S=>p.length===S);this.checkInputValidity(g,t,"Your card number is invalid",C)}else p.length===k[0]&&this.checkInputValidity(g,t,"Your card number is invalid",p.length>=14&&p.length<=19)}else this.checkInputValidity(!1,t,"Invalid card. Only locally issued cards are accepted.",s.trim().length>=14&&s.trim().length<=19)})}else if(o==="expiry"){const p=new Date;a=Os(s);const g=a.split("/"),f=(d=g[0])==null?void 0:d.trim(),y=(v=g[1])==null?void 0:v.trim(),k=new Date().getFullYear()%100,C=p.getMonth()+1;let S=!0;(parseInt(y)===k&&parseInt(f)<C||parseInt(y)<k)&&(S=!1),(y==null?void 0:y.length)===2&&this.checkInputValidity(S,t,"Your card has expired",g.join("").length===4)}else o==="cvv"?a=Rs(s):o==="name"&&(a=s);if(this.cardDetailsValues={...this.cardDetailsValues,[o]:a},t.value=a,this.validateCard())i&&i.removeAttribute("disabled");else if(i){if(i.disabled)return;i.setAttribute("disabled","")}}hideCardHolderInput(){const e=document.querySelector("#card-name");this.currency==="ZAR"?e&&(e.style.display="block"):e&&(e.style.display="none")}validateCard(){if(this.cardDetailsValues.expiry.split("/").length===2){const e=this.cardDetailsValues.expiry.split("/")[1].trim();return!!this.cardDetailsValues.number&&this.cardDetailsValues.number.length>15&&!!this.cardDetailsValues.expiry&&this.cardDetailsValues.expiry.length>3&&!!this.cardDetailsValues.cvv&&this.cardDetailsValues.cvv.length>2&&e.length===2&&(this.currency==="ZAR"?this.cardDetailsValues.name.trim()!=="":!0)}}displayCardTypes(){requestAnimationFrame(()=>{const e=this.container.querySelector("#card-type");e.innerHTML="",this.creditCardTypes.length>0?this.creditCardTypes.forEach(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">
482
482
  <path
483
483
  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"
484
484
  fill="#B6B4B9" />
485
- </svg>`})}filterCreditCardType(e){e?(this.creditCardTypes=Nt.filter(i=>i.name===Vs(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"),a=document.querySelector("#card-error"),l=document.querySelector("#card-details");if(e.style.color="#0D0716",l&&(l.style.border="1px solid #9E9BA1"),a&&(a.classList.remove("block"),a.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">
485
+ </svg>`})}filterCreditCardType(e){e?(this.creditCardTypes=Ht.filter(i=>i.name===Us(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"),a=document.querySelector("#card-error"),l=document.querySelector("#card-details");if(e.style.color="#0D0716",l&&(l.style.border="1px solid #9E9BA1"),a&&(a.classList.remove("block"),a.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">
486
486
  <path
487
487
  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"
488
488
  fill="#B6B4B9" />
@@ -504,7 +504,7 @@
504
504
  </p>
505
505
  </div>
506
506
  </div>
507
- </div>`;class qn{constructor({container:e,amount:i,currency:t,localCurrency:o,rate:s,message:a}){h(this,"container");h(this,"amount");h(this,"currency");h(this,"localCurrency");h(this,"rate");h(this,"message");this.container=e,this.amount=i,this.currency=t,this.localCurrency=o,this.rate=s,this.message=a}renderComponent(){this.container.innerHTML=this.render();const e=document.querySelector("#success-amount"),i=document.querySelector("#payment-success-text");i&&(this.message?i.innerHTML=this.message:i.innerHTML="Payment Successful"),e&&(e.innerHTML=`${this.localCurrency!==this.currency?this.localCurrency:this.currency} ${xe(this.amount)}`)}render(){return Ks}}const Rt=`<div id="paymentWarning">
507
+ </div>`;class qn{constructor({container:e,amount:i,currency:t,localCurrency:o,rate:s,message:a}){h(this,"container");h(this,"amount");h(this,"currency");h(this,"localCurrency");h(this,"rate");h(this,"message");this.container=e,this.amount=i,this.currency=t,this.localCurrency=o,this.rate=s,this.message=a}renderComponent(){this.container.innerHTML=this.render();const e=document.querySelector("#success-amount"),i=document.querySelector("#payment-success-text");i&&(this.message?i.innerHTML=this.message:i.innerHTML="Payment Successful"),e&&(e.innerHTML=`${this.localCurrency!==this.currency?this.localCurrency:this.currency} ${xe(this.amount)}`)}render(){return Ks}}const Ot=`<div id="paymentWarning">
508
508
  <div class="container-center min-h-[30dvh]">
509
509
  <div>
510
510
  <div class="container-center mb-5">
@@ -535,7 +535,7 @@
535
535
  </div> -->
536
536
  </div>
537
537
  </div>
538
- </div>`;class gn{constructor({container:e,onAction:i,onReportIssue:t}){h(this,"container");h(this,"onAction");h(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"),a=this.container.querySelector("#try-again");o&&(o.textContent=e),s&&i&&(s.textContent=i),a&&t&&(a.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 Rt}}const Fs=`<div id="checkoutcardotp">
538
+ </div>`;class gn{constructor({container:e,onAction:i,onReportIssue:t}){h(this,"container");h(this,"onAction");h(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"),a=this.container.querySelector("#try-again");o&&(o.textContent=e),s&&i&&(s.textContent=i),a&&t&&(a.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 Ot}}const Fs=`<div id="checkoutcardotp">
539
539
  <div class="w-full">
540
540
  <div id="otp-content" class=" grid gap-4">
541
541
  <h5 class="text-black" id="otp-message">
@@ -950,9 +950,9 @@
950
950
 
951
951
  </div>
952
952
  </div>
953
- </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 Qs({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 Xs(n){return n.nodeType===n.ELEMENT_NODE}function Wn(n){const e=n==null?void 0:n.host;return(e==null?void 0:e.shadowRoot)===n}function Zn(n){return Object.prototype.toString.call(n)==="[object ShadowRoot]"}function ea(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 na(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 pi(n){try{const e=n.rules||n.cssRules;return e?ea(Array.from(e,Ot).join("")):null}catch{return null}}function Ot(n){let e;if(ta(n))try{e=pi(n.styleSheet)||na(n)}catch{}else if(oa(n)&&n.selectorText.includes(":"))return ia(n.cssText);return e||n.cssText}function ia(n){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return n.replace(e,"$1\\$2")}function ta(n){return"styleSheet"in n}function oa(n){return"selectorText"in n}class Vt{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 sa(){return new Vt}function qi({element:n,maskInputOptions:e,tagName:i,type:t,value:o,maskInputFn:s}){let a=o||"";const l=t&&yn(t);return(e[i.toLowerCase()]||l&&e[l])&&(s?a=s(a,n):a="*".repeat(a.length)),a}function yn(n){return n.toLowerCase()}const Ut="__rrweb_original__";function aa(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,a=Ut in s?s[Ut]:s;if(new Uint32Array(a.call(e,t,o,Math.min(i,n.width-t),Math.min(i,n.height-o)).data.buffer).some(d=>d!==0))return!1}return!0}function Wi(n){const e=n.type;return n.hasAttribute("data-rr-is-password")?"password":e?yn(e):null}function jt(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 ra=1;const la=new RegExp("[^a-z0-9-_:]"),Jn=-2;function Kt(){return ra++}function da(n){if(n instanceof HTMLFormElement)return"form";const e=yn(n.tagName);return la.test(e)?"div":e}function ca(n){let e="";return n.indexOf("//")>-1?e=n.split("/").slice(0,3).join("/"):e=n.split("/")[0],e=e.split("?")[0],e}let In,Ft;const ua=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ha=/^(?:[a-z+]+:)?\/\//i,ma=/^www\..*/i,pa=/^(data:)([^,]*),(.*)/i;function vi(n,e){return(n||"").replace(ua,(i,t,o,s,a,l)=>{const d=o||a||l,v=t||s||"";if(!d)return i;if(ha.test(d)||ma.test(d))return`url(${v}${d}${v})`;if(pa.test(d))return`url(${v}${d}${v})`;if(d[0]==="/")return`url(${v}${ca(e)+d}${v})`;const p=e.split("/"),g=d.split("/");p.pop();for(const f of g)f!=="."&&(f===".."?p.pop():p.push(f));return`url(${v}${p.join("/")}${v})`})}const va=/^[^ \t\n\r\u000c]+/,ba=/^[, \t\n\r\u000c]+/;function fa(n,e){if(e.trim()==="")return e;let i=0;function t(s){let a;const l=s.exec(e.substring(i));return l?(a=l[0],i+=a.length,a):""}const o=[];for(;t(ba),!(i>=e.length);){let s=t(va);if(s.slice(-1)===",")s=Dn(n,s.substring(0,s.length-1)),o.push(s);else{let a="";s=Dn(n,s);let l=!1;for(;;){const d=e.charAt(i);if(d===""){o.push((s+a).trim());break}else if(l)d===")"&&(l=!1);else if(d===","){i+=1,o.push((s+a).trim());break}else d==="("&&(l=!0);a+=d,i+=1}}}return o.join(", ")}function Dn(n,e){if(!e||e.trim()==="")return e;const i=n.createElement("a");return i.href=e,i.href}function ga(n){return!!(n.tagName==="svg"||n.ownerSVGElement)}function Zi(){const n=document.createElement("a");return n.href="",n.href}function Gt(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")?Dn(n,t):i==="srcset"?fa(n,t):i==="style"?vi(t,Zi()):e==="object"&&i==="data"?Dn(n,t):t)}function zt(n,e,i){return(n==="video"||n==="audio")&&e==="autoplay"}function ya(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 bi(n,e,i){if(!n)return!1;if(n.nodeType!==n.ELEMENT_NODE)return i?bi(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?bi(n.parentNode,e,i):!1}function qt(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(bi(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 a="about:blank";if(t.location.href!==a||n.src===a||n.src==="")return setTimeout(e,0),n.addEventListener("load",e);n.addEventListener("load",e)}function wa(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 ka(n,e){const{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:a,inlineStylesheet:l,maskInputOptions:d={},maskTextFn:v,maskInputFn:p,dataURLOptions:g={},inlineImages:f,recordCanvas:y,keepIframeSrcFn:k,newlyAddedElement:C=!1}=e,S=Sa(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 Ma(n,{doc:i,blockClass:o,blockSelector:s,inlineStylesheet:l,maskInputOptions:d,maskInputFn:p,dataURLOptions:g,inlineImages:f,recordCanvas:y,keepIframeSrcFn:k,newlyAddedElement:C,rootId:S});case n.TEXT_NODE:return _a(n,{needsMask:a,maskTextFn:v,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 Sa(n,e){if(!e.hasNode(n))return;const i=e.getId(n);return i===1?void 0:i}function _a(n,e){var i;const{needsMask:t,maskTextFn:o,rootId:s}=e,a=n.parentNode&&n.parentNode.tagName;let l=n.textContent;const d=a==="STYLE"?!0:void 0,v=a==="SCRIPT"?!0:void 0;if(d&&l){try{n.nextSibling||n.previousSibling||!((i=n.parentNode.sheet)===null||i===void 0)&&i.cssRules&&(l=pi(n.parentNode.sheet))}catch(p){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${p}`,n)}l=vi(l,Zi())}return v&&(l="SCRIPT_PLACEHOLDER"),!d&&!v&&l&&t&&(l=o?o(l,n.parentElement):l.replace(/[\S]/g,"*")),{type:le.Text,textContent:l||"",isStyle:d,rootId:s}}function Ma(n,e){const{doc:i,blockClass:t,blockSelector:o,inlineStylesheet:s,maskInputOptions:a={},maskInputFn:l,dataURLOptions:d={},inlineImages:v,recordCanvas:p,keepIframeSrcFn:g,newlyAddedElement:f=!1,rootId:y}=e,k=ya(n,t,o),C=da(n);let S={};const M=n.attributes.length;for(let _=0;_<M;_++){const T=n.attributes[_];zt(C,T.name,T.value)||(S[T.name]=Gt(i,C,yn(T.name),T.value))}if(C==="link"&&s){const _=Array.from(i.styleSheets).find(I=>I.href===n.href);let T=null;_&&(T=pi(_)),T&&(delete S.rel,delete S.href,S._cssText=vi(T,_.href))}if(C==="style"&&n.sheet&&!(n.innerText||n.textContent||"").trim().length){const _=pi(n.sheet);_&&(S._cssText=vi(_,Zi()))}if(C==="input"||C==="textarea"||C==="select"){const _=n.value,T=n.checked;S.type!=="radio"&&S.type!=="checkbox"&&S.type!=="submit"&&S.type!=="button"&&_?S.value=qi({element:n,type:Wi(n),tagName:C,value:_,maskInputOptions:a,maskInputFn:l}):T&&(S.checked=T)}if(C==="option"&&(n.selected&&!a.select?S.selected=!0:delete S.selected),C==="canvas"&&p){if(n.__context==="2d")aa(n)||(S.rr_dataURL=n.toDataURL(d.type,d.quality));else if(!("__context"in n)){const _=n.toDataURL(d.type,d.quality),T=document.createElement("canvas");T.width=n.width,T.height=n.height;const I=T.toDataURL(d.type,d.quality);_!==I&&(S.rr_dataURL=_)}}if(C==="img"&&v){In||(In=i.createElement("canvas"),Ft=In.getContext("2d"));const _=n,T=_.crossOrigin;_.crossOrigin="anonymous";const I=()=>{_.removeEventListener("load",I);try{In.width=_.naturalWidth,In.height=_.naturalHeight,Ft.drawImage(_,0,0),S.rr_dataURL=In.toDataURL(d.type,d.quality)}catch(K){console.warn(`Cannot inline img src=${_.currentSrc}! Error: ${K}`)}T?S.crossOrigin=T:_.removeAttribute("crossorigin")};_.complete&&_.naturalWidth!==0?I():_.addEventListener("load",I)}if(C==="audio"||C==="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)),k){const{width:_,height:T}=n.getBoundingClientRect();S={class:S.class,rr_width:`${_}px`,rr_height:`${T}px`}}C==="iframe"&&!g(S.src)&&(n.contentDocument||(S.rr_src=S.src),delete S.src);let A;try{customElements.get(C)&&(A=!0)}catch{}return{type:le.Element,tagName:C,attributes:S,childNodes:[],isSVG:ga(n)||void 0,needBlock:k,rootId:y,isCustom:A}}function ne(n){return n==null?"":n.toLowerCase()}function Aa(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"&&jt(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 Bn(n,e){const{doc:i,mirror:t,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:l,skipChild:d=!1,inlineStylesheet:v=!0,maskInputOptions:p={},maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:k={},inlineImages:C=!1,recordCanvas:S=!1,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_=5e3,onStylesheetLoad:T,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:K=()=>!1,newlyAddedElement:G=!1}=e;let{needsMask:V}=e,{preserveWhiteSpace:F=!0}=e;!V&&n.childNodes&&(V=qt(n,a,l,V===void 0));const oe=ka(n,{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:V,inlineStylesheet:v,maskInputOptions:p,maskTextFn:g,maskInputFn:f,dataURLOptions:k,inlineImages:C,recordCanvas:S,keepIframeSrcFn:K,newlyAddedElement:G});if(!oe)return console.warn(n,"not serialized"),null;let ge;t.hasNode(n)?ge=t.getId(n):Aa(oe,y)||!F&&oe.type===le.Text&&!oe.isStyle&&!oe.textContent.replace(/^\s+|\s+$/gm,"").length?ge=Jn:ge=Kt();const U=Object.assign(oe,{id:ge});if(t.add(n,U),ge===Jn)return null;M&&M(n);let _e=!d;if(U.type===le.Element){_e=_e&&!U.needBlock,delete U.needBlock;const ue=n.shadowRoot;ue&&Zn(ue)&&(U.isShadowHost=!0)}if((U.type===le.Document||U.type===le.Element)&&_e){y.headWhitespace&&U.type===le.Element&&U.tagName==="head"&&(F=!1);const ue={doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:V,maskTextClass:a,maskTextSelector:l,skipChild:d,inlineStylesheet:v,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:k,inlineImages:C,recordCanvas:S,preserveWhiteSpace:F,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_,onStylesheetLoad:T,stylesheetLoadTimeout:I,keepIframeSrcFn:K};if(!(U.type===le.Element&&U.tagName==="textarea"&&U.attributes.value!==void 0))for(const Te of Array.from(n.childNodes)){const Me=Bn(Te,ue);Me&&U.childNodes.push(Me)}if(Xs(n)&&n.shadowRoot)for(const Te of Array.from(n.shadowRoot.childNodes)){const Me=Bn(Te,ue);Me&&(Zn(n.shadowRoot)&&(Me.isShadow=!0),U.childNodes.push(Me))}}return n.parentNode&&Wn(n.parentNode)&&Zn(n.parentNode)&&(U.isShadow=!0),U.type===le.Element&&U.tagName==="iframe"&&Ca(n,()=>{const ue=n.contentDocument;if(ue&&A){const Te=Bn(ue,{doc:ue,mirror:t,blockClass:o,blockSelector:s,needsMask:V,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:v,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:k,inlineImages:C,recordCanvas:S,preserveWhiteSpace:F,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_,onStylesheetLoad:T,stylesheetLoadTimeout:I,keepIframeSrcFn:K});Te&&A(n,Te)}},_),U.type===le.Element&&U.tagName==="link"&&typeof U.attributes.rel=="string"&&(U.attributes.rel==="stylesheet"||U.attributes.rel==="preload"&&typeof U.attributes.href=="string"&&jt(U.attributes.href)==="css")&&wa(n,()=>{if(T){const ue=Bn(n,{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:V,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:v,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:k,inlineImages:C,recordCanvas:S,preserveWhiteSpace:F,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_,onStylesheetLoad:T,stylesheetLoadTimeout:I,keepIframeSrcFn:K});ue&&T(n,ue)}},I),U}function xa(n,e){const{mirror:i=new Vt,blockClass:t="rr-block",blockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:a=null,inlineStylesheet:l=!0,inlineImages:d=!1,recordCanvas:v=!1,maskAllInputs:p=!1,maskTextFn:g,maskInputFn:f,slimDOM:y=!1,dataURLOptions:k,preserveWhiteSpace:C,onSerialize:S,onIframeLoad:M,iframeLoadTimeout:A,onStylesheetLoad:_,stylesheetLoadTimeout:T,keepIframeSrcFn:I=()=>!1}=e||{};return Bn(n,{doc:n,mirror:i,blockClass:t,blockSelector:o,maskTextClass:s,maskTextSelector:a,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:k,inlineImages:d,recordCanvas:v,preserveWhiteSpace:C,onSerialize:S,onIframeLoad:M,iframeLoadTimeout:A,onStylesheetLoad:_,stylesheetLoadTimeout:T,keepIframeSrcFn:I,newlyAddedElement:!1})}function ke(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
953
+ </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 Qs({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 Xs(n){return n.nodeType===n.ELEMENT_NODE}function Wn(n){const e=n==null?void 0:n.host;return(e==null?void 0:e.shadowRoot)===n}function Zn(n){return Object.prototype.toString.call(n)==="[object ShadowRoot]"}function ea(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 na(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 pi(n){try{const e=n.rules||n.cssRules;return e?ea(Array.from(e,Ut).join("")):null}catch{return null}}function Ut(n){let e;if(ta(n))try{e=pi(n.styleSheet)||na(n)}catch{}else if(oa(n)&&n.selectorText.includes(":"))return ia(n.cssText);return e||n.cssText}function ia(n){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return n.replace(e,"$1\\$2")}function ta(n){return"styleSheet"in n}function oa(n){return"selectorText"in n}class Vt{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 sa(){return new Vt}function Wi({element:n,maskInputOptions:e,tagName:i,type:t,value:o,maskInputFn:s}){let a=o||"";const l=t&&yn(t);return(e[i.toLowerCase()]||l&&e[l])&&(s?a=s(a,n):a="*".repeat(a.length)),a}function yn(n){return n.toLowerCase()}const jt="__rrweb_original__";function aa(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,a=jt in s?s[jt]:s;if(new Uint32Array(a.call(e,t,o,Math.min(i,n.width-t),Math.min(i,n.height-o)).data.buffer).some(d=>d!==0))return!1}return!0}function Zi(n){const e=n.type;return n.hasAttribute("data-rr-is-password")?"password":e?yn(e):null}function Kt(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 ra=1;const la=new RegExp("[^a-z0-9-_:]"),Jn=-2;function Ft(){return ra++}function da(n){if(n instanceof HTMLFormElement)return"form";const e=yn(n.tagName);return la.test(e)?"div":e}function ca(n){let e="";return n.indexOf("//")>-1?e=n.split("/").slice(0,3).join("/"):e=n.split("/")[0],e=e.split("?")[0],e}let In,Gt;const ua=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ha=/^(?:[a-z+]+:)?\/\//i,ma=/^www\..*/i,pa=/^(data:)([^,]*),(.*)/i;function vi(n,e){return(n||"").replace(ua,(i,t,o,s,a,l)=>{const d=o||a||l,v=t||s||"";if(!d)return i;if(ha.test(d)||ma.test(d))return`url(${v}${d}${v})`;if(pa.test(d))return`url(${v}${d}${v})`;if(d[0]==="/")return`url(${v}${ca(e)+d}${v})`;const p=e.split("/"),g=d.split("/");p.pop();for(const f of g)f!=="."&&(f===".."?p.pop():p.push(f));return`url(${v}${p.join("/")}${v})`})}const va=/^[^ \t\n\r\u000c]+/,ba=/^[, \t\n\r\u000c]+/;function fa(n,e){if(e.trim()==="")return e;let i=0;function t(s){let a;const l=s.exec(e.substring(i));return l?(a=l[0],i+=a.length,a):""}const o=[];for(;t(ba),!(i>=e.length);){let s=t(va);if(s.slice(-1)===",")s=Dn(n,s.substring(0,s.length-1)),o.push(s);else{let a="";s=Dn(n,s);let l=!1;for(;;){const d=e.charAt(i);if(d===""){o.push((s+a).trim());break}else if(l)d===")"&&(l=!1);else if(d===","){i+=1,o.push((s+a).trim());break}else d==="("&&(l=!0);a+=d,i+=1}}}return o.join(", ")}function Dn(n,e){if(!e||e.trim()==="")return e;const i=n.createElement("a");return i.href=e,i.href}function ga(n){return!!(n.tagName==="svg"||n.ownerSVGElement)}function Ji(){const n=document.createElement("a");return n.href="",n.href}function zt(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")?Dn(n,t):i==="srcset"?fa(n,t):i==="style"?vi(t,Ji()):e==="object"&&i==="data"?Dn(n,t):t)}function qt(n,e,i){return(n==="video"||n==="audio")&&e==="autoplay"}function ya(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 bi(n,e,i){if(!n)return!1;if(n.nodeType!==n.ELEMENT_NODE)return i?bi(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?bi(n.parentNode,e,i):!1}function Wt(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(bi(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 a="about:blank";if(t.location.href!==a||n.src===a||n.src==="")return setTimeout(e,0),n.addEventListener("load",e);n.addEventListener("load",e)}function wa(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 ka(n,e){const{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:a,inlineStylesheet:l,maskInputOptions:d={},maskTextFn:v,maskInputFn:p,dataURLOptions:g={},inlineImages:f,recordCanvas:y,keepIframeSrcFn:k,newlyAddedElement:C=!1}=e,S=Sa(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 Ma(n,{doc:i,blockClass:o,blockSelector:s,inlineStylesheet:l,maskInputOptions:d,maskInputFn:p,dataURLOptions:g,inlineImages:f,recordCanvas:y,keepIframeSrcFn:k,newlyAddedElement:C,rootId:S});case n.TEXT_NODE:return _a(n,{needsMask:a,maskTextFn:v,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 Sa(n,e){if(!e.hasNode(n))return;const i=e.getId(n);return i===1?void 0:i}function _a(n,e){var i;const{needsMask:t,maskTextFn:o,rootId:s}=e,a=n.parentNode&&n.parentNode.tagName;let l=n.textContent;const d=a==="STYLE"?!0:void 0,v=a==="SCRIPT"?!0:void 0;if(d&&l){try{n.nextSibling||n.previousSibling||!((i=n.parentNode.sheet)===null||i===void 0)&&i.cssRules&&(l=pi(n.parentNode.sheet))}catch(p){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${p}`,n)}l=vi(l,Ji())}return v&&(l="SCRIPT_PLACEHOLDER"),!d&&!v&&l&&t&&(l=o?o(l,n.parentElement):l.replace(/[\S]/g,"*")),{type:le.Text,textContent:l||"",isStyle:d,rootId:s}}function Ma(n,e){const{doc:i,blockClass:t,blockSelector:o,inlineStylesheet:s,maskInputOptions:a={},maskInputFn:l,dataURLOptions:d={},inlineImages:v,recordCanvas:p,keepIframeSrcFn:g,newlyAddedElement:f=!1,rootId:y}=e,k=ya(n,t,o),C=da(n);let S={};const M=n.attributes.length;for(let _=0;_<M;_++){const T=n.attributes[_];qt(C,T.name,T.value)||(S[T.name]=zt(i,C,yn(T.name),T.value))}if(C==="link"&&s){const _=Array.from(i.styleSheets).find(I=>I.href===n.href);let T=null;_&&(T=pi(_)),T&&(delete S.rel,delete S.href,S._cssText=vi(T,_.href))}if(C==="style"&&n.sheet&&!(n.innerText||n.textContent||"").trim().length){const _=pi(n.sheet);_&&(S._cssText=vi(_,Ji()))}if(C==="input"||C==="textarea"||C==="select"){const _=n.value,T=n.checked;S.type!=="radio"&&S.type!=="checkbox"&&S.type!=="submit"&&S.type!=="button"&&_?S.value=Wi({element:n,type:Zi(n),tagName:C,value:_,maskInputOptions:a,maskInputFn:l}):T&&(S.checked=T)}if(C==="option"&&(n.selected&&!a.select?S.selected=!0:delete S.selected),C==="canvas"&&p){if(n.__context==="2d")aa(n)||(S.rr_dataURL=n.toDataURL(d.type,d.quality));else if(!("__context"in n)){const _=n.toDataURL(d.type,d.quality),T=document.createElement("canvas");T.width=n.width,T.height=n.height;const I=T.toDataURL(d.type,d.quality);_!==I&&(S.rr_dataURL=_)}}if(C==="img"&&v){In||(In=i.createElement("canvas"),Gt=In.getContext("2d"));const _=n,T=_.crossOrigin;_.crossOrigin="anonymous";const I=()=>{_.removeEventListener("load",I);try{In.width=_.naturalWidth,In.height=_.naturalHeight,Gt.drawImage(_,0,0),S.rr_dataURL=In.toDataURL(d.type,d.quality)}catch(K){console.warn(`Cannot inline img src=${_.currentSrc}! Error: ${K}`)}T?S.crossOrigin=T:_.removeAttribute("crossorigin")};_.complete&&_.naturalWidth!==0?I():_.addEventListener("load",I)}if(C==="audio"||C==="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)),k){const{width:_,height:T}=n.getBoundingClientRect();S={class:S.class,rr_width:`${_}px`,rr_height:`${T}px`}}C==="iframe"&&!g(S.src)&&(n.contentDocument||(S.rr_src=S.src),delete S.src);let A;try{customElements.get(C)&&(A=!0)}catch{}return{type:le.Element,tagName:C,attributes:S,childNodes:[],isSVG:ga(n)||void 0,needBlock:k,rootId:y,isCustom:A}}function ne(n){return n==null?"":n.toLowerCase()}function Aa(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"&&Kt(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 Bn(n,e){const{doc:i,mirror:t,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:l,skipChild:d=!1,inlineStylesheet:v=!0,maskInputOptions:p={},maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:k={},inlineImages:C=!1,recordCanvas:S=!1,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_=5e3,onStylesheetLoad:T,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:K=()=>!1,newlyAddedElement:G=!1}=e;let{needsMask:U}=e,{preserveWhiteSpace:F=!0}=e;!U&&n.childNodes&&(U=Wt(n,a,l,U===void 0));const oe=ka(n,{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,inlineStylesheet:v,maskInputOptions:p,maskTextFn:g,maskInputFn:f,dataURLOptions:k,inlineImages:C,recordCanvas:S,keepIframeSrcFn:K,newlyAddedElement:G});if(!oe)return console.warn(n,"not serialized"),null;let ge;t.hasNode(n)?ge=t.getId(n):Aa(oe,y)||!F&&oe.type===le.Text&&!oe.isStyle&&!oe.textContent.replace(/^\s+|\s+$/gm,"").length?ge=Jn:ge=Ft();const V=Object.assign(oe,{id:ge});if(t.add(n,V),ge===Jn)return null;M&&M(n);let _e=!d;if(V.type===le.Element){_e=_e&&!V.needBlock,delete V.needBlock;const ue=n.shadowRoot;ue&&Zn(ue)&&(V.isShadowHost=!0)}if((V.type===le.Document||V.type===le.Element)&&_e){y.headWhitespace&&V.type===le.Element&&V.tagName==="head"&&(F=!1);const ue={doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:a,maskTextSelector:l,skipChild:d,inlineStylesheet:v,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:k,inlineImages:C,recordCanvas:S,preserveWhiteSpace:F,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_,onStylesheetLoad:T,stylesheetLoadTimeout:I,keepIframeSrcFn:K};if(!(V.type===le.Element&&V.tagName==="textarea"&&V.attributes.value!==void 0))for(const Te of Array.from(n.childNodes)){const Me=Bn(Te,ue);Me&&V.childNodes.push(Me)}if(Xs(n)&&n.shadowRoot)for(const Te of Array.from(n.shadowRoot.childNodes)){const Me=Bn(Te,ue);Me&&(Zn(n.shadowRoot)&&(Me.isShadow=!0),V.childNodes.push(Me))}}return n.parentNode&&Wn(n.parentNode)&&Zn(n.parentNode)&&(V.isShadow=!0),V.type===le.Element&&V.tagName==="iframe"&&Ca(n,()=>{const ue=n.contentDocument;if(ue&&A){const Te=Bn(ue,{doc:ue,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:v,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:k,inlineImages:C,recordCanvas:S,preserveWhiteSpace:F,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_,onStylesheetLoad:T,stylesheetLoadTimeout:I,keepIframeSrcFn:K});Te&&A(n,Te)}},_),V.type===le.Element&&V.tagName==="link"&&typeof V.attributes.rel=="string"&&(V.attributes.rel==="stylesheet"||V.attributes.rel==="preload"&&typeof V.attributes.href=="string"&&Kt(V.attributes.href)==="css")&&wa(n,()=>{if(T){const ue=Bn(n,{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:v,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:k,inlineImages:C,recordCanvas:S,preserveWhiteSpace:F,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_,onStylesheetLoad:T,stylesheetLoadTimeout:I,keepIframeSrcFn:K});ue&&T(n,ue)}},I),V}function xa(n,e){const{mirror:i=new Vt,blockClass:t="rr-block",blockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:a=null,inlineStylesheet:l=!0,inlineImages:d=!1,recordCanvas:v=!1,maskAllInputs:p=!1,maskTextFn:g,maskInputFn:f,slimDOM:y=!1,dataURLOptions:k,preserveWhiteSpace:C,onSerialize:S,onIframeLoad:M,iframeLoadTimeout:A,onStylesheetLoad:_,stylesheetLoadTimeout:T,keepIframeSrcFn:I=()=>!1}=e||{};return Bn(n,{doc:n,mirror:i,blockClass:t,blockSelector:o,maskTextClass:s,maskTextSelector:a,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:k,inlineImages:d,recordCanvas:v,preserveWhiteSpace:C,onSerialize:S,onIframeLoad:M,iframeLoadTimeout:A,onStylesheetLoad:_,stylesheetLoadTimeout:T,keepIframeSrcFn:I,newlyAddedElement:!1})}function ke(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
954
954
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
955
- or you can use record.mirror to access the mirror instance during recording.`;let Wt={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&&(Wt=new Proxy(Wt,{get(n,e,i){return e==="map"&&console.error(Nn),Reflect.get(n,e,i)}}));function $n(n,e,i={}){let t=null,o=0;return function(...s){const a=Date.now();!o&&i.leading===!1&&(o=a);const l=e-(a-o),d=this;l<=0||l>e?(t&&(clearTimeout(t),t=null),o=a,n.apply(d,s)):!t&&i.trailing!==!1&&(t=setTimeout(()=>{o=i.leading===!1?0:Date.now(),t=null,n.apply(d,s)},l))}}function fi(n,e,i,t,o=window){const s=o.Object.getOwnPropertyDescriptor(n,e);return o.Object.defineProperty(n,e,t?i:{set(a){setTimeout(()=>{i.set.call(this,a)},0),s&&s.set&&s.set.call(this,a)}}),()=>fi(n,e,s||{},!0)}function Hn(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 gi=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(gi=()=>new Date().getTime());function Zt(n){var e,i,t,o,s,a;const l=n.document;return{left:l.scrollingElement?l.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:(l==null?void 0:l.documentElement.scrollLeft)||((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)||((a=l==null?void 0:l.body)===null||a===void 0?void 0:a.scrollTop)||0}}function Jt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function $t(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Yt(n){return n?n.nodeType===n.ELEMENT_NODE?n:n.parentElement:null}function Se(n,e,i,t){if(!n)return!1;const o=Yt(n);if(!o)return!1;try{if(typeof e=="string"){if(o.classList.contains(e)||t&&o.closest("."+e)!==null)return!0}else if(bi(o,e,t))return!0}catch{}return!!(i&&(o.matches(i)||t&&o.closest(i)!==null))}function La(n,e){return e.getId(n)!==-1}function Ji(n,e){return e.getId(n)===Jn}function Qt(n,e){if(Wn(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 $i(n){return!!n.changedTouches}function Ta(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 Xt(n,e){return!!(n.nodeName==="IFRAME"&&e.getMeta(n))}function eo(n,e){return!!(n.nodeName==="LINK"&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute&&n.getAttribute("rel")==="stylesheet"&&e.getMeta(n))}function Yi(n){return!!(n!=null&&n.shadowRoot)}class Ea{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 no(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 Pa(n){let e=n,i;for(;i=no(e);)e=i;return e}function Ia(n){const e=n.ownerDocument;if(!e)return!1;const i=Pa(n);return e.contains(i)}function io(n){const e=n.ownerDocument;return e?e.contains(n)||Ia(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||{}),Je=(n=>(n[n.Mouse=0]="Mouse",n[n.Pen=1]="Pen",n[n.Touch=2]="Touch",n))(Je||{}),Rn=(n=>(n[n["2D"]=0]="2D",n[n.WebGL=1]="WebGL",n[n.WebGL2=2]="WebGL2",n))(Rn||{});function to(n){return"__ln"in n}class Da{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&&to(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&&to(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 oo=(n,e)=>`${n}@${e}`;class Ba{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 Da,o=d=>{let v=d,p=Jn;for(;p===Jn;)v=v&&v.nextSibling,p=v&&this.mirror.getId(v);return p},s=d=>{if(!d.parentNode||!io(d)||d.parentNode.tagName==="TEXTAREA")return;const v=Wn(d.parentNode)?this.mirror.getId(no(d)):this.mirror.getId(d.parentNode),p=o(d);if(v===-1||p===-1)return t.addNode(d);const g=Bn(d,{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=>{Xt(f,this.mirror)&&this.iframeManager.addIframe(f),eo(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Yi(d)&&this.shadowDomManager.addShadowRoot(d.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:v,nextId:p,node:g}),i.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const d of this.movedSet)so(this.removes,d,this.mirror)&&!this.movedSet.has(d.parentNode)||s(d);for(const d of this.addedSet)!ro(this.droppedSet,d)&&!so(this.removes,d,this.mirror)||ro(this.movedSet,d)?s(d):this.droppedSet.add(d);let a=null;for(;t.length;){let d=null;if(a){const v=this.mirror.getId(a.value.parentNode),p=o(a.value);v!==-1&&p!==-1&&(d=a)}if(!d){let v=t.tail;for(;v;){const p=v;if(v=v.previous,p){const g=this.mirror.getId(p.value.parentNode);if(o(p.value)===-1)continue;if(g!==-1){d=p;break}else{const y=p.value;if(y.parentNode&&y.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const k=y.parentNode.host;if(this.mirror.getId(k)!==-1){d=p;break}}}}}}if(!d){for(;t.head;)t.removeNode(t.head.value);break}a=d.previous,t.removeNode(d.value),s(d.value)}const l={texts:this.texts.map(d=>{const v=d.node;return v.parentNode&&v.parentNode.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(v.parentNode),{id:this.mirror.getId(v),value:d.value}}).filter(d=>!i.has(d.id)).filter(d=>this.mirror.has(d.id)),attributes:this.attributes.map(d=>{const{attributes:v}=d;if(typeof v.style=="string"){const p=JSON.stringify(d.styleDiff),g=JSON.stringify(d._unchangedStyles);p.length<v.style.length&&(p+g).split("var(").length===v.style.split("var(").length&&(v.style=d.styleDiff)}return{id:this.mirror.getId(d.node),attributes:v}}).filter(d=>!i.has(d.id)).filter(d=>this.mirror.has(d.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(!Ji(e.target,this.mirror))switch(e.type){case"characterData":{const i=e.target.textContent;!Se(e.target,this.blockClass,this.blockSelector,!1)&&i!==e.oldValue&&this.texts.push({value:qt(e.target,this.maskTextClass,this.maskTextSelector,!0)&&i?this.maskTextFn?this.maskTextFn(i,Yt(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 a=Wi(i);o=qi({element:i,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:a,value:o,maskInputFn:this.maskInputFn})}if(Se(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"),!zt(i.tagName,t)&&(s.attributes[t]=Gt(this.doc,yn(i.tagName),yn(t),o),t==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");e.oldValue&&a.setAttribute("style",e.oldValue);for(const l of Array.from(i.style)){const d=i.style.getPropertyValue(l),v=i.style.getPropertyPriority(l);d!==a.style.getPropertyValue(l)||v!==a.style.getPropertyPriority(l)?v===""?s.styleDiff[l]=d:s.styleDiff[l]=[d,v]:s._unchangedStyles[l]=[d,v]}for(const l of Array.from(a.style))i.style.getPropertyValue(l)===""&&(s.styleDiff[l]=!1)}break}case"childList":{if(Se(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=Wn(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);Se(e.target,this.blockClass,this.blockSelector,!1)||Ji(i,this.mirror)||!La(i,this.mirror)||(this.addedSet.has(i)?(Qi(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[oo(t,o)]?Qi(this.movedSet,i):this.removes.push({parentId:o,id:t,isShadow:Wn(e.target)&&Zn(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(Ji(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[oo(this.mirror.getId(e),t)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Se(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach(t=>this.genAdds(t)),Yi(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 Qi(n,e){n.delete(e),e.childNodes.forEach(i=>Qi(n,i))}function so(n,e,i){return n.length===0?!1:ao(n,e,i)}function ao(n,e,i){const{parentNode:t}=e;if(!t)return!1;const o=i.getId(t);return n.some(s=>s.id===o)?!0:ao(n,t,i)}function ro(n,e){return n.size===0?!1:lo(n,e)}function lo(n,e){const{parentNode:i}=e;return i?n.has(i)?!0:lo(n,i):!1}let Yn;function Na(n){Yn=n}function Ha(){Yn=void 0}const q=n=>Yn?(...i)=>{try{return n(...i)}catch(t){if(Yn&&Yn(t)===!0)return;throw t}}:n,Cn=[];function Qn(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 co(n,e){var i,t;const o=new Ba;Cn.push(o),o.init(n);let s=window.MutationObserver||window.__rrMutationObserver;const a=(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");a&&window[a]&&(s=window[a]);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 Ra({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 a=[],l;const d=$n(q(g=>{const f=Date.now()-l;n(a.map(y=>(y.timeOffset-=f,y)),g),a=[],l=null}),s),v=q($n(q(g=>{const f=Qn(g),{clientX:y,clientY:k}=$i(g)?g.changedTouches[0]:g;l||(l=gi()),a.push({x:y,y:k,id:t.getId(f),timeOffset:gi()-l}),d(typeof DragEvent<"u"&&g instanceof DragEvent?z.Drag:g instanceof MouseEvent?z.MouseMove:z.TouchMove)}),o,{trailing:!1})),p=[ke("mousemove",v,i),ke("touchmove",v,i),ke("drag",v,i)];return q(()=>{p.forEach(g=>g())})}function Oa({mouseInteractionCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};const a=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,l=[];let d=null;const v=p=>g=>{const f=Qn(g);if(Se(f,t,o,!0))return;let y=null,k=p;if("pointerType"in g){switch(g.pointerType){case"mouse":y=Je.Mouse;break;case"touch":y=Je.Touch;break;case"pen":y=Je.Pen;break}y===Je.Touch?Le[p]===Le.MouseDown?k="TouchStart":Le[p]===Le.MouseUp&&(k="TouchEnd"):Je.Pen}else $i(g)&&(y=Je.Touch);y!==null?(d=y,(k.startsWith("Touch")&&y===Je.Touch||k.startsWith("Mouse")&&y===Je.Mouse)&&(y=null)):Le[p]===Le.Click&&(y=d,d=null);const C=$i(g)?g.changedTouches[0]:g;if(!C)return;const S=i.getId(f),{clientX:M,clientY:A}=C;q(n)(Object.assign({type:Le[k],id:S,x:M,y:A},y!==null&&{pointerType:y}))};return Object.keys(Le).filter(p=>Number.isNaN(Number(p))&&!p.endsWith("_Departed")&&a[p]!==!1).forEach(p=>{let g=yn(p);const f=v(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(ke(g,f,e))}),q(()=>{l.forEach(p=>p())})}function uo({scrollCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){const a=q($n(q(l=>{const d=Qn(l);if(!d||Se(d,t,o,!0))return;const v=i.getId(d);if(d===e&&e.defaultView){const p=Zt(e.defaultView);n({id:v,x:p.left,y:p.top})}else n({id:v,x:d.scrollLeft,y:d.scrollTop})}),s.scroll||100));return ke("scroll",a,e)}function Va({viewportResizeCb:n},{win:e}){let i=-1,t=-1;const o=q($n(q(()=>{const s=Jt(),a=$t();(i!==s||t!==a)&&(n({width:Number(a),height:Number(s)}),i=s,t=a)}),200));return ke("resize",o,e)}const Ua=["INPUT","TEXTAREA","SELECT"],ho=new WeakMap;function ja({inputCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,ignoreClass:s,ignoreSelector:a,maskInputOptions:l,maskInputFn:d,sampling:v,userTriggeredOnInput:p}){function g(A){let _=Qn(A);const T=A.isTrusted,I=_&&_.tagName;if(_&&I==="OPTION"&&(_=_.parentElement),!_||!I||Ua.indexOf(I)<0||Se(_,t,o,!0)||_.classList.contains(s)||a&&_.matches(a))return;let K=_.value,G=!1;const V=Wi(_)||"";V==="radio"||V==="checkbox"?G=_.checked:(l[I.toLowerCase()]||l[V])&&(K=qi({element:_,maskInputOptions:l,tagName:I,type:V,value:K,maskInputFn:d})),f(_,p?{text:K,isChecked:G,userTriggered:T}:{text:K,isChecked:G});const F=_.name;V==="radio"&&F&&G&&e.querySelectorAll(`input[type="radio"][name="${F}"]`).forEach(oe=>{if(oe!==_){const ge=oe.value;f(oe,p?{text:ge,isChecked:!G,userTriggered:!1}:{text:ge,isChecked:!G})}})}function f(A,_){const T=ho.get(A);if(!T||T.text!==_.text||T.isChecked!==_.isChecked){ho.set(A,_);const I=i.getId(A);q(n)(Object.assign(Object.assign({},_),{id:I}))}}const k=(v.input==="last"?["change"]:["input","change"]).map(A=>ke(A,q(g),e)),C=e.defaultView;if(!C)return()=>{k.forEach(A=>A())};const S=C.Object.getOwnPropertyDescriptor(C.HTMLInputElement.prototype,"value"),M=[[C.HTMLInputElement.prototype,"value"],[C.HTMLInputElement.prototype,"checked"],[C.HTMLSelectElement.prototype,"value"],[C.HTMLTextAreaElement.prototype,"value"],[C.HTMLSelectElement.prototype,"selectedIndex"],[C.HTMLOptionElement.prototype,"selected"]];return S&&S.set&&k.push(...M.map(A=>fi(A[0],A[1],{set(){q(g)({target:this,isTrusted:!1})}},!1,C))),q(()=>{k.forEach(A=>A())})}function yi(n){const e=[];function i(t,o){if(Ci("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||Ci("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||Ci("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||Ci("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const a=Array.from(t.parentRule.cssRules).indexOf(t);o.unshift(a)}else if(t.parentStyleSheet){const a=Array.from(t.parentStyleSheet.cssRules).indexOf(t);o.unshift(a)}return o}return i(n,e)}function rn(n,e,i){let t,o;return n?(n.ownerNode?t=e.getId(n.ownerNode):o=i.getId(n),{styleId:o,id:t}):{}}function Ka({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,k]=f,{id:C,styleId:S}=rn(g,e,i.styleMirror);return(C&&C!==-1||S&&S!==-1)&&n({id:C,styleId:S,adds:[{rule:y,index:k}]}),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:k,styleId:C}=rn(g,e,i.styleMirror);return(k&&k!==-1||C&&C!==-1)&&n({id:k,styleId:C,removes:[{index:y}]}),p.apply(g,f)})});let a;t.CSSStyleSheet.prototype.replace&&(a=t.CSSStyleSheet.prototype.replace,t.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:q((p,g,f)=>{const[y]=f,{id:k,styleId:C}=rn(g,e,i.styleMirror);return(k&&k!==-1||C&&C!==-1)&&n({id:k,styleId:C,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:k,styleId:C}=rn(g,e,i.styleMirror);return(k&&k!==-1||C&&C!==-1)&&n({id:k,styleId:C,replaceSync:y}),p.apply(g,f)})}));const d={};wi("CSSGroupingRule")?d.CSSGroupingRule=t.CSSGroupingRule:(wi("CSSMediaRule")&&(d.CSSMediaRule=t.CSSMediaRule),wi("CSSConditionRule")&&(d.CSSConditionRule=t.CSSConditionRule),wi("CSSSupportsRule")&&(d.CSSSupportsRule=t.CSSSupportsRule));const v={};return Object.entries(d).forEach(([p,g])=>{v[p]={insertRule:g.prototype.insertRule,deleteRule:g.prototype.deleteRule},g.prototype.insertRule=new Proxy(v[p].insertRule,{apply:q((f,y,k)=>{const[C,S]=k,{id:M,styleId:A}=rn(y.parentStyleSheet,e,i.styleMirror);return(M&&M!==-1||A&&A!==-1)&&n({id:M,styleId:A,adds:[{rule:C,index:[...yi(y),S||0]}]}),f.apply(y,k)})}),g.prototype.deleteRule=new Proxy(v[p].deleteRule,{apply:q((f,y,k)=>{const[C]=k,{id:S,styleId:M}=rn(y.parentStyleSheet,e,i.styleMirror);return(S&&S!==-1||M&&M!==-1)&&n({id:S,styleId:M,removes:[{index:[...yi(y),C]}]}),f.apply(y,k)})})}),q(()=>{t.CSSStyleSheet.prototype.insertRule=o,t.CSSStyleSheet.prototype.deleteRule=s,a&&(t.CSSStyleSheet.prototype.replace=a),l&&(t.CSSStyleSheet.prototype.replaceSync=l),Object.entries(d).forEach(([p,g])=>{g.prototype.insertRule=v[p].insertRule,g.prototype.deleteRule=v[p].deleteRule})})}function mo({mirror:n,stylesheetManager:e},i){var t,o,s;let a=null;i.nodeName==="#document"?a=n.getId(i):a=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,d=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!l||!d?()=>{}:(Object.defineProperty(i,"adoptedStyleSheets",{configurable:d.configurable,enumerable:d.enumerable,get(){var v;return(v=d.get)===null||v===void 0?void 0:v.call(this)},set(v){var p;const g=(p=d.set)===null||p===void 0?void 0:p.call(this,v);if(a!==null&&a!==-1)try{e.adoptStyleSheets(v,a)}catch{}return g}}),q(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:d.configurable,enumerable:d.enumerable,get:d.get,set:d.set})}))}function Fa({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,d,v)=>{var p;const[g,f,y]=v;if(i.has(g))return s.apply(d,[g,f,y]);const{id:k,styleId:C}=rn((p=d.parentRule)===null||p===void 0?void 0:p.parentStyleSheet,e,t.styleMirror);return(k&&k!==-1||C&&C!==-1)&&n({id:k,styleId:C,set:{property:g,value:f,priority:y},index:yi(d.parentRule)}),l.apply(d,v)})});const a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:q((l,d,v)=>{var p;const[g]=v;if(i.has(g))return a.apply(d,[g]);const{id:f,styleId:y}=rn((p=d.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:yi(d.parentRule)}),l.apply(d,v)})}),q(()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=a})}function Ga({mediaInteractionCb:n,blockClass:e,blockSelector:i,mirror:t,sampling:o,doc:s}){const a=q(d=>$n(q(v=>{const p=Qn(v);if(!p||Se(p,e,i,!0))return;const{currentTime:g,volume:f,muted:y,playbackRate:k,loop:C}=p;n({type:d,id:t.getId(p),currentTime:g,volume:f,muted:y,playbackRate:k,loop:C})}),o.media||500)),l=[ke("play",a(0),s),ke("pause",a(1),s),ke("seeked",a(2),s),ke("volumechange",a(3),s),ke("ratechange",a(4),s)];return q(()=>{l.forEach(d=>d())})}function za({fontCb:n,doc:e}){const i=e.defaultView;if(!i)return()=>{};const t=[],o=new WeakMap,s=i.FontFace;i.FontFace=function(d,v,p){const g=new s(d,v,p);return o.set(g,{family:d,buffer:typeof v!="string",descriptors:p,fontSource:typeof v=="string"?v:JSON.stringify(Array.from(new Uint8Array(v)))}),g};const a=Hn(e.fonts,"add",function(l){return function(d){return setTimeout(q(()=>{const v=o.get(d);v&&(n(v),o.delete(d))}),0),l.apply(this,[d])}});return t.push(()=>{i.FontFace=s}),t.push(a),q(()=>{t.forEach(l=>l())})}function qa(n){const{doc:e,mirror:i,blockClass:t,blockSelector:o,selectionCb:s}=n;let a=!0;const l=q(()=>{const d=e.getSelection();if(!d||a&&(d!=null&&d.isCollapsed))return;a=d.isCollapsed||!1;const v=[],p=d.rangeCount||0;for(let g=0;g<p;g++){const f=d.getRangeAt(g),{startContainer:y,startOffset:k,endContainer:C,endOffset:S}=f;Se(y,t,o,!0)||Se(C,t,o,!0)||v.push({start:i.getId(y),startOffset:k,end:i.getId(C),endOffset:S})}s({ranges:v})});return l(),ke("selectionchange",l)}function Wa({doc:n,customElementCb:e}){const i=n.defaultView;return!i||!i.customElements?()=>{}:Hn(i.customElements,"define",function(o){return function(s,a,l){try{e({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return o.apply(this,[s,a,l])}})}function Za(n,e){const{mutationCb:i,mousemoveCb:t,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:a,inputCb:l,mediaInteractionCb:d,styleSheetRuleCb:v,styleDeclarationCb:p,canvasMutationCb:g,fontCb:f,selectionCb:y,customElementCb:k}=n;n.mutationCb=(...C)=>{e.mutation&&e.mutation(...C),i(...C)},n.mousemoveCb=(...C)=>{e.mousemove&&e.mousemove(...C),t(...C)},n.mouseInteractionCb=(...C)=>{e.mouseInteraction&&e.mouseInteraction(...C),o(...C)},n.scrollCb=(...C)=>{e.scroll&&e.scroll(...C),s(...C)},n.viewportResizeCb=(...C)=>{e.viewportResize&&e.viewportResize(...C),a(...C)},n.inputCb=(...C)=>{e.input&&e.input(...C),l(...C)},n.mediaInteractionCb=(...C)=>{e.mediaInteaction&&e.mediaInteaction(...C),d(...C)},n.styleSheetRuleCb=(...C)=>{e.styleSheetRule&&e.styleSheetRule(...C),v(...C)},n.styleDeclarationCb=(...C)=>{e.styleDeclaration&&e.styleDeclaration(...C),p(...C)},n.canvasMutationCb=(...C)=>{e.canvasMutation&&e.canvasMutation(...C),g(...C)},n.fontCb=(...C)=>{e.font&&e.font(...C),f(...C)},n.selectionCb=(...C)=>{e.selection&&e.selection(...C),y(...C)},n.customElementCb=(...C)=>{e.customElement&&e.customElement(...C),k(...C)}}function Ja(n,e={}){const i=n.doc.defaultView;if(!i)return()=>{};Za(n,e);let t;n.recordDOM&&(t=co(n,n.doc));const o=Ra(n),s=Oa(n),a=uo(n),l=Va(n,{win:i}),d=ja(n),v=Ga(n);let p=()=>{},g=()=>{},f=()=>{},y=()=>{};n.recordDOM&&(p=Ka(n,{win:i}),g=mo(n,n.doc),f=Fa(n,{win:i}),n.collectFonts&&(y=za(n)));const k=qa(n),C=Wa(n),S=[];for(const M of n.plugins)S.push(M.observer(M.callback,i,M.options));return q(()=>{Cn.forEach(M=>M.reset()),t==null||t.disconnect(),o(),s(),a(),l(),d(),v(),p(),g(),f(),y(),k(),C(),S.forEach(M=>M())})}function Ci(n){return typeof window[n]<"u"}function wi(n){return!!(typeof window[n]<"u"&&window[n].prototype&&"insertRule"in window[n].prototype&&"deleteRule"in window[n].prototype)}class po{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,i,t,o){const s=t||this.getIdToRemoteIdMap(e),a=o||this.getRemoteIdToIdMap(e);let l=s.get(i);return l||(l=this.generateIdFn(),s.set(i,l),a.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 $a{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new po(Kt),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new po(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 Ya{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(!Zn(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const t=co(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(uo(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(mo({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,i){const t=this;this.restoreHandlers.push(Hn(e.prototype,"attachShadow",function(o){return function(s){const a=o.call(this,s);return this.shadowRoot&&io(this)&&t.addShadowRoot(this.shadowRoot,i),a}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
955
+ or you can use record.mirror to access the mirror instance during recording.`;let Zt={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&&(Zt=new Proxy(Zt,{get(n,e,i){return e==="map"&&console.error(Nn),Reflect.get(n,e,i)}}));function $n(n,e,i={}){let t=null,o=0;return function(...s){const a=Date.now();!o&&i.leading===!1&&(o=a);const l=e-(a-o),d=this;l<=0||l>e?(t&&(clearTimeout(t),t=null),o=a,n.apply(d,s)):!t&&i.trailing!==!1&&(t=setTimeout(()=>{o=i.leading===!1?0:Date.now(),t=null,n.apply(d,s)},l))}}function fi(n,e,i,t,o=window){const s=o.Object.getOwnPropertyDescriptor(n,e);return o.Object.defineProperty(n,e,t?i:{set(a){setTimeout(()=>{i.set.call(this,a)},0),s&&s.set&&s.set.call(this,a)}}),()=>fi(n,e,s||{},!0)}function Hn(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 gi=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(gi=()=>new Date().getTime());function Jt(n){var e,i,t,o,s,a;const l=n.document;return{left:l.scrollingElement?l.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:(l==null?void 0:l.documentElement.scrollLeft)||((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)||((a=l==null?void 0:l.body)===null||a===void 0?void 0:a.scrollTop)||0}}function $t(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Yt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Qt(n){return n?n.nodeType===n.ELEMENT_NODE?n:n.parentElement:null}function Se(n,e,i,t){if(!n)return!1;const o=Qt(n);if(!o)return!1;try{if(typeof e=="string"){if(o.classList.contains(e)||t&&o.closest("."+e)!==null)return!0}else if(bi(o,e,t))return!0}catch{}return!!(i&&(o.matches(i)||t&&o.closest(i)!==null))}function La(n,e){return e.getId(n)!==-1}function $i(n,e){return e.getId(n)===Jn}function Xt(n,e){if(Wn(n))return!1;const i=e.getId(n);return e.has(i)?n.parentNode&&n.parentNode.nodeType===n.DOCUMENT_NODE?!1:n.parentNode?Xt(n.parentNode,e):!0:!0}function Yi(n){return!!n.changedTouches}function Ta(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 eo(n,e){return!!(n.nodeName==="IFRAME"&&e.getMeta(n))}function no(n,e){return!!(n.nodeName==="LINK"&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute&&n.getAttribute("rel")==="stylesheet"&&e.getMeta(n))}function Qi(n){return!!(n!=null&&n.shadowRoot)}class Ea{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 io(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 Pa(n){let e=n,i;for(;i=io(e);)e=i;return e}function Ia(n){const e=n.ownerDocument;if(!e)return!1;const i=Pa(n);return e.contains(i)}function to(n){const e=n.ownerDocument;return e?e.contains(n)||Ia(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||{}),Je=(n=>(n[n.Mouse=0]="Mouse",n[n.Pen=1]="Pen",n[n.Touch=2]="Touch",n))(Je||{}),Rn=(n=>(n[n["2D"]=0]="2D",n[n.WebGL=1]="WebGL",n[n.WebGL2=2]="WebGL2",n))(Rn||{});function oo(n){return"__ln"in n}class Da{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&&oo(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&&oo(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 so=(n,e)=>`${n}@${e}`;class Ba{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 Da,o=d=>{let v=d,p=Jn;for(;p===Jn;)v=v&&v.nextSibling,p=v&&this.mirror.getId(v);return p},s=d=>{if(!d.parentNode||!to(d)||d.parentNode.tagName==="TEXTAREA")return;const v=Wn(d.parentNode)?this.mirror.getId(io(d)):this.mirror.getId(d.parentNode),p=o(d);if(v===-1||p===-1)return t.addNode(d);const g=Bn(d,{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=>{eo(f,this.mirror)&&this.iframeManager.addIframe(f),no(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Qi(d)&&this.shadowDomManager.addShadowRoot(d.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:v,nextId:p,node:g}),i.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const d of this.movedSet)ao(this.removes,d,this.mirror)&&!this.movedSet.has(d.parentNode)||s(d);for(const d of this.addedSet)!lo(this.droppedSet,d)&&!ao(this.removes,d,this.mirror)||lo(this.movedSet,d)?s(d):this.droppedSet.add(d);let a=null;for(;t.length;){let d=null;if(a){const v=this.mirror.getId(a.value.parentNode),p=o(a.value);v!==-1&&p!==-1&&(d=a)}if(!d){let v=t.tail;for(;v;){const p=v;if(v=v.previous,p){const g=this.mirror.getId(p.value.parentNode);if(o(p.value)===-1)continue;if(g!==-1){d=p;break}else{const y=p.value;if(y.parentNode&&y.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const k=y.parentNode.host;if(this.mirror.getId(k)!==-1){d=p;break}}}}}}if(!d){for(;t.head;)t.removeNode(t.head.value);break}a=d.previous,t.removeNode(d.value),s(d.value)}const l={texts:this.texts.map(d=>{const v=d.node;return v.parentNode&&v.parentNode.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(v.parentNode),{id:this.mirror.getId(v),value:d.value}}).filter(d=>!i.has(d.id)).filter(d=>this.mirror.has(d.id)),attributes:this.attributes.map(d=>{const{attributes:v}=d;if(typeof v.style=="string"){const p=JSON.stringify(d.styleDiff),g=JSON.stringify(d._unchangedStyles);p.length<v.style.length&&(p+g).split("var(").length===v.style.split("var(").length&&(v.style=d.styleDiff)}return{id:this.mirror.getId(d.node),attributes:v}}).filter(d=>!i.has(d.id)).filter(d=>this.mirror.has(d.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(!$i(e.target,this.mirror))switch(e.type){case"characterData":{const i=e.target.textContent;!Se(e.target,this.blockClass,this.blockSelector,!1)&&i!==e.oldValue&&this.texts.push({value:Wt(e.target,this.maskTextClass,this.maskTextSelector,!0)&&i?this.maskTextFn?this.maskTextFn(i,Qt(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 a=Zi(i);o=Wi({element:i,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:a,value:o,maskInputFn:this.maskInputFn})}if(Se(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"),!qt(i.tagName,t)&&(s.attributes[t]=zt(this.doc,yn(i.tagName),yn(t),o),t==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");e.oldValue&&a.setAttribute("style",e.oldValue);for(const l of Array.from(i.style)){const d=i.style.getPropertyValue(l),v=i.style.getPropertyPriority(l);d!==a.style.getPropertyValue(l)||v!==a.style.getPropertyPriority(l)?v===""?s.styleDiff[l]=d:s.styleDiff[l]=[d,v]:s._unchangedStyles[l]=[d,v]}for(const l of Array.from(a.style))i.style.getPropertyValue(l)===""&&(s.styleDiff[l]=!1)}break}case"childList":{if(Se(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=Wn(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);Se(e.target,this.blockClass,this.blockSelector,!1)||$i(i,this.mirror)||!La(i,this.mirror)||(this.addedSet.has(i)?(Xi(this.addedSet,i),this.droppedSet.add(i)):this.addedSet.has(e.target)&&t===-1||Xt(e.target,this.mirror)||(this.movedSet.has(i)&&this.movedMap[so(t,o)]?Xi(this.movedSet,i):this.removes.push({parentId:o,id:t,isShadow:Wn(e.target)&&Zn(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($i(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[so(this.mirror.getId(e),t)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Se(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach(t=>this.genAdds(t)),Qi(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 Xi(n,e){n.delete(e),e.childNodes.forEach(i=>Xi(n,i))}function ao(n,e,i){return n.length===0?!1:ro(n,e,i)}function ro(n,e,i){const{parentNode:t}=e;if(!t)return!1;const o=i.getId(t);return n.some(s=>s.id===o)?!0:ro(n,t,i)}function lo(n,e){return n.size===0?!1:co(n,e)}function co(n,e){const{parentNode:i}=e;return i?n.has(i)?!0:co(n,i):!1}let Yn;function Na(n){Yn=n}function Ha(){Yn=void 0}const q=n=>Yn?(...i)=>{try{return n(...i)}catch(t){if(Yn&&Yn(t)===!0)return;throw t}}:n,Cn=[];function Qn(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 uo(n,e){var i,t;const o=new Ba;Cn.push(o),o.init(n);let s=window.MutationObserver||window.__rrMutationObserver;const a=(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");a&&window[a]&&(s=window[a]);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 Ra({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 a=[],l;const d=$n(q(g=>{const f=Date.now()-l;n(a.map(y=>(y.timeOffset-=f,y)),g),a=[],l=null}),s),v=q($n(q(g=>{const f=Qn(g),{clientX:y,clientY:k}=Yi(g)?g.changedTouches[0]:g;l||(l=gi()),a.push({x:y,y:k,id:t.getId(f),timeOffset:gi()-l}),d(typeof DragEvent<"u"&&g instanceof DragEvent?z.Drag:g instanceof MouseEvent?z.MouseMove:z.TouchMove)}),o,{trailing:!1})),p=[ke("mousemove",v,i),ke("touchmove",v,i),ke("drag",v,i)];return q(()=>{p.forEach(g=>g())})}function Oa({mouseInteractionCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};const a=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,l=[];let d=null;const v=p=>g=>{const f=Qn(g);if(Se(f,t,o,!0))return;let y=null,k=p;if("pointerType"in g){switch(g.pointerType){case"mouse":y=Je.Mouse;break;case"touch":y=Je.Touch;break;case"pen":y=Je.Pen;break}y===Je.Touch?Le[p]===Le.MouseDown?k="TouchStart":Le[p]===Le.MouseUp&&(k="TouchEnd"):Je.Pen}else Yi(g)&&(y=Je.Touch);y!==null?(d=y,(k.startsWith("Touch")&&y===Je.Touch||k.startsWith("Mouse")&&y===Je.Mouse)&&(y=null)):Le[p]===Le.Click&&(y=d,d=null);const C=Yi(g)?g.changedTouches[0]:g;if(!C)return;const S=i.getId(f),{clientX:M,clientY:A}=C;q(n)(Object.assign({type:Le[k],id:S,x:M,y:A},y!==null&&{pointerType:y}))};return Object.keys(Le).filter(p=>Number.isNaN(Number(p))&&!p.endsWith("_Departed")&&a[p]!==!1).forEach(p=>{let g=yn(p);const f=v(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(ke(g,f,e))}),q(()=>{l.forEach(p=>p())})}function ho({scrollCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){const a=q($n(q(l=>{const d=Qn(l);if(!d||Se(d,t,o,!0))return;const v=i.getId(d);if(d===e&&e.defaultView){const p=Jt(e.defaultView);n({id:v,x:p.left,y:p.top})}else n({id:v,x:d.scrollLeft,y:d.scrollTop})}),s.scroll||100));return ke("scroll",a,e)}function Ua({viewportResizeCb:n},{win:e}){let i=-1,t=-1;const o=q($n(q(()=>{const s=$t(),a=Yt();(i!==s||t!==a)&&(n({width:Number(a),height:Number(s)}),i=s,t=a)}),200));return ke("resize",o,e)}const Va=["INPUT","TEXTAREA","SELECT"],mo=new WeakMap;function ja({inputCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,ignoreClass:s,ignoreSelector:a,maskInputOptions:l,maskInputFn:d,sampling:v,userTriggeredOnInput:p}){function g(A){let _=Qn(A);const T=A.isTrusted,I=_&&_.tagName;if(_&&I==="OPTION"&&(_=_.parentElement),!_||!I||Va.indexOf(I)<0||Se(_,t,o,!0)||_.classList.contains(s)||a&&_.matches(a))return;let K=_.value,G=!1;const U=Zi(_)||"";U==="radio"||U==="checkbox"?G=_.checked:(l[I.toLowerCase()]||l[U])&&(K=Wi({element:_,maskInputOptions:l,tagName:I,type:U,value:K,maskInputFn:d})),f(_,p?{text:K,isChecked:G,userTriggered:T}:{text:K,isChecked:G});const F=_.name;U==="radio"&&F&&G&&e.querySelectorAll(`input[type="radio"][name="${F}"]`).forEach(oe=>{if(oe!==_){const ge=oe.value;f(oe,p?{text:ge,isChecked:!G,userTriggered:!1}:{text:ge,isChecked:!G})}})}function f(A,_){const T=mo.get(A);if(!T||T.text!==_.text||T.isChecked!==_.isChecked){mo.set(A,_);const I=i.getId(A);q(n)(Object.assign(Object.assign({},_),{id:I}))}}const k=(v.input==="last"?["change"]:["input","change"]).map(A=>ke(A,q(g),e)),C=e.defaultView;if(!C)return()=>{k.forEach(A=>A())};const S=C.Object.getOwnPropertyDescriptor(C.HTMLInputElement.prototype,"value"),M=[[C.HTMLInputElement.prototype,"value"],[C.HTMLInputElement.prototype,"checked"],[C.HTMLSelectElement.prototype,"value"],[C.HTMLTextAreaElement.prototype,"value"],[C.HTMLSelectElement.prototype,"selectedIndex"],[C.HTMLOptionElement.prototype,"selected"]];return S&&S.set&&k.push(...M.map(A=>fi(A[0],A[1],{set(){q(g)({target:this,isTrusted:!1})}},!1,C))),q(()=>{k.forEach(A=>A())})}function yi(n){const e=[];function i(t,o){if(Ci("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||Ci("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||Ci("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||Ci("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const a=Array.from(t.parentRule.cssRules).indexOf(t);o.unshift(a)}else if(t.parentStyleSheet){const a=Array.from(t.parentStyleSheet.cssRules).indexOf(t);o.unshift(a)}return o}return i(n,e)}function rn(n,e,i){let t,o;return n?(n.ownerNode?t=e.getId(n.ownerNode):o=i.getId(n),{styleId:o,id:t}):{}}function Ka({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,k]=f,{id:C,styleId:S}=rn(g,e,i.styleMirror);return(C&&C!==-1||S&&S!==-1)&&n({id:C,styleId:S,adds:[{rule:y,index:k}]}),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:k,styleId:C}=rn(g,e,i.styleMirror);return(k&&k!==-1||C&&C!==-1)&&n({id:k,styleId:C,removes:[{index:y}]}),p.apply(g,f)})});let a;t.CSSStyleSheet.prototype.replace&&(a=t.CSSStyleSheet.prototype.replace,t.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:q((p,g,f)=>{const[y]=f,{id:k,styleId:C}=rn(g,e,i.styleMirror);return(k&&k!==-1||C&&C!==-1)&&n({id:k,styleId:C,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:k,styleId:C}=rn(g,e,i.styleMirror);return(k&&k!==-1||C&&C!==-1)&&n({id:k,styleId:C,replaceSync:y}),p.apply(g,f)})}));const d={};wi("CSSGroupingRule")?d.CSSGroupingRule=t.CSSGroupingRule:(wi("CSSMediaRule")&&(d.CSSMediaRule=t.CSSMediaRule),wi("CSSConditionRule")&&(d.CSSConditionRule=t.CSSConditionRule),wi("CSSSupportsRule")&&(d.CSSSupportsRule=t.CSSSupportsRule));const v={};return Object.entries(d).forEach(([p,g])=>{v[p]={insertRule:g.prototype.insertRule,deleteRule:g.prototype.deleteRule},g.prototype.insertRule=new Proxy(v[p].insertRule,{apply:q((f,y,k)=>{const[C,S]=k,{id:M,styleId:A}=rn(y.parentStyleSheet,e,i.styleMirror);return(M&&M!==-1||A&&A!==-1)&&n({id:M,styleId:A,adds:[{rule:C,index:[...yi(y),S||0]}]}),f.apply(y,k)})}),g.prototype.deleteRule=new Proxy(v[p].deleteRule,{apply:q((f,y,k)=>{const[C]=k,{id:S,styleId:M}=rn(y.parentStyleSheet,e,i.styleMirror);return(S&&S!==-1||M&&M!==-1)&&n({id:S,styleId:M,removes:[{index:[...yi(y),C]}]}),f.apply(y,k)})})}),q(()=>{t.CSSStyleSheet.prototype.insertRule=o,t.CSSStyleSheet.prototype.deleteRule=s,a&&(t.CSSStyleSheet.prototype.replace=a),l&&(t.CSSStyleSheet.prototype.replaceSync=l),Object.entries(d).forEach(([p,g])=>{g.prototype.insertRule=v[p].insertRule,g.prototype.deleteRule=v[p].deleteRule})})}function po({mirror:n,stylesheetManager:e},i){var t,o,s;let a=null;i.nodeName==="#document"?a=n.getId(i):a=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,d=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!l||!d?()=>{}:(Object.defineProperty(i,"adoptedStyleSheets",{configurable:d.configurable,enumerable:d.enumerable,get(){var v;return(v=d.get)===null||v===void 0?void 0:v.call(this)},set(v){var p;const g=(p=d.set)===null||p===void 0?void 0:p.call(this,v);if(a!==null&&a!==-1)try{e.adoptStyleSheets(v,a)}catch{}return g}}),q(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:d.configurable,enumerable:d.enumerable,get:d.get,set:d.set})}))}function Fa({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,d,v)=>{var p;const[g,f,y]=v;if(i.has(g))return s.apply(d,[g,f,y]);const{id:k,styleId:C}=rn((p=d.parentRule)===null||p===void 0?void 0:p.parentStyleSheet,e,t.styleMirror);return(k&&k!==-1||C&&C!==-1)&&n({id:k,styleId:C,set:{property:g,value:f,priority:y},index:yi(d.parentRule)}),l.apply(d,v)})});const a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:q((l,d,v)=>{var p;const[g]=v;if(i.has(g))return a.apply(d,[g]);const{id:f,styleId:y}=rn((p=d.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:yi(d.parentRule)}),l.apply(d,v)})}),q(()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=a})}function Ga({mediaInteractionCb:n,blockClass:e,blockSelector:i,mirror:t,sampling:o,doc:s}){const a=q(d=>$n(q(v=>{const p=Qn(v);if(!p||Se(p,e,i,!0))return;const{currentTime:g,volume:f,muted:y,playbackRate:k,loop:C}=p;n({type:d,id:t.getId(p),currentTime:g,volume:f,muted:y,playbackRate:k,loop:C})}),o.media||500)),l=[ke("play",a(0),s),ke("pause",a(1),s),ke("seeked",a(2),s),ke("volumechange",a(3),s),ke("ratechange",a(4),s)];return q(()=>{l.forEach(d=>d())})}function za({fontCb:n,doc:e}){const i=e.defaultView;if(!i)return()=>{};const t=[],o=new WeakMap,s=i.FontFace;i.FontFace=function(d,v,p){const g=new s(d,v,p);return o.set(g,{family:d,buffer:typeof v!="string",descriptors:p,fontSource:typeof v=="string"?v:JSON.stringify(Array.from(new Uint8Array(v)))}),g};const a=Hn(e.fonts,"add",function(l){return function(d){return setTimeout(q(()=>{const v=o.get(d);v&&(n(v),o.delete(d))}),0),l.apply(this,[d])}});return t.push(()=>{i.FontFace=s}),t.push(a),q(()=>{t.forEach(l=>l())})}function qa(n){const{doc:e,mirror:i,blockClass:t,blockSelector:o,selectionCb:s}=n;let a=!0;const l=q(()=>{const d=e.getSelection();if(!d||a&&(d!=null&&d.isCollapsed))return;a=d.isCollapsed||!1;const v=[],p=d.rangeCount||0;for(let g=0;g<p;g++){const f=d.getRangeAt(g),{startContainer:y,startOffset:k,endContainer:C,endOffset:S}=f;Se(y,t,o,!0)||Se(C,t,o,!0)||v.push({start:i.getId(y),startOffset:k,end:i.getId(C),endOffset:S})}s({ranges:v})});return l(),ke("selectionchange",l)}function Wa({doc:n,customElementCb:e}){const i=n.defaultView;return!i||!i.customElements?()=>{}:Hn(i.customElements,"define",function(o){return function(s,a,l){try{e({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return o.apply(this,[s,a,l])}})}function Za(n,e){const{mutationCb:i,mousemoveCb:t,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:a,inputCb:l,mediaInteractionCb:d,styleSheetRuleCb:v,styleDeclarationCb:p,canvasMutationCb:g,fontCb:f,selectionCb:y,customElementCb:k}=n;n.mutationCb=(...C)=>{e.mutation&&e.mutation(...C),i(...C)},n.mousemoveCb=(...C)=>{e.mousemove&&e.mousemove(...C),t(...C)},n.mouseInteractionCb=(...C)=>{e.mouseInteraction&&e.mouseInteraction(...C),o(...C)},n.scrollCb=(...C)=>{e.scroll&&e.scroll(...C),s(...C)},n.viewportResizeCb=(...C)=>{e.viewportResize&&e.viewportResize(...C),a(...C)},n.inputCb=(...C)=>{e.input&&e.input(...C),l(...C)},n.mediaInteractionCb=(...C)=>{e.mediaInteaction&&e.mediaInteaction(...C),d(...C)},n.styleSheetRuleCb=(...C)=>{e.styleSheetRule&&e.styleSheetRule(...C),v(...C)},n.styleDeclarationCb=(...C)=>{e.styleDeclaration&&e.styleDeclaration(...C),p(...C)},n.canvasMutationCb=(...C)=>{e.canvasMutation&&e.canvasMutation(...C),g(...C)},n.fontCb=(...C)=>{e.font&&e.font(...C),f(...C)},n.selectionCb=(...C)=>{e.selection&&e.selection(...C),y(...C)},n.customElementCb=(...C)=>{e.customElement&&e.customElement(...C),k(...C)}}function Ja(n,e={}){const i=n.doc.defaultView;if(!i)return()=>{};Za(n,e);let t;n.recordDOM&&(t=uo(n,n.doc));const o=Ra(n),s=Oa(n),a=ho(n),l=Ua(n,{win:i}),d=ja(n),v=Ga(n);let p=()=>{},g=()=>{},f=()=>{},y=()=>{};n.recordDOM&&(p=Ka(n,{win:i}),g=po(n,n.doc),f=Fa(n,{win:i}),n.collectFonts&&(y=za(n)));const k=qa(n),C=Wa(n),S=[];for(const M of n.plugins)S.push(M.observer(M.callback,i,M.options));return q(()=>{Cn.forEach(M=>M.reset()),t==null||t.disconnect(),o(),s(),a(),l(),d(),v(),p(),g(),f(),y(),k(),C(),S.forEach(M=>M())})}function Ci(n){return typeof window[n]<"u"}function wi(n){return!!(typeof window[n]<"u"&&window[n].prototype&&"insertRule"in window[n].prototype&&"deleteRule"in window[n].prototype)}class vo{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,i,t,o){const s=t||this.getIdToRemoteIdMap(e),a=o||this.getRemoteIdToIdMap(e);let l=s.get(i);return l||(l=this.generateIdFn(),s.set(i,l),a.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 $a{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new vo(Ft),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new vo(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 Ya{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(!Zn(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const t=uo(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(ho(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(po({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(Hn(e.prototype,"attachShadow",function(o){return function(s){const a=o.call(this,s);return this.shadowRoot&&to(this)&&t.addShadowRoot(this.shadowRoot,i),a}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
956
956
  Copyright (c) Microsoft Corporation.
957
957
 
958
958
  Permission to use, copy, modify, and/or distribute this software for any
@@ -965,7 +965,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
965
965
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
966
966
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
967
967
  PERFORMANCE OF THIS SOFTWARE.
968
- ***************************************************************************** */function Qa(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 Xa(n,e,i,t){function o(s){return s instanceof i?s:new i(function(a){a(s)})}return new(i||(i=Promise))(function(s,a){function l(p){try{v(t.next(p))}catch(g){a(g)}}function d(p){try{v(t.throw(p))}catch(g){a(g)}}function v(p){p.done?s(p.value):o(p.value).then(l,d)}v((t=t.apply(n,[])).next())})}for(var On="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",er=typeof Uint8Array>"u"?[]:new Uint8Array(256),ki=0;ki<On.length;ki++)er[On.charCodeAt(ki)]=ki;var nr=function(n){var e=new Uint8Array(n),i,t=e.length,o="";for(i=0;i<t;i+=3)o+=On[e[i]>>2],o+=On[(e[i]&3)<<4|e[i+1]>>4],o+=On[(e[i+1]&15)<<2|e[i+2]>>6],o+=On[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 vo=new Map;function ir(n,e){let i=vo.get(n);return i||(i=new Map,vo.set(n,i)),i.has(e)||i.set(e,[]),i.get(e)}const bo=(n,e,i)=>{if(!n||!(go(n,e)||typeof n=="object"))return;const t=n.constructor.name,o=ir(i,t);let s=o.indexOf(n);return s===-1&&(s=o.length,o.push(n)),s};function Si(n,e,i){if(n instanceof Array)return n.map(t=>Si(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=nr(n);return{rr_type:t,base64:o}}else{if(n instanceof DataView)return{rr_type:n.constructor.name,args:[Si(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:[Si(n.data,e,i),n.width,n.height]};if(go(n,e)||typeof n=="object"){const t=n.constructor.name,o=bo(n,e,i);return{rr_type:t,index:o}}}}return n}const fo=(n,e,i)=>n.map(t=>Si(t,e,i)),go=(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 tr(n,e,i,t){const o=[],s=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const a of s)try{if(typeof e.CanvasRenderingContext2D.prototype[a]!="function")continue;const l=Hn(e.CanvasRenderingContext2D.prototype,a,function(d){return function(...v){return Se(this.canvas,i,t,!0)||setTimeout(()=>{const p=fo(v,e,this);n(this.canvas,{type:Rn["2D"],property:a,args:p})},0),d.apply(this,v)}});o.push(l)}catch{const d=fi(e.CanvasRenderingContext2D.prototype,a,{set(v){n(this.canvas,{type:Rn["2D"],property:a,args:[v],setter:!0})}});o.push(d)}return()=>{o.forEach(a=>a())}}function or(n){return n==="experimental-webgl"?"webgl":n}function yo(n,e,i,t){const o=[];try{const s=Hn(n.HTMLCanvasElement.prototype,"getContext",function(a){return function(l,...d){if(!Se(this,e,i,!0)){const v=or(l);if("__context"in this||(this.__context=v),t&&["webgl","webgl2"].includes(v))if(d[0]&&typeof d[0]=="object"){const p=d[0];p.preserveDrawingBuffer||(p.preserveDrawingBuffer=!0)}else d.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[l,...d])}});o.push(s)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(s=>s())}}function Co(n,e,i,t,o,s,a){const l=[],d=Object.getOwnPropertyNames(n);for(const v of d)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(v))try{if(typeof n[v]!="function")continue;const p=Hn(n,v,function(g){return function(...f){const y=g.apply(this,f);if(bo(y,a,this),"tagName"in this.canvas&&!Se(this.canvas,t,o,!0)){const k=fo(f,a,this),C={type:e,property:v,args:k};i(this.canvas,C)}return y}});l.push(p)}catch{const g=fi(n,v,{set(f){i(this.canvas,{type:e,property:v,args:[f],setter:!0})}});l.push(g)}return l}function sr(n,e,i,t,o){const s=[];return s.push(...Co(e.WebGLRenderingContext.prototype,Rn.WebGL,n,i,t,o,e)),typeof e.WebGL2RenderingContext<"u"&&s.push(...Co(e.WebGL2RenderingContext.prototype,Rn.WebGL2,n,i,t,o,e)),()=>{s.forEach(a=>a())}}function ar(n,e){var i=n.toString(),t=i.split(`
968
+ ***************************************************************************** */function Qa(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 Xa(n,e,i,t){function o(s){return s instanceof i?s:new i(function(a){a(s)})}return new(i||(i=Promise))(function(s,a){function l(p){try{v(t.next(p))}catch(g){a(g)}}function d(p){try{v(t.throw(p))}catch(g){a(g)}}function v(p){p.done?s(p.value):o(p.value).then(l,d)}v((t=t.apply(n,[])).next())})}for(var On="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",er=typeof Uint8Array>"u"?[]:new Uint8Array(256),ki=0;ki<On.length;ki++)er[On.charCodeAt(ki)]=ki;var nr=function(n){var e=new Uint8Array(n),i,t=e.length,o="";for(i=0;i<t;i+=3)o+=On[e[i]>>2],o+=On[(e[i]&3)<<4|e[i+1]>>4],o+=On[(e[i+1]&15)<<2|e[i+2]>>6],o+=On[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 bo=new Map;function ir(n,e){let i=bo.get(n);return i||(i=new Map,bo.set(n,i)),i.has(e)||i.set(e,[]),i.get(e)}const fo=(n,e,i)=>{if(!n||!(yo(n,e)||typeof n=="object"))return;const t=n.constructor.name,o=ir(i,t);let s=o.indexOf(n);return s===-1&&(s=o.length,o.push(n)),s};function Si(n,e,i){if(n instanceof Array)return n.map(t=>Si(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=nr(n);return{rr_type:t,base64:o}}else{if(n instanceof DataView)return{rr_type:n.constructor.name,args:[Si(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:[Si(n.data,e,i),n.width,n.height]};if(yo(n,e)||typeof n=="object"){const t=n.constructor.name,o=fo(n,e,i);return{rr_type:t,index:o}}}}return n}const go=(n,e,i)=>n.map(t=>Si(t,e,i)),yo=(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 tr(n,e,i,t){const o=[],s=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const a of s)try{if(typeof e.CanvasRenderingContext2D.prototype[a]!="function")continue;const l=Hn(e.CanvasRenderingContext2D.prototype,a,function(d){return function(...v){return Se(this.canvas,i,t,!0)||setTimeout(()=>{const p=go(v,e,this);n(this.canvas,{type:Rn["2D"],property:a,args:p})},0),d.apply(this,v)}});o.push(l)}catch{const d=fi(e.CanvasRenderingContext2D.prototype,a,{set(v){n(this.canvas,{type:Rn["2D"],property:a,args:[v],setter:!0})}});o.push(d)}return()=>{o.forEach(a=>a())}}function or(n){return n==="experimental-webgl"?"webgl":n}function Co(n,e,i,t){const o=[];try{const s=Hn(n.HTMLCanvasElement.prototype,"getContext",function(a){return function(l,...d){if(!Se(this,e,i,!0)){const v=or(l);if("__context"in this||(this.__context=v),t&&["webgl","webgl2"].includes(v))if(d[0]&&typeof d[0]=="object"){const p=d[0];p.preserveDrawingBuffer||(p.preserveDrawingBuffer=!0)}else d.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[l,...d])}});o.push(s)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(s=>s())}}function wo(n,e,i,t,o,s,a){const l=[],d=Object.getOwnPropertyNames(n);for(const v of d)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(v))try{if(typeof n[v]!="function")continue;const p=Hn(n,v,function(g){return function(...f){const y=g.apply(this,f);if(fo(y,a,this),"tagName"in this.canvas&&!Se(this.canvas,t,o,!0)){const k=go(f,a,this),C={type:e,property:v,args:k};i(this.canvas,C)}return y}});l.push(p)}catch{const g=fi(n,v,{set(f){i(this.canvas,{type:e,property:v,args:[f],setter:!0})}});l.push(g)}return l}function sr(n,e,i,t,o){const s=[];return s.push(...wo(e.WebGLRenderingContext.prototype,Rn.WebGL,n,i,t,o,e)),typeof e.WebGL2RenderingContext<"u"&&s.push(...wo(e.WebGL2RenderingContext.prototype,Rn.WebGL2,n,i,t,o,e)),()=>{s.forEach(a=>a())}}function ar(n,e){var i=n.toString(),t=i.split(`
969
969
  `);t.pop(),t.shift();for(var o=t[0].search(/\S/),s=/(['"])__worker_loader_strict__(['"])/g,a=0,l=t.length;a<l;++a)t[a]=t[a].substring(o).replace(s,"$1use strict$2")+`
970
970
  `;return t}function rr(n,e){var i=ar(n),t=new Blob(i,{type:"application/javascript"});return URL.createObjectURL(t)}function lr(n,e){var i;return function(o){return i=i||rr(n),new Worker(i,o)}}var dr=lr(function(){(function(){"__worker_loader_strict__";/*! *****************************************************************************
971
971
  Copyright (c) Microsoft Corporation.
@@ -980,13 +980,13 @@ or you can use record.mirror to access the mirror instance during recording.`;le
980
980
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
981
981
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
982
982
  PERFORMANCE OF THIS SOFTWARE.
983
- ***************************************************************************** */function n(v,p,g,f){function y(k){return k instanceof g?k:new g(function(C){C(k)})}return new(g||(g=Promise))(function(k,C){function S(_){try{A(f.next(_))}catch(T){C(T)}}function M(_){try{A(f.throw(_))}catch(T){C(T)}}function A(_){_.done?k(_.value):y(_.value).then(S,M)}A((f=f.apply(v,[])).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(v){var p=new Uint8Array(v),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,a=new Map;function l(v,p,g){return n(this,void 0,void 0,function*(){const f=`${v}-${p}`;if("OffscreenCanvas"in globalThis){if(a.has(f))return a.get(f);const y=new OffscreenCanvas(v,p);y.getContext("2d");const C=yield(yield y.convertToBlob(g)).arrayBuffer(),S=o(C);return a.set(f,S),S}else return""})}const d=self;d.onmessage=function(v){return n(this,void 0,void 0,function*(){if("OffscreenCanvas"in globalThis){const{id:p,bitmap:g,width:f,height:y,dataURLOptions:k}=v.data,C=l(f,y,k),S=new OffscreenCanvas(f,y);S.getContext("2d").drawImage(g,0,0),g.close();const A=yield S.convertToBlob(k),_=A.type,T=yield A.arrayBuffer(),I=o(T);if(!s.has(p)&&(yield C)===I)return s.set(p,I),d.postMessage({id:p});if(s.get(p)===I)return d.postMessage({id:p});d.postMessage({id:p,type:_,base64:I,width:f,height:y}),s.set(p,I)}else return d.postMessage({id:v.data.id})})}})()});class cr{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=(d,v)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(d)||this.pendingCanvasMutations.set(d,[]),this.pendingCanvasMutations.get(d).push(v)};const{sampling:i="all",win:t,blockClass:o,blockSelector:s,recordCanvas:a,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&i==="all"&&this.initCanvasMutationObserver(t,o,s),a&&typeof i=="number"&&this.initCanvasFPSObserver(i,t,o,s,{dataURLOptions:l})}initCanvasFPSObserver(e,i,t,o,s){const a=yo(i,t,o,!0),l=new Map,d=new dr;d.onmessage=k=>{const{id:C}=k.data;if(l.set(C,!1),!("base64"in k.data))return;const{base64:S,type:M,width:A,height:_}=k.data;this.mutationCb({id:C,type:Rn["2D"],commands:[{property:"clearRect",args:[0,0,A,_]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:M}]},0,0]}]})};const v=1e3/e;let p=0,g;const f=()=>{const k=[];return i.document.querySelectorAll("canvas").forEach(C=>{Se(C,t,o,!0)||k.push(C)}),k},y=k=>{if(p&&k-p<v){g=requestAnimationFrame(y);return}p=k,f().forEach(C=>Xa(this,void 0,void 0,function*(){var S;const M=this.mirror.getId(C);if(l.get(M)||C.width===0||C.height===0)return;if(l.set(M,!0),["webgl","webgl2"].includes(C.__context)){const _=C.getContext(C.__context);((S=_==null?void 0:_.getContextAttributes())===null||S===void 0?void 0:S.preserveDrawingBuffer)===!1&&_.clear(_.COLOR_BUFFER_BIT)}const A=yield createImageBitmap(C);d.postMessage({id:M,bitmap:A,width:C.width,height:C.height,dataURLOptions:s.dataURLOptions},[A])})),g=requestAnimationFrame(y)};g=requestAnimationFrame(y),this.resetObservers=()=>{a(),cancelAnimationFrame(g)}}initCanvasMutationObserver(e,i,t){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=yo(e,i,t,!1),s=tr(this.processMutation.bind(this),e,i,t),a=sr(this.processMutation.bind(this),e,i,t,this.mirror);this.resetObservers=()=>{o(),s(),a()}}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(a=>Qa(a,["type"])),{type:s}=t[0];this.mutationCb({id:i,type:s,commands:o}),this.pendingCanvasMutations.delete(e)}}class ur{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Ea,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 a;this.styleMirror.has(s)?a=this.styleMirror.getId(s):(a=this.styleMirror.add(s),o.push({styleId:a,rules:Array.from(s.rules||CSSRule,(l,d)=>({rule:Ot(l),index:d}))})),t.styleIds.push(a)}o.length>0&&(t.styles=o),this.adoptedStyleSheetCb(t)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class hr{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:gi()})}let ae,_i,Xi,Mi=!1;const Ue=sa();function Xn(n={}){const{emit:e,checkoutEveryNms:i,checkoutEveryNth:t,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:d="rr-mask",maskTextSelector:v=null,inlineStylesheet:p=!0,maskAllInputs:g,maskInputOptions:f,slimDOMOptions:y,maskInputFn:k,maskTextFn:C,hooks:S,packFn:M,sampling:A={},dataURLOptions:_={},mousemoveWait:T,recordDOM:I=!0,recordCanvas:K=!1,recordCrossOriginIframes:G=!1,recordAfter:V=n.recordAfter==="DOMContentLoaded"?n.recordAfter:"load",userTriggeredOnInput:F=!1,collectFonts:oe=!1,inlineImages:ge=!1,plugins:U,keepIframeSrcFn:_e=()=>!1,ignoreCSSAttributes:ue=new Set([]),errorHandler:Te}=n;Na(Te);const Me=G?window.parent===window:!0;let en=!1;if(!Me)try{window.parent.document&&(en=!1)}catch{en=!0}if(Me&&!e)throw new Error("emit function is required");T!==void 0&&A.mousemove===void 0&&(A.mousemove=T),Ue.reset();const vn=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},nn=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||{};Ta();let _n,bn=0;const Ee=B=>{for(const he of U||[])he.eventProcessor&&(B=he.eventProcessor(B));return M&&!en&&(B=M(B)),B};ae=(B,he)=>{var Q;if(!((Q=Cn[0])===null||Q===void 0)&&Q.isFrozen()&&B.type!==W.FullSnapshot&&!(B.type===W.IncrementalSnapshot&&B.data.source===z.Mutation)&&Cn.forEach(me=>me.unfreeze()),Me)e==null||e(Ee(B),he);else if(en){const me={type:"rrweb",event:Ee(B),origin:window.location.origin,isCheckout:he};window.parent.postMessage(me,"*")}if(B.type===W.FullSnapshot)_n=B,bn=0;else if(B.type===W.IncrementalSnapshot){if(B.data.source===z.Mutation&&B.data.isAttachIframe)return;bn++;const me=t&&bn>=t,Ie=i&&B.timestamp-_n.timestamp>i;(me||Ie)&&_i(!0)}};const tn=B=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Mutation},B)}))},Mn=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)})),fe=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.AdoptedStyleSheet},B)})),Re=new ur({mutationCb:tn,adoptedStyleSheetCb:fe}),Pe=new $a({mirror:Ue,mutationCb:tn,stylesheetManager:Re,recordCrossOriginIframes:G,wrappedEmit:ae});for(const B of U||[])B.getMirror&&B.getMirror({nodeMirror:Ue,crossOriginIframeMirror:Pe.crossOriginIframeMirror,crossOriginIframeStyleMirror:Pe.crossOriginIframeStyleMirror});const we=new hr;Xi=new cr({recordCanvas:K,mutationCb:re,win:window,blockClass:o,blockSelector:s,mirror:Ue,sampling:A.canvas,dataURLOptions:_});const We=new Ya({mutationCb:tn,scrollCb:Mn,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:d,maskTextSelector:v,inlineStylesheet:p,maskInputOptions:vn,dataURLOptions:_,maskTextFn:C,maskInputFn:k,recordCanvas:K,inlineImages:ge,sampling:A,slimDOMOptions:nn,iframeManager:Pe,stylesheetManager:Re,canvasManager:Xi,keepIframeSrcFn:_e,processedNodeManager:we},mirror:Ue});_i=(B=!1)=>{if(!I)return;ae(de({type:W.Meta,data:{href:window.location.href,width:$t(),height:Jt()}}),B),Re.reset(),We.init(),Cn.forEach(Q=>Q.lock());const he=xa(document,{mirror:Ue,blockClass:o,blockSelector:s,maskTextClass:d,maskTextSelector:v,inlineStylesheet:p,maskAllInputs:vn,maskTextFn:C,slimDOM:nn,dataURLOptions:_,recordCanvas:K,inlineImages:ge,onSerialize:Q=>{Xt(Q,Ue)&&Pe.addIframe(Q),eo(Q,Ue)&&Re.trackLinkElement(Q),Yi(Q)&&We.addShadowRoot(Q.shadowRoot,document)},onIframeLoad:(Q,me)=>{Pe.attachIframe(Q,me),We.observeAttachShadow(Q)},onStylesheetLoad:(Q,me)=>{Re.attachLinkElement(Q,me)},keepIframeSrcFn:_e});if(!he)return console.warn("Failed to snapshot the document");ae(de({type:W.FullSnapshot,data:{node:he,initialOffset:Zt(window)}}),B),Cn.forEach(Q=>Q.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Re.adoptStyleSheets(document.adoptedStyleSheets,Ue.getId(document))};try{const B=[],he=me=>{var Ie;return q(Ja)({mutationCb:tn,mousemoveCb:($,fn)=>ae(de({type:W.IncrementalSnapshot,data:{source:fn,positions:$}})),mouseInteractionCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.MouseInteraction},$)})),scrollCb:Mn,viewportResizeCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.ViewportResize},$)})),inputCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Input},$)})),mediaInteractionCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.MediaInteraction},$)})),styleSheetRuleCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.StyleSheetRule},$)})),styleDeclarationCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.StyleDeclaration},$)})),canvasMutationCb:re,fontCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Font},$)})),selectionCb:$=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Selection},$)}))},customElementCb:$=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.CustomElement},$)}))},blockClass:o,ignoreClass:a,ignoreSelector:l,maskTextClass:d,maskTextSelector:v,maskInputOptions:vn,inlineStylesheet:p,sampling:A,recordDOM:I,recordCanvas:K,inlineImages:ge,userTriggeredOnInput:F,collectFonts:oe,doc:me,maskInputFn:k,maskTextFn:C,keepIframeSrcFn:_e,blockSelector:s,slimDOMOptions:nn,dataURLOptions:_,mirror:Ue,iframeManager:Pe,stylesheetManager:Re,shadowDomManager:We,processedNodeManager:we,canvasManager:Xi,ignoreCSSAttributes:ue,plugins:((Ie=U==null?void 0:U.filter($=>$.observer))===null||Ie===void 0?void 0:Ie.map($=>({observer:$.observer,options:$.options,callback:fn=>ae(de({type:W.Plugin,data:{plugin:$.name,payload:fn}}))})))||[]},S)};Pe.addLoadListener(me=>{try{B.push(he(me.contentDocument))}catch(Ie){console.warn(Ie)}});const Q=()=>{_i(),B.push(he(document)),Mi=!0};return document.readyState==="interactive"||document.readyState==="complete"?Q():(B.push(ke("DOMContentLoaded",()=>{ae(de({type:W.DomContentLoaded,data:{}})),V==="DOMContentLoaded"&&Q()})),B.push(ke("load",()=>{ae(de({type:W.Load,data:{}})),V==="load"&&Q()},window))),()=>{B.forEach(me=>me()),we.destroy(),Mi=!1,Ha()}}catch(B){console.warn(B)}}Xn.addCustomEvent=(n,e)=>{if(!Mi)throw new Error("please add custom event after start recording");ae(de({type:W.Custom,data:{tag:n,payload:e}}))},Xn.freezePage=()=>{Cn.forEach(n=>n.freeze())},Xn.takeFullSnapshot=n=>{if(!Mi)throw new Error("please take full snapshot after start recording");_i(n)},Xn.mirror=Ue;var wo=(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))(wo||{}),Ge=(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))(Ge||{}),$e={DEBUG:!1,LIB_VERSION:"2.55.1"},N;if(typeof window>"u"){var ko={hostname:""};N={navigator:{userAgent:"",onLine:!0},document:{location:ko,referrer:""},screen:{width:0,height:0},location:ko}}else N=window;var ei=24*60*60*1e3,et=8*1e3,Ai=Array.prototype,mr=Function.prototype,So=Object.prototype,ln=Ai.slice,ni=So.toString,xi=So.hasOwnProperty,ce=N.console,dn=N.navigator,ee=N.document,Li=N.opera,Ti=N.screen,ze=dn.userAgent,nt=mr.bind,_o=Ai.forEach,Mo=Ai.indexOf,Ao=Ai.map,pr=Array.isArray,it={},m={trim:function(n){return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},J={log:function(){if($e.DEBUG&&!m.isUndefined(ce)&&ce)try{ce.log.apply(ce,arguments)}catch{m.each(arguments,function(e){ce.log(e)})}},warn:function(){if($e.DEBUG&&!m.isUndefined(ce)&&ce){var n=["Mixpanel warning:"].concat(m.toArray(arguments));try{ce.warn.apply(ce,n)}catch{m.each(n,function(i){ce.warn(i)})}}},error:function(){if($e.DEBUG&&!m.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(m.toArray(arguments));try{ce.error.apply(ce,n)}catch{m.each(n,function(i){ce.error(i)})}}},critical:function(){if(!m.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(m.toArray(arguments));try{ce.error.apply(ce,n)}catch{m.each(n,function(i){ce.error(i)})}}}},tt=function(n,e){return function(){return arguments[0]="["+e+"] "+arguments[0],n.apply(J,arguments)}},Ei=function(n){return{log:tt(J.log,n),error:tt(J.error,n),critical:tt(J.critical,n)}};m.bind=function(n,e){var i,t;if(nt&&n.bind===nt)return nt.apply(n,ln.call(arguments,1));if(!m.isFunction(n))throw new TypeError;return i=ln.call(arguments,2),t=function(){if(!(this instanceof t))return n.apply(e,i.concat(ln.call(arguments)));var o={};o.prototype=n.prototype;var s=new o;o.prototype=null;var a=n.apply(s,i.concat(ln.call(arguments)));return Object(a)===a?a:s},t},m.each=function(n,e,i){if(n!=null){if(_o&&n.forEach===_o)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)===it)return}else for(var s in n)if(xi.call(n,s)&&e.call(i,n[s],s,n)===it)return}},m.extend=function(n){return m.each(ln.call(arguments,1),function(e){for(var i in e)e[i]!==void 0&&(n[i]=e[i])}),n},m.isArray=pr||function(n){return ni.call(n)==="[object Array]"},m.isFunction=function(n){try{return/^\s*\bfunction\b/.test(n)}catch{return!1}},m.isArguments=function(n){return!!(n&&xi.call(n,"callee"))},m.toArray=function(n){return n?n.toArray?n.toArray():m.isArray(n)||m.isArguments(n)?ln.call(n):m.values(n):[]},m.map=function(n,e,i){if(Ao&&n.map===Ao)return n.map(e,i);var t=[];return m.each(n,function(o){t.push(e.call(i,o))}),t},m.keys=function(n){var e=[];return n===null||m.each(n,function(i,t){e[e.length]=t}),e},m.values=function(n){var e=[];return n===null||m.each(n,function(i){e[e.length]=i}),e},m.include=function(n,e){var i=!1;return n===null?i:Mo&&n.indexOf===Mo?n.indexOf(e)!=-1:(m.each(n,function(t){if(i||(i=t===e))return it}),i)},m.includes=function(n,e){return n.indexOf(e)!==-1},m.inherit=function(n,e){return n.prototype=new e,n.prototype.constructor=n,n.superclass=e.prototype,n},m.isObject=function(n){return n===Object(n)&&!m.isArray(n)},m.isEmptyObject=function(n){if(m.isObject(n)){for(var e in n)if(xi.call(n,e))return!1;return!0}return!1},m.isUndefined=function(n){return n===void 0},m.isString=function(n){return ni.call(n)=="[object String]"},m.isDate=function(n){return ni.call(n)=="[object Date]"},m.isNumber=function(n){return ni.call(n)=="[object Number]"},m.isElement=function(n){return!!(n&&n.nodeType===1)},m.encodeDates=function(n){return m.each(n,function(e,i){m.isDate(e)?n[i]=m.formatDate(e):m.isObject(e)&&(n[i]=m.encodeDates(e))}),n},m.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},m.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())},m.strip_empty_properties=function(n){var e={};return m.each(n,function(i,t){m.isString(i)&&i.length>0&&(e[t]=i)}),e},m.truncate=function(n,e){var i;return typeof n=="string"?i=n.slice(0,e):m.isArray(n)?(i=[],m.each(n,function(t){i.push(m.truncate(t,e))})):m.isObject(n)?(i={},m.each(n,function(t,o){i[o]=m.truncate(t,e)})):i=n,i},m.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,a={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return s.lastIndex=0,s.test(o)?'"'+o.replace(s,function(l){var d=a[l];return typeof d=="string"?d:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+o+'"'},t=function(o,s){var a="",l=" ",d=0,v="",p="",g=0,f=a,y=[],k=s[o];switch(k&&typeof k=="object"&&typeof k.toJSON=="function"&&(k=k.toJSON(o)),typeof k){case"string":return i(k);case"number":return isFinite(k)?String(k):"null";case"boolean":case"null":return String(k);case"object":if(!k)return"null";if(a+=l,y=[],ni.apply(k)==="[object Array]"){for(g=k.length,d=0;d<g;d+=1)y[d]=t(d,k)||"null";return p=y.length===0?"[]":a?`[
983
+ ***************************************************************************** */function n(v,p,g,f){function y(k){return k instanceof g?k:new g(function(C){C(k)})}return new(g||(g=Promise))(function(k,C){function S(_){try{A(f.next(_))}catch(T){C(T)}}function M(_){try{A(f.throw(_))}catch(T){C(T)}}function A(_){_.done?k(_.value):y(_.value).then(S,M)}A((f=f.apply(v,[])).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(v){var p=new Uint8Array(v),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,a=new Map;function l(v,p,g){return n(this,void 0,void 0,function*(){const f=`${v}-${p}`;if("OffscreenCanvas"in globalThis){if(a.has(f))return a.get(f);const y=new OffscreenCanvas(v,p);y.getContext("2d");const C=yield(yield y.convertToBlob(g)).arrayBuffer(),S=o(C);return a.set(f,S),S}else return""})}const d=self;d.onmessage=function(v){return n(this,void 0,void 0,function*(){if("OffscreenCanvas"in globalThis){const{id:p,bitmap:g,width:f,height:y,dataURLOptions:k}=v.data,C=l(f,y,k),S=new OffscreenCanvas(f,y);S.getContext("2d").drawImage(g,0,0),g.close();const A=yield S.convertToBlob(k),_=A.type,T=yield A.arrayBuffer(),I=o(T);if(!s.has(p)&&(yield C)===I)return s.set(p,I),d.postMessage({id:p});if(s.get(p)===I)return d.postMessage({id:p});d.postMessage({id:p,type:_,base64:I,width:f,height:y}),s.set(p,I)}else return d.postMessage({id:v.data.id})})}})()});class cr{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=(d,v)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(d)||this.pendingCanvasMutations.set(d,[]),this.pendingCanvasMutations.get(d).push(v)};const{sampling:i="all",win:t,blockClass:o,blockSelector:s,recordCanvas:a,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&i==="all"&&this.initCanvasMutationObserver(t,o,s),a&&typeof i=="number"&&this.initCanvasFPSObserver(i,t,o,s,{dataURLOptions:l})}initCanvasFPSObserver(e,i,t,o,s){const a=Co(i,t,o,!0),l=new Map,d=new dr;d.onmessage=k=>{const{id:C}=k.data;if(l.set(C,!1),!("base64"in k.data))return;const{base64:S,type:M,width:A,height:_}=k.data;this.mutationCb({id:C,type:Rn["2D"],commands:[{property:"clearRect",args:[0,0,A,_]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:M}]},0,0]}]})};const v=1e3/e;let p=0,g;const f=()=>{const k=[];return i.document.querySelectorAll("canvas").forEach(C=>{Se(C,t,o,!0)||k.push(C)}),k},y=k=>{if(p&&k-p<v){g=requestAnimationFrame(y);return}p=k,f().forEach(C=>Xa(this,void 0,void 0,function*(){var S;const M=this.mirror.getId(C);if(l.get(M)||C.width===0||C.height===0)return;if(l.set(M,!0),["webgl","webgl2"].includes(C.__context)){const _=C.getContext(C.__context);((S=_==null?void 0:_.getContextAttributes())===null||S===void 0?void 0:S.preserveDrawingBuffer)===!1&&_.clear(_.COLOR_BUFFER_BIT)}const A=yield createImageBitmap(C);d.postMessage({id:M,bitmap:A,width:C.width,height:C.height,dataURLOptions:s.dataURLOptions},[A])})),g=requestAnimationFrame(y)};g=requestAnimationFrame(y),this.resetObservers=()=>{a(),cancelAnimationFrame(g)}}initCanvasMutationObserver(e,i,t){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=Co(e,i,t,!1),s=tr(this.processMutation.bind(this),e,i,t),a=sr(this.processMutation.bind(this),e,i,t,this.mirror);this.resetObservers=()=>{o(),s(),a()}}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(a=>Qa(a,["type"])),{type:s}=t[0];this.mutationCb({id:i,type:s,commands:o}),this.pendingCanvasMutations.delete(e)}}class ur{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Ea,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 a;this.styleMirror.has(s)?a=this.styleMirror.getId(s):(a=this.styleMirror.add(s),o.push({styleId:a,rules:Array.from(s.rules||CSSRule,(l,d)=>({rule:Ut(l),index:d}))})),t.styleIds.push(a)}o.length>0&&(t.styles=o),this.adoptedStyleSheetCb(t)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class hr{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:gi()})}let ae,_i,et,Mi=!1;const Ve=sa();function Xn(n={}){const{emit:e,checkoutEveryNms:i,checkoutEveryNth:t,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:d="rr-mask",maskTextSelector:v=null,inlineStylesheet:p=!0,maskAllInputs:g,maskInputOptions:f,slimDOMOptions:y,maskInputFn:k,maskTextFn:C,hooks:S,packFn:M,sampling:A={},dataURLOptions:_={},mousemoveWait:T,recordDOM:I=!0,recordCanvas:K=!1,recordCrossOriginIframes:G=!1,recordAfter:U=n.recordAfter==="DOMContentLoaded"?n.recordAfter:"load",userTriggeredOnInput:F=!1,collectFonts:oe=!1,inlineImages:ge=!1,plugins:V,keepIframeSrcFn:_e=()=>!1,ignoreCSSAttributes:ue=new Set([]),errorHandler:Te}=n;Na(Te);const Me=G?window.parent===window:!0;let en=!1;if(!Me)try{window.parent.document&&(en=!1)}catch{en=!0}if(Me&&!e)throw new Error("emit function is required");T!==void 0&&A.mousemove===void 0&&(A.mousemove=T),Ve.reset();const vn=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},nn=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||{};Ta();let _n,bn=0;const Ee=B=>{for(const he of V||[])he.eventProcessor&&(B=he.eventProcessor(B));return M&&!en&&(B=M(B)),B};ae=(B,he)=>{var Q;if(!((Q=Cn[0])===null||Q===void 0)&&Q.isFrozen()&&B.type!==W.FullSnapshot&&!(B.type===W.IncrementalSnapshot&&B.data.source===z.Mutation)&&Cn.forEach(me=>me.unfreeze()),Me)e==null||e(Ee(B),he);else if(en){const me={type:"rrweb",event:Ee(B),origin:window.location.origin,isCheckout:he};window.parent.postMessage(me,"*")}if(B.type===W.FullSnapshot)_n=B,bn=0;else if(B.type===W.IncrementalSnapshot){if(B.data.source===z.Mutation&&B.data.isAttachIframe)return;bn++;const me=t&&bn>=t,Ie=i&&B.timestamp-_n.timestamp>i;(me||Ie)&&_i(!0)}};const tn=B=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Mutation},B)}))},Mn=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)})),fe=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.AdoptedStyleSheet},B)})),Re=new ur({mutationCb:tn,adoptedStyleSheetCb:fe}),Pe=new $a({mirror:Ve,mutationCb:tn,stylesheetManager:Re,recordCrossOriginIframes:G,wrappedEmit:ae});for(const B of V||[])B.getMirror&&B.getMirror({nodeMirror:Ve,crossOriginIframeMirror:Pe.crossOriginIframeMirror,crossOriginIframeStyleMirror:Pe.crossOriginIframeStyleMirror});const we=new hr;et=new cr({recordCanvas:K,mutationCb:re,win:window,blockClass:o,blockSelector:s,mirror:Ve,sampling:A.canvas,dataURLOptions:_});const We=new Ya({mutationCb:tn,scrollCb:Mn,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:d,maskTextSelector:v,inlineStylesheet:p,maskInputOptions:vn,dataURLOptions:_,maskTextFn:C,maskInputFn:k,recordCanvas:K,inlineImages:ge,sampling:A,slimDOMOptions:nn,iframeManager:Pe,stylesheetManager:Re,canvasManager:et,keepIframeSrcFn:_e,processedNodeManager:we},mirror:Ve});_i=(B=!1)=>{if(!I)return;ae(de({type:W.Meta,data:{href:window.location.href,width:Yt(),height:$t()}}),B),Re.reset(),We.init(),Cn.forEach(Q=>Q.lock());const he=xa(document,{mirror:Ve,blockClass:o,blockSelector:s,maskTextClass:d,maskTextSelector:v,inlineStylesheet:p,maskAllInputs:vn,maskTextFn:C,slimDOM:nn,dataURLOptions:_,recordCanvas:K,inlineImages:ge,onSerialize:Q=>{eo(Q,Ve)&&Pe.addIframe(Q),no(Q,Ve)&&Re.trackLinkElement(Q),Qi(Q)&&We.addShadowRoot(Q.shadowRoot,document)},onIframeLoad:(Q,me)=>{Pe.attachIframe(Q,me),We.observeAttachShadow(Q)},onStylesheetLoad:(Q,me)=>{Re.attachLinkElement(Q,me)},keepIframeSrcFn:_e});if(!he)return console.warn("Failed to snapshot the document");ae(de({type:W.FullSnapshot,data:{node:he,initialOffset:Jt(window)}}),B),Cn.forEach(Q=>Q.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Re.adoptStyleSheets(document.adoptedStyleSheets,Ve.getId(document))};try{const B=[],he=me=>{var Ie;return q(Ja)({mutationCb:tn,mousemoveCb:($,fn)=>ae(de({type:W.IncrementalSnapshot,data:{source:fn,positions:$}})),mouseInteractionCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.MouseInteraction},$)})),scrollCb:Mn,viewportResizeCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.ViewportResize},$)})),inputCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Input},$)})),mediaInteractionCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.MediaInteraction},$)})),styleSheetRuleCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.StyleSheetRule},$)})),styleDeclarationCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.StyleDeclaration},$)})),canvasMutationCb:re,fontCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Font},$)})),selectionCb:$=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.Selection},$)}))},customElementCb:$=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:z.CustomElement},$)}))},blockClass:o,ignoreClass:a,ignoreSelector:l,maskTextClass:d,maskTextSelector:v,maskInputOptions:vn,inlineStylesheet:p,sampling:A,recordDOM:I,recordCanvas:K,inlineImages:ge,userTriggeredOnInput:F,collectFonts:oe,doc:me,maskInputFn:k,maskTextFn:C,keepIframeSrcFn:_e,blockSelector:s,slimDOMOptions:nn,dataURLOptions:_,mirror:Ve,iframeManager:Pe,stylesheetManager:Re,shadowDomManager:We,processedNodeManager:we,canvasManager:et,ignoreCSSAttributes:ue,plugins:((Ie=V==null?void 0:V.filter($=>$.observer))===null||Ie===void 0?void 0:Ie.map($=>({observer:$.observer,options:$.options,callback:fn=>ae(de({type:W.Plugin,data:{plugin:$.name,payload:fn}}))})))||[]},S)};Pe.addLoadListener(me=>{try{B.push(he(me.contentDocument))}catch(Ie){console.warn(Ie)}});const Q=()=>{_i(),B.push(he(document)),Mi=!0};return document.readyState==="interactive"||document.readyState==="complete"?Q():(B.push(ke("DOMContentLoaded",()=>{ae(de({type:W.DomContentLoaded,data:{}})),U==="DOMContentLoaded"&&Q()})),B.push(ke("load",()=>{ae(de({type:W.Load,data:{}})),U==="load"&&Q()},window))),()=>{B.forEach(me=>me()),we.destroy(),Mi=!1,Ha()}}catch(B){console.warn(B)}}Xn.addCustomEvent=(n,e)=>{if(!Mi)throw new Error("please add custom event after start recording");ae(de({type:W.Custom,data:{tag:n,payload:e}}))},Xn.freezePage=()=>{Cn.forEach(n=>n.freeze())},Xn.takeFullSnapshot=n=>{if(!Mi)throw new Error("please take full snapshot after start recording");_i(n)},Xn.mirror=Ve;var ko=(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))(ko||{}),Ge=(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))(Ge||{}),$e={DEBUG:!1,LIB_VERSION:"2.55.1"},N;if(typeof window>"u"){var So={hostname:""};N={navigator:{userAgent:"",onLine:!0},document:{location:So,referrer:""},screen:{width:0,height:0},location:So}}else N=window;var ei=24*60*60*1e3,nt=8*1e3,Ai=Array.prototype,mr=Function.prototype,_o=Object.prototype,ln=Ai.slice,ni=_o.toString,xi=_o.hasOwnProperty,ce=N.console,dn=N.navigator,ee=N.document,Li=N.opera,Ti=N.screen,ze=dn.userAgent,it=mr.bind,Mo=Ai.forEach,Ao=Ai.indexOf,xo=Ai.map,pr=Array.isArray,tt={},m={trim:function(n){return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},J={log:function(){if($e.DEBUG&&!m.isUndefined(ce)&&ce)try{ce.log.apply(ce,arguments)}catch{m.each(arguments,function(e){ce.log(e)})}},warn:function(){if($e.DEBUG&&!m.isUndefined(ce)&&ce){var n=["Mixpanel warning:"].concat(m.toArray(arguments));try{ce.warn.apply(ce,n)}catch{m.each(n,function(i){ce.warn(i)})}}},error:function(){if($e.DEBUG&&!m.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(m.toArray(arguments));try{ce.error.apply(ce,n)}catch{m.each(n,function(i){ce.error(i)})}}},critical:function(){if(!m.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(m.toArray(arguments));try{ce.error.apply(ce,n)}catch{m.each(n,function(i){ce.error(i)})}}}},ot=function(n,e){return function(){return arguments[0]="["+e+"] "+arguments[0],n.apply(J,arguments)}},Ei=function(n){return{log:ot(J.log,n),error:ot(J.error,n),critical:ot(J.critical,n)}};m.bind=function(n,e){var i,t;if(it&&n.bind===it)return it.apply(n,ln.call(arguments,1));if(!m.isFunction(n))throw new TypeError;return i=ln.call(arguments,2),t=function(){if(!(this instanceof t))return n.apply(e,i.concat(ln.call(arguments)));var o={};o.prototype=n.prototype;var s=new o;o.prototype=null;var a=n.apply(s,i.concat(ln.call(arguments)));return Object(a)===a?a:s},t},m.each=function(n,e,i){if(n!=null){if(Mo&&n.forEach===Mo)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)===tt)return}else for(var s in n)if(xi.call(n,s)&&e.call(i,n[s],s,n)===tt)return}},m.extend=function(n){return m.each(ln.call(arguments,1),function(e){for(var i in e)e[i]!==void 0&&(n[i]=e[i])}),n},m.isArray=pr||function(n){return ni.call(n)==="[object Array]"},m.isFunction=function(n){try{return/^\s*\bfunction\b/.test(n)}catch{return!1}},m.isArguments=function(n){return!!(n&&xi.call(n,"callee"))},m.toArray=function(n){return n?n.toArray?n.toArray():m.isArray(n)||m.isArguments(n)?ln.call(n):m.values(n):[]},m.map=function(n,e,i){if(xo&&n.map===xo)return n.map(e,i);var t=[];return m.each(n,function(o){t.push(e.call(i,o))}),t},m.keys=function(n){var e=[];return n===null||m.each(n,function(i,t){e[e.length]=t}),e},m.values=function(n){var e=[];return n===null||m.each(n,function(i){e[e.length]=i}),e},m.include=function(n,e){var i=!1;return n===null?i:Ao&&n.indexOf===Ao?n.indexOf(e)!=-1:(m.each(n,function(t){if(i||(i=t===e))return tt}),i)},m.includes=function(n,e){return n.indexOf(e)!==-1},m.inherit=function(n,e){return n.prototype=new e,n.prototype.constructor=n,n.superclass=e.prototype,n},m.isObject=function(n){return n===Object(n)&&!m.isArray(n)},m.isEmptyObject=function(n){if(m.isObject(n)){for(var e in n)if(xi.call(n,e))return!1;return!0}return!1},m.isUndefined=function(n){return n===void 0},m.isString=function(n){return ni.call(n)=="[object String]"},m.isDate=function(n){return ni.call(n)=="[object Date]"},m.isNumber=function(n){return ni.call(n)=="[object Number]"},m.isElement=function(n){return!!(n&&n.nodeType===1)},m.encodeDates=function(n){return m.each(n,function(e,i){m.isDate(e)?n[i]=m.formatDate(e):m.isObject(e)&&(n[i]=m.encodeDates(e))}),n},m.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},m.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())},m.strip_empty_properties=function(n){var e={};return m.each(n,function(i,t){m.isString(i)&&i.length>0&&(e[t]=i)}),e},m.truncate=function(n,e){var i;return typeof n=="string"?i=n.slice(0,e):m.isArray(n)?(i=[],m.each(n,function(t){i.push(m.truncate(t,e))})):m.isObject(n)?(i={},m.each(n,function(t,o){i[o]=m.truncate(t,e)})):i=n,i},m.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,a={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return s.lastIndex=0,s.test(o)?'"'+o.replace(s,function(l){var d=a[l];return typeof d=="string"?d:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+o+'"'},t=function(o,s){var a="",l=" ",d=0,v="",p="",g=0,f=a,y=[],k=s[o];switch(k&&typeof k=="object"&&typeof k.toJSON=="function"&&(k=k.toJSON(o)),typeof k){case"string":return i(k);case"number":return isFinite(k)?String(k):"null";case"boolean":case"null":return String(k);case"object":if(!k)return"null";if(a+=l,y=[],ni.apply(k)==="[object Array]"){for(g=k.length,d=0;d<g;d+=1)y[d]=t(d,k)||"null";return p=y.length===0?"[]":a?`[
984
984
  `+a+y.join(`,
985
985
  `+a)+`
986
986
  `+f+"]":"["+y.join(",")+"]",a=f,p}for(v in k)xi.call(k,v)&&(p=t(v,k),p&&y.push(i(v)+(a?": ":":")+p));return p=y.length===0?"{}":a?"{"+y.join(",")+f+"}":"{"+y.join(",")+"}",a=f,p}};return t("",{"":e})}}(),m.JSONDecode=function(){var n,e,i={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
987
987
  `,r:"\r",t:" "},t,o=function(y){var k=new SyntaxError(y);throw k.at=n,k.text=t,k},s=function(y){return y&&y!==e&&o("Expected '"+y+"' instead of '"+e+"'"),e=t.charAt(n),n+=1,e},a=function(){var y,k="";for(e==="-"&&(k="-",s("-"));e>="0"&&e<="9";)k+=e,s();if(e===".")for(k+=".";s()&&e>="0"&&e<="9";)k+=e;if(e==="e"||e==="E")for(k+=e,s(),(e==="-"||e==="+")&&(k+=e,s());e>="0"&&e<="9";)k+=e,s();if(y=+k,!isFinite(y))o("Bad number");else return y},l=function(){var y,k,C="",S;if(e==='"')for(;s();){if(e==='"')return s(),C;if(e==="\\")if(s(),e==="u"){for(S=0,k=0;k<4&&(y=parseInt(s(),16),!!isFinite(y));k+=1)S=S*16+y;C+=String.fromCharCode(S)}else if(typeof i[e]=="string")C+=i[e];else break;else C+=e}o("Bad string")},d=function(){for(;e&&e<=" ";)s()},v=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("["),d(),e==="]")return s("]"),y;for(;e;){if(y.push(p()),d(),e==="]")return s("]"),y;s(","),d()}}o("Bad array")},f=function(){var y,k={};if(e==="{"){if(s("{"),d(),e==="}")return s("}"),k;for(;e;){if(y=l(),d(),s(":"),Object.hasOwnProperty.call(k,y)&&o('Duplicate key "'+y+'"'),k[y]=p(),d(),e==="}")return s("}"),k;s(","),d()}}o("Bad object")};return p=function(){switch(d(),e){case"{":return f();case"[":return g();case'"':return l();case"-":return a();default:return e>="0"&&e<="9"?a():v()}},function(y){var k;return t=y,n=0,e=" ",k=p(),d(),e&&o("Syntax error"),k}}(),m.base64Encode=function(n){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i,t,o,s,a,l,d,v,p=0,g=0,f="",y=[];if(!n)return n;n=m.utf8Encode(n);do i=n.charCodeAt(p++),t=n.charCodeAt(p++),o=n.charCodeAt(p++),v=i<<16|t<<8|o,s=v>>18&63,a=v>>12&63,l=v>>6&63,d=v&63,y[g++]=e.charAt(s)+e.charAt(a)+e.charAt(l)+e.charAt(d);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},m.utf8Encode=function(n){n=(n+"").replace(/\r\n/g,`
988
988
  `).replace(/\r/g,`
989
- `);var e="",i,t,o=0,s;for(i=t=0,o=n.length,s=0;s<o;s++){var a=n.charCodeAt(s),l=null;a<128?t++:a>127&&a<2048?l=String.fromCharCode(a>>6|192,a&63|128):l=String.fromCharCode(a>>12|224,a>>6&63|128,a&63|128),l!==null&&(t>i&&(e+=n.substring(i,t)),e+=l,i=t=s+1)}return t>i&&(e+=n.substring(i,n.length)),e},m.UUID=function(){var n=function(){var t=1*new Date,o;if(N.performance&&N.performance.now)o=N.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=ze,o,s,a=[],l=0;function d(v,p){var g,f=0;for(g=0;g<p.length;g++)f|=a[g]<<g*8;return v^f}for(o=0;o<t.length;o++)s=t.charCodeAt(o),a.unshift(s&255),a.length>=4&&(l=d(l,a),a=[]);return a.length>0&&(l=d(l,a)),l.toString(16)};return function(){var t=(Ti.height*Ti.width).toString(16);return n()+"-"+e()+"-"+i()+"-"+t+"-"+n()}}();var xo=["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"];m.isBlockedUA=function(n){var e;for(n=n.toLowerCase(),e=0;e<xo.length;e++)if(n.indexOf(xo[e])!==-1)return!0;return!1},m.HTTPBuildQuery=function(n,e){var i,t,o=[];return m.isUndefined(e)&&(e="&"),m.each(n,function(s,a){i=encodeURIComponent(s.toString()),t=encodeURIComponent(a),o[o.length]=t+"="+i}),o.join(e)},m.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," ")},m.cookie={get:function(n){for(var e=n+"=",i=ee.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=m.JSONDecode(m.cookie.get(n))||{}}catch{}return e},set_seconds:function(n,e,i,t,o,s,a){var l="",d="",v="";if(a)l="; domain="+a;else if(t){var p=Lo(ee.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*1e3),d="; expires="+g.toGMTString()}s&&(o=!0,v="; SameSite=None"),o&&(v+="; secure"),ee.cookie=n+"="+encodeURIComponent(e)+d+"; path=/"+l+v},set:function(n,e,i,t,o,s,a){var l="",d="",v="";if(a)l="; domain="+a;else if(t){var p=Lo(ee.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*24*60*60*1e3),d="; expires="+g.toGMTString()}s&&(o=!0,v="; SameSite=None"),o&&(v+="; secure");var f=n+"="+encodeURIComponent(e)+d+"; path=/"+l+v;return ee.cookie=f,f},remove:function(n,e,i){m.cookie.set(n,"",-1,e,!1,!1,i)}};var ot=null,Pi=function(n,e){if(ot!==null&&!e)return ot;var i=!0;try{n=n||window.localStorage;var t="__mplss_"+st(8),o="xyz";n.setItem(t,o),n.getItem(t)!==o&&(i=!1),n.removeItem(t)}catch{i=!1}return ot=i,i};m.localStorage={is_supported:function(n){var e=Pi(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){m.localStorage.error(e)}return null},parse:function(n){try{return m.JSONDecode(m.localStorage.get(n))||{}}catch{}return null},set:function(n,e){try{window.localStorage.setItem(n,e)}catch(i){m.localStorage.error(i)}},remove:function(n){try{window.localStorage.removeItem(n)}catch(e){m.localStorage.error(e)}}},m.register_event=function(){var n=function(t,o,s,a,l){if(!t){J.error("No valid element provided to register_event");return}if(t.addEventListener&&!a)t.addEventListener(o,s,!!l);else{var d="on"+o,v=t[d];t[d]=e(t,s,v)}};function e(t,o,s){var a=function(l){if(l=l||i(window.event),!!l){var d=!0,v,p;return m.isFunction(s)&&(v=s(l)),p=o.call(t,l),(v===!1||p===!1)&&(d=!1),d}};return a}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 vr=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');m.dom_query=function(){function n(o){return o.all?o.all:o.getElementsByTagName("*")}var e=/[\t\r\n]/g;function i(o,s){var a=" "+s+" ";return(" "+o.className+" ").replace(e," ").indexOf(a)>=0}function t(o){if(!ee.getElementsByTagName)return[];var s=o.split(" "),a,l,d,v,p,g,f,y,k,C,S=[ee];for(g=0;g<s.length;g++){if(a=s[g].replace(/^\s+/,"").replace(/\s+$/,""),a.indexOf("#")>-1){l=a.split("#"),d=l[0];var M=l[1],A=ee.getElementById(M);if(!A||d&&A.nodeName.toLowerCase()!=d)return[];S=[A];continue}if(a.indexOf(".")>-1){l=a.split("."),d=l[0];var _=l[1];for(d||(d="*"),v=[],p=0,f=0;f<S.length;f++)for(d=="*"?k=n(S[f]):k=S[f].getElementsByTagName(d),y=0;y<k.length;y++)v[p++]=k[y];for(S=[],C=0,f=0;f<v.length;f++)v[f].className&&m.isString(v[f].className)&&i(v[f],_)&&(S[C++]=v[f]);continue}var T=a.match(vr);if(T){d=T[1];var I=T[2],K=T[3],G=T[4];for(d||(d="*"),v=[],p=0,f=0;f<S.length;f++)for(d=="*"?k=n(S[f]):k=S[f].getElementsByTagName(d),y=0;y<k.length;y++)v[p++]=k[y];S=[],C=0;var V;switch(K){case"=":V=function(F){return F.getAttribute(I)==G};break;case"~":V=function(F){return F.getAttribute(I).match(new RegExp("\\b"+G+"\\b"))};break;case"|":V=function(F){return F.getAttribute(I).match(new RegExp("^"+G+"-?"))};break;case"^":V=function(F){return F.getAttribute(I).indexOf(G)===0};break;case"$":V=function(F){return F.getAttribute(I).lastIndexOf(G)==F.getAttribute(I).length-G.length};break;case"*":V=function(F){return F.getAttribute(I).indexOf(G)>-1};break;default:V=function(F){return F.getAttribute(I)}}for(S=[],C=0,f=0;f<v.length;f++)V(v[f])&&(S[C++]=v[f]);continue}for(d=a,v=[],p=0,f=0;f<S.length;f++)for(k=S[f].getElementsByTagName(d),y=0;y<k.length;y++)v[p++]=k[y];S=v}return S}return function(o){return m.isElement(o)?[o]:m.isObject(o)&&!m.isUndefined(o.length)?o:t.call(this,o)}}();var br=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],fr=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];m.info={campaignParams:function(n){var e="",i={};return m.each(br,function(t){e=m.getQueryParam(ee.URL,t),e.length?i[t]=e:n!==void 0&&(i[t]=n)}),i},clickParams:function(){var n="",e={};return m.each(fr,function(i){n=m.getQueryParam(ee.URL,i),n.length&&(e[i]=n)}),e},marketingParams:function(){return m.extend(m.info.campaignParams(),m.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=m.info.searchEngine(n),i=e!="yahoo"?"q":"p",t={};if(e!==null){t.$search_engine=e;var o=m.getQueryParam(n,i);o.length&&(t.mp_keyword=o)}return t},browser:function(n,e,i){return e=e||"",i||m.includes(n," OPR/")?m.includes(n,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":m.includes(n,"IEMobile")||m.includes(n,"WPDesktop")?"Internet Explorer Mobile":m.includes(n,"SamsungBrowser/")?"Samsung Internet":m.includes(n,"Edge")||m.includes(n,"Edg/")?"Microsoft Edge":m.includes(n,"FBIOS")?"Facebook Mobile":m.includes(n,"Chrome")?"Chrome":m.includes(n,"CriOS")?"Chrome iOS":m.includes(n,"UCWEB")||m.includes(n,"UCBrowser")?"UC Browser":m.includes(n,"FxiOS")?"Firefox iOS":m.includes(e,"Apple")?m.includes(n,"Mobile")?"Mobile Safari":"Safari":m.includes(n,"Android")?"Android Mobile":m.includes(n,"Konqueror")?"Konqueror":m.includes(n,"Firefox")?"Firefox":m.includes(n,"MSIE")||m.includes(n,"Trident/")?"Internet Explorer":m.includes(n,"Gecko")?"Mozilla":""},browserVersion:function(n,e,i){var t=m.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 a=n.match(s);return a?parseFloat(a[a.length-2]):null},os:function(){var n=ze;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 N.location.href},properties:function(n){return typeof n!="object"&&(n={}),m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(ze,dn.vendor,Li),$referrer:ee.referrer,$referring_domain:m.info.referringDomain(ee.referrer),$device:m.info.device(ze)}),{$current_url:m.info.currentUrl(),$browser_version:m.info.browserVersion(ze,dn.vendor,Li),$screen_height:Ti.height,$screen_width:Ti.width,mp_lib:"web",$lib_version:$e.LIB_VERSION,$insert_id:st(),time:m.timestamp()/1e3},m.strip_empty_properties(n))},people_properties:function(){return m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(ze,dn.vendor,Li)}),{$browser_version:m.info.browserVersion(ze,dn.vendor,Li)})},mpPageViewProperties:function(){return m.strip_empty_properties({current_page_title:ee.title,current_domain:N.location.hostname,current_url_path:N.location.pathname,current_url_protocol:N.location.protocol,current_url_search:N.location.search})}};var st=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},gr=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,yr=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,Lo=function(n){var e=yr,i=n.split("."),t=i[i.length-1];(t.length>4||t==="com"||t==="org")&&(e=gr);var o=n.match(e);return o?o[0]:""},Cr=function(){var n=N.navigator.onLine;return m.isUndefined(n)||n},Ii=null,Di=null;typeof JSON<"u"&&(Ii=JSON.stringify,Di=JSON.parse),Ii=Ii||m.JSONEncode,Di=Di||m.JSONDecode,m.toArray=m.toArray,m.isObject=m.isObject,m.JSONEncode=m.JSONEncode,m.JSONDecode=m.JSONDecode,m.isBlockedUA=m.isBlockedUA,m.isEmptyObject=m.isEmptyObject,m.info=m.info,m.info.device=m.info.device,m.info.browser=m.info.browser,m.info.browserVersion=m.info.browserVersion,m.info.properties=m.info.properties;var wr="__mp_opt_in_out_";function kr(n,e){Po(!0,n,e)}function Sr(n,e){Po(!1,n,e)}function _r(n,e){return Eo(n,e)==="1"}function To(n,e){if(Ar(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=Eo(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 cn(n){return lt(n,function(e){return this.get_config(e)})}function un(n){return lt(n,function(e){return this._get_config(e)})}function Vn(n){return lt(n,function(e){return this._get_config(e)})}function Mr(n,e){e=e||{},at(e).remove(rt(n,e),!!e.crossSubdomainCookie,e.cookieDomain)}function at(n){return n=n||{},n.persistenceType==="localStorage"?m.localStorage:m.cookie}function rt(n,e){return e=e||{},(e.persistencePrefix||wr)+n}function Eo(n,e){return at(e).get(rt(n,e))}function Ar(n){if(n&&n.ignoreDnt)return!1;var e=n&&n.window||N,i=e.navigator||{},t=!1;return m.each([i.doNotTrack,i.msDoNotTrack,e.doNotTrack],function(o){m.includes([!0,1,"1","yes"],o)&&(t=!0)}),t}function Po(n,e,i){if(!m.isString(e)||!e.length){J.error("gdpr."+(n?"optIn":"optOut")+" called with an invalid token");return}i=i||{},at(i).set(rt(e,i),n?1:0,m.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 lt(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"),a=e.call(this,"opt_out_tracking_cookie_prefix"),l=e.call(this,"window");t&&(i=To(t,{ignoreDnt:o,persistenceType:s,persistencePrefix:a,window:l}))}catch(v){J.error("Unexpected error when checking tracking opt-out status: "+v)}if(!i)return n.apply(this,arguments);var d=arguments[arguments.length-1];typeof d=="function"&&d(0)}}var xr=Ei("lock"),Io=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3};Io.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,a=this.pollIntervalMS,l=this.timeoutMS,d=this.storage,v=s+":X",p=s+":Y",g=s+":Z",f=function(A){e&&e(A)},y=function(A){if(new Date().getTime()-o>l){xr.error("Timeout waiting for mutex on "+s+"; clearing lock. ["+t+"]"),d.removeItem(g),d.removeItem(p),S();return}setTimeout(function(){try{A()}catch(_){f(_)}},a*(Math.random()+.1))},k=function(A,_){A()?_():y(function(){k(A,_)})},C=function(){var A=d.getItem(p);if(A&&A!==t)return!1;if(d.setItem(p,t),d.getItem(p)===t)return!0;if(!Pi(d,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},S=function(){d.setItem(v,t),k(C,function(){if(d.getItem(v)===t){M();return}y(function(){if(d.getItem(p)!==t){S();return}k(function(){return!d.getItem(g)},M)})})},M=function(){d.setItem(g,"1");try{n()}finally{d.removeItem(g),d.getItem(p)===t&&d.removeItem(p),d.getItem(v)===t&&d.removeItem(v)}};try{if(Pi(d,!0))S();else throw new Error("localStorage support check failed")}catch(A){f(A)}};var Do=Ei("batch"),hn=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.reportError=e.errorReporter||m.bind(Do.error,Do),this.lock=new Io(n,{storage:this.storage}),this.usePersistence=e.usePersistence,this.pid=e.pid||null,this.memQueue=[]};hn.prototype.enqueue=function(n,e,i){var t={id:st(),flushAfter:new Date().getTime()+e*2,payload:n};this.usePersistence?this.lock.withLock(m.bind(function(){var s;try{var a=this.readFromStorage();a.push(t),s=this.saveToStorage(a),s&&this.memQueue.push(t)}catch{this.reportError("Error enqueueing item",n),s=!1}i&&i(s)},this),m.bind(function(s){this.reportError("Error acquiring storage lock",s),i&&i(!1)},this),this.pid):(this.memQueue.push(t),i&&i(!0))},hn.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={};m.each(e,function(a){t[a.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 Bo=function(n,e){var i=[];return m.each(n,function(t){t.id&&!e[t.id]&&i.push(t)}),i};hn.prototype.removeItemsByID=function(n,e){var i={};if(m.each(n,function(o){i[o]=!0}),this.memQueue=Bo(this.memQueue,i),!this.usePersistence)e&&e(!0);else{var t=m.bind(function(){var o;try{var s=this.readFromStorage();if(s=Bo(s,i),o=this.saveToStorage(s),o){s=this.readFromStorage();for(var a=0;a<s.length;a++){var l=s[a];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)},m.bind(function(s){var a=!1;if(this.reportError("Error acquiring storage lock",s),!Pi(this.storage,!0)&&(a=t(),!a))try{this.storage.removeItem(this.storageKey)}catch(l){this.reportError("Error clearing queue",l)}e&&e(a)},this),this.pid)}};var No=function(n,e){var i=[];return m.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};hn.prototype.updatePayloads=function(n,e){this.memQueue=No(this.memQueue,n),this.usePersistence?this.lock.withLock(m.bind(function(){var t;try{var o=this.readFromStorage();o=No(o,n),t=this.saveToStorage(o)}catch{this.reportError("Error updating items",n),t=!1}e&&e(t)},this),m.bind(function(t){this.reportError("Error acquiring storage lock",t),e&&e(!1)},this),this.pid):e&&e(!0)},hn.prototype.readFromStorage=function(){var n;try{n=this.storage.getItem(this.storageKey),n&&(n=Di(n),m.isArray(n)||(this.reportError("Invalid storage entry:",n),n=null))}catch(e){this.reportError("Error retrieving queue",e),n=null}return n||[]},hn.prototype.saveToStorage=function(n){try{return this.storage.setItem(this.storageKey,Ii(n)),!0}catch(e){return this.reportError("Error saving queue",e),!1}},hn.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var Lr=10*60*1e3,ii=Ei("batch"),je=function(n,e){this.errorReporter=e.errorReporter,this.queue=new hn(n,{errorReporter:m.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};je.prototype.enqueue=function(n,e){this.queue.enqueue(n,this.flushInterval,e)},je.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},je.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},je.prototype.clear=function(){this.queue.clear()},je.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},je.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},je.prototype.scheduleFlush=function(n){this.flushInterval=n,this.stopped||(this.timeoutID=setTimeout(m.bind(function(){this.stopped||this.flush()},this),this.flushInterval))},je.prototype.flush=function(n){try{if(this.requestInProgress){ii.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,a=[],l={};if(m.each(o,function(p){var g=p.payload;if(this.beforeSendHook&&!p.orphaned&&(g=this.beforeSendHook(g)),g){g.event&&g.properties&&(g.properties=m.extend({},g.properties,{mp_sent_by_lib_version:$e.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&&a.push(g)}l[p.id]=g},this),a.length<1){this.resetFlush();return}this.requestInProgress=!0;var d=m.bind(function(p){this.requestInProgress=!1;try{var g=!1;if(n.unloading)this.queue.updatePayloads(l);else if(m.isObject(p)&&p.error==="timeout"&&new Date().getTime()-i>=e)this.reportError("Network timeout; retrying"),this.flush();else if(m.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(Lr,f),this.reportError("Error; retry in "+f+" ms"),this.scheduleFlush(f)}else if(m.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(m.map(o,function(k){return k.id}),m.bind(function(k){k?(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)),m.each(o,m.bind(function(k){var C=k.id;C?(this.itemIdsSentSuccessfully[C]=this.itemIdsSentSuccessfully[C]||0,this.itemIdsSentSuccessfully[C]++,this.itemIdsSentSuccessfully[C]>5&&this.reportError("[dupe] item ID sent too many times",{item:k,batchSize:o.length,timesSent:this.itemIdsSentSuccessfully[C]})):this.reportError("[dupe] found item with no ID while removing",{item:k})},this)))}catch(k){this.reportError("Error handling API response",k),this.resetFlush()}},this),v={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};n.unloading&&(v.transport="sendBeacon"),ii.log("MIXPANEL REQUEST:",a),this.sendRequest(a,v,d)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},je.prototype.reportError=function(n,e){if(ii.error.apply(ii.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(n)),this.errorReporter(n,e)}catch(i){ii.error(i)}};var wn=Ei("recorder"),Ho=N.CompressionStream,Tr={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},Er=new Set([Ge.MouseMove,Ge.MouseInteraction,Ge.Scroll,Ge.ViewportResize,Ge.Input,Ge.TouchMove,Ge.MediaInteraction,Ge.Drag,Ge.Selection]);function Pr(n){return n.type===wo.IncrementalSnapshot&&Er.has(n.data.source)}var Ke=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=ei,this.recordMinMs=0,this._initBatcher()};Ke.prototype._initBatcher=function(){this.batcher=new je("__mprec",{libConfig:Tr,sendRequestFunc:m.bind(this.flushEventsWithOptOut,this),errorReporter:m.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},Ke.prototype.get_config=function(n){return this._mixpanel.get_config(n)},Ke.prototype.startRecording=function(n){if(this._stopRecording!==null){wn.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>ei&&(this.recordMaxMs=ei,wn.critical("record_max_ms cannot be greater than "+ei+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>et&&(this.recordMinMs=et,wn.critical("record_min_ms cannot be greater than "+et+"ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=new Date().getTime(),this.replayId=m.UUID(),n||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var e=m.bind(function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(m.bind(function(){wn.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=Xn({emit:m.bind(function(t){this.batcher.enqueue(t),Pr(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(m.bind(this.resetRecording,this),this.recordMaxMs)},Ke.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},Ke.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)},Ke.prototype.flushEventsWithOptOut=function(n,e,i){this._flushEvents(n,e,i,m.bind(this._onOptOut,this))},Ke.prototype._onOptOut=function(n){n===0&&(this.recEvents=[],this.stopRecording())},Ke.prototype._sendRequest=function(n,e,i,t){var o=m.bind(function(s,a){s.status===200&&this.replayId===n&&this.seqNo++,t({status:0,httpStatusCode:s.status,responseBody:a,retryAfter:s.headers.get("Retry-After")})},this);N.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(a){o(s,a)}).catch(function(a){t({error:a})})}).catch(function(s){t({error:s,httpStatusCode:0})})},Ke.prototype._flushEvents=cn(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 a=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:a,replay_start_time:this.replayStartTime/1e3},d=m.JSONEncode(n),v=this._mixpanel.get_property("$device_id");v&&(l.$device_id=v);var p=this._mixpanel.get_property("$user_id");if(p&&(l.$user_id=p),Ho){var g=new Blob([d],{type:"application/json"}).stream(),f=g.pipeThrough(new Ho("gzip"));new Response(f).blob().then(m.bind(function(y){l.format="gzip",this._sendRequest(o,l,y,i)},this))}else l.format="body",this._sendRequest(o,l,d,i)}}),Ke.prototype.reportError=function(n,e){wn.error.apply(wn.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(i){wn.error(i)}},N.__mp_recorder=Ke;var Ye=function(){};Ye.prototype.create_properties=function(){},Ye.prototype.event_handler=function(){},Ye.prototype.after_track_handler=function(){},Ye.prototype.init=function(n){return this.mp=n,this},Ye.prototype.track=function(n,e,i,t){var o=this,s=m.dom_query(n);if(s.length===0){J.error("The DOM query ("+n+") returned 0 elements");return}return m.each(s,function(a){m.register_event(a,this.override_event,function(l){var d={},v=o.create_properties(i,this),p=o.mp.get_config("track_links_timeout");o.event_handler(l,this,d),window.setTimeout(o.track_callback(t,v,d,!0),p),o.mp.track(e,v,o.track_callback(t,v,d))})},this),!0},Ye.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))}},Ye.prototype.create_properties=function(n,e){var i;return typeof n=="function"?i=n(e):i=m.extend({},n),i};var Un=function(){this.override_event="click"};m.inherit(Un,Ye),Un.prototype.create_properties=function(n,e){var i=Un.superclass.create_properties.apply(this,arguments);return e.href&&(i.url=e.href),i},Un.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()},Un.prototype.after_track_handler=function(n,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var Bi=function(){this.override_event="submit"};m.inherit(Bi,Ye),Bi.prototype.event_handler=function(n,e,i){i.element=e,n.preventDefault()},Bi.prototype.after_track_handler=function(n,e){setTimeout(function(){e.element.submit()},0)};var mn="$set",jn="$set_once",Fe="$unset",kn="$add",qe="$append",Sn="$union",Qe="$remove",Ir="$delete",Ro={set_action:function(n,e){var i={},t={};return m.isObject(n)?m.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 m.isArray(n)||(n=[n]),m.each(n,function(t){this._is_reserved_property(t)||i.push(t)},this),e[Fe]=i,e},set_once_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[jn]=t,i},union_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=m.isArray(o)?o:[o])},this):t[n]=m.isArray(e)?e:[e],i[Sn]=t,i},append_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[qe]=t,i},remove_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Qe]=t,i},delete_action:function(){var n={};return n[Ir]="",n}},ie=function(){};m.extend(ie.prototype,Ro),ie.prototype._init=function(n,e,i){this._mixpanel=n,this._group_key=e,this._group_id=i},ie.prototype.set=Vn(function(n,e,i){var t=this.set_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.set_once=Vn(function(n,e,i){var t=this.set_once_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.unset=Vn(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),ie.prototype.union=Vn(function(n,e,i){m.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),ie.prototype.delete=Vn(function(n){var e=this.delete_action();return this._send_request(e,n)}),ie.prototype.remove=Vn(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=m.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 H=function(){};m.extend(H.prototype,Ro),H.prototype._init=function(n){this._mixpanel=n},H.prototype.set=un(function(n,e,i){var t=this.set_action(n,e);return m.isObject(n)&&(i=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),t[mn]=m.extend({},m.info.people_properties(),t[mn]),this._send_request(t,i)}),H.prototype.set_once=un(function(n,e,i){var t=this.set_once_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),H.prototype.unset=un(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),H.prototype.increment=un(function(n,e,i){var t={},o={};return m.isObject(n)?(m.each(n,function(s,a){if(!this._is_reserved_property(a))if(isNaN(parseFloat(s))){J.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else o[a]=s},this),i=e):(m.isUndefined(e)&&(e=1),o[n]=e),t[kn]=o,this._send_request(t,i)}),H.prototype.append=un(function(n,e,i){m.isObject(n)&&(i=e);var t=this.append_action(n,e);return this._send_request(t,i)}),H.prototype.remove=un(function(n,e,i){m.isObject(n)&&(i=e);var t=this.remove_action(n,e);return this._send_request(t,i)}),H.prototype.union=un(function(n,e,i){m.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),H.prototype.track_charge=un(function(n,e,i){if(!m.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",m.extend({$amount:n},e),i)}),H.prototype.clear_charges=function(n){return this.set("$transactions",[],n)},H.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)},H.prototype.toString=function(){return this._mixpanel.toString()+".people"},H.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=m.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),m.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),m.truncate(s,255))},H.prototype._get_config=function(n){return this._mixpanel.get_config(n)},H.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},H.prototype._enqueue=function(n){mn in n?this._mixpanel.persistence._add_to_people_queue(mn,n):jn in n?this._mixpanel.persistence._add_to_people_queue(jn,n):Fe in n?this._mixpanel.persistence._add_to_people_queue(Fe,n):kn in n?this._mixpanel.persistence._add_to_people_queue(kn,n):qe in n?this._mixpanel.persistence._add_to_people_queue(qe,n):Qe in n?this._mixpanel.persistence._add_to_people_queue(Qe,n):Sn in n?this._mixpanel.persistence._add_to_people_queue(Sn,n):J.error("Invalid call to _enqueue():",n)},H.prototype._flush_one_queue=function(n,e,i,t){var o=this,s=m.extend({},this._mixpanel.persistence.load_queue(n)),a=s;!m.isUndefined(s)&&m.isObject(s)&&!m.isEmptyObject(s)&&(o._mixpanel.persistence._pop_from_people_queue(n,s),o._mixpanel.persistence.save(),t&&(a=t(s)),e.call(o,a,function(l,d){l===0&&o._mixpanel.persistence._add_to_people_queue(n,s),m.isUndefined(i)||i(l,d)}))},H.prototype._flush=function(n,e,i,t,o,s,a){var l=this;this._flush_one_queue(mn,this.set,n),this._flush_one_queue(jn,this.set_once,t),this._flush_one_queue(Fe,this.unset,s,function(S){return m.keys(S)}),this._flush_one_queue(kn,this.increment,e),this._flush_one_queue(Sn,this.union,o);var d=this._mixpanel.persistence.load_queue(qe);if(!m.isUndefined(d)&&m.isArray(d)&&d.length)for(var v,p=function(S,M){S===0&&l._mixpanel.persistence._add_to_people_queue(qe,v),m.isUndefined(i)||i(S,M)},g=d.length-1;g>=0;g--)d=this._mixpanel.persistence.load_queue(qe),v=d.pop(),l._mixpanel.persistence.save(),m.isEmptyObject(v)||l.append(v,p);var f=this._mixpanel.persistence.load_queue(Qe);if(!m.isUndefined(f)&&m.isArray(f)&&f.length)for(var y,k=function(S,M){S===0&&l._mixpanel.persistence._add_to_people_queue(Qe,y),m.isUndefined(a)||a(S,M)},C=f.length-1;C>=0;C--)f=this._mixpanel.persistence.load_queue(Qe),y=f.pop(),l._mixpanel.persistence.save(),m.isEmptyObject(y)||l.remove(y,k)},H.prototype._is_reserved_property=function(n){return n==="$distinct_id"||n==="$token"||n==="$device_id"||n==="$user_id"||n==="$had_persisted_distinct_id"},H.prototype.set=H.prototype.set,H.prototype.set_once=H.prototype.set_once,H.prototype.unset=H.prototype.unset,H.prototype.increment=H.prototype.increment,H.prototype.append=H.prototype.append,H.prototype.remove=H.prototype.remove,H.prototype.union=H.prototype.union,H.prototype.track_charge=H.prototype.track_charge,H.prototype.clear_charges=H.prototype.clear_charges,H.prototype.delete_user=H.prototype.delete_user,H.prototype.toString=H.prototype.toString;var dt="__mps",ct="__mpso",ut="__mpus",ht="__mpa",mt="__mpap",pt="__mpr",vt="__mpu",Oo="$people_distinct_id",Ni="__alias",ti="__timers",Dr=[dt,ct,ut,ht,mt,pt,vt,Oo,Ni,ti],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"&&m.localStorage.is_supported()?this.storage=m.localStorage:this.storage=m.cookie,this.load(),this.update_config(n),this.upgrade(),this.save()};j.prototype.properties=function(){var n={};return this.load(),m.each(this.props,function(e,i){m.include(Dr,i)||(n[i]=e)}),n},j.prototype.load=function(){if(!this.disabled){var n=this.storage.parse(this.name);n&&(this.props=m.extend({},n))}},j.prototype.upgrade=function(){var n,e;this.storage===m.localStorage?(n=m.cookie.parse(this.name),m.cookie.remove(this.name),m.cookie.remove(this.name,!0),n&&this.register_once(n)):this.storage===m.cookie&&(e=m.localStorage.parse(this.name),m.localStorage.remove(this.name),e&&this.register_once(e))},j.prototype.save=function(){this.disabled||this.storage.set(this.name,m.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 m.isObject(n)?(typeof e>"u"&&(e="None"),this.expire_days=typeof i>"u"?this.default_expiry:i,this.load(),m.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 m.isObject(n)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),m.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(m.info.searchInfo(n))},j.prototype.update_referrer_info=function(n){this.register_once({$initial_referrer:n||"$direct",$initial_referring_domain:m.info.referringDomain(n)||"$direct"},"")},j.prototype.get_referrer_info=function(){return m.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(jn),a=this._get_or_create_queue(Fe),l=this._get_or_create_queue(kn),d=this._get_or_create_queue(Sn),v=this._get_or_create_queue(Qe,[]),p=this._get_or_create_queue(qe,[]);i===dt?(m.extend(o,t),this._pop_from_people_queue(kn,t),this._pop_from_people_queue(Sn,t),this._pop_from_people_queue(Fe,t)):i===ct?(m.each(t,function(g,f){f in s||(s[f]=g)}),this._pop_from_people_queue(Fe,t)):i===ut?m.each(t,function(g){m.each([o,s,l,d],function(f){g in f&&delete f[g]}),m.each(p,function(f){g in f&&delete f[g]}),a[g]=!0}):i===ht?(m.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(Fe,t)):i===vt?(m.each(t,function(g,f){m.isArray(g)&&(f in d||(d[f]=[]),d[f]=d[f].concat(g))}),this._pop_from_people_queue(Fe,t)):i===pt?(v.push(t),this._pop_from_people_queue(qe,t)):i===mt&&(p.push(t),this._pop_from_people_queue(Fe,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)];m.isUndefined(i)||m.each(e,function(t,o){n===qe||n===Qe?m.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 dt;if(n===jn)return ct;if(n===Fe)return ut;if(n===kn)return ht;if(n===qe)return mt;if(n===Qe)return pt;if(n===Sn)return vt;J.error("Invalid queue:",n)},j.prototype._get_or_create_queue=function(n,e){var i=this._get_queue_key(n);return e=m.isUndefined(e)?{}:e,this.props[i]||(this.props[i]=e)},j.prototype.set_event_timer=function(n,e){var i=this.load_prop(ti)||{};i[n]=e,this.props[ti]=i,this.save()},j.prototype.remove_event_timer=function(n){var e=this.load_prop(ti)||{},i=e[n];return m.isUndefined(i)||(delete this.props[ti][n],this.save()),i};var bt,Vo=function(n,e){throw new Error(n+" not available in this build.")},Ce,Uo=0,Br=1,Nr=function(n){return n},oi=function(){},He="mixpanel",jo="base64",Hr="json",ft="$device:",Kn=N.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,Ko=!Kn&&ze.indexOf("MSIE")===-1&&ze.indexOf("Mozilla")===-1,Hi=null;dn.sendBeacon&&(Hi=function(){return dn.sendBeacon.apply(dn,arguments)});var Fo={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},Go={api_host:"https://api-js.mixpanel.com",api_routes:Fo,api_method:"POST",api_transport:"XHR",api_payload_format:jo,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:oi,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:oi,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:ei,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},zo=!1,x=function(){},gt=function(n,e,i){var t,o=i===He?Ce:Ce[i];if(o&&bt===Uo)t=o;else{if(o&&!m.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 H,t.people._init(t),!t.get_config("skip_first_touch_marketing")){var s=m.info.campaignParams(null),a={},l=!1;m.each(s,function(d,v){a["initial_"+v]=d,d&&(l=!0)}),l&&t.people.set_once(a)}return $e.DEBUG=$e.DEBUG||t.get_config("debug"),!m.isUndefined(o)&&m.isArray(o)&&(t._execute_array.call(t.people,o.people),t._execute_array(o)),t};x.prototype.init=function(n,e,i){if(m.isUndefined(i)){this.report_error("You must name your new library: init(token, config, name)");return}if(i===He){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var t=gt(n,e,i);return Ce[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||Go.api_host;o.match(/\.mixpanel\.com/)&&(t.api_payload_format=Hr)}if(this.set_config(m.extend({},Go,t,e,{name:i,token:n,callback_fn:(i===He?i:He+"."+i)+"._jsc"})),this._jsc=oi,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(!m.localStorage.is_supported(!0)||!Kn)this._batch_requests=!1,J.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),m.each(this.get_batcher_configs(),function(d){J.log("Clearing batch queue "+d.queue_key),m.localStorage.remove(d.queue_key)});else if(this.init_batchers(),Hi&&N.addEventListener){var s=m.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);N.addEventListener("pagehide",function(d){d.persisted&&s()}),N.addEventListener("visibilitychange",function(){ee.visibilityState==="hidden"&&s()})}}this.persistence=this.cookie=new j(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=m.UUID();this.get_distinct_id()||this.register_once({distinct_id:ft+a,$device_id:a},"");var l=this.get_config("track_pageview");l&&this._init_url_change_tracking(l),this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent")&&this.start_session_recording()},x.prototype.start_session_recording=cn(function(){if(!N.MutationObserver){J.critical("Browser does not support MutationObserver; skipping session recording");return}var n=m.bind(function(){this._recorder=this._recorder||new N.__mp_recorder(this),this._recorder.startRecording()},this);m.isUndefined(N.__mp_recorder)?Vo(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=m.info.campaignParams(null);m.each(n,(function(e,i){this.unregister(i)}).bind(this))}},x.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(ee.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(m.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(ee.referrer)},x.prototype._dom_loaded=function(){m.each(this.__dom_loaded_queue,function(n){this._track_dom.apply(this,n)},this),this.has_opted_out_tracking()||m.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(!zo)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=m.info.currentUrl()),m.include(["full-url","url-with-path-and-query-string","url-with-path"],n)){N.addEventListener("popstate",function(){N.dispatchEvent(new Event("mp_locationchange"))}),N.addEventListener("hashchange",function(){N.dispatchEvent(new Event("mp_locationchange"))});var t=N.history.pushState;typeof t=="function"&&(N.history.pushState=function(s,a,l){t.call(N.history,s,a,l),N.dispatchEvent(new Event("mp_locationchange"))});var o=N.history.replaceState;typeof o=="function"&&(N.history.replaceState=function(s,a,l){o.call(N.history,s,a,l),N.dispatchEvent(new Event("mp_locationchange"))}),N.addEventListener("mp_locationchange",(function(){var s=m.info.currentUrl(),a=!1;if(n==="full-url"?a=s!==e:n==="url-with-path-and-query-string"?a=s.split("#")[0]!==e.split("#")[0]:n==="url-with-path"&&(a=s.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0]),a){var l=this.track_pageview();l&&(e=s)}}).bind(this))}},x.prototype._prepare_callback=function(n,e){if(m.isUndefined(n))return null;if(Kn){var i=function(a){n(a,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(a){delete t[o],n(a,e)},s}},x.prototype._send_request=function(n,e,i,t){var o=!0;if(Ko)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")},a=null;!t&&(m.isFunction(i)||typeof i=="string")&&(t=i,i=null),i=m.extend(s,i||{}),Kn||(i.method="GET");var l=i.method==="POST",d=Hi&&l&&i.transport.toLowerCase()==="sendbeacon",v=i.verbose;e.verbose&&(v=!0),this.get_config("test")&&(e.test=1),v&&(e.verbose=1),this.get_config("img")&&(e.img=1),Kn||(t?e.callback=t:(v||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),l&&(a="data="+encodeURIComponent(e.data),delete e.data),n+="?"+m.HTTPBuildQuery(e);var p=this;if("img"in e){var g=ee.createElement("img");g.src=n,ee.body.appendChild(g)}else if(d){try{o=Hi(n,a)}catch(M){p.report_error(M),o=!1}try{t&&t(o?1:0)}catch(M){p.report_error(M)}}else if(Kn)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"),m.each(y,function(M,A){f.setRequestHeader(A,M)}),i.timeout_ms&&typeof f.timeout<"u"){f.timeout=i.timeout_ms;var k=new Date().getTime()}f.withCredentials=!0,f.onreadystatechange=function(){if(f.readyState===4)if(f.status===200){if(t)if(v){var M;try{M=m.JSONDecode(f.responseText)}catch(T){if(p.report_error(T),i.ignore_json_errors)M=f.responseText;else return}t(M)}else t(Number(f.responseText))}else{var A;if(f.timeout&&!f.status&&new Date().getTime()-k>=f.timeout?A="timeout":A="Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(A),t)if(v){var _=f.responseHeaders||{};t({status:0,httpStatusCode:f.status,error:A,retryAfter:_["Retry-After"]})}else t(0)}},f.send(a)}catch(M){p.report_error(M),o=!1}else{var C=ee.createElement("script");C.type="text/javascript",C.async=!0,C.defer=!0,C.src=n;var S=ee.getElementsByTagName("script")[0];S.parentNode.insertBefore(C,S)}return o},x.prototype._execute_array=function(n){var e,i=[],t=[],o=[];m.each(n,function(a){a&&(e=a[0],m.isArray(e)?o.push(a):typeof a=="function"?a.call(this):m.isArray(a)&&e==="alias"?i.push(a):m.isArray(a)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?o.push(a):t.push(a))},this);var s=function(a,l){m.each(a,function(d){if(m.isArray(d[0])){var v=l;m.each(d,function(p){v=v[p[0]].apply(v,p.slice(1))})}else this[d[0]].apply(this,d.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=m.bind(function(i){return new je(i.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:m.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:m.bind(function(t){return this._run_hook("before_send_"+i.type,t)},this),stopAllBatchingFunc:m.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,m.each(this.request_batchers,function(n){n.start()}))},x.prototype.stop_batch_senders=function(){this._batch_requests=!1,m.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=m.JSONEncode(n);return this.get_config("api_payload_format")===jo&&(e=m.base64Encode(e)),{data:e}},x.prototype._track_or_batch=function(n,e){var i=m.truncate(n.data,255),t=n.endpoint,o=n.batcher,s=n.should_send_immediately,a=n.send_request_options||{};e=e||oi;var l=!0,d=m.bind(function(){return a.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),a,this._prepare_callback(e,i))):null},this);return this._batch_requests&&!s?o.enqueue(i,function(v){v?e(1,i):d()}):l=d(),l&&i},x.prototype.track=cn(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=oi),m.isUndefined(n)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(n)){t(0);return}e=m.extend({},e),e.token=this.get_config("token");var a=this.persistence.remove_event_timer(n);if(!m.isUndefined(a)){var l=new Date().getTime()-a;e.$duration=parseFloat((l/1e3).toFixed(3))}this._set_default_superprops();var d=this.get_config("track_marketing")?m.info.marketingParams():{};e=m.extend({},m.info.properties({mp_loader:this.get_config("mp_loader")}),d,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),e);var v=this.get_config("property_blacklist");m.isArray(v)?m.each(v,function(f){delete e[f]}):this.report_error("Invalid value for property_blacklist config: "+v);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=cn(function(n,e,i){m.isArray(e)||(e=[e]);var t={};return t[n]=e,this.register(t),this.people.set(n,e,i)}),x.prototype.add_group=cn(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=cn(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=cn(function(n,e,i,t){var o=m.extend({},e||{});return m.each(i,function(s,a){s!=null&&(o[a]=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=cn(function(n,e){typeof n!="object"&&(n={}),e=e||{};var i=e.event_name||"$mp_web_page_view",t=m.extend(m.info.mpPageViewProperties(),m.info.campaignParams(),m.info.clickParams()),o=m.extend({},t,n);return this.track(i,o)}),x.prototype.track_links=function(){return this._track_dom.call(this,Un,arguments)},x.prototype.track_forms=function(){return this._track_dom.call(this,Bi,arguments)},x.prototype.time_event=function(n){if(m.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 Rr={persistent:!0},yt=function(n){var e;return m.isObject(n)?e=n:m.isUndefined(n)?e={}:e={days:n},m.extend({},Rr,e)};x.prototype.register=function(n,e){var i=yt(e);i.persistent?this.persistence.register(n,i.days):m.extend(this.unpersisted_superprops,n)},x.prototype.register_once=function(n,e,i){var t=yt(i);t.persistent?this.persistence.register_once(n,e,t.days):(typeof e>"u"&&(e="None"),m.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=yt(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,a,l){var d=this.get_distinct_id();if(n&&d!==n){if(typeof n=="string"&&n.indexOf(ft)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:n})}if(!this.get_property("$device_id")){var v=d;this.register_once({$had_persisted_distinct_id:!0,$device_id:v},"")}n!==d&&n!==this.get_property(Ni)&&(this.unregister(Ni),this.register({distinct_id:n})),this._flags.identify_called=!0,this.people._flush(e,i,t,o,s,a,l),n!==d&&this.track("$identify",{distinct_id:n,$anon_distinct_id:d},{skip_hooks:!0})},x.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var n=m.UUID();this.register_once({distinct_id:ft+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(Oo))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var i=this;return m.isUndefined(e)&&(e=this.get_distinct_id()),n!==e?(this._register_single(Ni,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(m.isObject(n)){m.extend(this.config,n);var e=n.batch_size;e&&m.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),$e.DEBUG=$e.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]||Nr).apply(this,ln.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!==He&&(n=He+"."+n),n},x.prototype._event_is_disabled=function(n){return m.isBlockedUA(ze)||this._flags.disable_all_events||m.include(this.__disabled_events,n)},x.prototype._gdpr_init=function(){var n=this.get_config("opt_out_tracking_persistence_type")==="localStorage";n&&m.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")||m.cookie.get("mp_optout"))&&(m.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=m.extend({track:m.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),m.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=m.extend({enable_persistence:!0},n),this._gdpr_call_func(kr,n),this._gdpr_update_persistence(n)},x.prototype.opt_out_tracking=function(n){n=m.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(Sr,n),this._gdpr_update_persistence(n)},x.prototype.has_opted_in_tracking=function(n){return this._gdpr_call_func(_r,n)},x.prototype.has_opted_out_tracking=function(n){return this._gdpr_call_func(To,n)},x.prototype.clear_opt_in_out_tracking=function(n){n=m.extend({enable_persistence:!0},n),this._gdpr_call_func(Mr,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=Fo,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 Fn={},Or=function(){m.each(Fn,function(n,e){e!==He&&(Ce[e]=n)}),Ce._=m},Vr=function(){Ce.init=function(n,e,i){if(i)return Ce[i]||(Ce[i]=Fn[i]=gt(n,e,i),Ce[i]._loaded()),Ce[i];var t=Ce;Fn[He]?t=Fn[He]:n&&(t=gt(n,e,He),t._loaded(),Fn[He]=t),Ce=t,bt===Br&&(N[He]=Ce),Or()}},Ur=function(){function n(){n.done||(n.done=!0,zo=!0,Ko=!1,m.each(Fn,function(t){t._dom_loaded()}))}function e(){try{ee.documentElement.doScroll("left")}catch{setTimeout(e,1);return}n()}if(ee.addEventListener)ee.readyState==="complete"?n():ee.addEventListener("DOMContentLoaded",n,!1);else if(ee.attachEvent){ee.attachEvent("onreadystatechange",n);var i=!1;try{i=N.frameElement===null}catch{}ee.documentElement.doScroll&&i&&e()}m.register_event(N,"load",n,!0)};function jr(n){return Vo=n,bt=Uo,Ce=new x,Vr(),Ce.init(),Ur(),Ce}function Kr(n,e){e()}var P=jr(Kr);const qo=`<div id="checkoutConfirmationEnd">
989
+ `);var e="",i,t,o=0,s;for(i=t=0,o=n.length,s=0;s<o;s++){var a=n.charCodeAt(s),l=null;a<128?t++:a>127&&a<2048?l=String.fromCharCode(a>>6|192,a&63|128):l=String.fromCharCode(a>>12|224,a>>6&63|128,a&63|128),l!==null&&(t>i&&(e+=n.substring(i,t)),e+=l,i=t=s+1)}return t>i&&(e+=n.substring(i,n.length)),e},m.UUID=function(){var n=function(){var t=1*new Date,o;if(N.performance&&N.performance.now)o=N.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=ze,o,s,a=[],l=0;function d(v,p){var g,f=0;for(g=0;g<p.length;g++)f|=a[g]<<g*8;return v^f}for(o=0;o<t.length;o++)s=t.charCodeAt(o),a.unshift(s&255),a.length>=4&&(l=d(l,a),a=[]);return a.length>0&&(l=d(l,a)),l.toString(16)};return function(){var t=(Ti.height*Ti.width).toString(16);return n()+"-"+e()+"-"+i()+"-"+t+"-"+n()}}();var Lo=["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"];m.isBlockedUA=function(n){var e;for(n=n.toLowerCase(),e=0;e<Lo.length;e++)if(n.indexOf(Lo[e])!==-1)return!0;return!1},m.HTTPBuildQuery=function(n,e){var i,t,o=[];return m.isUndefined(e)&&(e="&"),m.each(n,function(s,a){i=encodeURIComponent(s.toString()),t=encodeURIComponent(a),o[o.length]=t+"="+i}),o.join(e)},m.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," ")},m.cookie={get:function(n){for(var e=n+"=",i=ee.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=m.JSONDecode(m.cookie.get(n))||{}}catch{}return e},set_seconds:function(n,e,i,t,o,s,a){var l="",d="",v="";if(a)l="; domain="+a;else if(t){var p=To(ee.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*1e3),d="; expires="+g.toGMTString()}s&&(o=!0,v="; SameSite=None"),o&&(v+="; secure"),ee.cookie=n+"="+encodeURIComponent(e)+d+"; path=/"+l+v},set:function(n,e,i,t,o,s,a){var l="",d="",v="";if(a)l="; domain="+a;else if(t){var p=To(ee.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*24*60*60*1e3),d="; expires="+g.toGMTString()}s&&(o=!0,v="; SameSite=None"),o&&(v+="; secure");var f=n+"="+encodeURIComponent(e)+d+"; path=/"+l+v;return ee.cookie=f,f},remove:function(n,e,i){m.cookie.set(n,"",-1,e,!1,!1,i)}};var st=null,Pi=function(n,e){if(st!==null&&!e)return st;var i=!0;try{n=n||window.localStorage;var t="__mplss_"+at(8),o="xyz";n.setItem(t,o),n.getItem(t)!==o&&(i=!1),n.removeItem(t)}catch{i=!1}return st=i,i};m.localStorage={is_supported:function(n){var e=Pi(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){m.localStorage.error(e)}return null},parse:function(n){try{return m.JSONDecode(m.localStorage.get(n))||{}}catch{}return null},set:function(n,e){try{window.localStorage.setItem(n,e)}catch(i){m.localStorage.error(i)}},remove:function(n){try{window.localStorage.removeItem(n)}catch(e){m.localStorage.error(e)}}},m.register_event=function(){var n=function(t,o,s,a,l){if(!t){J.error("No valid element provided to register_event");return}if(t.addEventListener&&!a)t.addEventListener(o,s,!!l);else{var d="on"+o,v=t[d];t[d]=e(t,s,v)}};function e(t,o,s){var a=function(l){if(l=l||i(window.event),!!l){var d=!0,v,p;return m.isFunction(s)&&(v=s(l)),p=o.call(t,l),(v===!1||p===!1)&&(d=!1),d}};return a}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 vr=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');m.dom_query=function(){function n(o){return o.all?o.all:o.getElementsByTagName("*")}var e=/[\t\r\n]/g;function i(o,s){var a=" "+s+" ";return(" "+o.className+" ").replace(e," ").indexOf(a)>=0}function t(o){if(!ee.getElementsByTagName)return[];var s=o.split(" "),a,l,d,v,p,g,f,y,k,C,S=[ee];for(g=0;g<s.length;g++){if(a=s[g].replace(/^\s+/,"").replace(/\s+$/,""),a.indexOf("#")>-1){l=a.split("#"),d=l[0];var M=l[1],A=ee.getElementById(M);if(!A||d&&A.nodeName.toLowerCase()!=d)return[];S=[A];continue}if(a.indexOf(".")>-1){l=a.split("."),d=l[0];var _=l[1];for(d||(d="*"),v=[],p=0,f=0;f<S.length;f++)for(d=="*"?k=n(S[f]):k=S[f].getElementsByTagName(d),y=0;y<k.length;y++)v[p++]=k[y];for(S=[],C=0,f=0;f<v.length;f++)v[f].className&&m.isString(v[f].className)&&i(v[f],_)&&(S[C++]=v[f]);continue}var T=a.match(vr);if(T){d=T[1];var I=T[2],K=T[3],G=T[4];for(d||(d="*"),v=[],p=0,f=0;f<S.length;f++)for(d=="*"?k=n(S[f]):k=S[f].getElementsByTagName(d),y=0;y<k.length;y++)v[p++]=k[y];S=[],C=0;var U;switch(K){case"=":U=function(F){return F.getAttribute(I)==G};break;case"~":U=function(F){return F.getAttribute(I).match(new RegExp("\\b"+G+"\\b"))};break;case"|":U=function(F){return F.getAttribute(I).match(new RegExp("^"+G+"-?"))};break;case"^":U=function(F){return F.getAttribute(I).indexOf(G)===0};break;case"$":U=function(F){return F.getAttribute(I).lastIndexOf(G)==F.getAttribute(I).length-G.length};break;case"*":U=function(F){return F.getAttribute(I).indexOf(G)>-1};break;default:U=function(F){return F.getAttribute(I)}}for(S=[],C=0,f=0;f<v.length;f++)U(v[f])&&(S[C++]=v[f]);continue}for(d=a,v=[],p=0,f=0;f<S.length;f++)for(k=S[f].getElementsByTagName(d),y=0;y<k.length;y++)v[p++]=k[y];S=v}return S}return function(o){return m.isElement(o)?[o]:m.isObject(o)&&!m.isUndefined(o.length)?o:t.call(this,o)}}();var br=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],fr=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];m.info={campaignParams:function(n){var e="",i={};return m.each(br,function(t){e=m.getQueryParam(ee.URL,t),e.length?i[t]=e:n!==void 0&&(i[t]=n)}),i},clickParams:function(){var n="",e={};return m.each(fr,function(i){n=m.getQueryParam(ee.URL,i),n.length&&(e[i]=n)}),e},marketingParams:function(){return m.extend(m.info.campaignParams(),m.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=m.info.searchEngine(n),i=e!="yahoo"?"q":"p",t={};if(e!==null){t.$search_engine=e;var o=m.getQueryParam(n,i);o.length&&(t.mp_keyword=o)}return t},browser:function(n,e,i){return e=e||"",i||m.includes(n," OPR/")?m.includes(n,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":m.includes(n,"IEMobile")||m.includes(n,"WPDesktop")?"Internet Explorer Mobile":m.includes(n,"SamsungBrowser/")?"Samsung Internet":m.includes(n,"Edge")||m.includes(n,"Edg/")?"Microsoft Edge":m.includes(n,"FBIOS")?"Facebook Mobile":m.includes(n,"Chrome")?"Chrome":m.includes(n,"CriOS")?"Chrome iOS":m.includes(n,"UCWEB")||m.includes(n,"UCBrowser")?"UC Browser":m.includes(n,"FxiOS")?"Firefox iOS":m.includes(e,"Apple")?m.includes(n,"Mobile")?"Mobile Safari":"Safari":m.includes(n,"Android")?"Android Mobile":m.includes(n,"Konqueror")?"Konqueror":m.includes(n,"Firefox")?"Firefox":m.includes(n,"MSIE")||m.includes(n,"Trident/")?"Internet Explorer":m.includes(n,"Gecko")?"Mozilla":""},browserVersion:function(n,e,i){var t=m.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 a=n.match(s);return a?parseFloat(a[a.length-2]):null},os:function(){var n=ze;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 N.location.href},properties:function(n){return typeof n!="object"&&(n={}),m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(ze,dn.vendor,Li),$referrer:ee.referrer,$referring_domain:m.info.referringDomain(ee.referrer),$device:m.info.device(ze)}),{$current_url:m.info.currentUrl(),$browser_version:m.info.browserVersion(ze,dn.vendor,Li),$screen_height:Ti.height,$screen_width:Ti.width,mp_lib:"web",$lib_version:$e.LIB_VERSION,$insert_id:at(),time:m.timestamp()/1e3},m.strip_empty_properties(n))},people_properties:function(){return m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(ze,dn.vendor,Li)}),{$browser_version:m.info.browserVersion(ze,dn.vendor,Li)})},mpPageViewProperties:function(){return m.strip_empty_properties({current_page_title:ee.title,current_domain:N.location.hostname,current_url_path:N.location.pathname,current_url_protocol:N.location.protocol,current_url_search:N.location.search})}};var at=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},gr=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,yr=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,To=function(n){var e=yr,i=n.split("."),t=i[i.length-1];(t.length>4||t==="com"||t==="org")&&(e=gr);var o=n.match(e);return o?o[0]:""},Cr=function(){var n=N.navigator.onLine;return m.isUndefined(n)||n},Ii=null,Di=null;typeof JSON<"u"&&(Ii=JSON.stringify,Di=JSON.parse),Ii=Ii||m.JSONEncode,Di=Di||m.JSONDecode,m.toArray=m.toArray,m.isObject=m.isObject,m.JSONEncode=m.JSONEncode,m.JSONDecode=m.JSONDecode,m.isBlockedUA=m.isBlockedUA,m.isEmptyObject=m.isEmptyObject,m.info=m.info,m.info.device=m.info.device,m.info.browser=m.info.browser,m.info.browserVersion=m.info.browserVersion,m.info.properties=m.info.properties;var wr="__mp_opt_in_out_";function kr(n,e){Io(!0,n,e)}function Sr(n,e){Io(!1,n,e)}function _r(n,e){return Po(n,e)==="1"}function Eo(n,e){if(Ar(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=Po(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 cn(n){return dt(n,function(e){return this.get_config(e)})}function un(n){return dt(n,function(e){return this._get_config(e)})}function Un(n){return dt(n,function(e){return this._get_config(e)})}function Mr(n,e){e=e||{},rt(e).remove(lt(n,e),!!e.crossSubdomainCookie,e.cookieDomain)}function rt(n){return n=n||{},n.persistenceType==="localStorage"?m.localStorage:m.cookie}function lt(n,e){return e=e||{},(e.persistencePrefix||wr)+n}function Po(n,e){return rt(e).get(lt(n,e))}function Ar(n){if(n&&n.ignoreDnt)return!1;var e=n&&n.window||N,i=e.navigator||{},t=!1;return m.each([i.doNotTrack,i.msDoNotTrack,e.doNotTrack],function(o){m.includes([!0,1,"1","yes"],o)&&(t=!0)}),t}function Io(n,e,i){if(!m.isString(e)||!e.length){J.error("gdpr."+(n?"optIn":"optOut")+" called with an invalid token");return}i=i||{},rt(i).set(lt(e,i),n?1:0,m.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 dt(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"),a=e.call(this,"opt_out_tracking_cookie_prefix"),l=e.call(this,"window");t&&(i=Eo(t,{ignoreDnt:o,persistenceType:s,persistencePrefix:a,window:l}))}catch(v){J.error("Unexpected error when checking tracking opt-out status: "+v)}if(!i)return n.apply(this,arguments);var d=arguments[arguments.length-1];typeof d=="function"&&d(0)}}var xr=Ei("lock"),Do=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3};Do.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,a=this.pollIntervalMS,l=this.timeoutMS,d=this.storage,v=s+":X",p=s+":Y",g=s+":Z",f=function(A){e&&e(A)},y=function(A){if(new Date().getTime()-o>l){xr.error("Timeout waiting for mutex on "+s+"; clearing lock. ["+t+"]"),d.removeItem(g),d.removeItem(p),S();return}setTimeout(function(){try{A()}catch(_){f(_)}},a*(Math.random()+.1))},k=function(A,_){A()?_():y(function(){k(A,_)})},C=function(){var A=d.getItem(p);if(A&&A!==t)return!1;if(d.setItem(p,t),d.getItem(p)===t)return!0;if(!Pi(d,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},S=function(){d.setItem(v,t),k(C,function(){if(d.getItem(v)===t){M();return}y(function(){if(d.getItem(p)!==t){S();return}k(function(){return!d.getItem(g)},M)})})},M=function(){d.setItem(g,"1");try{n()}finally{d.removeItem(g),d.getItem(p)===t&&d.removeItem(p),d.getItem(v)===t&&d.removeItem(v)}};try{if(Pi(d,!0))S();else throw new Error("localStorage support check failed")}catch(A){f(A)}};var Bo=Ei("batch"),hn=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.reportError=e.errorReporter||m.bind(Bo.error,Bo),this.lock=new Do(n,{storage:this.storage}),this.usePersistence=e.usePersistence,this.pid=e.pid||null,this.memQueue=[]};hn.prototype.enqueue=function(n,e,i){var t={id:at(),flushAfter:new Date().getTime()+e*2,payload:n};this.usePersistence?this.lock.withLock(m.bind(function(){var s;try{var a=this.readFromStorage();a.push(t),s=this.saveToStorage(a),s&&this.memQueue.push(t)}catch{this.reportError("Error enqueueing item",n),s=!1}i&&i(s)},this),m.bind(function(s){this.reportError("Error acquiring storage lock",s),i&&i(!1)},this),this.pid):(this.memQueue.push(t),i&&i(!0))},hn.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={};m.each(e,function(a){t[a.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 No=function(n,e){var i=[];return m.each(n,function(t){t.id&&!e[t.id]&&i.push(t)}),i};hn.prototype.removeItemsByID=function(n,e){var i={};if(m.each(n,function(o){i[o]=!0}),this.memQueue=No(this.memQueue,i),!this.usePersistence)e&&e(!0);else{var t=m.bind(function(){var o;try{var s=this.readFromStorage();if(s=No(s,i),o=this.saveToStorage(s),o){s=this.readFromStorage();for(var a=0;a<s.length;a++){var l=s[a];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)},m.bind(function(s){var a=!1;if(this.reportError("Error acquiring storage lock",s),!Pi(this.storage,!0)&&(a=t(),!a))try{this.storage.removeItem(this.storageKey)}catch(l){this.reportError("Error clearing queue",l)}e&&e(a)},this),this.pid)}};var Ho=function(n,e){var i=[];return m.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};hn.prototype.updatePayloads=function(n,e){this.memQueue=Ho(this.memQueue,n),this.usePersistence?this.lock.withLock(m.bind(function(){var t;try{var o=this.readFromStorage();o=Ho(o,n),t=this.saveToStorage(o)}catch{this.reportError("Error updating items",n),t=!1}e&&e(t)},this),m.bind(function(t){this.reportError("Error acquiring storage lock",t),e&&e(!1)},this),this.pid):e&&e(!0)},hn.prototype.readFromStorage=function(){var n;try{n=this.storage.getItem(this.storageKey),n&&(n=Di(n),m.isArray(n)||(this.reportError("Invalid storage entry:",n),n=null))}catch(e){this.reportError("Error retrieving queue",e),n=null}return n||[]},hn.prototype.saveToStorage=function(n){try{return this.storage.setItem(this.storageKey,Ii(n)),!0}catch(e){return this.reportError("Error saving queue",e),!1}},hn.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var Lr=10*60*1e3,ii=Ei("batch"),je=function(n,e){this.errorReporter=e.errorReporter,this.queue=new hn(n,{errorReporter:m.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};je.prototype.enqueue=function(n,e){this.queue.enqueue(n,this.flushInterval,e)},je.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},je.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},je.prototype.clear=function(){this.queue.clear()},je.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},je.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},je.prototype.scheduleFlush=function(n){this.flushInterval=n,this.stopped||(this.timeoutID=setTimeout(m.bind(function(){this.stopped||this.flush()},this),this.flushInterval))},je.prototype.flush=function(n){try{if(this.requestInProgress){ii.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,a=[],l={};if(m.each(o,function(p){var g=p.payload;if(this.beforeSendHook&&!p.orphaned&&(g=this.beforeSendHook(g)),g){g.event&&g.properties&&(g.properties=m.extend({},g.properties,{mp_sent_by_lib_version:$e.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&&a.push(g)}l[p.id]=g},this),a.length<1){this.resetFlush();return}this.requestInProgress=!0;var d=m.bind(function(p){this.requestInProgress=!1;try{var g=!1;if(n.unloading)this.queue.updatePayloads(l);else if(m.isObject(p)&&p.error==="timeout"&&new Date().getTime()-i>=e)this.reportError("Network timeout; retrying"),this.flush();else if(m.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(Lr,f),this.reportError("Error; retry in "+f+" ms"),this.scheduleFlush(f)}else if(m.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(m.map(o,function(k){return k.id}),m.bind(function(k){k?(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)),m.each(o,m.bind(function(k){var C=k.id;C?(this.itemIdsSentSuccessfully[C]=this.itemIdsSentSuccessfully[C]||0,this.itemIdsSentSuccessfully[C]++,this.itemIdsSentSuccessfully[C]>5&&this.reportError("[dupe] item ID sent too many times",{item:k,batchSize:o.length,timesSent:this.itemIdsSentSuccessfully[C]})):this.reportError("[dupe] found item with no ID while removing",{item:k})},this)))}catch(k){this.reportError("Error handling API response",k),this.resetFlush()}},this),v={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};n.unloading&&(v.transport="sendBeacon"),ii.log("MIXPANEL REQUEST:",a),this.sendRequest(a,v,d)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},je.prototype.reportError=function(n,e){if(ii.error.apply(ii.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(n)),this.errorReporter(n,e)}catch(i){ii.error(i)}};var wn=Ei("recorder"),Ro=N.CompressionStream,Tr={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},Er=new Set([Ge.MouseMove,Ge.MouseInteraction,Ge.Scroll,Ge.ViewportResize,Ge.Input,Ge.TouchMove,Ge.MediaInteraction,Ge.Drag,Ge.Selection]);function Pr(n){return n.type===ko.IncrementalSnapshot&&Er.has(n.data.source)}var Ke=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=ei,this.recordMinMs=0,this._initBatcher()};Ke.prototype._initBatcher=function(){this.batcher=new je("__mprec",{libConfig:Tr,sendRequestFunc:m.bind(this.flushEventsWithOptOut,this),errorReporter:m.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},Ke.prototype.get_config=function(n){return this._mixpanel.get_config(n)},Ke.prototype.startRecording=function(n){if(this._stopRecording!==null){wn.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>ei&&(this.recordMaxMs=ei,wn.critical("record_max_ms cannot be greater than "+ei+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>nt&&(this.recordMinMs=nt,wn.critical("record_min_ms cannot be greater than "+nt+"ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=new Date().getTime(),this.replayId=m.UUID(),n||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var e=m.bind(function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(m.bind(function(){wn.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=Xn({emit:m.bind(function(t){this.batcher.enqueue(t),Pr(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(m.bind(this.resetRecording,this),this.recordMaxMs)},Ke.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},Ke.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)},Ke.prototype.flushEventsWithOptOut=function(n,e,i){this._flushEvents(n,e,i,m.bind(this._onOptOut,this))},Ke.prototype._onOptOut=function(n){n===0&&(this.recEvents=[],this.stopRecording())},Ke.prototype._sendRequest=function(n,e,i,t){var o=m.bind(function(s,a){s.status===200&&this.replayId===n&&this.seqNo++,t({status:0,httpStatusCode:s.status,responseBody:a,retryAfter:s.headers.get("Retry-After")})},this);N.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(a){o(s,a)}).catch(function(a){t({error:a})})}).catch(function(s){t({error:s,httpStatusCode:0})})},Ke.prototype._flushEvents=cn(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 a=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:a,replay_start_time:this.replayStartTime/1e3},d=m.JSONEncode(n),v=this._mixpanel.get_property("$device_id");v&&(l.$device_id=v);var p=this._mixpanel.get_property("$user_id");if(p&&(l.$user_id=p),Ro){var g=new Blob([d],{type:"application/json"}).stream(),f=g.pipeThrough(new Ro("gzip"));new Response(f).blob().then(m.bind(function(y){l.format="gzip",this._sendRequest(o,l,y,i)},this))}else l.format="body",this._sendRequest(o,l,d,i)}}),Ke.prototype.reportError=function(n,e){wn.error.apply(wn.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(i){wn.error(i)}},N.__mp_recorder=Ke;var Ye=function(){};Ye.prototype.create_properties=function(){},Ye.prototype.event_handler=function(){},Ye.prototype.after_track_handler=function(){},Ye.prototype.init=function(n){return this.mp=n,this},Ye.prototype.track=function(n,e,i,t){var o=this,s=m.dom_query(n);if(s.length===0){J.error("The DOM query ("+n+") returned 0 elements");return}return m.each(s,function(a){m.register_event(a,this.override_event,function(l){var d={},v=o.create_properties(i,this),p=o.mp.get_config("track_links_timeout");o.event_handler(l,this,d),window.setTimeout(o.track_callback(t,v,d,!0),p),o.mp.track(e,v,o.track_callback(t,v,d))})},this),!0},Ye.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))}},Ye.prototype.create_properties=function(n,e){var i;return typeof n=="function"?i=n(e):i=m.extend({},n),i};var Vn=function(){this.override_event="click"};m.inherit(Vn,Ye),Vn.prototype.create_properties=function(n,e){var i=Vn.superclass.create_properties.apply(this,arguments);return e.href&&(i.url=e.href),i},Vn.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()},Vn.prototype.after_track_handler=function(n,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var Bi=function(){this.override_event="submit"};m.inherit(Bi,Ye),Bi.prototype.event_handler=function(n,e,i){i.element=e,n.preventDefault()},Bi.prototype.after_track_handler=function(n,e){setTimeout(function(){e.element.submit()},0)};var mn="$set",jn="$set_once",Fe="$unset",kn="$add",qe="$append",Sn="$union",Qe="$remove",Ir="$delete",Oo={set_action:function(n,e){var i={},t={};return m.isObject(n)?m.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 m.isArray(n)||(n=[n]),m.each(n,function(t){this._is_reserved_property(t)||i.push(t)},this),e[Fe]=i,e},set_once_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[jn]=t,i},union_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=m.isArray(o)?o:[o])},this):t[n]=m.isArray(e)?e:[e],i[Sn]=t,i},append_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[qe]=t,i},remove_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Qe]=t,i},delete_action:function(){var n={};return n[Ir]="",n}},ie=function(){};m.extend(ie.prototype,Oo),ie.prototype._init=function(n,e,i){this._mixpanel=n,this._group_key=e,this._group_id=i},ie.prototype.set=Un(function(n,e,i){var t=this.set_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.set_once=Un(function(n,e,i){var t=this.set_once_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.unset=Un(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),ie.prototype.union=Un(function(n,e,i){m.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),ie.prototype.delete=Un(function(n){var e=this.delete_action();return this._send_request(e,n)}),ie.prototype.remove=Un(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=m.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 H=function(){};m.extend(H.prototype,Oo),H.prototype._init=function(n){this._mixpanel=n},H.prototype.set=un(function(n,e,i){var t=this.set_action(n,e);return m.isObject(n)&&(i=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),t[mn]=m.extend({},m.info.people_properties(),t[mn]),this._send_request(t,i)}),H.prototype.set_once=un(function(n,e,i){var t=this.set_once_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),H.prototype.unset=un(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),H.prototype.increment=un(function(n,e,i){var t={},o={};return m.isObject(n)?(m.each(n,function(s,a){if(!this._is_reserved_property(a))if(isNaN(parseFloat(s))){J.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else o[a]=s},this),i=e):(m.isUndefined(e)&&(e=1),o[n]=e),t[kn]=o,this._send_request(t,i)}),H.prototype.append=un(function(n,e,i){m.isObject(n)&&(i=e);var t=this.append_action(n,e);return this._send_request(t,i)}),H.prototype.remove=un(function(n,e,i){m.isObject(n)&&(i=e);var t=this.remove_action(n,e);return this._send_request(t,i)}),H.prototype.union=un(function(n,e,i){m.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),H.prototype.track_charge=un(function(n,e,i){if(!m.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",m.extend({$amount:n},e),i)}),H.prototype.clear_charges=function(n){return this.set("$transactions",[],n)},H.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)},H.prototype.toString=function(){return this._mixpanel.toString()+".people"},H.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=m.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),m.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),m.truncate(s,255))},H.prototype._get_config=function(n){return this._mixpanel.get_config(n)},H.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},H.prototype._enqueue=function(n){mn in n?this._mixpanel.persistence._add_to_people_queue(mn,n):jn in n?this._mixpanel.persistence._add_to_people_queue(jn,n):Fe in n?this._mixpanel.persistence._add_to_people_queue(Fe,n):kn in n?this._mixpanel.persistence._add_to_people_queue(kn,n):qe in n?this._mixpanel.persistence._add_to_people_queue(qe,n):Qe in n?this._mixpanel.persistence._add_to_people_queue(Qe,n):Sn in n?this._mixpanel.persistence._add_to_people_queue(Sn,n):J.error("Invalid call to _enqueue():",n)},H.prototype._flush_one_queue=function(n,e,i,t){var o=this,s=m.extend({},this._mixpanel.persistence.load_queue(n)),a=s;!m.isUndefined(s)&&m.isObject(s)&&!m.isEmptyObject(s)&&(o._mixpanel.persistence._pop_from_people_queue(n,s),o._mixpanel.persistence.save(),t&&(a=t(s)),e.call(o,a,function(l,d){l===0&&o._mixpanel.persistence._add_to_people_queue(n,s),m.isUndefined(i)||i(l,d)}))},H.prototype._flush=function(n,e,i,t,o,s,a){var l=this;this._flush_one_queue(mn,this.set,n),this._flush_one_queue(jn,this.set_once,t),this._flush_one_queue(Fe,this.unset,s,function(S){return m.keys(S)}),this._flush_one_queue(kn,this.increment,e),this._flush_one_queue(Sn,this.union,o);var d=this._mixpanel.persistence.load_queue(qe);if(!m.isUndefined(d)&&m.isArray(d)&&d.length)for(var v,p=function(S,M){S===0&&l._mixpanel.persistence._add_to_people_queue(qe,v),m.isUndefined(i)||i(S,M)},g=d.length-1;g>=0;g--)d=this._mixpanel.persistence.load_queue(qe),v=d.pop(),l._mixpanel.persistence.save(),m.isEmptyObject(v)||l.append(v,p);var f=this._mixpanel.persistence.load_queue(Qe);if(!m.isUndefined(f)&&m.isArray(f)&&f.length)for(var y,k=function(S,M){S===0&&l._mixpanel.persistence._add_to_people_queue(Qe,y),m.isUndefined(a)||a(S,M)},C=f.length-1;C>=0;C--)f=this._mixpanel.persistence.load_queue(Qe),y=f.pop(),l._mixpanel.persistence.save(),m.isEmptyObject(y)||l.remove(y,k)},H.prototype._is_reserved_property=function(n){return n==="$distinct_id"||n==="$token"||n==="$device_id"||n==="$user_id"||n==="$had_persisted_distinct_id"},H.prototype.set=H.prototype.set,H.prototype.set_once=H.prototype.set_once,H.prototype.unset=H.prototype.unset,H.prototype.increment=H.prototype.increment,H.prototype.append=H.prototype.append,H.prototype.remove=H.prototype.remove,H.prototype.union=H.prototype.union,H.prototype.track_charge=H.prototype.track_charge,H.prototype.clear_charges=H.prototype.clear_charges,H.prototype.delete_user=H.prototype.delete_user,H.prototype.toString=H.prototype.toString;var ct="__mps",ut="__mpso",ht="__mpus",mt="__mpa",pt="__mpap",vt="__mpr",bt="__mpu",Uo="$people_distinct_id",Ni="__alias",ti="__timers",Dr=[ct,ut,ht,mt,pt,vt,bt,Uo,Ni,ti],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"&&m.localStorage.is_supported()?this.storage=m.localStorage:this.storage=m.cookie,this.load(),this.update_config(n),this.upgrade(),this.save()};j.prototype.properties=function(){var n={};return this.load(),m.each(this.props,function(e,i){m.include(Dr,i)||(n[i]=e)}),n},j.prototype.load=function(){if(!this.disabled){var n=this.storage.parse(this.name);n&&(this.props=m.extend({},n))}},j.prototype.upgrade=function(){var n,e;this.storage===m.localStorage?(n=m.cookie.parse(this.name),m.cookie.remove(this.name),m.cookie.remove(this.name,!0),n&&this.register_once(n)):this.storage===m.cookie&&(e=m.localStorage.parse(this.name),m.localStorage.remove(this.name),e&&this.register_once(e))},j.prototype.save=function(){this.disabled||this.storage.set(this.name,m.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 m.isObject(n)?(typeof e>"u"&&(e="None"),this.expire_days=typeof i>"u"?this.default_expiry:i,this.load(),m.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 m.isObject(n)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),m.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(m.info.searchInfo(n))},j.prototype.update_referrer_info=function(n){this.register_once({$initial_referrer:n||"$direct",$initial_referring_domain:m.info.referringDomain(n)||"$direct"},"")},j.prototype.get_referrer_info=function(){return m.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(jn),a=this._get_or_create_queue(Fe),l=this._get_or_create_queue(kn),d=this._get_or_create_queue(Sn),v=this._get_or_create_queue(Qe,[]),p=this._get_or_create_queue(qe,[]);i===ct?(m.extend(o,t),this._pop_from_people_queue(kn,t),this._pop_from_people_queue(Sn,t),this._pop_from_people_queue(Fe,t)):i===ut?(m.each(t,function(g,f){f in s||(s[f]=g)}),this._pop_from_people_queue(Fe,t)):i===ht?m.each(t,function(g){m.each([o,s,l,d],function(f){g in f&&delete f[g]}),m.each(p,function(f){g in f&&delete f[g]}),a[g]=!0}):i===mt?(m.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(Fe,t)):i===bt?(m.each(t,function(g,f){m.isArray(g)&&(f in d||(d[f]=[]),d[f]=d[f].concat(g))}),this._pop_from_people_queue(Fe,t)):i===vt?(v.push(t),this._pop_from_people_queue(qe,t)):i===pt&&(p.push(t),this._pop_from_people_queue(Fe,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)];m.isUndefined(i)||m.each(e,function(t,o){n===qe||n===Qe?m.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 ct;if(n===jn)return ut;if(n===Fe)return ht;if(n===kn)return mt;if(n===qe)return pt;if(n===Qe)return vt;if(n===Sn)return bt;J.error("Invalid queue:",n)},j.prototype._get_or_create_queue=function(n,e){var i=this._get_queue_key(n);return e=m.isUndefined(e)?{}:e,this.props[i]||(this.props[i]=e)},j.prototype.set_event_timer=function(n,e){var i=this.load_prop(ti)||{};i[n]=e,this.props[ti]=i,this.save()},j.prototype.remove_event_timer=function(n){var e=this.load_prop(ti)||{},i=e[n];return m.isUndefined(i)||(delete this.props[ti][n],this.save()),i};var ft,Vo=function(n,e){throw new Error(n+" not available in this build.")},Ce,jo=0,Br=1,Nr=function(n){return n},oi=function(){},He="mixpanel",Ko="base64",Hr="json",gt="$device:",Kn=N.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,Fo=!Kn&&ze.indexOf("MSIE")===-1&&ze.indexOf("Mozilla")===-1,Hi=null;dn.sendBeacon&&(Hi=function(){return dn.sendBeacon.apply(dn,arguments)});var Go={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},zo={api_host:"https://api-js.mixpanel.com",api_routes:Go,api_method:"POST",api_transport:"XHR",api_payload_format:Ko,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:oi,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:oi,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:ei,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},qo=!1,x=function(){},yt=function(n,e,i){var t,o=i===He?Ce:Ce[i];if(o&&ft===jo)t=o;else{if(o&&!m.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 H,t.people._init(t),!t.get_config("skip_first_touch_marketing")){var s=m.info.campaignParams(null),a={},l=!1;m.each(s,function(d,v){a["initial_"+v]=d,d&&(l=!0)}),l&&t.people.set_once(a)}return $e.DEBUG=$e.DEBUG||t.get_config("debug"),!m.isUndefined(o)&&m.isArray(o)&&(t._execute_array.call(t.people,o.people),t._execute_array(o)),t};x.prototype.init=function(n,e,i){if(m.isUndefined(i)){this.report_error("You must name your new library: init(token, config, name)");return}if(i===He){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var t=yt(n,e,i);return Ce[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||zo.api_host;o.match(/\.mixpanel\.com/)&&(t.api_payload_format=Hr)}if(this.set_config(m.extend({},zo,t,e,{name:i,token:n,callback_fn:(i===He?i:He+"."+i)+"._jsc"})),this._jsc=oi,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(!m.localStorage.is_supported(!0)||!Kn)this._batch_requests=!1,J.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),m.each(this.get_batcher_configs(),function(d){J.log("Clearing batch queue "+d.queue_key),m.localStorage.remove(d.queue_key)});else if(this.init_batchers(),Hi&&N.addEventListener){var s=m.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);N.addEventListener("pagehide",function(d){d.persisted&&s()}),N.addEventListener("visibilitychange",function(){ee.visibilityState==="hidden"&&s()})}}this.persistence=this.cookie=new j(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=m.UUID();this.get_distinct_id()||this.register_once({distinct_id:gt+a,$device_id:a},"");var l=this.get_config("track_pageview");l&&this._init_url_change_tracking(l),this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent")&&this.start_session_recording()},x.prototype.start_session_recording=cn(function(){if(!N.MutationObserver){J.critical("Browser does not support MutationObserver; skipping session recording");return}var n=m.bind(function(){this._recorder=this._recorder||new N.__mp_recorder(this),this._recorder.startRecording()},this);m.isUndefined(N.__mp_recorder)?Vo(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=m.info.campaignParams(null);m.each(n,(function(e,i){this.unregister(i)}).bind(this))}},x.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(ee.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(m.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(ee.referrer)},x.prototype._dom_loaded=function(){m.each(this.__dom_loaded_queue,function(n){this._track_dom.apply(this,n)},this),this.has_opted_out_tracking()||m.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(!qo)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=m.info.currentUrl()),m.include(["full-url","url-with-path-and-query-string","url-with-path"],n)){N.addEventListener("popstate",function(){N.dispatchEvent(new Event("mp_locationchange"))}),N.addEventListener("hashchange",function(){N.dispatchEvent(new Event("mp_locationchange"))});var t=N.history.pushState;typeof t=="function"&&(N.history.pushState=function(s,a,l){t.call(N.history,s,a,l),N.dispatchEvent(new Event("mp_locationchange"))});var o=N.history.replaceState;typeof o=="function"&&(N.history.replaceState=function(s,a,l){o.call(N.history,s,a,l),N.dispatchEvent(new Event("mp_locationchange"))}),N.addEventListener("mp_locationchange",(function(){var s=m.info.currentUrl(),a=!1;if(n==="full-url"?a=s!==e:n==="url-with-path-and-query-string"?a=s.split("#")[0]!==e.split("#")[0]:n==="url-with-path"&&(a=s.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0]),a){var l=this.track_pageview();l&&(e=s)}}).bind(this))}},x.prototype._prepare_callback=function(n,e){if(m.isUndefined(n))return null;if(Kn){var i=function(a){n(a,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(a){delete t[o],n(a,e)},s}},x.prototype._send_request=function(n,e,i,t){var o=!0;if(Fo)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")},a=null;!t&&(m.isFunction(i)||typeof i=="string")&&(t=i,i=null),i=m.extend(s,i||{}),Kn||(i.method="GET");var l=i.method==="POST",d=Hi&&l&&i.transport.toLowerCase()==="sendbeacon",v=i.verbose;e.verbose&&(v=!0),this.get_config("test")&&(e.test=1),v&&(e.verbose=1),this.get_config("img")&&(e.img=1),Kn||(t?e.callback=t:(v||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),l&&(a="data="+encodeURIComponent(e.data),delete e.data),n+="?"+m.HTTPBuildQuery(e);var p=this;if("img"in e){var g=ee.createElement("img");g.src=n,ee.body.appendChild(g)}else if(d){try{o=Hi(n,a)}catch(M){p.report_error(M),o=!1}try{t&&t(o?1:0)}catch(M){p.report_error(M)}}else if(Kn)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"),m.each(y,function(M,A){f.setRequestHeader(A,M)}),i.timeout_ms&&typeof f.timeout<"u"){f.timeout=i.timeout_ms;var k=new Date().getTime()}f.withCredentials=!0,f.onreadystatechange=function(){if(f.readyState===4)if(f.status===200){if(t)if(v){var M;try{M=m.JSONDecode(f.responseText)}catch(T){if(p.report_error(T),i.ignore_json_errors)M=f.responseText;else return}t(M)}else t(Number(f.responseText))}else{var A;if(f.timeout&&!f.status&&new Date().getTime()-k>=f.timeout?A="timeout":A="Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(A),t)if(v){var _=f.responseHeaders||{};t({status:0,httpStatusCode:f.status,error:A,retryAfter:_["Retry-After"]})}else t(0)}},f.send(a)}catch(M){p.report_error(M),o=!1}else{var C=ee.createElement("script");C.type="text/javascript",C.async=!0,C.defer=!0,C.src=n;var S=ee.getElementsByTagName("script")[0];S.parentNode.insertBefore(C,S)}return o},x.prototype._execute_array=function(n){var e,i=[],t=[],o=[];m.each(n,function(a){a&&(e=a[0],m.isArray(e)?o.push(a):typeof a=="function"?a.call(this):m.isArray(a)&&e==="alias"?i.push(a):m.isArray(a)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?o.push(a):t.push(a))},this);var s=function(a,l){m.each(a,function(d){if(m.isArray(d[0])){var v=l;m.each(d,function(p){v=v[p[0]].apply(v,p.slice(1))})}else this[d[0]].apply(this,d.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=m.bind(function(i){return new je(i.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:m.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:m.bind(function(t){return this._run_hook("before_send_"+i.type,t)},this),stopAllBatchingFunc:m.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,m.each(this.request_batchers,function(n){n.start()}))},x.prototype.stop_batch_senders=function(){this._batch_requests=!1,m.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=m.JSONEncode(n);return this.get_config("api_payload_format")===Ko&&(e=m.base64Encode(e)),{data:e}},x.prototype._track_or_batch=function(n,e){var i=m.truncate(n.data,255),t=n.endpoint,o=n.batcher,s=n.should_send_immediately,a=n.send_request_options||{};e=e||oi;var l=!0,d=m.bind(function(){return a.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),a,this._prepare_callback(e,i))):null},this);return this._batch_requests&&!s?o.enqueue(i,function(v){v?e(1,i):d()}):l=d(),l&&i},x.prototype.track=cn(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=oi),m.isUndefined(n)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(n)){t(0);return}e=m.extend({},e),e.token=this.get_config("token");var a=this.persistence.remove_event_timer(n);if(!m.isUndefined(a)){var l=new Date().getTime()-a;e.$duration=parseFloat((l/1e3).toFixed(3))}this._set_default_superprops();var d=this.get_config("track_marketing")?m.info.marketingParams():{};e=m.extend({},m.info.properties({mp_loader:this.get_config("mp_loader")}),d,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),e);var v=this.get_config("property_blacklist");m.isArray(v)?m.each(v,function(f){delete e[f]}):this.report_error("Invalid value for property_blacklist config: "+v);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=cn(function(n,e,i){m.isArray(e)||(e=[e]);var t={};return t[n]=e,this.register(t),this.people.set(n,e,i)}),x.prototype.add_group=cn(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=cn(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=cn(function(n,e,i,t){var o=m.extend({},e||{});return m.each(i,function(s,a){s!=null&&(o[a]=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=cn(function(n,e){typeof n!="object"&&(n={}),e=e||{};var i=e.event_name||"$mp_web_page_view",t=m.extend(m.info.mpPageViewProperties(),m.info.campaignParams(),m.info.clickParams()),o=m.extend({},t,n);return this.track(i,o)}),x.prototype.track_links=function(){return this._track_dom.call(this,Vn,arguments)},x.prototype.track_forms=function(){return this._track_dom.call(this,Bi,arguments)},x.prototype.time_event=function(n){if(m.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 Rr={persistent:!0},Ct=function(n){var e;return m.isObject(n)?e=n:m.isUndefined(n)?e={}:e={days:n},m.extend({},Rr,e)};x.prototype.register=function(n,e){var i=Ct(e);i.persistent?this.persistence.register(n,i.days):m.extend(this.unpersisted_superprops,n)},x.prototype.register_once=function(n,e,i){var t=Ct(i);t.persistent?this.persistence.register_once(n,e,t.days):(typeof e>"u"&&(e="None"),m.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=Ct(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,a,l){var d=this.get_distinct_id();if(n&&d!==n){if(typeof n=="string"&&n.indexOf(gt)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:n})}if(!this.get_property("$device_id")){var v=d;this.register_once({$had_persisted_distinct_id:!0,$device_id:v},"")}n!==d&&n!==this.get_property(Ni)&&(this.unregister(Ni),this.register({distinct_id:n})),this._flags.identify_called=!0,this.people._flush(e,i,t,o,s,a,l),n!==d&&this.track("$identify",{distinct_id:n,$anon_distinct_id:d},{skip_hooks:!0})},x.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var n=m.UUID();this.register_once({distinct_id:gt+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(Uo))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var i=this;return m.isUndefined(e)&&(e=this.get_distinct_id()),n!==e?(this._register_single(Ni,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(m.isObject(n)){m.extend(this.config,n);var e=n.batch_size;e&&m.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),$e.DEBUG=$e.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]||Nr).apply(this,ln.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!==He&&(n=He+"."+n),n},x.prototype._event_is_disabled=function(n){return m.isBlockedUA(ze)||this._flags.disable_all_events||m.include(this.__disabled_events,n)},x.prototype._gdpr_init=function(){var n=this.get_config("opt_out_tracking_persistence_type")==="localStorage";n&&m.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")||m.cookie.get("mp_optout"))&&(m.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=m.extend({track:m.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),m.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=m.extend({enable_persistence:!0},n),this._gdpr_call_func(kr,n),this._gdpr_update_persistence(n)},x.prototype.opt_out_tracking=function(n){n=m.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(Sr,n),this._gdpr_update_persistence(n)},x.prototype.has_opted_in_tracking=function(n){return this._gdpr_call_func(_r,n)},x.prototype.has_opted_out_tracking=function(n){return this._gdpr_call_func(Eo,n)},x.prototype.clear_opt_in_out_tracking=function(n){n=m.extend({enable_persistence:!0},n),this._gdpr_call_func(Mr,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=Go,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 Fn={},Or=function(){m.each(Fn,function(n,e){e!==He&&(Ce[e]=n)}),Ce._=m},Ur=function(){Ce.init=function(n,e,i){if(i)return Ce[i]||(Ce[i]=Fn[i]=yt(n,e,i),Ce[i]._loaded()),Ce[i];var t=Ce;Fn[He]?t=Fn[He]:n&&(t=yt(n,e,He),t._loaded(),Fn[He]=t),Ce=t,ft===Br&&(N[He]=Ce),Or()}},Vr=function(){function n(){n.done||(n.done=!0,qo=!0,Fo=!1,m.each(Fn,function(t){t._dom_loaded()}))}function e(){try{ee.documentElement.doScroll("left")}catch{setTimeout(e,1);return}n()}if(ee.addEventListener)ee.readyState==="complete"?n():ee.addEventListener("DOMContentLoaded",n,!1);else if(ee.attachEvent){ee.attachEvent("onreadystatechange",n);var i=!1;try{i=N.frameElement===null}catch{}ee.documentElement.doScroll&&i&&e()}m.register_event(N,"load",n,!0)};function jr(n){return Vo=n,ft=jo,Ce=new x,Ur(),Ce.init(),Vr(),Ce}function Kr(n,e){e()}var P=jr(Kr);const Wo=`<div id="checkoutConfirmationEnd">
990
990
  <div class="w-full">
991
991
  <div id="otp-content" class=" grid gap-4">
992
992
  <h5 class="text-black" id="otp-message">
@@ -1014,7 +1014,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1014
1014
  </div>
1015
1015
  </div>
1016
1016
  </div>
1017
- </div>`;class Wo{constructor(e){h(this,"container");h(this,"onAction");h(this,"callBackUrl");h(this,"paymentResponse");h(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",()=>{Ze(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return qo}}const Fr=`<div id="confirmationProgress">
1017
+ </div>`;class Zo{constructor(e){h(this,"container");h(this,"onAction");h(this,"callBackUrl");h(this,"paymentResponse");h(this,"paymentResponseHeaders");h(this,"paymentMethod");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders,this.paymentMethod=e.paymentMethod}attachListeners(){const e=this.container.querySelector("#goback-to-merchant");e&&e.addEventListener("click",()=>{var i;P.track("redirect_to_merchant",{payment_method:this.paymentMethod,status:(i=this.paymentResponse)==null?void 0:i.status}),Ze(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){var e;this.container.innerHTML=this.render(),P.track("payment_timeout",{payment_method:this.paymentMethod,status:(e=this.paymentResponse)==null?void 0:e.status}),this.attachListeners()}render(){return Wo}}const Fr=`<div id="confirmationProgress">
1018
1018
  <div class="min-h-[20dvh]">
1019
1019
  <div>
1020
1020
  <div class="grid grid-rows-[auto_1fr] gap-4 mx-5">
@@ -1043,213 +1043,535 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1043
1043
 
1044
1044
  </div>
1045
1045
  </div>
1046
- </div>`;class Gr{constructor(e){h(this,"container");h(this,"onAction");h(this,"onSuccess");h(this,"ref");h(this,"token");h(this,"initialTime",300);h(this,"abortController");h(this,"timeLeft");h(this,"timer");h(this,"timerId",null);h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"setPaymentResponses");h(this,"step");h(this,"paymentMethod");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.onSuccess=e.onSuccess,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses,this.step=e.step,this.paymentMethod=e.paymentMethod}attachListeners(){this.initialTime=300,this.timeLeft=this.initialTime;const e=3e4;this.abortController=new AbortController,setTimeout(()=>{this.verifyCardPayment(this.token,e,({data:i,headers:t})=>{this.onAction(this.step.success),this.redirectTo(i,t,"success")},()=>{this.onAction(this.step.failed)})},5e3),this.startTimer()}async verifyCardPayment(e,i,t,o){let s=0,a=i,l=!0,d;this.abortController&&(d=this.abortController.signal);const v=async()=>{if(this.timeLeft<=0){l=!1,this.onAction(this.step.end);return}s+=1;try{const p=await an(e,this.ref,d,this.rdtCode,this.url);p.data.status==="failed"&&(l=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),this.setPaymentResponses(p.data,p.headers),P.track("verify_payment",{payment_method:this.paymentMethod,verification_status:"Failed"}),o(p)),p.data.status==="inProgress"&&(l&&(a=i*(s+1),this.timer=setTimeout(v,a)),this.setPaymentResponses(p.data,p.headers)),(p.data.status==="success"||p.data.status==="successful")&&(this.setPaymentResponses(p.data,p.headers),l=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),P.track("verify_payment",{payment_method:this.paymentMethod,verification_status:"Success"}),t(p))}catch{l&&(a=i*(s+1),this.timer=setTimeout(v,a))}};v()}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)}startTimer(){const e=this.container.querySelector("#ctd-timer");this.stopTimer(),this.timerId=window.setInterval(()=>{this.timeLeft>0?(this.timeLeft-=1,e&&(e.innerHTML=zn(this.timeLeft),this.startTimer())):(this.stopTimer(),this.onAction(this.step.end))},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return Fr}}class zr{constructor({amount:e,totalAmount:i,container:t,customer:o,encryption:s,planId:a,token:l,currency:d,rdtCode:v,url:p,reference:g,onSuccess:f,callBackUrl:y,metadata:k,localCurrency:C,hidePaymentMethods:S,showPaymentMethods:M,onClose:A,restartTransactionProcess:_,retryingPayment:T}){h(this,"contents");h(this,"cardDetailForm");h(this,"cardOtpValidationForm");h(this,"merchantPlanDetail",{});h(this,"cardPinForm");h(this,"avsForm");h(this,"successScreen");h(this,"pageLoader");h(this,"warningScreen");h(this,"transactionIssuesScreen");h(this,"container");h(this,"onSuccess");h(this,"planId","");h(this,"customer");h(this,"token");h(this,"amount");h(this,"totalAmount");h(this,"encryption");h(this,"currency");h(this,"_currentStep");h(this,"activeRef");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"onClose");h(this,"cardResponse");h(this,"cardResponseHeader");h(this,"confirmationEnd");h(this,"confirmationProgress");h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);this.currency=d,this.onSuccess=f||(()=>null),this.container=t,this.encryption=s,this.token=l,this.customer=o,this.planId=a,this.amount=e,this.totalAmount=i,this.rdtCode=v,this.url=p,this.reference=g,this.callBackUrl=y,this.metadata=k,this.localCurrency=C,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.cardResponse={},this.cardResponseHeader={},this.hidePaymentMethods=S,this.showPaymentMethods=M,this.onClose=A,this.restartTransactionProcess=_,this.retryingPayment=T,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 js(JSON.stringify(i),this.encryption);t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),(()=>{var l;if(this.retryingPayment){const d={channel:"card",reference:this.reference,encryptedCard:s};return ci(this.token,d,this.rdtCode,this.url)}else{const d={amount:this.amount,channel:"card",currency:this.currency||"USD",planId:this.planId,customer:this.customer,reference:this.reference,encryptedCard:s,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((l=this.merchantPlanDetail)==null?void 0:l.taxQuoteId)&&{taxQuoteId:this.merchantPlanDetail.taxQuoteId}};return As(this.token,d,this.rdtCode,this.url)}})().then(({data:l,headers:d})=>{var v,p,g,f,y,k,C,S;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=d,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(!["success","successful"].includes(l.status)&&l.status!=="failed")if(this.cardResponse=l,this.cardResponseHeader=d,l!=null&&l.authorization){if(this.activeRef=l.reference,((v=l==null?void 0:l.authorization)==null?void 0:v.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),(y=l==null?void 0:l.authorization)!=null&&y.embeddedHtml&&this.redirectToPreciumDoc((k=l==null?void 0:l.authorization)==null?void 0:k.embeddedHtml);return}if(((C=l==null?void 0:l.authorization)==null?void 0:C.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}if(((S=l==null?void 0:l.authorization)==null?void 0:S.mode)==="avs"){this.currentStep=7;return}}else this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Error with Payment"),this.warningScreen.hideReportIssue();else["success","successful"].includes(l.status)&&(this.currentStep=5,this.cardResponse=l,this.cardResponseHeader=d,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"}),this.redirectTo(l,d,"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">
1047
- <path
1048
- 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"
1049
- stroke="black" stroke-width="4" stroke-linejoin="round" />
1050
- </svg>`),o&&o.classList.add("hidden"),di(this.token,i,this.rdtCode,this.url).then(({data:a,headers:l})=>{var d,v,p,g,f,y,k;if(a.status==="failed")P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.currentStep=4,a.providerMessage?this.warningScreen.setPaymentError(a.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(a.status))this.currentStep=5,this.redirectTo(a,l,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"});else{if(((d=a==null?void 0:a.authorization)==null?void 0:d.mode)==="3DS"){(v=a==null?void 0:a.authorization)!=null&&v.redirectUrl&&this.redirectTo3DS((p=a==null?void 0:a.authorization)==null?void 0:p.redirectUrl),(g=a==null?void 0:a.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=a==null?void 0:a.authorization)==null?void 0:f.embeddedHtml);return}if(((y=a==null?void 0:a.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=a,this.currentStep=3;return}if(((k=a==null?void 0:a.authorization)==null?void 0:k.mode)==="avs"){this.currentStep=7;return}this.currentStep=10}}).catch(a=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),this.currentStep=4,a.message?this.warningScreen.setPaymentError(a.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()})},300)}}showLoader(){this.pageLoader=new Ne(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:a})=>{const l=document.createElement("button");l.textContent=a,l.setAttribute("id",s),l.classList.add("warning-button");const d=document.createElement("div");d.appendChild(l),t.appendChild(d)})}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")),di(this.token,s,this.rdtCode,this.url).then(({data:l,headers:d})=>{var v,p,g,f,y,k,C;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"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(l.status))["success","successful"].includes(l.status)&&(this.currentStep=5,this.redirectTo(l,d,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"AVS"}));else{if(((v=l==null?void 0:l.authorization)==null?void 0:v.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),(y=l==null?void 0:l.authorization)!=null&&y.embeddedHtml&&this.redirectToPreciumDoc((k=l==null?void 0:l.authorization)==null?void 0:k.embeddedHtml);return}if(((C=l==null?void 0:l.authorization)==null?void 0:C.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}this.currentStep=10}}).catch(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"}),di(this.token,t,this.rdtCode,this.url).then(({data:s,headers:a})=>{var l,d,v,p,g,f,y;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"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(s.status))["success","successful"].includes(s.status)&&(this.currentStep=5,this.redirectTo(s,a,"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(((d=s==null?void 0:s.authorization)==null?void 0:d.mode)==="3DS"){(v=s==null?void 0:s.authorization)!=null&&v.redirectUrl&&this.redirectTo3DS((p=s==null?void 0:s.authorization)==null?void 0:p.redirectUrl),(g=s==null?void 0:s.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=s==null?void 0:s.authorization)==null?void 0:f.embeddedHtml);return}if(((y=s==null?void 0:s.authorization)==null?void 0:y.mode)==="avs"){this.currentStep=7;return}this.currentStep=10}}).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"),this.warningScreen.hideReportIssue()})}redirectTo3DS(e){const i=window.open("","_blank");if(!i){alert("Please enable popups for this site to complete the authentication.");return}i.location.href=e,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"),this.warningScreen.hideReportIssue(),P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}redirectToPreciumDoc(e){const i=atob(e),t=new Blob([i],{type:"text/html"}),o=URL.createObjectURL(t),s=window.open(o,"_blank");if(s){s.document.close(),P.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const a=setInterval(()=>{s.closed&&(clearInterval(a),this.verifyPayment(({data:l,headers:d})=>{this.currentStep=5,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(l,d,"success")},({data:l})=>{this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue(),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 an(this.token,this.activeRef,void 0,this.rdtCode,this.url);t.data.status==="failed"?i(t):(["success","successful"].includes(t.data.status)&&e(t),t.data.status==="inProgress"&&(this.currentStep=10))}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 an(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 Ht({container:this.contents,onAction:a=>l=>this.submitCardDetails.bind(this)(a,l),merchantName:this.merchantPlanDetail.merchantName,currency:this.localCurrency!==this.currency?this.localCurrency:this.currency}),this.cardDetailForm.renderContent();break;case 2:this.cardPinForm=new qs({container:this.contents,onClose:this.onClose,onAction:a=>this.handlePinRequest.bind(this)(a)}),this.cardPinForm.renderComponent();break;case 3:this.cardOtpValidationForm=new Gs({container:this.contents,onClose:this.onClose,onAction:a=>l=>this.submitOtp.bind(this)(a,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 gn({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 qn({container:this.contents,amount:this.totalAmount,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 Ne(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 7:this.avsForm=new Js({container:this.contents,onAction:a=>l=>this.validatedAVS.bind(this)(a,l)}),this.avsForm.renderComponent();break;case 8:this.transactionIssuesScreen=new mi({container:this.contents,onAction:()=>{var a;this.currentStep=4,this.warningScreen.setPaymentError(((a=this.cardResponse)==null?void 0:a.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 Wo({container:this.contents,onAction:a=>{this.currentStep=a},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;case 10:this.confirmationProgress=new Gr({container:this.contents,onAction:a=>{this.currentStep=a},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(a,l)=>{this.cardResponse=a,this.cardResponseHeader=l},step:{failed:4,success:5,end:9},paymentMethod:"Card"}),this.confirmationProgress.renderComponent();break;default:this.cardDetailForm=new Ht({container:this.contents,onAction:a=>l=>this.submitCardDetails.bind(this)(a,l),merchantName:this.merchantPlanDetail.merchantName,currency:this.localCurrency?this.localCurrency:this.currency}),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,a;const i=this.container.querySelector("#details-form-button-text");if(i){const l=this.currency,d=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 ${d} ${xe(this.totalAmount!==this.amount?this.totalAmount:(this.amount||0)*(l==="USD"?(a=(s=this.merchantPlanDetail)==null?void 0:s.rate)==null?void 0:a.rate:1),2)}`}}}const qr=`<div>
1051
- <div class="container-center h-[40vh] hidden" id="loader">
1052
- <img src="" alt="loader gif" />
1046
+ </div>`;class Gr{constructor(e){h(this,"container");h(this,"onAction");h(this,"onSuccess");h(this,"ref");h(this,"token");h(this,"initialTime",300);h(this,"abortController");h(this,"timeLeft");h(this,"timer");h(this,"timerId",null);h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"setPaymentResponses");h(this,"step");h(this,"paymentMethod");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.onSuccess=e.onSuccess,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses,this.step=e.step,this.paymentMethod=e.paymentMethod}attachListeners(){this.initialTime=300,this.timeLeft=this.initialTime;const e=3e4;this.abortController=new AbortController,setTimeout(()=>{this.verifyCardPayment(this.token,e,({data:i,headers:t})=>{this.onAction(this.step.success),this.redirectTo(i,t,"success")},()=>{this.onAction(this.step.failed)})},5e3),this.startTimer()}async verifyCardPayment(e,i,t,o){let s=0,a=i,l=!0,d;this.abortController&&(d=this.abortController.signal);const v=async()=>{if(this.timeLeft<=0){l=!1,this.onAction(this.step.end);return}s+=1;try{const p=await an(e,this.ref,d,this.rdtCode,this.url);p.data.status==="failed"&&(l=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),this.setPaymentResponses(p.data,p.headers),P.track("verify_payment",{payment_method:this.paymentMethod,verification_status:"Failed"}),o(p)),p.data.status==="inProgress"&&(l&&(a=i*(s+1),this.timer=setTimeout(v,a)),this.setPaymentResponses(p.data,p.headers)),(p.data.status==="success"||p.data.status==="successful")&&(this.setPaymentResponses(p.data,p.headers),l=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),P.track("verify_payment",{payment_method:this.paymentMethod,verification_status:"Success"}),t(p))}catch{l&&(a=i*(s+1),this.timer=setTimeout(v,a))}};v()}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)}startTimer(){const e=this.container.querySelector("#ctd-timer");this.stopTimer(),this.timerId=window.setInterval(()=>{this.timeLeft>0?(this.timeLeft-=1,e&&(e.innerHTML=zn(this.timeLeft),this.startTimer())):(this.stopTimer(),this.onAction(this.step.end))},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return Fr}}const zr=`<div class="flex items-center justify-center md:justify-between w-full text-xxs mt-5">
1047
+ <div class="text-tone-60"><span>Powered by</span> <span class="font-bold">Spotflow</span></div>
1048
+ <div class="align-center text-tone-60 hidden md:flex gap-4">
1049
+ <span id="test-cards-link" class="hover:font-bold">Test Cards</span>
1050
+ <a href="https://ribbon-scowl-35f.notion.site/Terms-Conditions-940742f0a1b144498ffc1786c5bc6a08?pvs=4" target="_blank" class="hover:font-bold">Terms</a>
1051
+ <a href="https://ribbon-scowl-35f.notion.site/Privacy-Policy-Spotflow-3997ee8d923d4cd39a3dc43b7249b713" target="_blank" class="hover:font-bold">Privacy</a>
1052
+ <a href="mailto:hello@spotflow.one" class="hover:font-bold">Contact</a>
1053
1053
  </div>
1054
- <div id="details-content" class="grid gap-5">
1055
- <h5 class="text-sm text-tone-100 text-center font-semibold md:w-4/5 mx-auto">
1056
- Make a single bank transfer from your bank to this account
1057
- before it expires.
1058
- </h5>
1059
- <div class="border border-grey-100 rounded-lg text-black px-6 py-5 grid gap-4">
1060
- <div class="text-sm grid grid-cols-[1fr_auto] gap-3">
1061
- <div>
1062
- <p class="text-sm">Amount</p>
1054
+ </div>`,qr=`<div class="box-container flex-1">
1055
+ <!-- test-cards.html -->
1056
+ <div class="bg-gray-100 py-2 px-4 rounded-lg mt-4 relative">
1057
+ <div class="flex items-start gap-4 mb-4">
1058
+ <nav id="test-card-tabs"
1059
+ class="flex w-full font-medium items-start gap-6 border-b border-tone-10 text-base text-tone-40 mb-2">
1060
+ <button class="tab-btn active-tab" data-target="no-auth">No auth</button>
1061
+ <button class="tab-btn" data-target="pin">Pin</button>
1062
+ <button class="tab-btn" data-target="pin-otp">Pin + OTP</button>
1063
+ <button class="tab-btn" data-target="3ds">3DS</button>
1064
+ <button class="tab-btn" data-target="avs">AVS</button>
1065
+ </nav>
1066
+ <!-- Close Icon -->
1067
+ <button id="close-test-card" class="text-gray-500 hover:text-black">
1068
+
1069
+ </button>
1063
1070
  </div>
1064
1071
 
1065
- <div class="align-center gap-2">
1066
- <p class="font-bold transfer-curr-amount" id="transfer-amount"></p>
1067
-
1068
- <button type="button" class="relative group" id="copy-amount">
1069
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
1070
- <path
1071
- d="M9.33268 7.52502V9.97502C9.33268 12.0167 8.51602 12.8334 6.47435 12.8334H4.02435C1.98268 12.8334 1.16602 12.0167 1.16602 9.97502V7.52502C1.16602 5.48335 1.98268 4.66669 4.02435 4.66669H6.47435C8.51602 4.66669 9.33268 5.48335 9.33268 7.52502Z"
1072
- stroke="#0D0716" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
1073
- <path
1074
- d="M12.8327 4.02502V6.47502C12.8327 8.51669 12.016 9.33335 9.97435 9.33335H9.33268V7.52502C9.33268 5.48335 8.51602 4.66669 6.47435 4.66669H4.66602V4.02502C4.66602 1.98335 5.48268 1.16669 7.52435 1.16669H9.97435C12.016 1.16669 12.8327 1.98335 12.8327 4.02502Z"
1075
- stroke="#0D0716" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
1076
- </svg>
1077
-
1078
-
1079
- <div class="tooltip">
1080
- <div class="tooltip-textbox">
1081
- <p class="tooltip-text" id="amount-tooltip">Copy</p>
1082
- </div>
1072
+ <!-- Section contents -->
1073
+ <div id="no-auth" class="tab-content grid gap-3 border border-tone-50 px-6 py-4 rounded-2xl mb-4">
1074
+ <div class="flex justify-between items-center">
1075
+ <span class="text-tone-60 font-medium text-sm">Number</span>
1076
+ <div class="flex items-center gap-1">
1077
+ <span data-copy-value="4111112000062555" class="text-tone-100 text-sm font-medium">4111112000062555</span>
1078
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1079
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1080
+ <path
1081
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1082
+ fill="#0D0716" />
1083
+ </svg>
1084
+ </button>
1085
+ </div>
1083
1086
  </div>
1084
- </button>
1085
- </div>
1086
- </div>
1087
-
1088
- <div class="grid grid-cols-[1fr_auto] gap-3 text-sm">
1089
- <div>
1090
- <p class="text-sm">Account Number</p>
1091
- </div>
1092
-
1093
- <div class="align-center gap-2">
1094
- <p class="font-bold" id="transfer-acn"></p>
1095
-
1096
- <button type="button" class="relative group" id="copy-acn">
1097
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
1098
- <path
1099
- d="M9.33268 7.52502V9.97502C9.33268 12.0167 8.51602 12.8334 6.47435 12.8334H4.02435C1.98268 12.8334 1.16602 12.0167 1.16602 9.97502V7.52502C1.16602 5.48335 1.98268 4.66669 4.02435 4.66669H6.47435C8.51602 4.66669 9.33268 5.48335 9.33268 7.52502Z"
1100
- stroke="#0D0716" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
1101
- <path
1102
- d="M12.8327 4.02502V6.47502C12.8327 8.51669 12.016 9.33335 9.97435 9.33335H9.33268V7.52502C9.33268 5.48335 8.51602 4.66669 6.47435 4.66669H4.66602V4.02502C4.66602 1.98335 5.48268 1.16669 7.52435 1.16669H9.97435C12.016 1.16669 12.8327 1.98335 12.8327 4.02502Z"
1103
- stroke="#0D0716" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
1104
- </svg>
1105
-
1106
-
1107
- <div class="tooltip">
1108
- <div class="tooltip-textbox">
1109
- <p class="tooltip-text" id="acn-tooltip">Copy</p>
1110
- </div>
1087
+ <div class="flex justify-between items-center">
1088
+ <span class="text-tone-60 font-medium text-sm">Expiry</span>
1089
+ <div class="flex items-center gap-1">
1090
+ <span data-copy-value="12/30" class="text-tone-100 text-sm font-medium">12/2030 </span>
1091
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1092
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1093
+ <path
1094
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1095
+ fill="#0D0716" />
1096
+ </svg>
1097
+ </button>
1098
+ </div>
1099
+ </div>
1100
+ <div class="flex justify-between items-center">
1101
+ <span class="text-tone-60 font-medium text-sm">CVV</span>
1102
+ <div class="flex items-center gap-1">
1103
+ <span data-copy-value="455" class="text-tone-100 text-sm font-medium">455 </span>
1104
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1105
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1106
+ <path
1107
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1108
+ fill="#0D0716" />
1109
+ </svg>
1110
+ </button>
1111
+ </div>
1111
1112
  </div>
1112
- </button>
1113
1113
  </div>
1114
- </div>
1115
-
1116
- <div class="grid grid-cols-[1fr_auto] gap-3 text-sm">
1117
- <p>Bank name</p>
1118
- <p class="font-semibold" id="transfer-bank"></p>
1119
- </div>
1120
-
1121
-
1122
- <div class="grid grid-cols-[1fr_auto] gap-3 text-sm">
1123
- <p>Beneficiary</p>
1124
- <p class="font-semibold" id="account-name"></p>
1125
- </div>
1126
- </div>
1127
-
1128
- <div class="mt-3">
1129
- <button type="button" id="transfer-button" class="details-form-button">I have made this bank transfer</button>
1130
- </div>
1131
1114
 
1132
- <div class="mt-5">
1133
- <div class="w-9/12 mx-auto">
1134
- <div class="bg-[#FEF7ED] text-[#816039] text-sm text-center rounded-lg p-2">
1135
- This account is for this transaction only and
1136
- expires in <span class="font-semibold" id="time-left"></span><span class="font-semibold">s</span>
1137
- </div>
1138
- </div>
1139
- </div>
1140
- </div>
1141
- </div>`;function Wr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Zo={exports:{}};/*!
1142
- * Pusher JavaScript Library v8.4.0
1143
- * https://pusher.com/
1144
- *
1145
- * Copyright 2020, Pusher
1146
- * Released under the MIT licence.
1147
- */(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 a=t[s]={i:s,l:!1,exports:{}};return i[s].call(a.exports,a,a.exports,o),a.l=!0,a.exports}return o.m=i,o.c=t,o.d=function(s,a,l){o.o(s,a)||Object.defineProperty(s,a,{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,a){if(a&1&&(s=o(s)),a&8||a&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}),a&2&&typeof s!="string")for(var d in s)o.d(l,d,(function(v){return s[v]}).bind(null,d));return l},o.n=function(s){var a=s&&s.__esModule?function(){return s.default}:function(){return s};return o.d(a,"a",a),a},o.o=function(s,a){return Object.prototype.hasOwnProperty.call(s,a)},o.p="",o(o.s=2)}([function(i,t,o){var s=this&&this.__extends||function(){var C=function(S,M){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,_){A.__proto__=_}||function(A,_){for(var T in _)_.hasOwnProperty(T)&&(A[T]=_[T])},C(S,M)};return function(S,M){C(S,M);function A(){this.constructor=S}S.prototype=M===null?Object.create(M):(A.prototype=M.prototype,new A)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=256,l=function(){function C(S){S===void 0&&(S="="),this._paddingCharacter=S}return C.prototype.encodedLength=function(S){return this._paddingCharacter?(S+2)/3*4|0:(S*8+5)/6|0},C.prototype.encode=function(S){for(var M="",A=0;A<S.length-2;A+=3){var _=S[A]<<16|S[A+1]<<8|S[A+2];M+=this._encodeByte(_>>>3*6&63),M+=this._encodeByte(_>>>2*6&63),M+=this._encodeByte(_>>>1*6&63),M+=this._encodeByte(_>>>0*6&63)}var T=S.length-A;if(T>0){var _=S[A]<<16|(T===2?S[A+1]<<8:0);M+=this._encodeByte(_>>>3*6&63),M+=this._encodeByte(_>>>2*6&63),T===2?M+=this._encodeByte(_>>>1*6&63):M+=this._paddingCharacter||"",M+=this._paddingCharacter||""}return M},C.prototype.maxDecodedLength=function(S){return this._paddingCharacter?S/4*3|0:(S*6+7)/8|0},C.prototype.decodedLength=function(S){return this.maxDecodedLength(S.length-this._getPaddingLength(S))},C.prototype.decode=function(S){if(S.length===0)return new Uint8Array(0);for(var M=this._getPaddingLength(S),A=S.length-M,_=new Uint8Array(this.maxDecodedLength(A)),T=0,I=0,K=0,G=0,V=0,F=0,oe=0;I<A-4;I+=4)G=this._decodeChar(S.charCodeAt(I+0)),V=this._decodeChar(S.charCodeAt(I+1)),F=this._decodeChar(S.charCodeAt(I+2)),oe=this._decodeChar(S.charCodeAt(I+3)),_[T++]=G<<2|V>>>4,_[T++]=V<<4|F>>>2,_[T++]=F<<6|oe,K|=G&a,K|=V&a,K|=F&a,K|=oe&a;if(I<A-1&&(G=this._decodeChar(S.charCodeAt(I)),V=this._decodeChar(S.charCodeAt(I+1)),_[T++]=G<<2|V>>>4,K|=G&a,K|=V&a),I<A-2&&(F=this._decodeChar(S.charCodeAt(I+2)),_[T++]=V<<4|F>>>2,K|=F&a),I<A-3&&(oe=this._decodeChar(S.charCodeAt(I+3)),_[T++]=F<<6|oe,K|=oe&a),K!==0)throw new Error("Base64Coder: incorrect characters for decoding");return _},C.prototype._encodeByte=function(S){var M=S;return M+=65,M+=25-S>>>8&6,M+=51-S>>>8&-75,M+=61-S>>>8&-15,M+=62-S>>>8&3,String.fromCharCode(M)},C.prototype._decodeChar=function(S){var M=a;return M+=(42-S&S-44)>>>8&-a+S-43+62,M+=(46-S&S-48)>>>8&-a+S-47+63,M+=(47-S&S-58)>>>8&-a+S-48+52,M+=(64-S&S-91)>>>8&-a+S-65+0,M+=(96-S&S-123)>>>8&-a+S-97+26,M},C.prototype._getPaddingLength=function(S){var M=0;if(this._paddingCharacter){for(var A=S.length-1;A>=0&&S[A]===this._paddingCharacter;A--)M++;if(S.length<4||M>2)throw new Error("Base64Coder: incorrect padding")}return M},C}();t.Coder=l;var d=new l;function v(C){return d.encode(C)}t.encode=v;function p(C){return d.decode(C)}t.decode=p;var g=function(C){s(S,C);function S(){return C!==null&&C.apply(this,arguments)||this}return S.prototype._encodeByte=function(M){var A=M;return A+=65,A+=25-M>>>8&6,A+=51-M>>>8&-75,A+=61-M>>>8&-13,A+=62-M>>>8&49,String.fromCharCode(A)},S.prototype._decodeChar=function(M){var A=a;return A+=(44-M&M-46)>>>8&-a+M-45+62,A+=(94-M&M-96)>>>8&-a+M-95+63,A+=(47-M&M-58)>>>8&-a+M-48+52,A+=(64-M&M-91)>>>8&-a+M-65+0,A+=(96-M&M-123)>>>8&-a+M-97+26,A},S}(l);t.URLSafeCoder=g;var f=new g;function y(C){return f.encode(C)}t.encodeURLSafe=y;function k(C){return f.decode(C)}t.decodeURLSafe=k,t.encodedLength=function(C){return d.encodedLength(C)},t.maxDecodedLength=function(C){return d.maxDecodedLength(C)},t.decodedLength=function(C){return d.decodedLength(C)}},function(i,t,o){Object.defineProperty(t,"__esModule",{value:!0});var s="utf8: invalid string",a="utf8: invalid source encoding";function l(p){for(var g=new Uint8Array(d(p)),f=0,y=0;y<p.length;y++){var k=p.charCodeAt(y);k<128?g[f++]=k:k<2048?(g[f++]=192|k>>6,g[f++]=128|k&63):k<55296?(g[f++]=224|k>>12,g[f++]=128|k>>6&63,g[f++]=128|k&63):(y++,k=(k&1023)<<10,k|=p.charCodeAt(y)&1023,k+=65536,g[f++]=240|k>>18,g[f++]=128|k>>12&63,g[f++]=128|k>>6&63,g[f++]=128|k&63)}return g}t.encode=l;function d(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=d;function v(p){for(var g=[],f=0;f<p.length;f++){var y=p[f];if(y&128){var k=void 0;if(y<224){if(f>=p.length)throw new Error(a);var C=p[++f];if((C&192)!==128)throw new Error(a);y=(y&31)<<6|C&63,k=128}else if(y<240){if(f>=p.length-1)throw new Error(a);var C=p[++f],S=p[++f];if((C&192)!==128||(S&192)!==128)throw new Error(a);y=(y&15)<<12|(C&63)<<6|S&63,k=2048}else if(y<248){if(f>=p.length-2)throw new Error(a);var C=p[++f],S=p[++f],M=p[++f];if((C&192)!==128||(S&192)!==128||(M&192)!==128)throw new Error(a);y=(y&15)<<18|(C&63)<<12|(S&63)<<6|M&63,k=65536}else throw new Error(a);if(y<k||y>=55296&&y<=57343)throw new Error(a);if(y>=65536){if(y>1114111)throw new Error(a);y-=65536,g.push(String.fromCharCode(55296|y>>10)),y=56320|y&1023}}g.push(String.fromCharCode(y))}return g.join("")}t.decode=v},function(i,t,o){i.exports=o(3).default},function(i,t,o){o.r(t);class s{constructor(r,c){this.lastId=0,this.prefix=r,this.name=c}create(r){this.lastId++;var c=this.lastId,b=this.prefix+c,w=this.name+"["+c+"]",L=!1,E=function(){L||(r.apply(null,arguments),L=!0)};return this[c]=E,{number:c,id:b,name:w,callback:E}}remove(r){delete this[r.number]}}var a=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:""},d=l;class v{constructor(r){this.options=r,this.receivers=r.receivers||a,this.loading={}}load(r,c,b){var w=this;if(w.loading[r]&&w.loading[r].length>0)w.loading[r].push(b);else{w.loading[r]=[b];var L=O.createScriptRequest(w.getPath(r,c)),E=w.receivers.create(function(D){if(w.receivers.remove(E),w.loading[r]){var R=w.loading[r];delete w.loading[r];for(var Z=function(pe){pe||L.cleanup()},X=0;X<R.length;X++)R[X](D,Z)}});L.send(E)}}getRoot(r){var c,b=O.getDocument().location.protocol;return r&&r.useTLS||b==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(r,c){return this.getRoot(c)+"/"+r+this.options.suffix+".js"}}var p=new s("_pusher_dependencies","Pusher.DependenciesReceivers"),g=new v({cdn_http:d.cdn_http,cdn_https:d.cdn_https,version:d.VERSION,suffix:d.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 k={buildLogSuffix:function(u){const r="See:",c=f.urls[u];if(!c)return"";let b;return c.fullUrl?b=c.fullUrl:c.path&&(b=f.baseUrl+c.path),b?`${r} ${b}`:""}},C;(function(u){u.UserAuthentication="user-authentication",u.ChannelAuthorization="channel-authorization"})(C||(C={}));class S extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class A extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class _ extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class T extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class I extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class K extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class G extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class V extends Error{constructor(r,c){super(c),this.status=r,Object.setPrototypeOf(this,new.target.prototype)}}var oe=function(u,r,c,b,w){const L=O.createXHR();L.open("POST",c.endpoint,!0),L.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var E in c.headers)L.setRequestHeader(E,c.headers[E]);if(c.headersProvider!=null){let D=c.headersProvider();for(var E in D)L.setRequestHeader(E,D[E])}return L.onreadystatechange=function(){if(L.readyState===4)if(L.status===200){let D,R=!1;try{D=JSON.parse(L.responseText),R=!0}catch{w(new V(200,`JSON returned from ${b.toString()} endpoint was invalid, yet status code was 200. Data was: ${L.responseText}`),null)}R&&w(null,D)}else{let D="";switch(b){case C.UserAuthentication:D=k.buildLogSuffix("authenticationEndpoint");break;case C.ChannelAuthorization:D=`Clients must be authorized to join private or presence channels. ${k.buildLogSuffix("authorizationEndpoint")}`;break}w(new V(L.status,`Unable to retrieve auth string from ${b.toString()} endpoint - received status: ${L.status} from ${c.endpoint}. ${D}`),null)}},L.send(r),L};function ge(u){return en(Te(u))}var U=String.fromCharCode,_e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ue=function(u){var r=u.charCodeAt(0);return r<128?u:r<2048?U(192|r>>>6)+U(128|r&63):U(224|r>>>12&15)+U(128|r>>>6&63)+U(128|r&63)},Te=function(u){return u.replace(/[^\x00-\x7F]/g,ue)},Me=function(u){var r=[0,2,1][u.length%3],c=u.charCodeAt(0)<<16|(u.length>1?u.charCodeAt(1):0)<<8|(u.length>2?u.charCodeAt(2):0),b=[_e.charAt(c>>>18),_e.charAt(c>>>12&63),r>=2?"=":_e.charAt(c>>>6&63),r>=1?"=":_e.charAt(c&63)];return b.join("")},en=window.btoa||function(u){return u.replace(/[\s\S]{1,3}/g,Me)};class vn{constructor(r,c,b,w){this.clear=c,this.timer=r(()=>{this.timer&&(this.timer=w(this.timer))},b)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var nn=vn;function _n(u){window.clearTimeout(u)}function bn(u){window.clearInterval(u)}class Ee extends nn{constructor(r,c){super(setTimeout,_n,r,function(b){return c(),null})}}class tn extends nn{constructor(r,c){super(setInterval,bn,r,function(b){return c(),b})}}var Mn={now(){return Date.now?Date.now():new Date().valueOf()},defer(u){return new Ee(0,u)},method(u,...r){var c=Array.prototype.slice.call(arguments,1);return function(b){return b[u].apply(b,c.concat(arguments))}}},re=Mn;function fe(u,...r){for(var c=0;c<r.length;c++){var b=r[c];for(var w in b)b[w]&&b[w].constructor&&b[w].constructor===Object?u[w]=fe(u[w]||{},b[w]):u[w]=b[w]}return u}function Re(){for(var u=["Pusher"],r=0;r<arguments.length;r++)typeof arguments[r]=="string"?u.push(arguments[r]):u.push(An(arguments[r]));return u.join(" : ")}function Pe(u,r){var c=Array.prototype.indexOf;if(u===null)return-1;if(c&&u.indexOf===c)return u.indexOf(r);for(var b=0,w=u.length;b<w;b++)if(u[b]===r)return b;return-1}function we(u,r){for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&r(u[c],c,u)}function We(u){var r=[];return we(u,function(c,b){r.push(b)}),r}function B(u){var r=[];return we(u,function(c){r.push(c)}),r}function he(u,r,c){for(var b=0;b<u.length;b++)r.call(c||window,u[b],b,u)}function Q(u,r){for(var c=[],b=0;b<u.length;b++)c.push(r(u[b],b,u,c));return c}function me(u,r){var c={};return we(u,function(b,w){c[w]=r(b)}),c}function Ie(u,r){r=r||function(w){return!!w};for(var c=[],b=0;b<u.length;b++)r(u[b],b,u,c)&&c.push(u[b]);return c}function $(u,r){var c={};return we(u,function(b,w){(r&&r(b,w,u,c)||b)&&(c[w]=b)}),c}function fn(u){var r=[];return we(u,function(c,b){r.push([b,c])}),r}function si(u,r){for(var c=0;c<u.length;c++)if(r(u[c],c,u))return!0;return!1}function Oi(u,r){for(var c=0;c<u.length;c++)if(!r(u[c],c,u))return!1;return!0}function Vi(u){return me(u,function(r){return typeof r=="object"&&(r=An(r)),encodeURIComponent(ge(r.toString()))})}function Ui(u){var r=$(u,function(b){return b!==void 0}),c=Q(fn(Vi(r)),re.method("join","=")).join("&");return c}function ji(u){var r=[],c=[];return function b(w,L){var E,D,R;switch(typeof w){case"object":if(!w)return null;for(E=0;E<r.length;E+=1)if(r[E]===w)return{$ref:c[E]};if(r.push(w),c.push(L),Object.prototype.toString.apply(w)==="[object Array]")for(R=[],E=0;E<w.length;E+=1)R[E]=b(w[E],L+"["+E+"]");else{R={};for(D in w)Object.prototype.hasOwnProperty.call(w,D)&&(R[D]=b(w[D],L+"["+JSON.stringify(D)+"]"))}return R;case"number":case"string":case"boolean":return w}}(u,"$")}function An(u){try{return JSON.stringify(u)}catch{return JSON.stringify(ji(u))}}class ai{constructor(){this.globalLog=r=>{window.console&&window.console.log&&window.console.log(r)}}debug(...r){this.log(this.globalLog,r)}warn(...r){this.log(this.globalLogWarn,r)}error(...r){this.log(this.globalLogError,r)}globalLogWarn(r){window.console&&window.console.warn?window.console.warn(r):this.globalLog(r)}globalLogError(r){window.console&&window.console.error?window.console.error(r):this.globalLogWarn(r)}log(r,...c){var b=Re.apply(this,arguments);Pt.log?Pt.log(b):Pt.logToConsole&&r.bind(this)(b)}}var se=new ai,El=function(u,r,c,b,w){(c.headers!==void 0||c.headersProvider!=null)&&se.warn(`To send headers with the ${b.toString()} request, you must use AJAX, rather than JSONP.`);var L=u.nextAuthCallbackID.toString();u.nextAuthCallbackID++;var E=u.getDocument(),D=E.createElement("script");u.auth_callbacks[L]=function(X){w(null,X)};var R="Pusher.auth_callbacks['"+L+"']";D.src=c.endpoint+"?callback="+encodeURIComponent(R)+"&"+r;var Z=E.getElementsByTagName("head")[0]||E.documentElement;Z.insertBefore(D,Z.firstChild)},Pl=El;class Il{constructor(r){this.src=r}send(r){var c=this,b="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=r.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){r.callback(b)},c.script.onload=function(){r.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&r.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=r.id+"_error",c.errorScript.text=r.name+"('"+b+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var w=document.getElementsByTagName("head")[0];w.insertBefore(c.script,w.firstChild),c.errorScript&&w.insertBefore(c.errorScript,c.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 Dl{constructor(r,c){this.url=r,this.data=c}send(r){if(!this.request){var c=Ui(this.data),b=this.url+"/"+r.number+"?"+c;this.request=O.createScriptRequest(b),this.request.send(r)}}cleanup(){this.request&&this.request.cleanup()}}var Bl=function(u,r){return function(c,b){var w="http"+(r?"s":"")+"://",L=w+(u.host||u.options.host)+u.options.path,E=O.createJSONPRequest(L,c),D=O.ScriptReceivers.create(function(R,Z){a.remove(D),E.cleanup(),Z&&Z.host&&(u.host=Z.host),b&&b(R,Z)});E.send(D)}},Nl={name:"jsonp",getAgent:Bl},Hl=Nl;function wt(u,r,c){var b=u+(r.useTLS?"s":""),w=r.useTLS?r.hostTLS:r.hostNonTLS;return b+"://"+w+c}function kt(u,r){var c="/app/"+u,b="?protocol="+d.PROTOCOL+"&client=js&version="+d.VERSION+(r?"&"+r:"");return c+b}var Rl={getInitial:function(u,r){var c=(r.httpPath||"")+kt(u,"flash=false");return wt("ws",r,c)}},Ol={getInitial:function(u,r){var c=(r.httpPath||"/pusher")+kt(u);return wt("http",r,c)}},Vl={getInitial:function(u,r){return wt("http",r,r.httpPath||"/pusher")},getPath:function(u,r){return kt(u)}};class Ul{constructor(){this._callbacks={}}get(r){return this._callbacks[St(r)]}add(r,c,b){var w=St(r);this._callbacks[w]=this._callbacks[w]||[],this._callbacks[w].push({fn:c,context:b})}remove(r,c,b){if(!r&&!c&&!b){this._callbacks={};return}var w=r?[St(r)]:We(this._callbacks);c||b?this.removeCallback(w,c,b):this.removeAllCallbacks(w)}removeCallback(r,c,b){he(r,function(w){this._callbacks[w]=Ie(this._callbacks[w]||[],function(L){return c&&c!==L.fn||b&&b!==L.context}),this._callbacks[w].length===0&&delete this._callbacks[w]},this)}removeAllCallbacks(r){he(r,function(c){delete this._callbacks[c]},this)}}function St(u){return"_"+u}class on{constructor(r){this.callbacks=new Ul,this.global_callbacks=[],this.failThrough=r}bind(r,c,b){return this.callbacks.add(r,c,b),this}bind_global(r){return this.global_callbacks.push(r),this}unbind(r,c,b){return this.callbacks.remove(r,c,b),this}unbind_global(r){return r?(this.global_callbacks=Ie(this.global_callbacks||[],c=>c!==r),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(r,c,b){for(var w=0;w<this.global_callbacks.length;w++)this.global_callbacks[w](r,c);var L=this.callbacks.get(r),E=[];if(b?E.push(c,b):c&&E.push(c),L&&L.length>0)for(var w=0;w<L.length;w++)L[w].fn.apply(L[w].context||window,E);else this.failThrough&&this.failThrough(r,c);return this}}class jl extends on{constructor(r,c,b,w,L){super(),this.initialize=O.transportConnectionInitializer,this.hooks=r,this.name=c,this.priority=b,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 r=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(r,this.options)}catch(c){return re.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),se.debug("Connecting",{transport:this.name,url:r}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(r){return this.state==="open"?(re.defer(()=>{this.socket&&this.socket.send(r)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(r){this.emit("error",{type:"WebSocketError",error:r}),this.timeline.error(this.buildTimelineMessage({error:r.toString()}))}onClose(r){r?this.changeState("closed",{code:r.code,reason:r.reason,wasClean:r.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(r){this.emit("message",r)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=r=>{this.onError(r)},this.socket.onclose=r=>{this.onClose(r)},this.socket.onmessage=r=>{this.onMessage(r)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(r,c){this.state=r,this.timeline.info(this.buildTimelineMessage({state:r,params:c})),this.emit(r,c)}buildTimelineMessage(r){return fe({cid:this.id},r)}}class Gn{constructor(r){this.hooks=r}isSupported(r){return this.hooks.isSupported(r)}createConnection(r,c,b,w){return new jl(this.hooks,r,c,b,w)}}var Kl=new Gn({urls:Rl,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!O.getWebSocketAPI()},isSupported:function(){return!!O.getWebSocketAPI()},getSocket:function(u){return O.createWebSocket(u)}}),ss={urls:Ol,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},as=fe({getSocket:function(u){return O.HTTPFactory.createStreamingSocket(u)}},ss),rs=fe({getSocket:function(u){return O.HTTPFactory.createPollingSocket(u)}},ss),ls={isSupported:function(){return O.isXHRSupported()}},Fl=new Gn(fe({},as,ls)),Gl=new Gn(fe({},rs,ls)),zl={ws:Kl,xhr_streaming:Fl,xhr_polling:Gl},Ki=zl,ql=new Gn({file:"sockjs",urls:Vl,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(u,r){return new window.SockJS(u,null,{js_path:g.getPath("sockjs",{useTLS:r.useTLS}),ignore_null_origin:r.ignoreNullOrigin})},beforeOpen:function(u,r){u.send(JSON.stringify({path:r}))}}),ds={isSupported:function(u){var r=O.isXDRSupported(u.useTLS);return r}},Wl=new Gn(fe({},as,ds)),Zl=new Gn(fe({},rs,ds));Ki.xdr_streaming=Wl,Ki.xdr_polling=Zl,Ki.sockjs=ql;var Jl=Ki;class $l extends on{constructor(){super();var r=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){r.emit("online")},!1),window.addEventListener("offline",function(){r.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Yl=new $l;class Ql{constructor(r,c,b){this.manager=r,this.transport=c,this.minPingDelay=b.minPingDelay,this.maxPingDelay=b.maxPingDelay,this.pingDelay=void 0}createConnection(r,c,b,w){w=fe({},w,{activityTimeout:this.pingDelay});var L=this.transport.createConnection(r,c,b,w),E=null,D=function(){L.unbind("open",D),L.bind("closed",R),E=re.now()},R=Z=>{if(L.unbind("closed",R),Z.code===1002||Z.code===1003)this.manager.reportDeath();else if(!Z.wasClean&&E){var X=re.now()-E;X<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(X/2,this.minPingDelay))}};return L.bind("open",D),L}isSupported(r){return this.manager.isAlive()&&this.transport.isSupported(r)}}const cs={decodeMessage:function(u){try{var r=JSON.parse(u.data),c=r.data;if(typeof c=="string")try{c=JSON.parse(r.data)}catch{}var b={event:r.event,channel:r.channel,data:c};return r.user_id&&(b.user_id=r.user_id),b}catch(w){throw{type:"MessageParseError",error:w,data:u.data}}},encodeMessage:function(u){return JSON.stringify(u)},processHandshake:function(u){var r=cs.decodeMessage(u);if(r.event==="pusher:connection_established"){if(!r.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:r.data.socket_id,activityTimeout:r.data.activity_timeout*1e3}}else{if(r.event==="pusher:error")return{action:this.getCloseAction(r.data),error:this.getCloseError(r.data)};throw"Invalid handshake"}},getCloseAction:function(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 xn=cs;class Xl extends on{constructor(r,c){super(),this.id=r,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(r){return this.transport.send(r)}send_event(r,c,b){var w={event:r,data:c};return b&&(w.channel=b),se.debug("Event sent",w),this.send(xn.encodeMessage(w))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var r={message:b=>{var w;try{w=xn.decodeMessage(b)}catch(L){this.emit("error",{type:"MessageParseError",error:L,data:b.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:b=>{this.emit("error",b)},closed:b=>{c(),b&&b.code&&this.handleCloseEvent(b),this.transport=null,this.emit("closed")}},c=()=>{we(r,(b,w)=>{this.transport.unbind(w,b)})};we(r,(b,w)=>{this.transport.bind(w,b)})}handleCloseEvent(r){var c=xn.getCloseAction(r),b=xn.getCloseError(r);b&&this.emit("error",b),c&&this.emit(c,{action:c,error:b})}}class ed{constructor(r,c){this.transport=r,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=r=>{this.unbindListeners();var c;try{c=xn.processHandshake(r)}catch(b){this.finish("error",{error:b}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new Xl(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=r=>{this.unbindListeners();var c=xn.getCloseAction(r)||"backoff",b=xn.getCloseError(r);this.finish(c,{error:b})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(r,c){this.callback(fe({transport:this.transport,action:r},c))}}class nd{constructor(r,c){this.timeline=r,this.options=c||{}}send(r,c){this.timeline.isEmpty()||this.timeline.send(O.TimelineTransport.getAgent(this,r),c)}}class _t extends on{constructor(r,c){super(function(b,w){se.debug("No callbacks on "+r+" for "+b)}),this.name=r,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(r,c){return c(null,{auth:""})}trigger(r,c){if(r.indexOf("client-")!==0)throw new S("Event '"+r+"' does not start with 'client-'");if(!this.subscribed){var b=k.buildLogSuffix("triggeringClientEvents");se.warn(`Client event triggered before channel 'subscription_succeeded' event . ${b}`)}return this.pusher.send_event(r,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(r){var c=r.event,b=r.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(r);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(r);else if(c.indexOf("pusher_internal:")!==0){var w={};this.emit(c,b,w)}}handleSubscriptionSucceededEvent(r){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",r.data)}handleSubscriptionCountEvent(r){r.data.subscription_count&&(this.subscriptionCount=r.data.subscription_count),this.emit("pusher:subscription_count",r.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(r,c)=>{r?(this.subscriptionPending=!1,se.error(r.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:r.message},r instanceof V?{status:r.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.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 Mt extends _t{authorize(r,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:r},c)}}class id{constructor(){this.reset()}get(r){return Object.prototype.hasOwnProperty.call(this.members,r)?{id:r,info:this.members[r]}:null}each(r){we(this.members,(c,b)=>{r(this.get(b))})}setMyID(r){this.myID=r}onSubscription(r){this.members=r.presence.hash,this.count=r.presence.count,this.me=this.get(this.myID)}addMember(r){return this.get(r.user_id)===null&&this.count++,this.members[r.user_id]=r.user_info,this.get(r.user_id)}removeMember(r){var c=this.get(r.user_id);return c&&(delete this.members[r.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var td=function(u,r,c,b){function w(L){return L instanceof c?L:new c(function(E){E(L)})}return new(c||(c=Promise))(function(L,E){function D(X){try{Z(b.next(X))}catch(pe){E(pe)}}function R(X){try{Z(b.throw(X))}catch(pe){E(pe)}}function Z(X){X.done?L(X.value):w(X.value).then(D,R)}Z((b=b.apply(u,r||[])).next())})};class od extends Mt{constructor(r,c){super(r,c),this.members=new id}authorize(r,c){super.authorize(r,(b,w)=>td(this,void 0,void 0,function*(){if(!b)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 E=k.buildLogSuffix("authorizationEndpoint");se.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${E}, or the user should be signed in.`),c("Invalid auth response");return}c(b,w)}))}handleEvent(r){var c=r.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(r);else{var b=r.data,w={};r.user_id&&(w.user_id=r.user_id),this.emit(c,b,w)}}handleInternalEvent(r){var c=r.event,b=r.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(r);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(r);break;case"pusher_internal:member_added":var w=this.members.addMember(b);this.emit("pusher:member_added",w);break;case"pusher_internal:member_removed":var L=this.members.removeMember(b);L&&this.emit("pusher:member_removed",L);break}}handleSubscriptionSucceededEvent(r){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(r.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var sd=o(1),At=o(0);class ad extends Mt{constructor(r,c,b){super(r,c),this.key=null,this.nacl=b}authorize(r,c){super.authorize(r,(b,w)=>{if(b){c(b,w);return}let L=w.shared_secret;if(!L){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(At.decode)(L),delete w.shared_secret,c(null,w)})}trigger(r,c){throw new I("Client events are not currently supported for encrypted channels")}handleEvent(r){var c=r.event,b=r.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(r);return}this.handleEncryptedEvent(c,b)}handleEncryptedEvent(r,c){if(!this.key){se.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){se.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let b=Object(At.decode)(c.ciphertext);if(b.length<this.nacl.secretbox.overheadLength){se.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${b.length}`);return}let w=Object(At.decode)(c.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(b,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,(E,D)=>{if(E){se.error(`Failed to make a request to the authEndpoint: ${D}. Unable to fetch new key, so dropping encrypted event`);return}if(L=this.nacl.secretbox.open(b,w,this.key),L===null){se.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(r,this.getDataToEmit(L))});return}this.emit(r,this.getDataToEmit(L))}getDataToEmit(r){let c=Object(sd.decode)(r);try{return JSON.parse(c)}catch{return c}}}class rd extends on{constructor(r,c){super(),this.state="initialized",this.connection=null,this.key=r,this.options=c,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 b=O.getNetwork();b.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),b.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(r){return this.connection?this.connection.send(r):!1}send_event(r,c,b){return this.connection?this.connection.send_event(r,c,b):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var r=(c,b)=>{c?this.runner=this.strategy.connect(0,r):b.action==="error"?(this.emit("error",{type:"HandshakeError",error:b.error}),this.timeline.error({handshakeError:b.error})):(this.abortConnecting(),this.handshakeCallbacks[b.action](b))};this.runner=this.strategy.connect(0,r)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var r=this.abandonConnection();r.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(r){this.timeline.info({action:"retry",delay:r}),r>0&&this.emit("connecting_in",Math.round(r/1e3)),this.retryTimer=new Ee(r||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(r){return fe({},r,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(r){return fe({},r,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let r=c=>b=>{b.error&&this.emit("error",{type:"WebSocketError",error:b.error}),c(b)};return{tls_only:r(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:r(()=>{this.disconnect()}),backoff:r(()=>{this.retryIn(1e3)}),retry:r(()=>{this.retryIn(0)})}}setConnection(r){this.connection=r;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var r in this.connectionCallbacks)this.connection.unbind(r,this.connectionCallbacks[r]);var c=this.connection;return this.connection=null,c}}updateState(r,c){var b=this.state;if(this.state=r,b!==r){var w=r;w==="connected"&&(w+=" with new socket ID "+c.socket_id),se.debug("State changed",b+" -> "+w),this.timeline.info({state:r,params:c}),this.emit("state_change",{previous:b,current:r}),this.emit(r,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class ld{constructor(){this.channels={}}add(r,c){return this.channels[r]||(this.channels[r]=dd(r,c)),this.channels[r]}all(){return B(this.channels)}find(r){return this.channels[r]}remove(r){var c=this.channels[r];return delete this.channels[r],c}disconnect(){we(this.channels,function(r){r.disconnect()})}}function dd(u,r){if(u.indexOf("private-encrypted-")===0){if(r.config.nacl)return sn.createEncryptedChannel(u,r,r.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",b=k.buildLogSuffix("encryptedChannelSupport");throw new I(`${c}. ${b}`)}else{if(u.indexOf("private-")===0)return sn.createPrivateChannel(u,r);if(u.indexOf("presence-")===0)return sn.createPresenceChannel(u,r);if(u.indexOf("#")===0)throw new M('Cannot create a channel with name "'+u+'".');return sn.createChannel(u,r)}}var cd={createChannels(){return new ld},createConnectionManager(u,r){return new rd(u,r)},createChannel(u,r){return new _t(u,r)},createPrivateChannel(u,r){return new Mt(u,r)},createPresenceChannel(u,r){return new od(u,r)},createEncryptedChannel(u,r,c){return new ad(u,r,c)},createTimelineSender(u,r){return new nd(u,r)},createHandshake(u,r){return new ed(u,r)},createAssistantToTheTransportManager(u,r,c){return new Ql(u,r,c)}},sn=cd;class us{constructor(r){this.options=r||{},this.livesLeft=this.options.lives||1/0}getAssistant(r){return sn.createAssistantToTheTransportManager(this,r,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Ln{constructor(r,c){this.strategies=r,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return si(this.strategies,re.method("isSupported"))}connect(r,c){var b=this.strategies,w=0,L=this.timeout,E=null,D=(R,Z)=>{Z?c(null,Z):(w=w+1,this.loop&&(w=w%b.length),w<b.length?(L&&(L=L*2,this.timeoutLimit&&(L=Math.min(L,this.timeoutLimit))),E=this.tryStrategy(b[w],r,{timeout:L,failFast:this.failFast},D)):c(!0))};return E=this.tryStrategy(b[w],r,{timeout:L,failFast:this.failFast},D),{abort:function(){E.abort()},forceMinPriority:function(R){r=R,E&&E.forceMinPriority(R)}}}tryStrategy(r,c,b,w){var L=null,E=null;return b.timeout>0&&(L=new Ee(b.timeout,function(){E.abort(),w(!0)})),E=r.connect(c,function(D,R){D&&L&&L.isRunning()&&!b.failFast||(L&&L.ensureAborted(),w(D,R))}),{abort:function(){L&&L.ensureAborted(),E.abort()},forceMinPriority:function(D){E.forceMinPriority(D)}}}}class xt{constructor(r){this.strategies=r}isSupported(){return si(this.strategies,re.method("isSupported"))}connect(r,c){return ud(this.strategies,r,function(b,w){return function(L,E){if(w[b].error=L,L){hd(w)&&c(!0);return}he(w,function(D){D.forceMinPriority(E.transport.priority)}),c(null,E)}})}}function ud(u,r,c){var b=Q(u,function(w,L,E,D){return w.connect(r,c(L,D))});return{abort:function(){he(b,md)},forceMinPriority:function(w){he(b,function(L){L.forceMinPriority(w)})}}}function hd(u){return Oi(u,function(r){return!!r.error})}function md(u){!u.error&&!u.aborted&&(u.abort(),u.aborted=!0)}class pd{constructor(r,c,b){this.strategy=r,this.transports=c,this.ttl=b.ttl||1800*1e3,this.usingTLS=b.useTLS,this.timeline=b.timeline}isSupported(){return this.strategy.isSupported()}connect(r,c){var b=this.usingTLS,w=vd(b),L=w&&w.cacheSkipCount?w.cacheSkipCount:0,E=[this.strategy];if(w&&w.timestamp+this.ttl>=re.now()){var D=this.transports[w.transport];D&&(["ws","wss"].includes(w.transport)||L>3?(this.timeline.info({cached:!0,transport:w.transport,latency:w.latency}),E.push(new Ln([D],{timeout:w.latency*2+1e3,failFast:!0}))):L++)}var R=re.now(),Z=E.pop().connect(r,function X(pe,zi){pe?(hs(b),E.length>0?(R=re.now(),Z=E.pop().connect(r,X)):c(pe)):(bd(b,zi.transport.name,re.now()-R,L),c(null,zi))});return{abort:function(){Z.abort()},forceMinPriority:function(X){r=X,Z&&Z.forceMinPriority(X)}}}}function Lt(u){return"pusherTransport"+(u?"TLS":"NonTLS")}function vd(u){var r=O.getLocalStorage();if(r)try{var c=r[Lt(u)];if(c)return JSON.parse(c)}catch{hs(u)}return null}function bd(u,r,c,b){var w=O.getLocalStorage();if(w)try{w[Lt(u)]=An({timestamp:re.now(),transport:r,latency:c,cacheSkipCount:b})}catch{}}function hs(u){var r=O.getLocalStorage();if(r)try{delete r[Lt(u)]}catch{}}class Fi{constructor(r,{delay:c}){this.strategy=r,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(r,c){var b=this.strategy,w,L=new Ee(this.options.delay,function(){w=b.connect(r,c)});return{abort:function(){L.ensureAborted(),w&&w.abort()},forceMinPriority:function(E){r=E,w&&w.forceMinPriority(E)}}}}class ri{constructor(r,c,b){this.test=r,this.trueBranch=c,this.falseBranch=b}isSupported(){var r=this.test()?this.trueBranch:this.falseBranch;return r.isSupported()}connect(r,c){var b=this.test()?this.trueBranch:this.falseBranch;return b.connect(r,c)}}class fd{constructor(r){this.strategy=r}isSupported(){return this.strategy.isSupported()}connect(r,c){var b=this.strategy.connect(r,function(w,L){L&&b.abort(),c(w,L)});return b}}function li(u){return function(){return u.isSupported()}}var gd=function(u,r,c){var b={};function w(Ss,fc,gc,yc,Cc){var _s=c(u,Ss,fc,gc,yc,Cc);return b[Ss]=_s,_s}var L=Object.assign({},r,{hostNonTLS:u.wsHost+":"+u.wsPort,hostTLS:u.wsHost+":"+u.wssPort,httpPath:u.wsPath}),E=Object.assign({},L,{useTLS:!0}),D=Object.assign({},r,{hostNonTLS:u.httpHost+":"+u.httpPort,hostTLS:u.httpHost+":"+u.httpsPort,httpPath:u.httpPath}),R={loop:!0,timeout:15e3,timeoutLimit:6e4},Z=new us({minPingDelay:1e4,maxPingDelay:u.activityTimeout}),X=new us({lives:2,minPingDelay:1e4,maxPingDelay:u.activityTimeout}),pe=w("ws","ws",3,L,Z),zi=w("wss","ws",3,E,Z),hc=w("sockjs","sockjs",1,D),fs=w("xhr_streaming","xhr_streaming",1,D,X),mc=w("xdr_streaming","xdr_streaming",1,D,X),gs=w("xhr_polling","xhr_polling",1,D),pc=w("xdr_polling","xdr_polling",1,D),ys=new Ln([pe],R),vc=new Ln([zi],R),bc=new Ln([hc],R),Cs=new Ln([new ri(li(fs),fs,mc)],R),ws=new Ln([new ri(li(gs),gs,pc)],R),ks=new Ln([new ri(li(Cs),new xt([Cs,new Fi(ws,{delay:4e3})]),ws)],R),It=new ri(li(ks),ks,bc),Dt;return r.useTLS?Dt=new xt([ys,new Fi(It,{delay:2e3})]):Dt=new xt([ys,new Fi(vc,{delay:2e3}),new Fi(It,{delay:5e3})]),new pd(new fd(new ri(li(pe),Dt,It)),b,{ttl:18e5,timeline:r.timeline,useTLS:r.useTLS})},yd=gd,Cd=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(r,c){u.hooks.isInitialized()?(u.changeState("initialized"),c(!0)):(r&&u.onError(r),u.onClose(),c(!1))})):u.onClose()},wd={getRequest:function(u){var r=new window.XDomainRequest;return r.ontimeout=function(){u.emit("error",new A),u.close()},r.onerror=function(c){u.emit("error",c),u.close()},r.onprogress=function(){r.responseText&&r.responseText.length>0&&u.onChunk(200,r.responseText)},r.onload=function(){r.responseText&&r.responseText.length>0&&u.onChunk(200,r.responseText),u.emit("finished",200),u.close()},r},abortRequest:function(u){u.ontimeout=u.onerror=u.onprogress=u.onload=null,u.abort()}},kd=wd;const Sd=256*1024;class _d extends on{constructor(r,c,b){super(),this.hooks=r,this.method=c,this.url=b}start(r){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},O.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(r)}close(){this.unloader&&(O.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(r,c){for(;;){var b=this.advanceBuffer(c);if(b)this.emit("chunk",{status:r,data:b});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(r){var c=r.slice(this.position),b=c.indexOf(`
1148
- `);return b!==-1?(this.position+=b+1,c.slice(0,b)):null}isBufferTooLong(r){return this.position===r.length&&r.length>Sd}}var Tt;(function(u){u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=3]="CLOSED"})(Tt||(Tt={}));var Tn=Tt,Md=1;class Ad{constructor(r,c){this.hooks=r,this.session=ps(1e3)+"/"+Ed(8),this.location=xd(c),this.readyState=Tn.CONNECTING,this.openStream()}send(r){return this.sendRaw(JSON.stringify([r]))}ping(){this.hooks.sendHeartbeat(this)}close(r,c){this.onClose(r,c,!0)}sendRaw(r){if(this.readyState===Tn.OPEN)try{return O.createSocketRequest("POST",ms(Ld(this.location,this.session))).start(r),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(r,c,b){this.closeStream(),this.readyState=Tn.CLOSED,this.onclose&&this.onclose({code:r,reason:c,wasClean:b})}onChunk(r){if(r.status===200){this.readyState===Tn.OPEN&&this.onActivity();var c,b=r.data.slice(0,1);switch(b){case"o":c=JSON.parse(r.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(r.data.slice(1)||"[]");for(var w=0;w<c.length;w++)this.onEvent(c[w]);break;case"m":c=JSON.parse(r.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(r.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(r){this.readyState===Tn.CONNECTING?(r&&r.hostname&&(this.location.base=Td(this.location.base,r.hostname)),this.readyState=Tn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(r){this.readyState===Tn.OPEN&&this.onmessage&&this.onmessage({data:r})}onActivity(){this.onactivity&&this.onactivity()}onError(r){this.onerror&&this.onerror(r)}openStream(){this.stream=O.createSocketRequest("POST",ms(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",r=>{this.onChunk(r)}),this.stream.bind("finished",r=>{this.hooks.onFinished(this,r)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(r){re.defer(()=>{this.onError(r),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function xd(u){var r=/([^\?]*)\/*(\??.*)/.exec(u);return{base:r[1],queryString:r[2]}}function Ld(u,r){return u.base+"/"+r+"/xhr_send"}function ms(u){var r=u.indexOf("?")===-1?"?":"&";return u+r+"t="+ +new Date+"&n="+Md++}function Td(u,r){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(u);return c[1]+r+c[3]}function ps(u){return O.randomInt(u)}function Ed(u){for(var r=[],c=0;c<u;c++)r.push(ps(32).toString(32));return r.join("")}var Pd=Ad,Id={getReceiveURL:function(u,r){return u.base+"/"+r+"/xhr_streaming"+u.queryString},onHeartbeat:function(u){u.sendRaw("[]")},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,r){u.onClose(1006,"Connection interrupted ("+r+")",!1)}},Dd=Id,Bd={getReceiveURL:function(u,r){return u.base+"/"+r+"/xhr"+u.queryString},onHeartbeat:function(){},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,r){r===200?u.reconnect():u.onClose(1006,"Connection interrupted ("+r+")",!1)}},Nd=Bd,Hd={getRequest:function(u){var r=O.getXHRAPI(),c=new r;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText),u.emit("finished",c.status),u.close();break}},c},abortRequest:function(u){u.onreadystatechange=null,u.abort()}},Rd=Hd,Od={createStreamingSocket(u){return this.createSocket(Dd,u)},createPollingSocket(u){return this.createSocket(Nd,u)},createSocket(u,r){return new Pd(u,r)},createXHR(u,r){return this.createRequest(Rd,u,r)},createRequest(u,r,c){return new _d(u,r,c)}},vs=Od;vs.createXDR=function(u,r){return this.createRequest(kd,u,r)};var Vd=vs,Ud={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:a,DependenciesReceivers:p,getDefaultStrategy:yd,Transports:Jl,transportConnectionInitializer:Cd,HTTPFactory:Vd,TimelineTransport:Hl,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(u){window.Pusher=u;var r=()=>{this.onDocumentBody(u.ready)};window.JSON?r():g.load("json2",{},r)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:oe,jsonp:Pl}},onDocumentBody(u){document.body?u():setTimeout(()=>{this.onDocumentBody(u)},0)},createJSONPRequest(u,r){return new Dl(u,r)},createScriptRequest(u){return new Il(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 Yl},createWebSocket(u){var r=this.getWebSocketAPI();return new r(u)},createSocketRequest(u,r){if(this.isXHRSupported())return this.HTTPFactory.createXHR(u,r);if(this.isXDRSupported(r.indexOf("https:")===0))return this.HTTPFactory.createXDR(u,r);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var u=this.getXHRAPI();return!!u&&new u().withCredentials!==void 0},isXDRSupported(u){var r=u?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===r},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)}},O=Ud,Et;(function(u){u[u.ERROR=3]="ERROR",u[u.INFO=6]="INFO",u[u.DEBUG=7]="DEBUG"})(Et||(Et={}));var Gi=Et;class jd{constructor(r,c,b){this.key=r,this.session=c,this.events=[],this.options=b||{},this.sent=0,this.uniqueID=0}log(r,c){r<=this.options.level&&(this.events.push(fe({},c,{timestamp:re.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(r){this.log(Gi.ERROR,r)}info(r){this.log(Gi.INFO,r)}debug(r){this.log(Gi.DEBUG,r)}isEmpty(){return this.events.length===0}send(r,c){var b=fe({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],r(b,(w,L)=>{w||this.sent++,c&&c(w,L)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class Kd{constructor(r,c,b,w){this.name=r,this.priority=c,this.transport=b,this.options=w||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(r,c){if(this.isSupported()){if(this.priority<r)return bs(new _,c)}else return bs(new G,c);var b=!1,w=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),L=null,E=function(){w.unbind("initialized",E),w.connect()},D=function(){L=sn.createHandshake(w,function(pe){b=!0,X(),c(null,pe)})},R=function(pe){X(),c(pe)},Z=function(){X();var pe;pe=An(w),c(new T(pe))},X=function(){w.unbind("initialized",E),w.unbind("open",D),w.unbind("error",R),w.unbind("closed",Z)};return w.bind("initialized",E),w.bind("open",D),w.bind("error",R),w.bind("closed",Z),w.initialize(),{abort:()=>{b||(X(),L?L.close():w.close())},forceMinPriority:pe=>{b||this.priority<pe&&(L?L.close():w.close())}}}}function bs(u,r){return re.defer(function(){r(u)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Fd}=O;var Gd=function(u,r,c,b,w,L){var E=Fd[c];if(!E)throw new K(c);var D=(!u.enabledTransports||Pe(u.enabledTransports,r)!==-1)&&(!u.disabledTransports||Pe(u.disabledTransports,r)===-1),R;return D?(w=Object.assign({ignoreNullOrigin:u.ignoreNullOrigin},w),R=new Kd(r,b,L?L.getAssistant(E):E,w)):R=zd,R},zd={isSupported:function(){return!1},connect:function(u,r){var c=re.defer(function(){r(new G)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function qd(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 Wd=(u,r)=>{var c="socket_id="+encodeURIComponent(u.socketId);for(var b in r.params)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(r.params[b]);if(r.paramsProvider!=null){let w=r.paramsProvider();for(var b in w)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(w[b])}return c};var Zd=u=>{if(typeof O.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(r,c)=>{const b=Wd(r,u);O.getAuthorizers()[u.transport](O,b,u,C.UserAuthentication,c)}};const Jd=(u,r)=>{var c="socket_id="+encodeURIComponent(u.socketId);c+="&channel_name="+encodeURIComponent(u.channelName);for(var b in r.params)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(r.params[b]);if(r.paramsProvider!=null){let w=r.paramsProvider();for(var b in w)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(w[b])}return c};var $d=u=>{if(typeof O.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(r,c)=>{const b=Jd(r,u);O.getAuthorizers()[u.transport](O,b,u,C.ChannelAuthorization,c)}};const Yd=(u,r,c)=>{const b={authTransport:r.transport,authEndpoint:r.endpoint,auth:{params:r.params,headers:r.headers}};return(w,L)=>{const E=u.channel(w.channelName);c(E,b).authorize(w.socketId,L)}};function Qd(u,r){let c={activityTimeout:u.activityTimeout||d.activityTimeout,cluster:u.cluster,httpPath:u.httpPath||d.httpPath,httpPort:u.httpPort||d.httpPort,httpsPort:u.httpsPort||d.httpsPort,pongTimeout:u.pongTimeout||d.pongTimeout,statsHost:u.statsHost||d.stats_host,unavailableTimeout:u.unavailableTimeout||d.unavailableTimeout,wsPath:u.wsPath||d.wsPath,wsPort:u.wsPort||d.wsPort,wssPort:u.wssPort||d.wssPort,enableStats:tc(u),httpHost:Xd(u),useTLS:ic(u),wsHost:ec(u),userAuthenticator:oc(u),channelAuthorizer:ac(u,r)};return"disabledTransports"in u&&(c.disabledTransports=u.disabledTransports),"enabledTransports"in u&&(c.enabledTransports=u.enabledTransports),"ignoreNullOrigin"in u&&(c.ignoreNullOrigin=u.ignoreNullOrigin),"timelineParams"in u&&(c.timelineParams=u.timelineParams),"nacl"in u&&(c.nacl=u.nacl),c}function Xd(u){return u.httpHost?u.httpHost:u.cluster?`sockjs-${u.cluster}.pusher.com`:d.httpHost}function ec(u){return u.wsHost?u.wsHost:nc(u.cluster)}function nc(u){return`ws-${u}.pusher.com`}function ic(u){return O.getProtocol()==="https:"?!0:u.forceTLS!==!1}function tc(u){return"enableStats"in u?u.enableStats:"disableStats"in u?!u.disableStats:!1}function oc(u){const r=Object.assign(Object.assign({},d.userAuthentication),u.userAuthentication);return"customHandler"in r&&r.customHandler!=null?r.customHandler:Zd(r)}function sc(u,r){let c;return"channelAuthorization"in u?c=Object.assign(Object.assign({},d.channelAuthorization),u.channelAuthorization):(c={transport:u.authTransport||d.authTransport,endpoint:u.authEndpoint||d.authEndpoint},"auth"in u&&("params"in u.auth&&(c.params=u.auth.params),"headers"in u.auth&&(c.headers=u.auth.headers)),"authorizer"in u&&(c.customHandler=Yd(r,c,u.authorizer))),c}function ac(u,r){const c=sc(u,r);return"customHandler"in c&&c.customHandler!=null?c.customHandler:$d(c)}class rc extends on{constructor(r){super(function(c,b){se.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=r,this.bindWatchlistInternalEvent()}handleEvent(r){r.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",r=>{var c=r.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(r)})}}function lc(){let u,r;return{promise:new Promise((b,w)=>{u=b,r=w}),resolve:u,reject:r}}var dc=lc;class cc extends on{constructor(r){super(function(c,b){se.debug("No callbacks on user for "+c)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(c,b)=>{if(c){se.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:b.auth,user_data:b.user_data})},this.pusher=r,this.pusher.connection.bind("state_change",({previous:c,current:b})=>{c!=="connected"&&b==="connected"&&this._signin(),c==="connected"&&b!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new rc(r),this.pusher.connection.bind("message",c=>{var b=c.event;b==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(r){try{this.user_data=JSON.parse(r.user_data)}catch{se.error(`Failed parsing user data after signin: ${r.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 r=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new _t(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,b)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,b)}),r(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:r,resolve:c,reject:b}=dc();r.done=!1;const w=()=>{r.done=!0};r.then(w).catch(w),this.signinDonePromise=r,this._signinDoneResolve=c}}class ye{static ready(){ye.isReady=!0;for(var r=0,c=ye.instances.length;r<c;r++)ye.instances[r].connect()}static getClientFeatures(){return We($({ws:O.Transports.ws},function(r){return r.isSupported({})}))}constructor(r,c){uc(r),qd(c),this.key=r,this.config=Qd(c,this),this.channels=sn.createChannels(),this.global_emitter=new on,this.sessionID=O.randomInt(1e9),this.timeline=new jd(this.key,this.sessionID,{cluster:this.config.cluster,features:ye.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Gi.INFO,version:d.VERSION}),this.config.enableStats&&(this.timelineSender=sn.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+O.TimelineTransport.name}));var b=w=>O.getDefaultStrategy(this.config,w,Gd);this.connection=sn.createConnectionManager(this.key,{getStrategy:b,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,E=L.indexOf("pusher_internal:")===0;if(w.channel){var D=this.channel(w.channel);D&&D.handleEvent(w)}E||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 cc(this),ye.isReady&&this.connect()}channel(r){return this.channels.find(r)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var r=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new tn(6e4,function(){c.send(r)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(r,c,b){return this.global_emitter.bind(r,c,b),this}unbind(r,c,b){return this.global_emitter.unbind(r,c,b),this}bind_global(r){return this.global_emitter.bind_global(r),this}unbind_global(r){return this.global_emitter.unbind_global(r),this}unbind_all(r){return this.global_emitter.unbind_all(),this}subscribeAll(){var r;for(r in this.channels.channels)this.channels.channels.hasOwnProperty(r)&&this.subscribe(r)}subscribe(r){var c=this.channels.add(r,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(r){var c=this.channels.find(r);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(r),c&&c.subscribed&&c.unsubscribe())}send_event(r,c,b){return this.connection.send_event(r,c,b)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}ye.instances=[],ye.isReady=!1,ye.logToConsole=!1,ye.Runtime=O,ye.ScriptReceivers=O.ScriptReceivers,ye.DependenciesReceivers=O.DependenciesReceivers,ye.auth_callbacks=O.auth_callbacks;var Pt=t.default=ye;function uc(u){if(u==null)throw"You must pass your app key when you instantiate Pusher."}O.setup(ye)}])})})(Zo);var Zr=Zo.exports;const Jr=Wr(Zr);class Jo{constructor(e){h(this,"container");h(this,"onAction");h(this,"onFail");h(this,"initialTime");h(this,"timeLeft");h(this,"timerId");h(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("#transfer-bank"),t=this.container.querySelector("#copy-acn"),o=this.container.querySelector("#acn-tooltip"),s=this.container.querySelector("#transfer-amount"),a=this.container.querySelector("#copy-amount"),l=this.container.querySelector("#amount-tooltip"),d=this.container.querySelector("#transfer-button");t&&e&&t.addEventListener("click",()=>{o&&(i&&P.track("copy_transferBank",{payment_method:"Transfer",payment_process:"Payment Started",account_number:e.innerHTML,bank_name:i.innerHTML}),this.copyToClipboard(e.innerHTML,o))}),a&&s&&a.addEventListener("click",()=>{l&&(P.track("copy_transferAmount",{payment_method:"Transfer",amount:s.innerHTML.split(" ")[1].replace(/,/g,"")}),this.copyToClipboard(s.innerHTML.split(" ")[1].replace(/,/g,""),l))}),d&&d.addEventListener("click",()=>{this.onAction(5),P.track("initiate_payment_verification",{payment_method:"Transfer"})})}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=zn(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,k,C,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"),a=this.container.querySelector("#time-left"),l=((g=this.payment)==null?void 0:g.currency)||"USD",d=l==="USD"?(f=this.payment)==null?void 0:f.localCurrency:l;if(i&&(i.innerHTML=`${d} ${xe(this.payment.totalTaxAmount?this.payment.totalLocalAmount:l==="USD"?(y=this.payment)==null?void 0:y.localAmount:(k=this.payment)==null?void 0:k.amount,2)}`),t&&this.payment.bankDetails&&(t.innerHTML=(C=this.payment.bankDetails)==null?void 0:C.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),a&&(a.innerHTML=zn(this.initialTime)),this.startTimer("poll"),e.status==="inProgress"){const M="45654f3ce4c9512ea9a4",A="us2";var v=new Jr(M,{cluster:A}),p=v.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 T=new URL(_.redirectUrl);T.searchParams.append("status",_.status),T.searchParams.append("reference",_.reference),window.location.href=T.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 qr}}const $r=`<div id="trasferConfirmationProgress">
1149
- <div>
1150
- <div>
1151
- <div class=" grid grid-rows-[auto_1fr] gap-4 mx-5">
1152
- <div class="items-center justify-self-center flex flex-col relative ">
1153
- <svg class="animate-spin" width="40" height="40" viewBox="0 0 64 64" fill="none"
1154
- xmlns="http://www.w3.org/2000/svg">
1155
- <path
1156
- 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"
1157
- stroke="black" stroke-width="4" stroke-linejoin="round" />
1158
- </svg>
1159
- <!-- <div class="relative w-12 h-12">
1160
- <svg viewBox="0 0 100 100" width="100" height="100" class="h-full w-full">
1161
- <circle stroke-width="10" stroke="#E6E6E7" stroke-linecap="round" cx="50" cy="50"
1162
- class="circle-progress-bg" r="40" fill="transparent"></circle>
1163
- <circle stroke-width="11" stroke="#000000" stroke-linecap="round" cx="50" cy="50" r="40"
1164
- class="circle-progress" fill="transparent" stroke-dasharray="" stroke-dashoffset=""
1165
- transform="rotate(-90 50 50)"></circle>
1166
- </svg>
1115
+ <!-- Pin -->
1116
+ <div id="pin" class="hidden tab-content">
1117
+ <div class=" grid gap-3 border border-tone-50 px-6 py-4 rounded-2xl mb-4">
1118
+ <div class="flex justify-between items-center">
1119
+ <span class="text-tone-60 font-medium text-sm">Number</span>
1120
+ <div class="flex items-center gap-1">
1121
+ <span data-copy-value="5555558684543932"
1122
+ class="text-tone-100 text-sm font-medium">5555558684543932 </span>
1123
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1124
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1125
+ xmlns="http://www.w3.org/2000/svg">
1126
+ <path
1127
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1128
+ fill="#0D0716" />
1129
+ </svg>
1130
+ </button>
1131
+ </div>
1132
+ </div>
1167
1133
 
1168
- </div> -->
1134
+ <div class="flex justify-between items-center">
1135
+ <span class="text-tone-60 font-medium text-sm">Expiry</span>
1136
+ <div class="flex items-center gap-1">
1137
+ <span data-copy-value="12/30" class="text-tone-100 text-sm font-medium">12/2030</span>
1138
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1139
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1140
+ xmlns="http://www.w3.org/2000/svg">
1141
+ <path
1142
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1143
+ fill="#0D0716" />
1144
+ </svg>
1145
+ </button>
1146
+ </div>
1147
+ </div>
1148
+ <div class="flex justify-between items-center">
1149
+ <span class="text-tone-60 font-medium text-sm">CVV</span>
1150
+ <div class="flex items-center gap-1">
1151
+ <span data-copy-value="321" class="text-tone-100 text-sm font-medium">321</span>
1152
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1153
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1154
+ xmlns="http://www.w3.org/2000/svg">
1155
+ <path
1156
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1157
+ fill="#0D0716" />
1158
+ </svg>
1159
+ </button>
1160
+ </div>
1161
+ </div>
1162
+ <div class="flex justify-between items-center">
1163
+ <span class="text-tone-60 font-medium text-sm">Pin</span>
1164
+ <div class="flex items-center gap-1">
1165
+ <span data-copy-value="4321" class="text-tone-100 text-sm font-medium">4321</span>
1166
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1167
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1168
+ xmlns="http://www.w3.org/2000/svg">
1169
+ <path
1170
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1171
+ fill="#0D0716" />
1172
+ </svg>
1173
+ </button>
1174
+ </div>
1175
+ </div>
1176
+ </div>
1169
1177
  </div>
1170
- </div>
1171
- </div>
1172
- <div class="text-center w-11/12 md:w-4/5 mx-auto grid gap-4 mb-8">
1173
- <h5 class="text-center text-sm text-grey-400">
1174
- We are confirming transaction status.
1175
- <br>
1176
- This can take a few minutes.
1177
- </h5>
1178
-
1179
- <div>
1180
- <p class="text-grey-400 text-sm">
1181
- Please wait for <span id="ctd-timer" class="font-bold"> </span> minutes
1182
- </p>
1183
- </div>
1184
-
1185
- </div>
1186
-
1187
- <div>
1188
- <div class="border border-tone-10 rounded-lg text-black px-4 py-4 grid gap-2">
1189
-
1190
- <div class="grid grid-cols-[1fr_auto] gap-3">
1191
- <div>
1192
- <p class="text-xs">Account details</p>
1193
- </div>
1194
-
1195
- <div class="align-center gap-2">
1196
- <p class="font-medium text-xs" id="transfer-acn-pr"></p>
1197
1178
 
1198
- <button type="button" class="relative group" id="copy-acn-pr">
1199
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
1200
- <path
1201
- d="M9.33268 7.52502V9.97502C9.33268 12.0167 8.51602 12.8334 6.47435 12.8334H4.02435C1.98268 12.8334 1.16602 12.0167 1.16602 9.97502V7.52502C1.16602 5.48335 1.98268 4.66669 4.02435 4.66669H6.47435C8.51602 4.66669 9.33268 5.48335 9.33268 7.52502Z"
1202
- stroke="#0D0716" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
1203
- <path
1204
- d="M12.8327 4.02502V6.47502C12.8327 8.51669 12.016 9.33335 9.97435 9.33335H9.33268V7.52502C9.33268 5.48335 8.51602 4.66669 6.47435 4.66669H4.66602V4.02502C4.66602 1.98335 5.48268 1.16669 7.52435 1.16669H9.97435C12.016 1.16669 12.8327 1.98335 12.8327 4.02502Z"
1205
- stroke="#0D0716" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
1206
- </svg>
1207
-
1208
- <div class="tooltip">
1209
- <div class="tooltip-textbox">
1210
- <p class="tooltip-text" id="acn-tooltip-pr">Copy</p>
1179
+ <!-- Pin + OTP -->
1180
+ <div id="pin-otp" class="tab-content hidden">
1181
+ <div class=" grid gap-3 border border-tone-50 px-6 py-4 rounded-2xl mb-4">
1182
+ <div class="flex justify-between items-center">
1183
+ <span class="text-tone-60 font-medium text-sm">Number</span>
1184
+ <div class="flex items-center gap-1">
1185
+ <span data-copy-value="5555567973581842" class="text-tone-100 text-sm font-medium">5555567973581842</span>
1186
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1187
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1188
+ xmlns="http://www.w3.org/2000/svg">
1189
+ <path
1190
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1191
+ fill="#0D0716" />
1192
+ </svg>
1193
+ </button>
1194
+ </div>
1211
1195
  </div>
1212
- </div>
1213
- </button>
1214
- </div>
1196
+ <div class="flex justify-between items-center">
1197
+ <span class="text-tone-60 font-medium text-sm">Expiry</span>
1198
+ <div class="flex items-center gap-1">
1199
+ <span data-copy-value="12/30" class="text-tone-100 text-sm font-medium">12/2030</span>
1200
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1201
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1202
+ xmlns="http://www.w3.org/2000/svg">
1203
+ <path
1204
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1205
+ fill="#0D0716" />
1206
+ </svg>
1207
+ </button>
1208
+ </div>
1209
+ </div>
1210
+ <div class="flex justify-between items-center">
1211
+ <span class="text-tone-60 font-medium text-sm">CVV</span>
1212
+ <div class="flex items-center gap-1">
1213
+ <span data-copy-value="321" class="text-tone-100 text-sm font-medium">321</span>
1214
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1215
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1216
+ xmlns="http://www.w3.org/2000/svg">
1217
+ <path
1218
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1219
+ fill="#0D0716" />
1220
+ </svg>
1221
+ </button>
1222
+ </div>
1223
+ </div>
1224
+ <div class="flex justify-between items-center">
1225
+ <span class="text-tone-60 font-medium text-sm">Pin</span>
1226
+ <div class="flex items-center gap-1">
1227
+ <span data-copy-value="4321" class="text-tone-100 text-sm font-medium">4321</span>
1228
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1229
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1230
+ xmlns="http://www.w3.org/2000/svg">
1231
+ <path
1232
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1233
+ fill="#0D0716" />
1234
+ </svg>
1235
+ </button>
1236
+ </div>
1237
+ </div>
1238
+ <div class="flex justify-between items-center">
1239
+ <span class="text-tone-60 font-medium text-sm">OTP</span>
1240
+ <div class="flex items-center gap-1">
1241
+ <span data-copy-value="654321" class="text-tone-100 text-sm font-medium">654321</span>
1242
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1243
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1244
+ xmlns="http://www.w3.org/2000/svg">
1245
+ <path
1246
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1247
+ fill="#0D0716" />
1248
+ </svg>
1249
+ </button>
1250
+ </div>
1251
+ </div>
1252
+ </div>
1215
1253
  </div>
1254
+ <!-- 3DS -->
1255
+ <div id="3ds" class="tab-content hidden">
1256
+ <div class=" grid gap-3 border border-tone-50 px-6 py-4 rounded-2xl mb-4">
1257
+ <div class="flex justify-between items-center">
1258
+ <span class="text-tone-60 font-medium text-sm">Number</span>
1259
+ <div class="flex items-center gap-1">
1260
+ <span data-copy-value="5555558684543932"
1261
+ class="text-tone-100 text-sm font-medium">5555577124976817 </span>
1262
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1263
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1264
+ xmlns="http://www.w3.org/2000/svg">
1265
+ <path
1266
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1267
+ fill="#0D0716" />
1268
+ </svg>
1269
+ </button>
1270
+ </div>
1271
+ </div>
1216
1272
 
1217
- <div class="grid grid-cols-[1fr_auto] gap-3 text-xxs">
1218
- <p class="text-xs">Bank name</p>
1219
- <p class="font-medium text-xs" id="transfer-bank"></p>
1273
+ <div class="flex justify-between items-center">
1274
+ <span class="text-tone-60 font-medium text-sm">Expiry</span>
1275
+ <div class="flex items-center gap-1">
1276
+ <span data-copy-value="12/30" class="text-tone-100 text-sm font-medium">12/2030</span>
1277
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1278
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1279
+ xmlns="http://www.w3.org/2000/svg">
1280
+ <path
1281
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1282
+ fill="#0D0716" />
1283
+ </svg>
1284
+ </button>
1285
+ </div>
1286
+ </div>
1287
+ <div class="flex justify-between items-center">
1288
+ <span class="text-tone-60 font-medium text-sm">CVV</span>
1289
+ <div class="flex items-center gap-1">
1290
+ <span data-copy-value="321" class="text-tone-100 text-sm font-medium">321</span>
1291
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1292
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1293
+ xmlns="http://www.w3.org/2000/svg">
1294
+ <path
1295
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1296
+ fill="#0D0716" />
1297
+ </svg>
1298
+ </button>
1299
+ </div>
1300
+ </div>
1301
+ </div>
1220
1302
  </div>
1221
1303
 
1222
- <div class="grid grid-cols-[1fr_auto] gap-3 text-xxs">
1223
- <p class="text-xs">Beneficiary</p>
1224
- <p class="font-medium text-xs" id="account-name"></p>
1304
+ <!-- AVS -->
1305
+ <div id="avs" class="tab-content hidden">
1306
+ <div class=" grid gap-3 border border-tone-50 px-6 py-4 rounded-2xl mb-4">
1307
+ <div class="flex justify-between items-center">
1308
+ <span class="text-tone-60 font-medium text-sm">Number</span>
1309
+ <div class="flex items-center gap-1">
1310
+ <span data-copy-value="4111124373708482"
1311
+ class="text-tone-100 text-sm font-medium">4111124373708482 </span>
1312
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1313
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1314
+ xmlns="http://www.w3.org/2000/svg">
1315
+ <path
1316
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1317
+ fill="#0D0716" />
1318
+ </svg>
1319
+ </button>
1320
+ </div>
1321
+ </div>
1322
+
1323
+ <div class="flex justify-between items-center">
1324
+ <span class="text-tone-60 font-medium text-sm">Expiry</span>
1325
+ <div class="flex items-center gap-1">
1326
+ <span data-copy-value="12/30" class="text-tone-100 text-sm font-medium">12/2030</span>
1327
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1328
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1329
+ xmlns="http://www.w3.org/2000/svg">
1330
+ <path
1331
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1332
+ fill="#0D0716" />
1333
+ </svg>
1334
+ </button>
1335
+ </div>
1336
+ </div>
1337
+ <div class="flex justify-between items-center">
1338
+ <span class="text-tone-60 font-medium text-sm">CVV</span>
1339
+ <div class="flex items-center gap-1">
1340
+ <span data-copy-value="321" class="text-tone-100 text-sm font-medium">321</span>
1341
+ <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1342
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1343
+ xmlns="http://www.w3.org/2000/svg">
1344
+ <path
1345
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1346
+ fill="#0D0716" />
1347
+ </svg>
1348
+ </button>
1349
+ </div>
1350
+ </div>
1351
+ <div class="flex justify-between items-center">
1352
+ <span class="text-tone-60 font-medium text-sm">OTP</span>
1353
+ <div class="flex flex-col items-end gap-1">
1354
+ <span class="text-tone-100 text-sm font-medium">Address: 1, Spotflow Street</span>
1355
+ <span class="text-tone-100 text-sm font-medium">City: Lekki</span>
1356
+ <span class="text-tone-100 text-sm font-medium">State: Lagos</span>
1357
+ <span class="text-tone-100 text-sm font-medium">Country: Nigeria</span>
1358
+ <span class="text-tone-100 text-sm font-medium">ZIP: 101233</span>
1359
+ </div>
1360
+ </div>
1361
+ </div>
1225
1362
  </div>
1226
- </div>
1227
1363
  </div>
1364
+ </div>`;class Jo{constructor({container:e,closeCallback:i}){h(this,"container");h(this,"closeCallback");this.container=e,this.closeCallback=i}render(){return qr}attachListener(){const e=this.container.querySelector("#close-test-card");e==null||e.addEventListener("click",()=>this.closeCallback());const i=this.container.querySelectorAll("#test-card-tabs .tab-btn"),t=this.container.querySelectorAll(".tab-content");i.forEach(s=>{s.addEventListener("click",()=>{i.forEach(l=>l.classList.remove("active-tab")),s.classList.add("active-tab");const a=s.getAttribute("data-target");t.forEach(l=>{l.id===a?l.classList.remove("hidden"):l.classList.add("hidden")})})}),this.container.querySelectorAll(".copy-btn").forEach(s=>{s.addEventListener("click",async a=>{const d=a.currentTarget.previousElementSibling.getAttribute("data-copy-value")||"";d&&(await navigator.clipboard.writeText(d),s.innerHTML='<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5 2V1H10V2H5ZM4.75 0C4.33579 0 4 0.335786 4 0.75V1H3.5C2.67157 1 2 1.67157 2 2.5V12.5C2 13.3284 2.67157 14 3.5 14H7V13H3.5C3.22386 13 3 12.7761 3 12.5V2.5C3 2.22386 3.22386 2 3.5 2H4V2.25C4 2.66421 4.33579 3 4.75 3H10.25C10.6642 3 11 2.66421 11 2.25V2H11.5C11.7761 2 12 2.22386 12 2.5V7H13V2.5C13 1.67157 12.3284 1 11.5 1H11V0.75C11 0.335786 10.6642 0 10.25 0H4.75ZM9 8.5C9 8.77614 8.77614 9 8.5 9C8.22386 9 8 8.77614 8 8.5C8 8.22386 8.22386 8 8.5 8C8.77614 8 9 8.22386 9 8.5ZM10.5 9C10.7761 9 11 8.77614 11 8.5C11 8.22386 10.7761 8 10.5 8C10.2239 8 10 8.22386 10 8.5C10 8.77614 10.2239 9 10.5 9ZM13 8.5C13 8.77614 12.7761 9 12.5 9C12.2239 9 12 8.77614 12 8.5C12 8.22386 12.2239 8 12.5 8C12.7761 8 13 8.22386 13 8.5ZM14.5 9C14.7761 9 15 8.77614 15 8.5C15 8.2239 14.7761 8 14.5 8C14.2239 8 14 8.22386 14 8.5C14 8.77614 14.2239 9 14.5 9ZM15 10.5C15 10.7761 14.7761 11 14.5 11C14.2239 11 14 10.7761 14 10.5C14 10.2239 14.2239 10 14.5 10C14.7761 10 15 10.2239 15 10.5ZM14.5 13C14.7761 13 15 12.7761 15 12.5C15 12.2239 14.7761 12 14.5 12C14.2239 12 14 12.2239 14 12.5C14 12.7761 14.2239 13 14.5 13ZM14.5 15C14.7761 15 15 14.7761 15 14.5C15 14.2239 14.7761 14 14.5 14C14.2239 14 14 14.2239 14 14.5C14 14.7761 14.2239 15 14.5 15ZM8.5 11C8.77614 11 9 10.7761 9 10.5C9 10.2239 8.77614 10 8.5 10C8.22386 10 8 10.2239 8 10.5C8 10.7761 8.22386 11 8.5 11ZM9 12.5C9 12.7761 8.77614 13 8.5 13C8.22386 13 8 12.7761 8 12.5C8 12.2239 8.22386 12 8.5 12C8.77614 12 9 12.2239 9 12.5ZM8.5 15C8.77614 15 9 14.7761 9 14.5C9 14.2239 8.77614 14 8.5 14C8.22386 14 8 14.2239 8 14.5C8 14.7761 8.22386 15 8.5 15ZM11 14.5C11 14.7761 10.7761 15 10.5 15C10.2239 15 10 14.7761 10 14.5C10 14.2239 10.2239 14 10.5 14C10.7761 14 11 14.2239 11 14.5ZM12.5 15C12.7761 15 13 14.7761 13 14.5C13 14.2239 12.7761 14 12.5 14C12.2239 14 12 14.2239 12 14.5C12 14.7761 12.2239 15 12.5 15Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg>',setTimeout(()=>{s.innerHTML=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1365
+ <path
1366
+ d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1367
+ fill="#0D0716" />
1368
+ </svg>`},1e3))})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}}function Wr(n){n.classList.remove("hidden"),requestAnimationFrame(()=>{n.classList.remove("opacity-0","scale-95")})}function Ri(n){n.classList.add("opacity-0","scale-95"),n.addEventListener("transitionend",()=>n.classList.add("hidden"),{once:!0})}class $o{constructor({container:e,testCardContainer:i}){h(this,"container");h(this,"testCardContainer");h(this,"testCardInstance",null);this.container=e,this.testCardContainer=i}attachListener(){const e=this.container.querySelector("#test-cards-link");e&&e.addEventListener("click",()=>{this.testCardInstance||(this.testCardInstance=new Jo({container:this.testCardContainer,closeCallback:()=>{this.testCardContainer.innerHTML="",Ri(this.testCardContainer),e.classList.remove("text-tone-100","font-bold")}})),this.testCardInstance.renderComponent(),Wr(this.testCardContainer),e.classList.add("text-tone-100","font-bold")})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return zr}}class Zr{constructor({amount:e,totalAmount:i,container:t,customer:o,encryption:s,planId:a,token:l,currency:d,rdtCode:v,url:p,reference:g,onSuccess:f,callBackUrl:y,metadata:k,localCurrency:C,hidePaymentMethods:S,showPaymentMethods:M,onClose:A,restartTransactionProcess:_,retryingPayment:T}){h(this,"contents");h(this,"cardDetailForm");h(this,"cardOtpValidationForm");h(this,"merchantPlanDetail",{});h(this,"cardPinForm");h(this,"avsForm");h(this,"successScreen");h(this,"pageLoader");h(this,"warningScreen");h(this,"transactionIssuesScreen");h(this,"container");h(this,"onSuccess");h(this,"planId","");h(this,"customer");h(this,"token");h(this,"amount");h(this,"totalAmount");h(this,"encryption");h(this,"currency");h(this,"_currentStep");h(this,"activeRef");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"onClose");h(this,"cardResponse");h(this,"cardResponseHeader");h(this,"confirmationEnd");h(this,"confirmationProgress");h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);this.currency=d,this.onSuccess=f||(()=>null),this.container=t,this.encryption=s,this.token=l,this.customer=o,this.planId=a,this.amount=e,this.totalAmount=i,this.rdtCode=v,this.url=p,this.reference=g,this.callBackUrl=y,this.metadata=k,this.localCurrency=C,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.cardResponse={},this.cardResponseHeader={},this.hidePaymentMethods=S,this.showPaymentMethods=M,this.onClose=A,this.restartTransactionProcess=_,this.retryingPayment=T,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 js(JSON.stringify(i),this.encryption);t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),(()=>{var l;if(this.retryingPayment){const d={channel:"card",reference:this.reference,encryptedCard:s};return ci(this.token,d,this.rdtCode,this.url)}else{const d={amount:this.amount,channel:"card",currency:this.currency||"USD",planId:this.planId,customer:this.customer,reference:this.reference,encryptedCard:s,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((l=this.merchantPlanDetail)==null?void 0:l.taxQuoteId)&&{taxQuoteId:this.merchantPlanDetail.taxQuoteId}};return As(this.token,d,this.rdtCode,this.url)}})().then(({data:l,headers:d})=>{var v,p,g,f,y,k,C,S;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=d,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(!["success","successful"].includes(l.status)&&l.status!=="failed")if(this.cardResponse=l,this.cardResponseHeader=d,l!=null&&l.authorization){if(this.activeRef=l.reference,((v=l==null?void 0:l.authorization)==null?void 0:v.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),(y=l==null?void 0:l.authorization)!=null&&y.embeddedHtml&&this.redirectToPreciumDoc((k=l==null?void 0:l.authorization)==null?void 0:k.embeddedHtml);return}if(((C=l==null?void 0:l.authorization)==null?void 0:C.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}if(((S=l==null?void 0:l.authorization)==null?void 0:S.mode)==="avs"){this.currentStep=7;return}}else this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Error with Payment"),this.warningScreen.hideReportIssue();else["success","successful"].includes(l.status)&&(this.currentStep=5,this.cardResponse=l,this.cardResponseHeader=d,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"}),this.redirectTo(l,d,"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">
1369
+ <path
1370
+ 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"
1371
+ stroke="black" stroke-width="4" stroke-linejoin="round" />
1372
+ </svg>`),o&&o.classList.add("hidden"),di(this.token,i,this.rdtCode,this.url).then(({data:a,headers:l})=>{var d,v,p,g,f,y,k;if(a.status==="failed")P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.currentStep=4,a.providerMessage?this.warningScreen.setPaymentError(a.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(a.status))this.currentStep=5,this.redirectTo(a,l,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"});else{if(((d=a==null?void 0:a.authorization)==null?void 0:d.mode)==="3DS"){(v=a==null?void 0:a.authorization)!=null&&v.redirectUrl&&this.redirectTo3DS((p=a==null?void 0:a.authorization)==null?void 0:p.redirectUrl),(g=a==null?void 0:a.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=a==null?void 0:a.authorization)==null?void 0:f.embeddedHtml);return}if(((y=a==null?void 0:a.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=a,this.currentStep=3;return}if(((k=a==null?void 0:a.authorization)==null?void 0:k.mode)==="avs"){this.currentStep=7;return}this.currentStep=10}}).catch(a=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),this.currentStep=4,a.message?this.warningScreen.setPaymentError(a.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()})},300)}}showLoader(){this.pageLoader=new Ne(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:a})=>{const l=document.createElement("button");l.textContent=a,l.setAttribute("id",s),l.classList.add("warning-button");const d=document.createElement("div");d.appendChild(l),t.appendChild(d)})}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")),di(this.token,s,this.rdtCode,this.url).then(({data:l,headers:d})=>{var v,p,g,f,y,k,C;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"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(l.status))["success","successful"].includes(l.status)&&(this.currentStep=5,this.redirectTo(l,d,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"AVS"}));else{if(((v=l==null?void 0:l.authorization)==null?void 0:v.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),(y=l==null?void 0:l.authorization)!=null&&y.embeddedHtml&&this.redirectToPreciumDoc((k=l==null?void 0:l.authorization)==null?void 0:k.embeddedHtml);return}if(((C=l==null?void 0:l.authorization)==null?void 0:C.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}this.currentStep=10}}).catch(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"}),di(this.token,t,this.rdtCode,this.url).then(({data:s,headers:a})=>{var l,d,v,p,g,f,y;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"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(s.status))["success","successful"].includes(s.status)&&(this.currentStep=5,this.redirectTo(s,a,"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(((d=s==null?void 0:s.authorization)==null?void 0:d.mode)==="3DS"){(v=s==null?void 0:s.authorization)!=null&&v.redirectUrl&&this.redirectTo3DS((p=s==null?void 0:s.authorization)==null?void 0:p.redirectUrl),(g=s==null?void 0:s.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=s==null?void 0:s.authorization)==null?void 0:f.embeddedHtml);return}if(((y=s==null?void 0:s.authorization)==null?void 0:y.mode)==="avs"){this.currentStep=7;return}this.currentStep=10}}).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"),this.warningScreen.hideReportIssue()})}redirectTo3DS(e){const i=window.open("","_blank");if(!i){alert("Please enable popups for this site to complete the authentication.");return}i.location.href=e,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"),this.warningScreen.hideReportIssue(),P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}redirectToPreciumDoc(e){const i=atob(e),t=new Blob([i],{type:"text/html"}),o=URL.createObjectURL(t),s=window.open(o,"_blank");if(s){s.document.close(),P.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const a=setInterval(()=>{s.closed&&(clearInterval(a),this.verifyPayment(({data:l,headers:d})=>{this.currentStep=5,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(l,d,"success")},({data:l})=>{this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue(),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 an(this.token,this.activeRef,void 0,this.rdtCode,this.url);t.data.status==="failed"?i(t):(["success","successful"].includes(t.data.status)&&e(t),t.data.status==="inProgress"&&(this.currentStep=10))}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 an(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 s,a;e&&(this.merchantPlanDetail=e);const i=document.getElementById("test-container"),t=this.container.querySelector("#test-cards-link"),o=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),o==null||o.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.cardDetailForm=new Rt({container:this.contents,onAction:d=>v=>this.submitCardDetails.bind(this)(d,v),merchantName:this.merchantPlanDetail.merchantName,currency:this.localCurrency!==this.currency?this.localCurrency:this.currency}),this.cardDetailForm.renderContent();break;case 2:this.cardPinForm=new qs({container:this.contents,onClose:this.onClose,onAction:d=>this.handlePinRequest.bind(this)(d)}),this.cardPinForm.renderComponent();break;case 3:this.cardOtpValidationForm=new Gs({container:this.contents,onClose:this.onClose,onAction:d=>v=>this.submitOtp.bind(this)(d,v),otpMessage:((s=this.cardResponse)==null?void 0:s.providerMessage)||"Please enter your OTP sent to your phone"}),this.cardOtpValidationForm.renderComponent();break;case 4:this.warningScreen=new gn({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(),Ri(i),t.classList.remove("text-tone-100","font-bold");break;case 5:this.successScreen=new qn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(a=this.merchantPlanDetail)==null?void 0:a.rate.rate}),this.successScreen.renderComponent(),Ri(i),t.classList.remove("text-tone-100","font-bold");break;case 6:this.pageLoader=new Ne(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 7:this.avsForm=new Js({container:this.contents,onAction:d=>v=>this.validatedAVS.bind(this)(d,v)}),this.avsForm.renderComponent();break;case 8:this.transactionIssuesScreen=new mi({container:this.contents,onAction:()=>{var d;this.currentStep=4,this.warningScreen.setPaymentError(((d=this.cardResponse)==null?void 0:d.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 Zo({container:this.contents,onAction:d=>{this.currentStep=d},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader,paymentMethod:"Card"}),this.confirmationEnd.renderComponent();break;case 10:this.confirmationProgress=new Gr({container:this.contents,onAction:d=>{this.currentStep=d},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(d,v)=>{this.cardResponse=d,this.cardResponseHeader=v},step:{failed:4,success:5,end:9},paymentMethod:"Card"}),this.confirmationProgress.renderComponent(),Ri(i),t.classList.remove("text-tone-100","font-bold");break;default:this.cardDetailForm=new Rt({container:this.contents,onAction:d=>v=>this.submitCardDetails.bind(this)(d,v),merchantName:this.merchantPlanDetail.merchantName,currency:this.localCurrency?this.localCurrency:this.currency}),this.cardDetailForm.renderContent();break}this.displayButtonText();const l=this.container.querySelector("#card-currency");l&&(l.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,a;const i=this.container.querySelector("#details-form-button-text");if(i){const l=this.currency,d=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 ${d} ${xe(this.totalAmount!==this.amount?this.totalAmount:(this.amount||0)*(l==="USD"?(a=(s=this.merchantPlanDetail)==null?void 0:s.rate)==null?void 0:a.rate:1),2)}`}}}const Jr=`<div>
1373
+ <div class="container-center h-[40vh] hidden" id="loader">
1374
+ <img src="" alt="loader gif" />
1228
1375
  </div>
1229
- </div>`;class Yr{constructor(e){h(this,"container");h(this,"onAction");h(this,"ref");h(this,"token");h(this,"initialTime",300);h(this,"abortController");h(this,"timeLeft");h(this,"timer");h(this,"timerId",null);h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"payment");h(this,"setPaymentResponses");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses}attachListeners(){const e=this.container.querySelector("#show-acn");e&&e.addEventListener("click",()=>{this.onAction(1),clearTimeout(this.timer)});const i=this.container.querySelector("#transfer-bank"),t=this.container.querySelector("#transfer-acn-pr"),o=this.container.querySelector("#copy-acn-pr"),s=this.container.querySelector("#acn-tooltip-pr");o&&t&&o.addEventListener("click",()=>{P.track("copy_transferBank",{payment_method:"Transfer",payment_process:"Payment Verification",account_number:t.innerHTML,bank_name:i==null?void 0:i.innerHTML}),s&&this.copyToClipboard(t.innerHTML,s)}),this.initialTime=300,this.timeLeft=this.initialTime;const a=3e4;this.abortController=new AbortController,setTimeout(()=>{this.verifyTransfer(this.token,a,({data:l,headers:d})=>{this.onAction(6),this.redirectTo(l,d)})},5e3),this.startTimer()}updateProgressTimerContent(){const i=2*Math.PI*40,o=(this.initialTime-this.timeLeft)/this.initialTime*100/100*i,s=this.container.querySelector(".circle-progress");s&&(s.setAttribute("stroke-dasharray",`${i}`),s.setAttribute("stroke-dashoffset",`${o}`))}async verifyTransfer(e,i,t){let o=0,s=i,a=!0,l;this.abortController&&(l=this.abortController.signal);const d=async()=>{if(this.timeLeft<=0){a=!1,this.onAction(8);return}o+=1;try{const v=await an(e,this.ref,l,this.rdtCode,this.url);v.data.status==="inProgress"?(a&&(s=i*(o+1),this.timer=setTimeout(d,s)),this.setPaymentResponses(v.data,v.headers)):v.data.status==="successful"||v.data.status==="success"?(this.setPaymentResponses(v.data,v.headers),a=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Success"}),t(v)):v.data.status==="failed"&&(this.setPaymentResponses(v.data,v.headers),a=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),this.onAction(7,"Transfer failed"),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Failed"}))}catch{a&&(s=i*(o+1),this.timer=setTimeout(d,s))}};d()}redirectTo(e,i){const t=i.get("spf-redirect-url");this.callBackUrl=t||this.callBackUrl,this.callBackUrl&&setTimeout(()=>{const o=new URL(this.callBackUrl);o.searchParams.append("status",e.status),o.searchParams.append("reference",e.reference),window.location.href=o.toString()},1800)}startTimer(){const e=this.container.querySelector("#ctd-timer");this.stopTimer(),this.timerId=window.setInterval(()=>{this.timeLeft>0?(this.timeLeft-=1,e&&(e.innerHTML=zn(this.timeLeft),this.startTimer()),this.updateProgressTimerContent()):(this.stopTimer(),this.onAction(8))},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}renderTransferDetailsComponent(e){var s,a;e&&(this.payment=e),this.container.innerHTML=this.render();const i=this.container.querySelector("#transfer-bank"),t=this.container.querySelector("#transfer-acn-pr"),o=this.container.querySelector("#account-name");i&&e.bankDetails&&(i.innerHTML=(s=e.bankDetails)==null?void 0:s.bankName),t&&e.bankDetails&&(t.innerHTML=e.bankDetails.accountNumber),o&&e.bankDetails&&(o.innerHTML=(a=e.bankDetails)==null?void 0:a.accountName)}copyToClipboard(e,i){navigator.clipboard.writeText(e).then(()=>{i.innerHTML="Copied!"}).catch(()=>{i.innerHTML="Failed to copy"})}renderComponent(e){this.container.innerHTML=this.render(),this.renderTransferDetailsComponent(e),this.attachListeners()}render(){return $r}}const Qr=`<div id="paymenExpired">
1230
- <div class="container-center min-h-[30dvh]">
1231
- <div>
1232
- <div class="container-center mb-5">
1233
- <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
1234
- <path
1235
- d="M32.5172 9.74998L22.6172 4.03331C21.0005 3.09998 19.0005 3.09998 17.3672 4.03331L7.48385 9.74998C5.86719 10.6833 4.86719 12.4166 4.86719 14.3V25.7C4.86719 27.5666 5.86719 29.3 7.48385 30.25L17.3839 35.9666C19.0005 36.9 21.0005 36.9 22.6339 35.9666L32.5339 30.25C34.1505 29.3166 35.1505 27.5833 35.1505 25.7V14.3C35.1339 12.4166 34.1339 10.7 32.5172 9.74998ZM18.7505 12.9166C18.7505 12.2333 19.3172 11.6666 20.0005 11.6666C20.6839 11.6666 21.2505 12.2333 21.2505 12.9166V21.6666C21.2505 22.35 20.6839 22.9166 20.0005 22.9166C19.3172 22.9166 18.7505 22.35 18.7505 21.6666V12.9166ZM21.5339 27.7166C21.4505 27.9166 21.3339 28.1 21.1839 28.2666C20.8672 28.5833 20.4505 28.75 20.0005 28.75C19.7839 28.75 19.5672 28.7 19.3672 28.6166C19.1505 28.5333 18.9839 28.4166 18.8172 28.2666C18.6672 28.1 18.5505 27.9166 18.4505 27.7166C18.3672 27.5166 18.3339 27.3 18.3339 27.0833C18.3339 26.65 18.5005 26.2166 18.8172 25.9C18.9839 25.75 19.1505 25.6333 19.3672 25.55C19.9839 25.2833 20.7172 25.4333 21.1839 25.9C21.3339 26.0666 21.4505 26.2333 21.5339 26.45C21.6172 26.65 21.6672 26.8666 21.6672 27.0833C21.6672 27.3 21.6172 27.5166 21.5339 27.7166Z"
1236
- fill="#D62020" />
1237
- </svg>
1376
+ <div id="details-content" class="grid gap-5">
1377
+ <h5 class="text-sm text-tone-100 text-center font-semibold md:w-4/5 mx-auto">
1378
+ Make a single bank transfer from your bank to this account
1379
+ before it expires.
1380
+ </h5>
1381
+ <div class="border border-grey-100 rounded-lg text-black px-6 py-5 grid gap-4">
1382
+ <div class="text-sm grid grid-cols-[1fr_auto] gap-3">
1383
+ <div>
1384
+ <p class="text-sm">Amount</p>
1385
+ </div>
1386
+
1387
+ <div class="align-center gap-2">
1388
+ <p class="font-bold transfer-curr-amount" id="transfer-amount"></p>
1389
+
1390
+ <button type="button" class="relative group" id="copy-amount">
1391
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
1392
+ <path
1393
+ d="M9.33268 7.52502V9.97502C9.33268 12.0167 8.51602 12.8334 6.47435 12.8334H4.02435C1.98268 12.8334 1.16602 12.0167 1.16602 9.97502V7.52502C1.16602 5.48335 1.98268 4.66669 4.02435 4.66669H6.47435C8.51602 4.66669 9.33268 5.48335 9.33268 7.52502Z"
1394
+ stroke="#0D0716" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
1395
+ <path
1396
+ d="M12.8327 4.02502V6.47502C12.8327 8.51669 12.016 9.33335 9.97435 9.33335H9.33268V7.52502C9.33268 5.48335 8.51602 4.66669 6.47435 4.66669H4.66602V4.02502C4.66602 1.98335 5.48268 1.16669 7.52435 1.16669H9.97435C12.016 1.16669 12.8327 1.98335 12.8327 4.02502Z"
1397
+ stroke="#0D0716" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
1398
+ </svg>
1399
+
1400
+
1401
+ <div class="tooltip">
1402
+ <div class="tooltip-textbox">
1403
+ <p class="tooltip-text" id="amount-tooltip">Copy</p>
1404
+ </div>
1405
+ </div>
1406
+ </button>
1407
+ </div>
1238
1408
  </div>
1239
- <h5 class="text-tone-100 font-semibold text-xl text-center mb-1" id="payment-warning-text">
1240
- Account Expired
1241
- </h5>
1242
1409
 
1243
- <p class="w-11/12 mx-auto text-sm text-center">
1244
- Looks like your account is not valid. Please confirm and try again
1245
- </p>
1410
+ <div class="grid grid-cols-[1fr_auto] gap-3 text-sm">
1411
+ <div>
1412
+ <p class="text-sm">Account Number</p>
1413
+ </div>
1414
+
1415
+ <div class="align-center gap-2">
1416
+ <p class="font-bold" id="transfer-acn"></p>
1417
+
1418
+ <button type="button" class="relative group" id="copy-acn">
1419
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
1420
+ <path
1421
+ d="M9.33268 7.52502V9.97502C9.33268 12.0167 8.51602 12.8334 6.47435 12.8334H4.02435C1.98268 12.8334 1.16602 12.0167 1.16602 9.97502V7.52502C1.16602 5.48335 1.98268 4.66669 4.02435 4.66669H6.47435C8.51602 4.66669 9.33268 5.48335 9.33268 7.52502Z"
1422
+ stroke="#0D0716" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
1423
+ <path
1424
+ d="M12.8327 4.02502V6.47502C12.8327 8.51669 12.016 9.33335 9.97435 9.33335H9.33268V7.52502C9.33268 5.48335 8.51602 4.66669 6.47435 4.66669H4.66602V4.02502C4.66602 1.98335 5.48268 1.16669 7.52435 1.16669H9.97435C12.016 1.16669 12.8327 1.98335 12.8327 4.02502Z"
1425
+ stroke="#0D0716" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
1426
+ </svg>
1427
+
1428
+
1429
+ <div class="tooltip">
1430
+ <div class="tooltip-textbox">
1431
+ <p class="tooltip-text" id="acn-tooltip">Copy</p>
1432
+ </div>
1433
+ </div>
1434
+ </button>
1435
+ </div>
1436
+ </div>
1437
+
1438
+ <div class="grid grid-cols-[1fr_auto] gap-3 text-sm">
1439
+ <p>Bank name</p>
1440
+ <p class="font-semibold" id="transfer-bank"></p>
1441
+ </div>
1442
+
1443
+
1444
+ <div class="grid grid-cols-[1fr_auto] gap-3 text-sm">
1445
+ <p>Beneficiary</p>
1446
+ <p class="font-semibold" id="account-name"></p>
1447
+ </div>
1448
+ </div>
1449
+
1450
+ <div class="mt-3">
1451
+ <button type="button" id="transfer-button" class="details-form-button">I have made this bank transfer</button>
1452
+ </div>
1453
+
1454
+ <div class="mt-5">
1455
+ <div class="w-9/12 mx-auto">
1456
+ <div class="bg-[#FEF7ED] text-[#816039] text-sm text-center rounded-lg p-2">
1457
+ This account is for this transaction only and
1458
+ expires in <span class="font-semibold" id="time-left"></span><span class="font-semibold">s</span>
1459
+ </div>
1460
+ </div>
1461
+ </div>
1462
+ </div>
1463
+ </div>`;function $r(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Yo={exports:{}};/*!
1464
+ * Pusher JavaScript Library v8.4.0
1465
+ * https://pusher.com/
1466
+ *
1467
+ * Copyright 2020, Pusher
1468
+ * Released under the MIT licence.
1469
+ */(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 a=t[s]={i:s,l:!1,exports:{}};return i[s].call(a.exports,a,a.exports,o),a.l=!0,a.exports}return o.m=i,o.c=t,o.d=function(s,a,l){o.o(s,a)||Object.defineProperty(s,a,{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,a){if(a&1&&(s=o(s)),a&8||a&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}),a&2&&typeof s!="string")for(var d in s)o.d(l,d,(function(v){return s[v]}).bind(null,d));return l},o.n=function(s){var a=s&&s.__esModule?function(){return s.default}:function(){return s};return o.d(a,"a",a),a},o.o=function(s,a){return Object.prototype.hasOwnProperty.call(s,a)},o.p="",o(o.s=2)}([function(i,t,o){var s=this&&this.__extends||function(){var C=function(S,M){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,_){A.__proto__=_}||function(A,_){for(var T in _)_.hasOwnProperty(T)&&(A[T]=_[T])},C(S,M)};return function(S,M){C(S,M);function A(){this.constructor=S}S.prototype=M===null?Object.create(M):(A.prototype=M.prototype,new A)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=256,l=function(){function C(S){S===void 0&&(S="="),this._paddingCharacter=S}return C.prototype.encodedLength=function(S){return this._paddingCharacter?(S+2)/3*4|0:(S*8+5)/6|0},C.prototype.encode=function(S){for(var M="",A=0;A<S.length-2;A+=3){var _=S[A]<<16|S[A+1]<<8|S[A+2];M+=this._encodeByte(_>>>3*6&63),M+=this._encodeByte(_>>>2*6&63),M+=this._encodeByte(_>>>1*6&63),M+=this._encodeByte(_>>>0*6&63)}var T=S.length-A;if(T>0){var _=S[A]<<16|(T===2?S[A+1]<<8:0);M+=this._encodeByte(_>>>3*6&63),M+=this._encodeByte(_>>>2*6&63),T===2?M+=this._encodeByte(_>>>1*6&63):M+=this._paddingCharacter||"",M+=this._paddingCharacter||""}return M},C.prototype.maxDecodedLength=function(S){return this._paddingCharacter?S/4*3|0:(S*6+7)/8|0},C.prototype.decodedLength=function(S){return this.maxDecodedLength(S.length-this._getPaddingLength(S))},C.prototype.decode=function(S){if(S.length===0)return new Uint8Array(0);for(var M=this._getPaddingLength(S),A=S.length-M,_=new Uint8Array(this.maxDecodedLength(A)),T=0,I=0,K=0,G=0,U=0,F=0,oe=0;I<A-4;I+=4)G=this._decodeChar(S.charCodeAt(I+0)),U=this._decodeChar(S.charCodeAt(I+1)),F=this._decodeChar(S.charCodeAt(I+2)),oe=this._decodeChar(S.charCodeAt(I+3)),_[T++]=G<<2|U>>>4,_[T++]=U<<4|F>>>2,_[T++]=F<<6|oe,K|=G&a,K|=U&a,K|=F&a,K|=oe&a;if(I<A-1&&(G=this._decodeChar(S.charCodeAt(I)),U=this._decodeChar(S.charCodeAt(I+1)),_[T++]=G<<2|U>>>4,K|=G&a,K|=U&a),I<A-2&&(F=this._decodeChar(S.charCodeAt(I+2)),_[T++]=U<<4|F>>>2,K|=F&a),I<A-3&&(oe=this._decodeChar(S.charCodeAt(I+3)),_[T++]=F<<6|oe,K|=oe&a),K!==0)throw new Error("Base64Coder: incorrect characters for decoding");return _},C.prototype._encodeByte=function(S){var M=S;return M+=65,M+=25-S>>>8&6,M+=51-S>>>8&-75,M+=61-S>>>8&-15,M+=62-S>>>8&3,String.fromCharCode(M)},C.prototype._decodeChar=function(S){var M=a;return M+=(42-S&S-44)>>>8&-a+S-43+62,M+=(46-S&S-48)>>>8&-a+S-47+63,M+=(47-S&S-58)>>>8&-a+S-48+52,M+=(64-S&S-91)>>>8&-a+S-65+0,M+=(96-S&S-123)>>>8&-a+S-97+26,M},C.prototype._getPaddingLength=function(S){var M=0;if(this._paddingCharacter){for(var A=S.length-1;A>=0&&S[A]===this._paddingCharacter;A--)M++;if(S.length<4||M>2)throw new Error("Base64Coder: incorrect padding")}return M},C}();t.Coder=l;var d=new l;function v(C){return d.encode(C)}t.encode=v;function p(C){return d.decode(C)}t.decode=p;var g=function(C){s(S,C);function S(){return C!==null&&C.apply(this,arguments)||this}return S.prototype._encodeByte=function(M){var A=M;return A+=65,A+=25-M>>>8&6,A+=51-M>>>8&-75,A+=61-M>>>8&-13,A+=62-M>>>8&49,String.fromCharCode(A)},S.prototype._decodeChar=function(M){var A=a;return A+=(44-M&M-46)>>>8&-a+M-45+62,A+=(94-M&M-96)>>>8&-a+M-95+63,A+=(47-M&M-58)>>>8&-a+M-48+52,A+=(64-M&M-91)>>>8&-a+M-65+0,A+=(96-M&M-123)>>>8&-a+M-97+26,A},S}(l);t.URLSafeCoder=g;var f=new g;function y(C){return f.encode(C)}t.encodeURLSafe=y;function k(C){return f.decode(C)}t.decodeURLSafe=k,t.encodedLength=function(C){return d.encodedLength(C)},t.maxDecodedLength=function(C){return d.maxDecodedLength(C)},t.decodedLength=function(C){return d.decodedLength(C)}},function(i,t,o){Object.defineProperty(t,"__esModule",{value:!0});var s="utf8: invalid string",a="utf8: invalid source encoding";function l(p){for(var g=new Uint8Array(d(p)),f=0,y=0;y<p.length;y++){var k=p.charCodeAt(y);k<128?g[f++]=k:k<2048?(g[f++]=192|k>>6,g[f++]=128|k&63):k<55296?(g[f++]=224|k>>12,g[f++]=128|k>>6&63,g[f++]=128|k&63):(y++,k=(k&1023)<<10,k|=p.charCodeAt(y)&1023,k+=65536,g[f++]=240|k>>18,g[f++]=128|k>>12&63,g[f++]=128|k>>6&63,g[f++]=128|k&63)}return g}t.encode=l;function d(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=d;function v(p){for(var g=[],f=0;f<p.length;f++){var y=p[f];if(y&128){var k=void 0;if(y<224){if(f>=p.length)throw new Error(a);var C=p[++f];if((C&192)!==128)throw new Error(a);y=(y&31)<<6|C&63,k=128}else if(y<240){if(f>=p.length-1)throw new Error(a);var C=p[++f],S=p[++f];if((C&192)!==128||(S&192)!==128)throw new Error(a);y=(y&15)<<12|(C&63)<<6|S&63,k=2048}else if(y<248){if(f>=p.length-2)throw new Error(a);var C=p[++f],S=p[++f],M=p[++f];if((C&192)!==128||(S&192)!==128||(M&192)!==128)throw new Error(a);y=(y&15)<<18|(C&63)<<12|(S&63)<<6|M&63,k=65536}else throw new Error(a);if(y<k||y>=55296&&y<=57343)throw new Error(a);if(y>=65536){if(y>1114111)throw new Error(a);y-=65536,g.push(String.fromCharCode(55296|y>>10)),y=56320|y&1023}}g.push(String.fromCharCode(y))}return g.join("")}t.decode=v},function(i,t,o){i.exports=o(3).default},function(i,t,o){o.r(t);class s{constructor(r,c){this.lastId=0,this.prefix=r,this.name=c}create(r){this.lastId++;var c=this.lastId,b=this.prefix+c,w=this.name+"["+c+"]",L=!1,E=function(){L||(r.apply(null,arguments),L=!0)};return this[c]=E,{number:c,id:b,name:w,callback:E}}remove(r){delete this[r.number]}}var a=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:""},d=l;class v{constructor(r){this.options=r,this.receivers=r.receivers||a,this.loading={}}load(r,c,b){var w=this;if(w.loading[r]&&w.loading[r].length>0)w.loading[r].push(b);else{w.loading[r]=[b];var L=O.createScriptRequest(w.getPath(r,c)),E=w.receivers.create(function(D){if(w.receivers.remove(E),w.loading[r]){var R=w.loading[r];delete w.loading[r];for(var Z=function(pe){pe||L.cleanup()},X=0;X<R.length;X++)R[X](D,Z)}});L.send(E)}}getRoot(r){var c,b=O.getDocument().location.protocol;return r&&r.useTLS||b==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(r,c){return this.getRoot(c)+"/"+r+this.options.suffix+".js"}}var p=new s("_pusher_dependencies","Pusher.DependenciesReceivers"),g=new v({cdn_http:d.cdn_http,cdn_https:d.cdn_https,version:d.VERSION,suffix:d.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 k={buildLogSuffix:function(u){const r="See:",c=f.urls[u];if(!c)return"";let b;return c.fullUrl?b=c.fullUrl:c.path&&(b=f.baseUrl+c.path),b?`${r} ${b}`:""}},C;(function(u){u.UserAuthentication="user-authentication",u.ChannelAuthorization="channel-authorization"})(C||(C={}));class S extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class A extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class _ extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class T extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class I extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class K extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class G extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class U extends Error{constructor(r,c){super(c),this.status=r,Object.setPrototypeOf(this,new.target.prototype)}}var oe=function(u,r,c,b,w){const L=O.createXHR();L.open("POST",c.endpoint,!0),L.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var E in c.headers)L.setRequestHeader(E,c.headers[E]);if(c.headersProvider!=null){let D=c.headersProvider();for(var E in D)L.setRequestHeader(E,D[E])}return L.onreadystatechange=function(){if(L.readyState===4)if(L.status===200){let D,R=!1;try{D=JSON.parse(L.responseText),R=!0}catch{w(new U(200,`JSON returned from ${b.toString()} endpoint was invalid, yet status code was 200. Data was: ${L.responseText}`),null)}R&&w(null,D)}else{let D="";switch(b){case C.UserAuthentication:D=k.buildLogSuffix("authenticationEndpoint");break;case C.ChannelAuthorization:D=`Clients must be authorized to join private or presence channels. ${k.buildLogSuffix("authorizationEndpoint")}`;break}w(new U(L.status,`Unable to retrieve auth string from ${b.toString()} endpoint - received status: ${L.status} from ${c.endpoint}. ${D}`),null)}},L.send(r),L};function ge(u){return en(Te(u))}var V=String.fromCharCode,_e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ue=function(u){var r=u.charCodeAt(0);return r<128?u:r<2048?V(192|r>>>6)+V(128|r&63):V(224|r>>>12&15)+V(128|r>>>6&63)+V(128|r&63)},Te=function(u){return u.replace(/[^\x00-\x7F]/g,ue)},Me=function(u){var r=[0,2,1][u.length%3],c=u.charCodeAt(0)<<16|(u.length>1?u.charCodeAt(1):0)<<8|(u.length>2?u.charCodeAt(2):0),b=[_e.charAt(c>>>18),_e.charAt(c>>>12&63),r>=2?"=":_e.charAt(c>>>6&63),r>=1?"=":_e.charAt(c&63)];return b.join("")},en=window.btoa||function(u){return u.replace(/[\s\S]{1,3}/g,Me)};class vn{constructor(r,c,b,w){this.clear=c,this.timer=r(()=>{this.timer&&(this.timer=w(this.timer))},b)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var nn=vn;function _n(u){window.clearTimeout(u)}function bn(u){window.clearInterval(u)}class Ee extends nn{constructor(r,c){super(setTimeout,_n,r,function(b){return c(),null})}}class tn extends nn{constructor(r,c){super(setInterval,bn,r,function(b){return c(),b})}}var Mn={now(){return Date.now?Date.now():new Date().valueOf()},defer(u){return new Ee(0,u)},method(u,...r){var c=Array.prototype.slice.call(arguments,1);return function(b){return b[u].apply(b,c.concat(arguments))}}},re=Mn;function fe(u,...r){for(var c=0;c<r.length;c++){var b=r[c];for(var w in b)b[w]&&b[w].constructor&&b[w].constructor===Object?u[w]=fe(u[w]||{},b[w]):u[w]=b[w]}return u}function Re(){for(var u=["Pusher"],r=0;r<arguments.length;r++)typeof arguments[r]=="string"?u.push(arguments[r]):u.push(An(arguments[r]));return u.join(" : ")}function Pe(u,r){var c=Array.prototype.indexOf;if(u===null)return-1;if(c&&u.indexOf===c)return u.indexOf(r);for(var b=0,w=u.length;b<w;b++)if(u[b]===r)return b;return-1}function we(u,r){for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&r(u[c],c,u)}function We(u){var r=[];return we(u,function(c,b){r.push(b)}),r}function B(u){var r=[];return we(u,function(c){r.push(c)}),r}function he(u,r,c){for(var b=0;b<u.length;b++)r.call(c||window,u[b],b,u)}function Q(u,r){for(var c=[],b=0;b<u.length;b++)c.push(r(u[b],b,u,c));return c}function me(u,r){var c={};return we(u,function(b,w){c[w]=r(b)}),c}function Ie(u,r){r=r||function(w){return!!w};for(var c=[],b=0;b<u.length;b++)r(u[b],b,u,c)&&c.push(u[b]);return c}function $(u,r){var c={};return we(u,function(b,w){(r&&r(b,w,u,c)||b)&&(c[w]=b)}),c}function fn(u){var r=[];return we(u,function(c,b){r.push([b,c])}),r}function si(u,r){for(var c=0;c<u.length;c++)if(r(u[c],c,u))return!0;return!1}function Ui(u,r){for(var c=0;c<u.length;c++)if(!r(u[c],c,u))return!1;return!0}function Vi(u){return me(u,function(r){return typeof r=="object"&&(r=An(r)),encodeURIComponent(ge(r.toString()))})}function ji(u){var r=$(u,function(b){return b!==void 0}),c=Q(fn(Vi(r)),re.method("join","=")).join("&");return c}function Ki(u){var r=[],c=[];return function b(w,L){var E,D,R;switch(typeof w){case"object":if(!w)return null;for(E=0;E<r.length;E+=1)if(r[E]===w)return{$ref:c[E]};if(r.push(w),c.push(L),Object.prototype.toString.apply(w)==="[object Array]")for(R=[],E=0;E<w.length;E+=1)R[E]=b(w[E],L+"["+E+"]");else{R={};for(D in w)Object.prototype.hasOwnProperty.call(w,D)&&(R[D]=b(w[D],L+"["+JSON.stringify(D)+"]"))}return R;case"number":case"string":case"boolean":return w}}(u,"$")}function An(u){try{return JSON.stringify(u)}catch{return JSON.stringify(Ki(u))}}class ai{constructor(){this.globalLog=r=>{window.console&&window.console.log&&window.console.log(r)}}debug(...r){this.log(this.globalLog,r)}warn(...r){this.log(this.globalLogWarn,r)}error(...r){this.log(this.globalLogError,r)}globalLogWarn(r){window.console&&window.console.warn?window.console.warn(r):this.globalLog(r)}globalLogError(r){window.console&&window.console.error?window.console.error(r):this.globalLogWarn(r)}log(r,...c){var b=Re.apply(this,arguments);It.log?It.log(b):It.logToConsole&&r.bind(this)(b)}}var se=new ai,El=function(u,r,c,b,w){(c.headers!==void 0||c.headersProvider!=null)&&se.warn(`To send headers with the ${b.toString()} request, you must use AJAX, rather than JSONP.`);var L=u.nextAuthCallbackID.toString();u.nextAuthCallbackID++;var E=u.getDocument(),D=E.createElement("script");u.auth_callbacks[L]=function(X){w(null,X)};var R="Pusher.auth_callbacks['"+L+"']";D.src=c.endpoint+"?callback="+encodeURIComponent(R)+"&"+r;var Z=E.getElementsByTagName("head")[0]||E.documentElement;Z.insertBefore(D,Z.firstChild)},Pl=El;class Il{constructor(r){this.src=r}send(r){var c=this,b="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=r.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){r.callback(b)},c.script.onload=function(){r.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&r.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=r.id+"_error",c.errorScript.text=r.name+"('"+b+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var w=document.getElementsByTagName("head")[0];w.insertBefore(c.script,w.firstChild),c.errorScript&&w.insertBefore(c.errorScript,c.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 Dl{constructor(r,c){this.url=r,this.data=c}send(r){if(!this.request){var c=ji(this.data),b=this.url+"/"+r.number+"?"+c;this.request=O.createScriptRequest(b),this.request.send(r)}}cleanup(){this.request&&this.request.cleanup()}}var Bl=function(u,r){return function(c,b){var w="http"+(r?"s":"")+"://",L=w+(u.host||u.options.host)+u.options.path,E=O.createJSONPRequest(L,c),D=O.ScriptReceivers.create(function(R,Z){a.remove(D),E.cleanup(),Z&&Z.host&&(u.host=Z.host),b&&b(R,Z)});E.send(D)}},Nl={name:"jsonp",getAgent:Bl},Hl=Nl;function kt(u,r,c){var b=u+(r.useTLS?"s":""),w=r.useTLS?r.hostTLS:r.hostNonTLS;return b+"://"+w+c}function St(u,r){var c="/app/"+u,b="?protocol="+d.PROTOCOL+"&client=js&version="+d.VERSION+(r?"&"+r:"");return c+b}var Rl={getInitial:function(u,r){var c=(r.httpPath||"")+St(u,"flash=false");return kt("ws",r,c)}},Ol={getInitial:function(u,r){var c=(r.httpPath||"/pusher")+St(u);return kt("http",r,c)}},Ul={getInitial:function(u,r){return kt("http",r,r.httpPath||"/pusher")},getPath:function(u,r){return St(u)}};class Vl{constructor(){this._callbacks={}}get(r){return this._callbacks[_t(r)]}add(r,c,b){var w=_t(r);this._callbacks[w]=this._callbacks[w]||[],this._callbacks[w].push({fn:c,context:b})}remove(r,c,b){if(!r&&!c&&!b){this._callbacks={};return}var w=r?[_t(r)]:We(this._callbacks);c||b?this.removeCallback(w,c,b):this.removeAllCallbacks(w)}removeCallback(r,c,b){he(r,function(w){this._callbacks[w]=Ie(this._callbacks[w]||[],function(L){return c&&c!==L.fn||b&&b!==L.context}),this._callbacks[w].length===0&&delete this._callbacks[w]},this)}removeAllCallbacks(r){he(r,function(c){delete this._callbacks[c]},this)}}function _t(u){return"_"+u}class on{constructor(r){this.callbacks=new Vl,this.global_callbacks=[],this.failThrough=r}bind(r,c,b){return this.callbacks.add(r,c,b),this}bind_global(r){return this.global_callbacks.push(r),this}unbind(r,c,b){return this.callbacks.remove(r,c,b),this}unbind_global(r){return r?(this.global_callbacks=Ie(this.global_callbacks||[],c=>c!==r),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(r,c,b){for(var w=0;w<this.global_callbacks.length;w++)this.global_callbacks[w](r,c);var L=this.callbacks.get(r),E=[];if(b?E.push(c,b):c&&E.push(c),L&&L.length>0)for(var w=0;w<L.length;w++)L[w].fn.apply(L[w].context||window,E);else this.failThrough&&this.failThrough(r,c);return this}}class jl extends on{constructor(r,c,b,w,L){super(),this.initialize=O.transportConnectionInitializer,this.hooks=r,this.name=c,this.priority=b,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 r=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(r,this.options)}catch(c){return re.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),se.debug("Connecting",{transport:this.name,url:r}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(r){return this.state==="open"?(re.defer(()=>{this.socket&&this.socket.send(r)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(r){this.emit("error",{type:"WebSocketError",error:r}),this.timeline.error(this.buildTimelineMessage({error:r.toString()}))}onClose(r){r?this.changeState("closed",{code:r.code,reason:r.reason,wasClean:r.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(r){this.emit("message",r)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=r=>{this.onError(r)},this.socket.onclose=r=>{this.onClose(r)},this.socket.onmessage=r=>{this.onMessage(r)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(r,c){this.state=r,this.timeline.info(this.buildTimelineMessage({state:r,params:c})),this.emit(r,c)}buildTimelineMessage(r){return fe({cid:this.id},r)}}class Gn{constructor(r){this.hooks=r}isSupported(r){return this.hooks.isSupported(r)}createConnection(r,c,b,w){return new jl(this.hooks,r,c,b,w)}}var Kl=new Gn({urls:Rl,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!O.getWebSocketAPI()},isSupported:function(){return!!O.getWebSocketAPI()},getSocket:function(u){return O.createWebSocket(u)}}),ss={urls:Ol,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},as=fe({getSocket:function(u){return O.HTTPFactory.createStreamingSocket(u)}},ss),rs=fe({getSocket:function(u){return O.HTTPFactory.createPollingSocket(u)}},ss),ls={isSupported:function(){return O.isXHRSupported()}},Fl=new Gn(fe({},as,ls)),Gl=new Gn(fe({},rs,ls)),zl={ws:Kl,xhr_streaming:Fl,xhr_polling:Gl},Fi=zl,ql=new Gn({file:"sockjs",urls:Ul,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(u,r){return new window.SockJS(u,null,{js_path:g.getPath("sockjs",{useTLS:r.useTLS}),ignore_null_origin:r.ignoreNullOrigin})},beforeOpen:function(u,r){u.send(JSON.stringify({path:r}))}}),ds={isSupported:function(u){var r=O.isXDRSupported(u.useTLS);return r}},Wl=new Gn(fe({},as,ds)),Zl=new Gn(fe({},rs,ds));Fi.xdr_streaming=Wl,Fi.xdr_polling=Zl,Fi.sockjs=ql;var Jl=Fi;class $l extends on{constructor(){super();var r=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){r.emit("online")},!1),window.addEventListener("offline",function(){r.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Yl=new $l;class Ql{constructor(r,c,b){this.manager=r,this.transport=c,this.minPingDelay=b.minPingDelay,this.maxPingDelay=b.maxPingDelay,this.pingDelay=void 0}createConnection(r,c,b,w){w=fe({},w,{activityTimeout:this.pingDelay});var L=this.transport.createConnection(r,c,b,w),E=null,D=function(){L.unbind("open",D),L.bind("closed",R),E=re.now()},R=Z=>{if(L.unbind("closed",R),Z.code===1002||Z.code===1003)this.manager.reportDeath();else if(!Z.wasClean&&E){var X=re.now()-E;X<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(X/2,this.minPingDelay))}};return L.bind("open",D),L}isSupported(r){return this.manager.isAlive()&&this.transport.isSupported(r)}}const cs={decodeMessage:function(u){try{var r=JSON.parse(u.data),c=r.data;if(typeof c=="string")try{c=JSON.parse(r.data)}catch{}var b={event:r.event,channel:r.channel,data:c};return r.user_id&&(b.user_id=r.user_id),b}catch(w){throw{type:"MessageParseError",error:w,data:u.data}}},encodeMessage:function(u){return JSON.stringify(u)},processHandshake:function(u){var r=cs.decodeMessage(u);if(r.event==="pusher:connection_established"){if(!r.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:r.data.socket_id,activityTimeout:r.data.activity_timeout*1e3}}else{if(r.event==="pusher:error")return{action:this.getCloseAction(r.data),error:this.getCloseError(r.data)};throw"Invalid handshake"}},getCloseAction:function(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 xn=cs;class Xl extends on{constructor(r,c){super(),this.id=r,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(r){return this.transport.send(r)}send_event(r,c,b){var w={event:r,data:c};return b&&(w.channel=b),se.debug("Event sent",w),this.send(xn.encodeMessage(w))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var r={message:b=>{var w;try{w=xn.decodeMessage(b)}catch(L){this.emit("error",{type:"MessageParseError",error:L,data:b.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:b=>{this.emit("error",b)},closed:b=>{c(),b&&b.code&&this.handleCloseEvent(b),this.transport=null,this.emit("closed")}},c=()=>{we(r,(b,w)=>{this.transport.unbind(w,b)})};we(r,(b,w)=>{this.transport.bind(w,b)})}handleCloseEvent(r){var c=xn.getCloseAction(r),b=xn.getCloseError(r);b&&this.emit("error",b),c&&this.emit(c,{action:c,error:b})}}class ed{constructor(r,c){this.transport=r,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=r=>{this.unbindListeners();var c;try{c=xn.processHandshake(r)}catch(b){this.finish("error",{error:b}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new Xl(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=r=>{this.unbindListeners();var c=xn.getCloseAction(r)||"backoff",b=xn.getCloseError(r);this.finish(c,{error:b})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(r,c){this.callback(fe({transport:this.transport,action:r},c))}}class nd{constructor(r,c){this.timeline=r,this.options=c||{}}send(r,c){this.timeline.isEmpty()||this.timeline.send(O.TimelineTransport.getAgent(this,r),c)}}class Mt extends on{constructor(r,c){super(function(b,w){se.debug("No callbacks on "+r+" for "+b)}),this.name=r,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(r,c){return c(null,{auth:""})}trigger(r,c){if(r.indexOf("client-")!==0)throw new S("Event '"+r+"' does not start with 'client-'");if(!this.subscribed){var b=k.buildLogSuffix("triggeringClientEvents");se.warn(`Client event triggered before channel 'subscription_succeeded' event . ${b}`)}return this.pusher.send_event(r,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(r){var c=r.event,b=r.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(r);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(r);else if(c.indexOf("pusher_internal:")!==0){var w={};this.emit(c,b,w)}}handleSubscriptionSucceededEvent(r){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",r.data)}handleSubscriptionCountEvent(r){r.data.subscription_count&&(this.subscriptionCount=r.data.subscription_count),this.emit("pusher:subscription_count",r.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(r,c)=>{r?(this.subscriptionPending=!1,se.error(r.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:r.message},r instanceof U?{status:r.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.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 At extends Mt{authorize(r,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:r},c)}}class id{constructor(){this.reset()}get(r){return Object.prototype.hasOwnProperty.call(this.members,r)?{id:r,info:this.members[r]}:null}each(r){we(this.members,(c,b)=>{r(this.get(b))})}setMyID(r){this.myID=r}onSubscription(r){this.members=r.presence.hash,this.count=r.presence.count,this.me=this.get(this.myID)}addMember(r){return this.get(r.user_id)===null&&this.count++,this.members[r.user_id]=r.user_info,this.get(r.user_id)}removeMember(r){var c=this.get(r.user_id);return c&&(delete this.members[r.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var td=function(u,r,c,b){function w(L){return L instanceof c?L:new c(function(E){E(L)})}return new(c||(c=Promise))(function(L,E){function D(X){try{Z(b.next(X))}catch(pe){E(pe)}}function R(X){try{Z(b.throw(X))}catch(pe){E(pe)}}function Z(X){X.done?L(X.value):w(X.value).then(D,R)}Z((b=b.apply(u,r||[])).next())})};class od extends At{constructor(r,c){super(r,c),this.members=new id}authorize(r,c){super.authorize(r,(b,w)=>td(this,void 0,void 0,function*(){if(!b)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 E=k.buildLogSuffix("authorizationEndpoint");se.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${E}, or the user should be signed in.`),c("Invalid auth response");return}c(b,w)}))}handleEvent(r){var c=r.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(r);else{var b=r.data,w={};r.user_id&&(w.user_id=r.user_id),this.emit(c,b,w)}}handleInternalEvent(r){var c=r.event,b=r.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(r);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(r);break;case"pusher_internal:member_added":var w=this.members.addMember(b);this.emit("pusher:member_added",w);break;case"pusher_internal:member_removed":var L=this.members.removeMember(b);L&&this.emit("pusher:member_removed",L);break}}handleSubscriptionSucceededEvent(r){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(r.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var sd=o(1),xt=o(0);class ad extends At{constructor(r,c,b){super(r,c),this.key=null,this.nacl=b}authorize(r,c){super.authorize(r,(b,w)=>{if(b){c(b,w);return}let L=w.shared_secret;if(!L){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(xt.decode)(L),delete w.shared_secret,c(null,w)})}trigger(r,c){throw new I("Client events are not currently supported for encrypted channels")}handleEvent(r){var c=r.event,b=r.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(r);return}this.handleEncryptedEvent(c,b)}handleEncryptedEvent(r,c){if(!this.key){se.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){se.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let b=Object(xt.decode)(c.ciphertext);if(b.length<this.nacl.secretbox.overheadLength){se.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${b.length}`);return}let w=Object(xt.decode)(c.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(b,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,(E,D)=>{if(E){se.error(`Failed to make a request to the authEndpoint: ${D}. Unable to fetch new key, so dropping encrypted event`);return}if(L=this.nacl.secretbox.open(b,w,this.key),L===null){se.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(r,this.getDataToEmit(L))});return}this.emit(r,this.getDataToEmit(L))}getDataToEmit(r){let c=Object(sd.decode)(r);try{return JSON.parse(c)}catch{return c}}}class rd extends on{constructor(r,c){super(),this.state="initialized",this.connection=null,this.key=r,this.options=c,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 b=O.getNetwork();b.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),b.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(r){return this.connection?this.connection.send(r):!1}send_event(r,c,b){return this.connection?this.connection.send_event(r,c,b):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var r=(c,b)=>{c?this.runner=this.strategy.connect(0,r):b.action==="error"?(this.emit("error",{type:"HandshakeError",error:b.error}),this.timeline.error({handshakeError:b.error})):(this.abortConnecting(),this.handshakeCallbacks[b.action](b))};this.runner=this.strategy.connect(0,r)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var r=this.abandonConnection();r.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(r){this.timeline.info({action:"retry",delay:r}),r>0&&this.emit("connecting_in",Math.round(r/1e3)),this.retryTimer=new Ee(r||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(r){return fe({},r,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(r){return fe({},r,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let r=c=>b=>{b.error&&this.emit("error",{type:"WebSocketError",error:b.error}),c(b)};return{tls_only:r(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:r(()=>{this.disconnect()}),backoff:r(()=>{this.retryIn(1e3)}),retry:r(()=>{this.retryIn(0)})}}setConnection(r){this.connection=r;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var r in this.connectionCallbacks)this.connection.unbind(r,this.connectionCallbacks[r]);var c=this.connection;return this.connection=null,c}}updateState(r,c){var b=this.state;if(this.state=r,b!==r){var w=r;w==="connected"&&(w+=" with new socket ID "+c.socket_id),se.debug("State changed",b+" -> "+w),this.timeline.info({state:r,params:c}),this.emit("state_change",{previous:b,current:r}),this.emit(r,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class ld{constructor(){this.channels={}}add(r,c){return this.channels[r]||(this.channels[r]=dd(r,c)),this.channels[r]}all(){return B(this.channels)}find(r){return this.channels[r]}remove(r){var c=this.channels[r];return delete this.channels[r],c}disconnect(){we(this.channels,function(r){r.disconnect()})}}function dd(u,r){if(u.indexOf("private-encrypted-")===0){if(r.config.nacl)return sn.createEncryptedChannel(u,r,r.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",b=k.buildLogSuffix("encryptedChannelSupport");throw new I(`${c}. ${b}`)}else{if(u.indexOf("private-")===0)return sn.createPrivateChannel(u,r);if(u.indexOf("presence-")===0)return sn.createPresenceChannel(u,r);if(u.indexOf("#")===0)throw new M('Cannot create a channel with name "'+u+'".');return sn.createChannel(u,r)}}var cd={createChannels(){return new ld},createConnectionManager(u,r){return new rd(u,r)},createChannel(u,r){return new Mt(u,r)},createPrivateChannel(u,r){return new At(u,r)},createPresenceChannel(u,r){return new od(u,r)},createEncryptedChannel(u,r,c){return new ad(u,r,c)},createTimelineSender(u,r){return new nd(u,r)},createHandshake(u,r){return new ed(u,r)},createAssistantToTheTransportManager(u,r,c){return new Ql(u,r,c)}},sn=cd;class us{constructor(r){this.options=r||{},this.livesLeft=this.options.lives||1/0}getAssistant(r){return sn.createAssistantToTheTransportManager(this,r,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Ln{constructor(r,c){this.strategies=r,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return si(this.strategies,re.method("isSupported"))}connect(r,c){var b=this.strategies,w=0,L=this.timeout,E=null,D=(R,Z)=>{Z?c(null,Z):(w=w+1,this.loop&&(w=w%b.length),w<b.length?(L&&(L=L*2,this.timeoutLimit&&(L=Math.min(L,this.timeoutLimit))),E=this.tryStrategy(b[w],r,{timeout:L,failFast:this.failFast},D)):c(!0))};return E=this.tryStrategy(b[w],r,{timeout:L,failFast:this.failFast},D),{abort:function(){E.abort()},forceMinPriority:function(R){r=R,E&&E.forceMinPriority(R)}}}tryStrategy(r,c,b,w){var L=null,E=null;return b.timeout>0&&(L=new Ee(b.timeout,function(){E.abort(),w(!0)})),E=r.connect(c,function(D,R){D&&L&&L.isRunning()&&!b.failFast||(L&&L.ensureAborted(),w(D,R))}),{abort:function(){L&&L.ensureAborted(),E.abort()},forceMinPriority:function(D){E.forceMinPriority(D)}}}}class Lt{constructor(r){this.strategies=r}isSupported(){return si(this.strategies,re.method("isSupported"))}connect(r,c){return ud(this.strategies,r,function(b,w){return function(L,E){if(w[b].error=L,L){hd(w)&&c(!0);return}he(w,function(D){D.forceMinPriority(E.transport.priority)}),c(null,E)}})}}function ud(u,r,c){var b=Q(u,function(w,L,E,D){return w.connect(r,c(L,D))});return{abort:function(){he(b,md)},forceMinPriority:function(w){he(b,function(L){L.forceMinPriority(w)})}}}function hd(u){return Ui(u,function(r){return!!r.error})}function md(u){!u.error&&!u.aborted&&(u.abort(),u.aborted=!0)}class pd{constructor(r,c,b){this.strategy=r,this.transports=c,this.ttl=b.ttl||1800*1e3,this.usingTLS=b.useTLS,this.timeline=b.timeline}isSupported(){return this.strategy.isSupported()}connect(r,c){var b=this.usingTLS,w=vd(b),L=w&&w.cacheSkipCount?w.cacheSkipCount:0,E=[this.strategy];if(w&&w.timestamp+this.ttl>=re.now()){var D=this.transports[w.transport];D&&(["ws","wss"].includes(w.transport)||L>3?(this.timeline.info({cached:!0,transport:w.transport,latency:w.latency}),E.push(new Ln([D],{timeout:w.latency*2+1e3,failFast:!0}))):L++)}var R=re.now(),Z=E.pop().connect(r,function X(pe,qi){pe?(hs(b),E.length>0?(R=re.now(),Z=E.pop().connect(r,X)):c(pe)):(bd(b,qi.transport.name,re.now()-R,L),c(null,qi))});return{abort:function(){Z.abort()},forceMinPriority:function(X){r=X,Z&&Z.forceMinPriority(X)}}}}function Tt(u){return"pusherTransport"+(u?"TLS":"NonTLS")}function vd(u){var r=O.getLocalStorage();if(r)try{var c=r[Tt(u)];if(c)return JSON.parse(c)}catch{hs(u)}return null}function bd(u,r,c,b){var w=O.getLocalStorage();if(w)try{w[Tt(u)]=An({timestamp:re.now(),transport:r,latency:c,cacheSkipCount:b})}catch{}}function hs(u){var r=O.getLocalStorage();if(r)try{delete r[Tt(u)]}catch{}}class Gi{constructor(r,{delay:c}){this.strategy=r,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(r,c){var b=this.strategy,w,L=new Ee(this.options.delay,function(){w=b.connect(r,c)});return{abort:function(){L.ensureAborted(),w&&w.abort()},forceMinPriority:function(E){r=E,w&&w.forceMinPriority(E)}}}}class ri{constructor(r,c,b){this.test=r,this.trueBranch=c,this.falseBranch=b}isSupported(){var r=this.test()?this.trueBranch:this.falseBranch;return r.isSupported()}connect(r,c){var b=this.test()?this.trueBranch:this.falseBranch;return b.connect(r,c)}}class fd{constructor(r){this.strategy=r}isSupported(){return this.strategy.isSupported()}connect(r,c){var b=this.strategy.connect(r,function(w,L){L&&b.abort(),c(w,L)});return b}}function li(u){return function(){return u.isSupported()}}var gd=function(u,r,c){var b={};function w(Ss,fc,gc,yc,Cc){var _s=c(u,Ss,fc,gc,yc,Cc);return b[Ss]=_s,_s}var L=Object.assign({},r,{hostNonTLS:u.wsHost+":"+u.wsPort,hostTLS:u.wsHost+":"+u.wssPort,httpPath:u.wsPath}),E=Object.assign({},L,{useTLS:!0}),D=Object.assign({},r,{hostNonTLS:u.httpHost+":"+u.httpPort,hostTLS:u.httpHost+":"+u.httpsPort,httpPath:u.httpPath}),R={loop:!0,timeout:15e3,timeoutLimit:6e4},Z=new us({minPingDelay:1e4,maxPingDelay:u.activityTimeout}),X=new us({lives:2,minPingDelay:1e4,maxPingDelay:u.activityTimeout}),pe=w("ws","ws",3,L,Z),qi=w("wss","ws",3,E,Z),hc=w("sockjs","sockjs",1,D),fs=w("xhr_streaming","xhr_streaming",1,D,X),mc=w("xdr_streaming","xdr_streaming",1,D,X),gs=w("xhr_polling","xhr_polling",1,D),pc=w("xdr_polling","xdr_polling",1,D),ys=new Ln([pe],R),vc=new Ln([qi],R),bc=new Ln([hc],R),Cs=new Ln([new ri(li(fs),fs,mc)],R),ws=new Ln([new ri(li(gs),gs,pc)],R),ks=new Ln([new ri(li(Cs),new Lt([Cs,new Gi(ws,{delay:4e3})]),ws)],R),Dt=new ri(li(ks),ks,bc),Bt;return r.useTLS?Bt=new Lt([ys,new Gi(Dt,{delay:2e3})]):Bt=new Lt([ys,new Gi(vc,{delay:2e3}),new Gi(Dt,{delay:5e3})]),new pd(new fd(new ri(li(pe),Bt,Dt)),b,{ttl:18e5,timeline:r.timeline,useTLS:r.useTLS})},yd=gd,Cd=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(r,c){u.hooks.isInitialized()?(u.changeState("initialized"),c(!0)):(r&&u.onError(r),u.onClose(),c(!1))})):u.onClose()},wd={getRequest:function(u){var r=new window.XDomainRequest;return r.ontimeout=function(){u.emit("error",new A),u.close()},r.onerror=function(c){u.emit("error",c),u.close()},r.onprogress=function(){r.responseText&&r.responseText.length>0&&u.onChunk(200,r.responseText)},r.onload=function(){r.responseText&&r.responseText.length>0&&u.onChunk(200,r.responseText),u.emit("finished",200),u.close()},r},abortRequest:function(u){u.ontimeout=u.onerror=u.onprogress=u.onload=null,u.abort()}},kd=wd;const Sd=256*1024;class _d extends on{constructor(r,c,b){super(),this.hooks=r,this.method=c,this.url=b}start(r){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},O.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(r)}close(){this.unloader&&(O.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(r,c){for(;;){var b=this.advanceBuffer(c);if(b)this.emit("chunk",{status:r,data:b});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(r){var c=r.slice(this.position),b=c.indexOf(`
1470
+ `);return b!==-1?(this.position+=b+1,c.slice(0,b)):null}isBufferTooLong(r){return this.position===r.length&&r.length>Sd}}var Et;(function(u){u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=3]="CLOSED"})(Et||(Et={}));var Tn=Et,Md=1;class Ad{constructor(r,c){this.hooks=r,this.session=ps(1e3)+"/"+Ed(8),this.location=xd(c),this.readyState=Tn.CONNECTING,this.openStream()}send(r){return this.sendRaw(JSON.stringify([r]))}ping(){this.hooks.sendHeartbeat(this)}close(r,c){this.onClose(r,c,!0)}sendRaw(r){if(this.readyState===Tn.OPEN)try{return O.createSocketRequest("POST",ms(Ld(this.location,this.session))).start(r),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(r,c,b){this.closeStream(),this.readyState=Tn.CLOSED,this.onclose&&this.onclose({code:r,reason:c,wasClean:b})}onChunk(r){if(r.status===200){this.readyState===Tn.OPEN&&this.onActivity();var c,b=r.data.slice(0,1);switch(b){case"o":c=JSON.parse(r.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(r.data.slice(1)||"[]");for(var w=0;w<c.length;w++)this.onEvent(c[w]);break;case"m":c=JSON.parse(r.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(r.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(r){this.readyState===Tn.CONNECTING?(r&&r.hostname&&(this.location.base=Td(this.location.base,r.hostname)),this.readyState=Tn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(r){this.readyState===Tn.OPEN&&this.onmessage&&this.onmessage({data:r})}onActivity(){this.onactivity&&this.onactivity()}onError(r){this.onerror&&this.onerror(r)}openStream(){this.stream=O.createSocketRequest("POST",ms(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",r=>{this.onChunk(r)}),this.stream.bind("finished",r=>{this.hooks.onFinished(this,r)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(r){re.defer(()=>{this.onError(r),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function xd(u){var r=/([^\?]*)\/*(\??.*)/.exec(u);return{base:r[1],queryString:r[2]}}function Ld(u,r){return u.base+"/"+r+"/xhr_send"}function ms(u){var r=u.indexOf("?")===-1?"?":"&";return u+r+"t="+ +new Date+"&n="+Md++}function Td(u,r){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(u);return c[1]+r+c[3]}function ps(u){return O.randomInt(u)}function Ed(u){for(var r=[],c=0;c<u;c++)r.push(ps(32).toString(32));return r.join("")}var Pd=Ad,Id={getReceiveURL:function(u,r){return u.base+"/"+r+"/xhr_streaming"+u.queryString},onHeartbeat:function(u){u.sendRaw("[]")},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,r){u.onClose(1006,"Connection interrupted ("+r+")",!1)}},Dd=Id,Bd={getReceiveURL:function(u,r){return u.base+"/"+r+"/xhr"+u.queryString},onHeartbeat:function(){},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,r){r===200?u.reconnect():u.onClose(1006,"Connection interrupted ("+r+")",!1)}},Nd=Bd,Hd={getRequest:function(u){var r=O.getXHRAPI(),c=new r;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText),u.emit("finished",c.status),u.close();break}},c},abortRequest:function(u){u.onreadystatechange=null,u.abort()}},Rd=Hd,Od={createStreamingSocket(u){return this.createSocket(Dd,u)},createPollingSocket(u){return this.createSocket(Nd,u)},createSocket(u,r){return new Pd(u,r)},createXHR(u,r){return this.createRequest(Rd,u,r)},createRequest(u,r,c){return new _d(u,r,c)}},vs=Od;vs.createXDR=function(u,r){return this.createRequest(kd,u,r)};var Ud=vs,Vd={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:a,DependenciesReceivers:p,getDefaultStrategy:yd,Transports:Jl,transportConnectionInitializer:Cd,HTTPFactory:Ud,TimelineTransport:Hl,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(u){window.Pusher=u;var r=()=>{this.onDocumentBody(u.ready)};window.JSON?r():g.load("json2",{},r)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:oe,jsonp:Pl}},onDocumentBody(u){document.body?u():setTimeout(()=>{this.onDocumentBody(u)},0)},createJSONPRequest(u,r){return new Dl(u,r)},createScriptRequest(u){return new Il(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 Yl},createWebSocket(u){var r=this.getWebSocketAPI();return new r(u)},createSocketRequest(u,r){if(this.isXHRSupported())return this.HTTPFactory.createXHR(u,r);if(this.isXDRSupported(r.indexOf("https:")===0))return this.HTTPFactory.createXDR(u,r);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var u=this.getXHRAPI();return!!u&&new u().withCredentials!==void 0},isXDRSupported(u){var r=u?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===r},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)}},O=Vd,Pt;(function(u){u[u.ERROR=3]="ERROR",u[u.INFO=6]="INFO",u[u.DEBUG=7]="DEBUG"})(Pt||(Pt={}));var zi=Pt;class jd{constructor(r,c,b){this.key=r,this.session=c,this.events=[],this.options=b||{},this.sent=0,this.uniqueID=0}log(r,c){r<=this.options.level&&(this.events.push(fe({},c,{timestamp:re.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(r){this.log(zi.ERROR,r)}info(r){this.log(zi.INFO,r)}debug(r){this.log(zi.DEBUG,r)}isEmpty(){return this.events.length===0}send(r,c){var b=fe({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],r(b,(w,L)=>{w||this.sent++,c&&c(w,L)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class Kd{constructor(r,c,b,w){this.name=r,this.priority=c,this.transport=b,this.options=w||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(r,c){if(this.isSupported()){if(this.priority<r)return bs(new _,c)}else return bs(new G,c);var b=!1,w=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),L=null,E=function(){w.unbind("initialized",E),w.connect()},D=function(){L=sn.createHandshake(w,function(pe){b=!0,X(),c(null,pe)})},R=function(pe){X(),c(pe)},Z=function(){X();var pe;pe=An(w),c(new T(pe))},X=function(){w.unbind("initialized",E),w.unbind("open",D),w.unbind("error",R),w.unbind("closed",Z)};return w.bind("initialized",E),w.bind("open",D),w.bind("error",R),w.bind("closed",Z),w.initialize(),{abort:()=>{b||(X(),L?L.close():w.close())},forceMinPriority:pe=>{b||this.priority<pe&&(L?L.close():w.close())}}}}function bs(u,r){return re.defer(function(){r(u)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Fd}=O;var Gd=function(u,r,c,b,w,L){var E=Fd[c];if(!E)throw new K(c);var D=(!u.enabledTransports||Pe(u.enabledTransports,r)!==-1)&&(!u.disabledTransports||Pe(u.disabledTransports,r)===-1),R;return D?(w=Object.assign({ignoreNullOrigin:u.ignoreNullOrigin},w),R=new Kd(r,b,L?L.getAssistant(E):E,w)):R=zd,R},zd={isSupported:function(){return!1},connect:function(u,r){var c=re.defer(function(){r(new G)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function qd(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 Wd=(u,r)=>{var c="socket_id="+encodeURIComponent(u.socketId);for(var b in r.params)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(r.params[b]);if(r.paramsProvider!=null){let w=r.paramsProvider();for(var b in w)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(w[b])}return c};var Zd=u=>{if(typeof O.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(r,c)=>{const b=Wd(r,u);O.getAuthorizers()[u.transport](O,b,u,C.UserAuthentication,c)}};const Jd=(u,r)=>{var c="socket_id="+encodeURIComponent(u.socketId);c+="&channel_name="+encodeURIComponent(u.channelName);for(var b in r.params)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(r.params[b]);if(r.paramsProvider!=null){let w=r.paramsProvider();for(var b in w)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(w[b])}return c};var $d=u=>{if(typeof O.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(r,c)=>{const b=Jd(r,u);O.getAuthorizers()[u.transport](O,b,u,C.ChannelAuthorization,c)}};const Yd=(u,r,c)=>{const b={authTransport:r.transport,authEndpoint:r.endpoint,auth:{params:r.params,headers:r.headers}};return(w,L)=>{const E=u.channel(w.channelName);c(E,b).authorize(w.socketId,L)}};function Qd(u,r){let c={activityTimeout:u.activityTimeout||d.activityTimeout,cluster:u.cluster,httpPath:u.httpPath||d.httpPath,httpPort:u.httpPort||d.httpPort,httpsPort:u.httpsPort||d.httpsPort,pongTimeout:u.pongTimeout||d.pongTimeout,statsHost:u.statsHost||d.stats_host,unavailableTimeout:u.unavailableTimeout||d.unavailableTimeout,wsPath:u.wsPath||d.wsPath,wsPort:u.wsPort||d.wsPort,wssPort:u.wssPort||d.wssPort,enableStats:tc(u),httpHost:Xd(u),useTLS:ic(u),wsHost:ec(u),userAuthenticator:oc(u),channelAuthorizer:ac(u,r)};return"disabledTransports"in u&&(c.disabledTransports=u.disabledTransports),"enabledTransports"in u&&(c.enabledTransports=u.enabledTransports),"ignoreNullOrigin"in u&&(c.ignoreNullOrigin=u.ignoreNullOrigin),"timelineParams"in u&&(c.timelineParams=u.timelineParams),"nacl"in u&&(c.nacl=u.nacl),c}function Xd(u){return u.httpHost?u.httpHost:u.cluster?`sockjs-${u.cluster}.pusher.com`:d.httpHost}function ec(u){return u.wsHost?u.wsHost:nc(u.cluster)}function nc(u){return`ws-${u}.pusher.com`}function ic(u){return O.getProtocol()==="https:"?!0:u.forceTLS!==!1}function tc(u){return"enableStats"in u?u.enableStats:"disableStats"in u?!u.disableStats:!1}function oc(u){const r=Object.assign(Object.assign({},d.userAuthentication),u.userAuthentication);return"customHandler"in r&&r.customHandler!=null?r.customHandler:Zd(r)}function sc(u,r){let c;return"channelAuthorization"in u?c=Object.assign(Object.assign({},d.channelAuthorization),u.channelAuthorization):(c={transport:u.authTransport||d.authTransport,endpoint:u.authEndpoint||d.authEndpoint},"auth"in u&&("params"in u.auth&&(c.params=u.auth.params),"headers"in u.auth&&(c.headers=u.auth.headers)),"authorizer"in u&&(c.customHandler=Yd(r,c,u.authorizer))),c}function ac(u,r){const c=sc(u,r);return"customHandler"in c&&c.customHandler!=null?c.customHandler:$d(c)}class rc extends on{constructor(r){super(function(c,b){se.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=r,this.bindWatchlistInternalEvent()}handleEvent(r){r.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",r=>{var c=r.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(r)})}}function lc(){let u,r;return{promise:new Promise((b,w)=>{u=b,r=w}),resolve:u,reject:r}}var dc=lc;class cc extends on{constructor(r){super(function(c,b){se.debug("No callbacks on user for "+c)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(c,b)=>{if(c){se.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:b.auth,user_data:b.user_data})},this.pusher=r,this.pusher.connection.bind("state_change",({previous:c,current:b})=>{c!=="connected"&&b==="connected"&&this._signin(),c==="connected"&&b!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new rc(r),this.pusher.connection.bind("message",c=>{var b=c.event;b==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(r){try{this.user_data=JSON.parse(r.user_data)}catch{se.error(`Failed parsing user data after signin: ${r.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 r=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new Mt(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,b)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,b)}),r(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:r,resolve:c,reject:b}=dc();r.done=!1;const w=()=>{r.done=!0};r.then(w).catch(w),this.signinDonePromise=r,this._signinDoneResolve=c}}class ye{static ready(){ye.isReady=!0;for(var r=0,c=ye.instances.length;r<c;r++)ye.instances[r].connect()}static getClientFeatures(){return We($({ws:O.Transports.ws},function(r){return r.isSupported({})}))}constructor(r,c){uc(r),qd(c),this.key=r,this.config=Qd(c,this),this.channels=sn.createChannels(),this.global_emitter=new on,this.sessionID=O.randomInt(1e9),this.timeline=new jd(this.key,this.sessionID,{cluster:this.config.cluster,features:ye.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:zi.INFO,version:d.VERSION}),this.config.enableStats&&(this.timelineSender=sn.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+O.TimelineTransport.name}));var b=w=>O.getDefaultStrategy(this.config,w,Gd);this.connection=sn.createConnectionManager(this.key,{getStrategy:b,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,E=L.indexOf("pusher_internal:")===0;if(w.channel){var D=this.channel(w.channel);D&&D.handleEvent(w)}E||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 cc(this),ye.isReady&&this.connect()}channel(r){return this.channels.find(r)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var r=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new tn(6e4,function(){c.send(r)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(r,c,b){return this.global_emitter.bind(r,c,b),this}unbind(r,c,b){return this.global_emitter.unbind(r,c,b),this}bind_global(r){return this.global_emitter.bind_global(r),this}unbind_global(r){return this.global_emitter.unbind_global(r),this}unbind_all(r){return this.global_emitter.unbind_all(),this}subscribeAll(){var r;for(r in this.channels.channels)this.channels.channels.hasOwnProperty(r)&&this.subscribe(r)}subscribe(r){var c=this.channels.add(r,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(r){var c=this.channels.find(r);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(r),c&&c.subscribed&&c.unsubscribe())}send_event(r,c,b){return this.connection.send_event(r,c,b)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}ye.instances=[],ye.isReady=!1,ye.logToConsole=!1,ye.Runtime=O,ye.ScriptReceivers=O.ScriptReceivers,ye.DependenciesReceivers=O.DependenciesReceivers,ye.auth_callbacks=O.auth_callbacks;var It=t.default=ye;function uc(u){if(u==null)throw"You must pass your app key when you instantiate Pusher."}O.setup(ye)}])})})(Yo);var Yr=Yo.exports;const Qr=$r(Yr);class Qo{constructor(e){h(this,"container");h(this,"onAction");h(this,"onFail");h(this,"initialTime");h(this,"timeLeft");h(this,"timerId");h(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("#transfer-bank"),t=this.container.querySelector("#copy-acn"),o=this.container.querySelector("#acn-tooltip"),s=this.container.querySelector("#transfer-amount"),a=this.container.querySelector("#copy-amount"),l=this.container.querySelector("#amount-tooltip"),d=this.container.querySelector("#transfer-button");t&&e&&t.addEventListener("click",()=>{o&&(i&&P.track("copy_transferBank",{payment_method:"Transfer",payment_process:"Payment Started",account_number:e.innerHTML,bank_name:i.innerHTML}),this.copyToClipboard(e.innerHTML,o))}),a&&s&&a.addEventListener("click",()=>{l&&(P.track("copy_transferAmount",{payment_method:"Transfer",amount:s.innerHTML.split(" ")[1].replace(/,/g,"")}),this.copyToClipboard(s.innerHTML.split(" ")[1].replace(/,/g,""),l))}),d&&d.addEventListener("click",()=>{this.onAction(5),P.track("initiate_payment_verification",{payment_method:"Transfer"})})}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=zn(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,k,C,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"),a=this.container.querySelector("#time-left"),l=((g=this.payment)==null?void 0:g.currency)||"USD",d=l==="USD"?(f=this.payment)==null?void 0:f.localCurrency:l;if(i&&(i.innerHTML=`${d} ${xe(this.payment.totalTaxAmount?this.payment.totalLocalAmount:l==="USD"?(y=this.payment)==null?void 0:y.localAmount:(k=this.payment)==null?void 0:k.amount,2)}`),t&&this.payment.bankDetails&&(t.innerHTML=(C=this.payment.bankDetails)==null?void 0:C.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),a&&(a.innerHTML=zn(this.initialTime)),this.startTimer("poll"),e.status==="inProgress"){const M="45654f3ce4c9512ea9a4",A="us2";var v=new Qr(M,{cluster:A}),p=v.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 T=new URL(_.redirectUrl);T.searchParams.append("status",_.status),T.searchParams.append("reference",_.reference),window.location.href=T.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 Jr}}const Xr=`<div id="trasferConfirmationProgress">
1471
+ <div>
1472
+ <div>
1473
+ <div class=" grid grid-rows-[auto_1fr] gap-4 mx-5">
1474
+ <div class="items-center justify-self-center flex flex-col relative ">
1475
+ <svg class="animate-spin" width="40" height="40" viewBox="0 0 64 64" fill="none"
1476
+ xmlns="http://www.w3.org/2000/svg">
1477
+ <path
1478
+ 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"
1479
+ stroke="black" stroke-width="4" stroke-linejoin="round" />
1480
+ </svg>
1481
+ <!-- <div class="relative w-12 h-12">
1482
+ <svg viewBox="0 0 100 100" width="100" height="100" class="h-full w-full">
1483
+ <circle stroke-width="10" stroke="#E6E6E7" stroke-linecap="round" cx="50" cy="50"
1484
+ class="circle-progress-bg" r="40" fill="transparent"></circle>
1485
+ <circle stroke-width="11" stroke="#000000" stroke-linecap="round" cx="50" cy="50" r="40"
1486
+ class="circle-progress" fill="transparent" stroke-dasharray="" stroke-dashoffset=""
1487
+ transform="rotate(-90 50 50)"></circle>
1488
+ </svg>
1489
+
1490
+ </div> -->
1491
+ </div>
1492
+ </div>
1493
+ </div>
1494
+ <div class="text-center w-11/12 md:w-4/5 mx-auto grid gap-4 mb-8">
1495
+ <h5 class="text-center text-sm text-grey-400">
1496
+ We are confirming transaction status.
1497
+ <br>
1498
+ This can take a few minutes.
1499
+ </h5>
1500
+
1501
+ <div>
1502
+ <p class="text-grey-400 text-sm">
1503
+ Please wait for <span id="ctd-timer" class="font-bold"> </span> minutes
1504
+ </p>
1505
+ </div>
1506
+
1507
+ </div>
1508
+
1509
+ <div>
1510
+ <div class="border border-tone-10 rounded-lg text-black px-4 py-4 grid gap-2">
1511
+
1512
+ <div class="grid grid-cols-[1fr_auto] gap-3">
1513
+ <div>
1514
+ <p class="text-xs">Account details</p>
1515
+ </div>
1516
+
1517
+ <div class="align-center gap-2">
1518
+ <p class="font-medium text-xs" id="transfer-acn-pr"></p>
1519
+
1520
+ <button type="button" class="relative group" id="copy-acn-pr">
1521
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
1522
+ <path
1523
+ d="M9.33268 7.52502V9.97502C9.33268 12.0167 8.51602 12.8334 6.47435 12.8334H4.02435C1.98268 12.8334 1.16602 12.0167 1.16602 9.97502V7.52502C1.16602 5.48335 1.98268 4.66669 4.02435 4.66669H6.47435C8.51602 4.66669 9.33268 5.48335 9.33268 7.52502Z"
1524
+ stroke="#0D0716" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
1525
+ <path
1526
+ d="M12.8327 4.02502V6.47502C12.8327 8.51669 12.016 9.33335 9.97435 9.33335H9.33268V7.52502C9.33268 5.48335 8.51602 4.66669 6.47435 4.66669H4.66602V4.02502C4.66602 1.98335 5.48268 1.16669 7.52435 1.16669H9.97435C12.016 1.16669 12.8327 1.98335 12.8327 4.02502Z"
1527
+ stroke="#0D0716" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
1528
+ </svg>
1529
+
1530
+ <div class="tooltip">
1531
+ <div class="tooltip-textbox">
1532
+ <p class="tooltip-text" id="acn-tooltip-pr">Copy</p>
1533
+ </div>
1534
+ </div>
1535
+ </button>
1536
+ </div>
1537
+ </div>
1538
+
1539
+ <div class="grid grid-cols-[1fr_auto] gap-3 text-xxs">
1540
+ <p class="text-xs">Bank name</p>
1541
+ <p class="font-medium text-xs" id="transfer-bank"></p>
1542
+ </div>
1543
+
1544
+ <div class="grid grid-cols-[1fr_auto] gap-3 text-xxs">
1545
+ <p class="text-xs">Beneficiary</p>
1546
+ <p class="font-medium text-xs" id="account-name"></p>
1547
+ </div>
1548
+ </div>
1549
+ </div>
1550
+ </div>
1551
+ </div>`;class el{constructor(e){h(this,"container");h(this,"onAction");h(this,"ref");h(this,"token");h(this,"initialTime",300);h(this,"abortController");h(this,"timeLeft");h(this,"timer");h(this,"timerId",null);h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"payment");h(this,"setPaymentResponses");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses}attachListeners(){const e=this.container.querySelector("#show-acn");e&&e.addEventListener("click",()=>{this.onAction(1),clearTimeout(this.timer)});const i=this.container.querySelector("#transfer-bank"),t=this.container.querySelector("#transfer-acn-pr"),o=this.container.querySelector("#copy-acn-pr"),s=this.container.querySelector("#acn-tooltip-pr");o&&t&&o.addEventListener("click",()=>{P.track("copy_transferBank",{payment_method:"Transfer",payment_process:"Payment Verification",account_number:t.innerHTML,bank_name:i==null?void 0:i.innerHTML}),s&&this.copyToClipboard(t.innerHTML,s)}),this.initialTime=300,this.timeLeft=this.initialTime;const a=3e4;this.abortController=new AbortController,setTimeout(()=>{this.verifyTransfer(this.token,a,({data:l,headers:d})=>{this.onAction(6),this.redirectTo(l,d)})},5e3),this.startTimer()}updateProgressTimerContent(){const i=2*Math.PI*40,o=(this.initialTime-this.timeLeft)/this.initialTime*100/100*i,s=this.container.querySelector(".circle-progress");s&&(s.setAttribute("stroke-dasharray",`${i}`),s.setAttribute("stroke-dashoffset",`${o}`))}async verifyTransfer(e,i,t){let o=0,s=i,a=!0,l;this.abortController&&(l=this.abortController.signal);const d=async()=>{if(this.timeLeft<=0){a=!1,this.onAction(8);return}o+=1;try{const v=await an(e,this.ref,l,this.rdtCode,this.url);v.data.status==="inProgress"?(a&&(s=i*(o+1),this.timer=setTimeout(d,s)),this.setPaymentResponses(v.data,v.headers)):v.data.status==="successful"||v.data.status==="success"?(this.setPaymentResponses(v.data,v.headers),a=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Success"}),t(v)):v.data.status==="failed"&&(this.setPaymentResponses(v.data,v.headers),a=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),this.onAction(7,"Transfer failed"),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Failed"}))}catch{a&&(s=i*(o+1),this.timer=setTimeout(d,s))}};d()}redirectTo(e,i){const t=i.get("spf-redirect-url");this.callBackUrl=t||this.callBackUrl,this.callBackUrl&&setTimeout(()=>{const o=new URL(this.callBackUrl);o.searchParams.append("status",e.status),o.searchParams.append("reference",e.reference),window.location.href=o.toString()},1800)}startTimer(){const e=this.container.querySelector("#ctd-timer");this.stopTimer(),this.timerId=window.setInterval(()=>{this.timeLeft>0?(this.timeLeft-=1,e&&(e.innerHTML=zn(this.timeLeft),this.startTimer()),this.updateProgressTimerContent()):(this.stopTimer(),this.onAction(8))},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}renderTransferDetailsComponent(e){var s,a;e&&(this.payment=e),this.container.innerHTML=this.render();const i=this.container.querySelector("#transfer-bank"),t=this.container.querySelector("#transfer-acn-pr"),o=this.container.querySelector("#account-name");i&&e.bankDetails&&(i.innerHTML=(s=e.bankDetails)==null?void 0:s.bankName),t&&e.bankDetails&&(t.innerHTML=e.bankDetails.accountNumber),o&&e.bankDetails&&(o.innerHTML=(a=e.bankDetails)==null?void 0:a.accountName)}copyToClipboard(e,i){navigator.clipboard.writeText(e).then(()=>{i.innerHTML="Copied!"}).catch(()=>{i.innerHTML="Failed to copy"})}renderComponent(e){this.container.innerHTML=this.render(),this.renderTransferDetailsComponent(e),this.attachListeners()}render(){return Xr}}const nl=`<div id="paymenExpired">
1552
+ <div class="container-center min-h-[30dvh]">
1553
+ <div>
1554
+ <div class="container-center mb-5">
1555
+ <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
1556
+ <path
1557
+ d="M32.5172 9.74998L22.6172 4.03331C21.0005 3.09998 19.0005 3.09998 17.3672 4.03331L7.48385 9.74998C5.86719 10.6833 4.86719 12.4166 4.86719 14.3V25.7C4.86719 27.5666 5.86719 29.3 7.48385 30.25L17.3839 35.9666C19.0005 36.9 21.0005 36.9 22.6339 35.9666L32.5339 30.25C34.1505 29.3166 35.1505 27.5833 35.1505 25.7V14.3C35.1339 12.4166 34.1339 10.7 32.5172 9.74998ZM18.7505 12.9166C18.7505 12.2333 19.3172 11.6666 20.0005 11.6666C20.6839 11.6666 21.2505 12.2333 21.2505 12.9166V21.6666C21.2505 22.35 20.6839 22.9166 20.0005 22.9166C19.3172 22.9166 18.7505 22.35 18.7505 21.6666V12.9166ZM21.5339 27.7166C21.4505 27.9166 21.3339 28.1 21.1839 28.2666C20.8672 28.5833 20.4505 28.75 20.0005 28.75C19.7839 28.75 19.5672 28.7 19.3672 28.6166C19.1505 28.5333 18.9839 28.4166 18.8172 28.2666C18.6672 28.1 18.5505 27.9166 18.4505 27.7166C18.3672 27.5166 18.3339 27.3 18.3339 27.0833C18.3339 26.65 18.5005 26.2166 18.8172 25.9C18.9839 25.75 19.1505 25.6333 19.3672 25.55C19.9839 25.2833 20.7172 25.4333 21.1839 25.9C21.3339 26.0666 21.4505 26.2333 21.5339 26.45C21.6172 26.65 21.6672 26.8666 21.6672 27.0833C21.6672 27.3 21.6172 27.5166 21.5339 27.7166Z"
1558
+ fill="#D62020" />
1559
+ </svg>
1560
+ </div>
1561
+ <h5 class="text-tone-100 font-semibold text-xl text-center mb-1" id="payment-warning-text">
1562
+ Account Expired
1563
+ </h5>
1564
+
1565
+ <p class="w-11/12 mx-auto text-sm text-center">
1566
+ Looks like your account is not valid. Please confirm and try again
1567
+ </p>
1246
1568
 
1247
1569
  <!-- <div class="mt-8 container-center">
1248
1570
  <button type="button" id="payment-expired" class="button-outline w-60">I have made the payment</button>
1249
1571
  </div> -->
1250
1572
  </div>
1251
1573
  </div>
1252
- </div>`;class Xr{constructor(e){h(this,"container");this.container=e.container}attachListeners(){}renderComponent(){this.container.innerHTML=this.render()}render(){return Qr}}class el{constructor({amount:e,totalAmount:i,closeModal:t,container:o,customer:s,token:a,currency:l,rdtCode:d,url:v,reference:p,callBackUrl:g,metadata:f,localCurrency:y,disablePaymentMethods:k,restartTransactionProcess:C,hidePaymentMethods:S,retryingPayment:M}){h(this,"container");h(this,"contents");h(this,"closeModal");h(this,"customer");h(this,"transferDetails");h(this,"transferConfirmationProgress");h(this,"transferConfirmationEnd");h(this,"transferExpired");h(this,"mainLoader");h(this,"warningScreen");h(this,"successScreen");h(this,"merchantPlanDetail",{});h(this,"token");h(this,"currency");h(this,"amount");h(this,"totalAmount");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"_currentStep");h(this,"activeRef");h(this,"paymentResponse");h(this,"timerId");h(this,"abortController",null);h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"transactionIssuesScreen");h(this,"disablePaymentMethods");h(this,"paymentResponseHeaders");h(this,"restartTransactionProcess");h(this,"hidePaymentMethods");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);this.currency=l,this.container=o,this.contents=this.container.querySelector("#payment-content-view"),this.closeModal=t,this.token=a,this.customer=s,this.amount=e,this.totalAmount=i,this.rdtCode=d,this.url=v,this.reference=p,this._currentStep=1,this.callBackUrl=g,this.metadata=f,this.localCurrency=y,this.disablePaymentMethods=k,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=C,this.hidePaymentMethods=S,this.retryingPayment=M,this.isMaxRetriesReached=!1,this.renderTransferContent(),this.paymentResponse={},this.activeRef="",this.timerId=null,this.mainLoader=new Ne(this.contents),this.mainLoader.mountLoader("25dvh"),this.currentStep===1&&(this.abortController=new AbortController,this.createTransfer()),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderTransferContent(),e===1&&this.createTransfer()}attachInputListeners(){const e=this.container.querySelector("#transfer-try-again"),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 an(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 Ne(this.contents),this.mainLoader.mountLoader("25dvh"),i.classList.add("hidden")),P.track("start_payment",{payment_method:"Transfer"}),(()=>{var o,s;if(this.retryingPayment){const a={channel:"bank_transfer",reference:this.reference};return ci(this.token,a,this.rdtCode,this.url)}else{const a={amount:this.amount,channel:"bank_transfer",currency:this.currency,customer:this.customer,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((o=this.merchantPlanDetail)==null?void 0:o.taxQuoteId)&&{taxQuoteId:(s=this.merchantPlanDetail)==null?void 0:s.taxQuoteId}};return Bt(this.token,a,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"),this.warningScreen.hideReportIssue(),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 Jo({container:this.contents,onAction:a=>{this.onSentVerify.bind(this)(a)},onFail:(a,l)=>{this.currentStep=a,a===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(){Ze(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 Jo({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 Xr({container:this.contents}),this.transferExpired.renderComponent();break;case 5:this.transferConfirmationProgress=new Yr({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 qn({container:this.contents,amount:this.totalAmount,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 gn({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 Wo({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 mi({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 $o(){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 Xe extends Error{constructor(e){super(e),this.name="AuthorizationError"}}class Ct{constructor(e){h(this,"token");h(this,"baseurl","https://api.spotflow.co/api/v1");h(this,"headers");h(this,"rdtCode");h(this,"url");h(this,"getHeaders",(e,i)=>{if(!e)throw new Xe("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 Yo extends Ct{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 Xe?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 Xe?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 Xe?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 Xe?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 Xe?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 Xe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class nl extends Ct{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 Xe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class il extends Ct{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?(hi.showToast(e.message,"error",9e3),console.error(`FetchError: ${e.message} (status: ${e.status})`)):e instanceof Xe?console.error(`AuthorizationError: ${e.message}`):console.error(`Unexpected error: ${e}`),e}}}const tl=`<form id="ussdBanks">
1574
+ </div>`;class il{constructor(e){h(this,"container");this.container=e.container}attachListeners(){}renderComponent(){this.container.innerHTML=this.render()}render(){return nl}}class tl{constructor({amount:e,totalAmount:i,closeModal:t,container:o,customer:s,token:a,currency:l,rdtCode:d,url:v,reference:p,callBackUrl:g,metadata:f,localCurrency:y,disablePaymentMethods:k,restartTransactionProcess:C,hidePaymentMethods:S,retryingPayment:M}){h(this,"container");h(this,"contents");h(this,"closeModal");h(this,"customer");h(this,"transferDetails");h(this,"transferConfirmationProgress");h(this,"transferConfirmationEnd");h(this,"transferExpired");h(this,"mainLoader");h(this,"warningScreen");h(this,"successScreen");h(this,"merchantPlanDetail",{});h(this,"token");h(this,"currency");h(this,"amount");h(this,"totalAmount");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"_currentStep");h(this,"activeRef");h(this,"paymentResponse");h(this,"timerId");h(this,"abortController",null);h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"transactionIssuesScreen");h(this,"disablePaymentMethods");h(this,"paymentResponseHeaders");h(this,"restartTransactionProcess");h(this,"hidePaymentMethods");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);this.currency=l,this.container=o,this.contents=this.container.querySelector("#payment-content-view"),this.closeModal=t,this.token=a,this.customer=s,this.amount=e,this.totalAmount=i,this.rdtCode=d,this.url=v,this.reference=p,this._currentStep=1,this.callBackUrl=g,this.metadata=f,this.localCurrency=y,this.disablePaymentMethods=k,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=C,this.hidePaymentMethods=S,this.retryingPayment=M,this.isMaxRetriesReached=!1,this.renderTransferContent(),this.paymentResponse={},this.activeRef="",this.timerId=null,this.mainLoader=new Ne(this.contents),this.mainLoader.mountLoader("25dvh"),this.currentStep===1&&(this.abortController=new AbortController,this.createTransfer()),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderTransferContent(),e===1&&this.createTransfer()}attachInputListeners(){const e=this.container.querySelector("#transfer-try-again"),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 an(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 Ne(this.contents),this.mainLoader.mountLoader("25dvh"),i.classList.add("hidden")),P.track("start_payment",{payment_method:"Transfer"}),(()=>{var o,s;if(this.retryingPayment){const a={channel:"bank_transfer",reference:this.reference};return ci(this.token,a,this.rdtCode,this.url)}else{const a={amount:this.amount,channel:"bank_transfer",currency:this.currency,customer:this.customer,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((o=this.merchantPlanDetail)==null?void 0:o.taxQuoteId)&&{taxQuoteId:(s=this.merchantPlanDetail)==null?void 0:s.taxQuoteId}};return Nt(this.token,a,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"),this.warningScreen.hideReportIssue(),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 Qo({container:this.contents,onAction:a=>{this.onSentVerify.bind(this)(a)},onFail:(a,l)=>{this.currentStep=a,a===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(){Ze(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 Qo({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 il({container:this.contents}),this.transferExpired.renderComponent();break;case 5:this.transferConfirmationProgress=new el({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 qn({container:this.contents,amount:this.totalAmount,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 gn({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 Zo({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,paymentMethod:"Transfer"}),this.transferConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new mi({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 Xo(){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 Xe extends Error{constructor(e){super(e),this.name="AuthorizationError"}}class wt{constructor(e){h(this,"token");h(this,"baseurl","https://api.spotflow.co/api/v1");h(this,"headers");h(this,"rdtCode");h(this,"url");h(this,"getHeaders",(e,i)=>{if(!e)throw new Xe("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 es extends wt{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 Xe?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 Xe?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 Xe?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 Xe?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 Xe?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 Xe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class ol extends wt{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 Xe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class sl extends wt{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?(hi.showToast(e.message,"error",9e3),console.error(`FetchError: ${e.message} (status: ${e.status})`)):e instanceof Xe?console.error(`AuthorizationError: ${e.message}`):console.error(`Unexpected error: ${e}`),e}}}const al=`<form id="ussdBanks">
1253
1575
  <div>
1254
1576
  <h5 class="text-grey-400 font-semibold text-sm">Please choose your bank to begin payment</h5>
1255
1577
  <div class="mt-2">
@@ -1284,7 +1606,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1284
1606
  </div>
1285
1607
  </div>
1286
1608
  </div>
1287
- </form>`;class Qo{constructor(e){h(this,"container");h(this,"bank_service");h(this,"bank_list");h(this,"onAction");h(this,"selectedBank");h(this,"currency");h(this,"localCurrency");h(this,"rate");h(this,"amount");h(this,"totalAmount");this.container=e.container,this.currency=e.currency,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.totalAmount=e.totalAmount,this.bank_list=[],this.bank_service=new il({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 a,l;if(s.stopPropagation(),this.selectedBank={code:e.value,name:((l=(a=this.bank_list.filter(d=>d.code==e.value))==null?void 0:a[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(a=>{a.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");if(i){const t=this.localCurrency?this.localCurrency:this.currency;i.textContent=`Continue to pay ${t} ${xe(this.totalAmount!==this.amount?this.totalAmount:this.amount*(this.rate?this.rate:1),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 tl}}const ol=`<div id="viewCode">
1609
+ </form>`;class ns{constructor(e){h(this,"container");h(this,"bank_service");h(this,"bank_list");h(this,"onAction");h(this,"selectedBank");h(this,"currency");h(this,"localCurrency");h(this,"rate");h(this,"amount");h(this,"totalAmount");this.container=e.container,this.currency=e.currency,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.totalAmount=e.totalAmount,this.bank_list=[],this.bank_service=new sl({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 a,l;if(s.stopPropagation(),this.selectedBank={code:e.value,name:((l=(a=this.bank_list.filter(d=>d.code==e.value))==null?void 0:a[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(a=>{a.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");if(i){const t=this.localCurrency?this.localCurrency:this.currency;i.textContent=`Continue to pay ${t} ${xe(this.totalAmount!==this.amount?this.totalAmount:this.amount*(this.rate?this.rate:1),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 al}}const rl=`<div id="viewCode">
1288
1610
  <div class="grid gap-4">
1289
1611
  <div class="text-center">
1290
1612
  <div class="md:w-4/5 mx-auto grid gap-3">
@@ -1321,7 +1643,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1321
1643
  payment</button>
1322
1644
  </div>
1323
1645
  </div>
1324
- </div>`;class sl{constructor(e){h(this,"container");h(this,"selected");h(this,"secret");h(this,"onAction");h(this,"paymentService");h(this,"currency");h(this,"amount");h(this,"ussd_detail");h(this,"reference");h(this,"customer");h(this,"activeRef","");h(this,"pageLoader");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"onError");this.container=e.container,this.selected=e.selected,this.onAction=e.onAction,this.secret=e.secret,this.paymentService=new Yo({token:this.secret,rdtCode:e.rdtCode,url:e.url}),this.currency=e.currency,this.amount=e.amount||0,this.customer=e.customer,this.reference=e.reference,this.callBackUrl=e.callBackUrl,this.metadata=e.metadata,this.localCurrency=e.localCurrency,this.onError=e.onError??(()=>null),this.pageLoader=new Ne(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:this.customer,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 a=new URL(this.callBackUrl);a.searchParams.append("status",i.status),a.searchParams.append("reference",i.reference),window.location.href=a.toString()},1800);return}else if(i.status!=="success")if(i.ussd){this.container.innerHTML=this.render();const s=this.container.querySelectorAll(".bank-dial-code"),a=this.container.querySelector("#bank-dial-code");a&&(a.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(v=>{var p;v.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(a=>{a.addEventListener("click",l=>{var d;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((d=this.ussd_detail)==null?void 0:d.code)||"")})}),Array.from(i).forEach(a=>{a.addEventListener("click",l=>{var d;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((d=this.ussd_detail)==null?void 0:d.code)||"")})}),t&&t.addEventListener("click",a=>{a.preventDefault(),this.onAction(this.selected,this.activeRef)})}renderComponent(){this.makePayment(),this.attachListener()}render(){return ol}}var al=Object.defineProperty,rl=(n,e,i,t)=>{for(var o=void 0,s=n.length-1,a;s>=0;s--)(a=n[s])&&(o=a(e,i,o)||o);return o&&al(e,i,o),o};class Xo{constructor({container:e,onSuccess:i,secret:t,amount:o,totalAmount:s,currency:a,customer:l,reference:d,rdtCode:v,url:p,callBackUrl:g,metadata:f,localCurrency:y,hidePaymentMethods:k,showPaymentMethods:C,disablePaymentMethods:S}){h(this,"contents");h(this,"selectedCode");h(this,"secret");h(this,"amount");h(this,"totalAmount");h(this,"currency");h(this,"customer");h(this,"pageLoader");h(this,"reference");h(this,"onSuccess");h(this,"warningScreen");h(this,"bankDetail");h(this,"viewUssdCode");h(this,"_currentStep");h(this,"container");h(this,"paymentService");h(this,"successScreen");h(this,"activeRef","");h(this,"abortController");h(this,"_retry_count",10);h(this,"intervalPayment");h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"merchantDetails");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"disablePaymentMethods");this.onSuccess=i||(()=>null),this.container=e,this.secret=t,this.amount=o,this.totalAmount=s,this.currency=a,this.reference=d,this.customer=l,this.rdtCode=v,this.url=p,this.callBackUrl=g,this.metadata=f,this.localCurrency=y,this.merchantDetails={},this.hidePaymentMethods=k,this.showPaymentMethods=C,this.disablePaymentMethods=S,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.paymentService=new Yo({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;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,totalAmount:this.totalAmount}),this.bankDetail.renderContent();break;case 2:this.viewUssdCode=new sl({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,totalAmount:this.totalAmount,currency:this.currency,customer:this.customer,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=Rt,this.warningScreen=new gn({container:this.contents});break;case 4:this.pageLoader=new Ne(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 qn({container:this.contents,amount:this.totalAmount,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,totalAmount:this.totalAmount}),this.bankDetail.renderContent();break}}handleSelectChange(e){setTimeout(()=>{this.currentStep=2},400),this.currentStep=2}}rl([$o(),$o()],Xo.prototype,"selectedCode");const ll={NGN:"Nigerian Naira",USD:"US Dollar",GHS:"Ghanaian Cedi",GBP:"Pounds",ZAF:"South African Rand",USDT:"Tether",KSH:"Kenyan Shilling"},dl=n=>n==null?void 0:n.replace(/_/g," ");function cl(n){return n.split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}const Ri=n=>{if(n){const e=dl(n);return cl(e)}return""},ul=`<div>
1646
+ </div>`;class ll{constructor(e){h(this,"container");h(this,"selected");h(this,"secret");h(this,"onAction");h(this,"paymentService");h(this,"currency");h(this,"amount");h(this,"ussd_detail");h(this,"reference");h(this,"customer");h(this,"activeRef","");h(this,"pageLoader");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"onError");this.container=e.container,this.selected=e.selected,this.onAction=e.onAction,this.secret=e.secret,this.paymentService=new es({token:this.secret,rdtCode:e.rdtCode,url:e.url}),this.currency=e.currency,this.amount=e.amount||0,this.customer=e.customer,this.reference=e.reference,this.callBackUrl=e.callBackUrl,this.metadata=e.metadata,this.localCurrency=e.localCurrency,this.onError=e.onError??(()=>null),this.pageLoader=new Ne(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:this.customer,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 a=new URL(this.callBackUrl);a.searchParams.append("status",i.status),a.searchParams.append("reference",i.reference),window.location.href=a.toString()},1800);return}else if(i.status!=="success")if(i.ussd){this.container.innerHTML=this.render();const s=this.container.querySelectorAll(".bank-dial-code"),a=this.container.querySelector("#bank-dial-code");a&&(a.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(v=>{var p;v.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(a=>{a.addEventListener("click",l=>{var d;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((d=this.ussd_detail)==null?void 0:d.code)||"")})}),Array.from(i).forEach(a=>{a.addEventListener("click",l=>{var d;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((d=this.ussd_detail)==null?void 0:d.code)||"")})}),t&&t.addEventListener("click",a=>{a.preventDefault(),this.onAction(this.selected,this.activeRef)})}renderComponent(){this.makePayment(),this.attachListener()}render(){return rl}}var dl=Object.defineProperty,cl=(n,e,i,t)=>{for(var o=void 0,s=n.length-1,a;s>=0;s--)(a=n[s])&&(o=a(e,i,o)||o);return o&&dl(e,i,o),o};class is{constructor({container:e,onSuccess:i,secret:t,amount:o,totalAmount:s,currency:a,customer:l,reference:d,rdtCode:v,url:p,callBackUrl:g,metadata:f,localCurrency:y,hidePaymentMethods:k,showPaymentMethods:C,disablePaymentMethods:S}){h(this,"contents");h(this,"selectedCode");h(this,"secret");h(this,"amount");h(this,"totalAmount");h(this,"currency");h(this,"customer");h(this,"pageLoader");h(this,"reference");h(this,"onSuccess");h(this,"warningScreen");h(this,"bankDetail");h(this,"viewUssdCode");h(this,"_currentStep");h(this,"container");h(this,"paymentService");h(this,"successScreen");h(this,"activeRef","");h(this,"abortController");h(this,"_retry_count",10);h(this,"intervalPayment");h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"merchantDetails");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"disablePaymentMethods");this.onSuccess=i||(()=>null),this.container=e,this.secret=t,this.amount=o,this.totalAmount=s,this.currency=a,this.reference=d,this.customer=l,this.rdtCode=v,this.url=p,this.callBackUrl=g,this.metadata=f,this.localCurrency=y,this.merchantDetails={},this.hidePaymentMethods=k,this.showPaymentMethods=C,this.disablePaymentMethods=S,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.paymentService=new es({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;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 ns({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,totalAmount:this.totalAmount}),this.bankDetail.renderContent();break;case 2:this.viewUssdCode=new ll({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,totalAmount:this.totalAmount,currency:this.currency,customer:this.customer,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=Ot,this.warningScreen=new gn({container:this.contents});break;case 4:this.pageLoader=new Ne(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 qn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(i=this.merchantDetails)==null?void 0:i.rate.rate}),this.successScreen.renderComponent();break;default:this.bankDetail=new ns({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,totalAmount:this.totalAmount}),this.bankDetail.renderContent();break}}handleSelectChange(e){setTimeout(()=>{this.currentStep=2},400),this.currentStep=2}}cl([Xo(),Xo()],is.prototype,"selectedCode");const ul={NGN:"Nigerian Naira",USD:"US Dollar",GHS:"Ghanaian Cedi",GBP:"Pounds",ZAF:"South African Rand",USDT:"Tether",KSH:"Kenyan Shilling"},hl=n=>n==null?void 0:n.replace(/_/g," ");function ml(n){return n.split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}const Oi=n=>{if(n){const e=hl(n);return ml(e)}return""},pl=`<div>
1325
1647
  <button id="go-back" class="md:hidden" aria-label="Go back">
1326
1648
  </button>
1327
1649
  </div>
@@ -1457,7 +1779,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1457
1779
 
1458
1780
  <!-- Tab options -->
1459
1781
  </div>
1460
- </div>`;class hl{constructor(e){h(this,"container");h(this,"email");h(this,"amount",0);h(this,"metadata");h(this,"currency");h(this,"localCurrency");h(this,"merchantDetail");h(this,"onAction");h(this,"isMobile");h(this,"onClose");h(this,"currentPaymentMethod");this.container=e.container,this.email=e.email,this.amount=e.amount||0,this.metadata=e.metadata,this.currency=e.currency,this.localCurrency=e.localCurrency,this.merchantDetail=e.merchantDetail,this.onAction=e.onAction,this.isMobile=e.isMobile,this.onClose=e.onClose,this.currentPaymentMethod=e.currentPaymentMethod}attachListeners(){const e=this.container.querySelectorAll(".tab-button");Array.from(e).forEach(s=>{const a=s.dataset.name||"",l=s.querySelector(".tab-button-icon"),d=s.querySelector(".tab-button-label");l&&(l.innerHTML=be[a].icon),d&&(d.textContent=be[a].label),s.addEventListener("click",v=>{v.preventDefault(),this.onAction(a)})});const t=this.container.querySelector("#close-btn");t&&t.addEventListener("click",()=>{this.onClose(!0)});const o=document.getElementById("go-back");o==null||o.addEventListener("click",()=>{this.onAction("")})}renderComponent(){var G,V,F,oe,ge,U,_e,ue,Te,Me,en,vn,nn,_n,bn,Ee,tn,Mn,re,fe,Re,Pe,we,We,B,he,Q,me,Ie,$,fn,si,Oi,Vi,Ui,ji,An;this.container.innerHTML=this.render(),this.amount=this.amount;const e=this.container.querySelector("#merchant-logo-container"),i=this.container.querySelector("#merchant-logo"),t=this.container.querySelector("#merchant-email"),o=this.container.querySelector("#merchant-email-mob"),s=this.container.querySelector("#plan-name"),a=this.container.querySelector("#plan-name-mob"),l=this.container.querySelector("#payment-fees"),d=this.container.querySelector("#currency-cursor"),v=this.container.querySelector("#currency-cursor-mob"),p=this.container.querySelector("#payment-rate-display"),g=this.container.querySelector("#payment-rate-display-mob"),f=this.container.querySelector("#designated-rate"),y=this.container.querySelector("#designated-rate-mob"),k=this.container.querySelector("#designated-rate-no-plan"),C=this.container.querySelector("#source-rate"),S=this.container.querySelector("#source-rate-mob"),M=this.container.querySelector("#tax-rate"),A=this.container.querySelector("#tax-rate-mob"),_=this.container.querySelector("#tooltip-localCurrency"),T=this.container.querySelector("#tooltip-localCurrency-mob");if((G=this.merchantDetail)!=null&&G.merchantLogo?i&&i.setAttribute("src",(V=this.merchantDetail)==null?void 0:V.merchantLogo):e&&(i==null||i.remove(),e.innerHTML=`<div class="font-semibold text-tone-100 rounded-2xl w-8 h-8 bg-tone-10 container-center uppercase">${this.merchantDetail.merchantName[0]}</div>`),t&&(t.innerHTML=this.email),o&&(o.innerHTML=this.email),s){if((oe=(F=this.merchantDetail)==null?void 0:F.plan)!=null&&oe.title){const ai=((U=(ge=this.merchantDetail)==null?void 0:ge.plan)==null?void 0:U.title)||"";s.textContent=Ri(ai)}(_e=this.metadata)!=null&&_e.productName&&(s.textContent=Ri(this.metadata.productName))}if(a){if((Te=(ue=this.merchantDetail)==null?void 0:ue.plan)!=null&&Te.title){const ai=((en=(Me=this.merchantDetail)==null?void 0:Me.plan)==null?void 0:en.title)||"";a.textContent=Ri(ai)}(vn=this.metadata)!=null&&vn.productName&&(a.textContent=Ri(this.metadata.productName))}d&&(this.currency==="USD"?p&&(p.innerHTML=`1 ${((_n=(nn=this.merchantDetail)==null?void 0:nn.rate)==null?void 0:_n.to)||"-"} = ${((Ee=(bn=this.merchantDetail)==null?void 0:bn.rate)==null?void 0:Ee.from)||"-"} ${xe(((tn=this.merchantDetail.rate)==null?void 0:tn.rate)||1,2)} `):d.innerHTML=""),v&&(this.currency==="USD"?g&&(g.innerHTML=`1 ${((re=(Mn=this.merchantDetail)==null?void 0:Mn.rate)==null?void 0:re.to)||"-"} = ${((Re=(fe=this.merchantDetail)==null?void 0:fe.rate)==null?void 0:Re.from)||"-"} ${xe(((Pe=this.merchantDetail.rate)==null?void 0:Pe.rate)||1,2)} `):v.innerHTML=""),(We=(we=this.merchantDetail)==null?void 0:we.plan)!=null&&We.title||(B=this.metadata)!=null&&B.productName?f&&(f.innerHTML=`${this.currency} ${xe(this.amount,2)}`):(k&&(k.innerHTML=`<span> ${this.currency} ${xe(this.amount,2)} </span>`),s&&a&&(s.remove(),a==null||a.remove()),this.localCurrency?f==null||f.remove():l&&l.remove()),y&&(y.innerHTML=`${this.currency} ${xe(this.amount,2)}`),C&&(this.localCurrency&&this.localCurrency!==this.currency?C.children[1].innerHTML=`${this.localCurrency} ${xe(this.amount*(((Q=(he=this.merchantDetail)==null?void 0:he.rate)==null?void 0:Q.rate)||1),2)}`:C.remove()),S&&(this.localCurrency&&this.localCurrency!==this.currency?S.children[1].innerHTML=`${this.localCurrency} ${xe(this.amount*(((Ie=(me=this.merchantDetail)==null?void 0:me.rate)==null?void 0:Ie.rate)||1),2)}`:S.remove());const I=this.localCurrency!==this.currency?this.amount*(((fn=($=this.merchantDetail)==null?void 0:$.rate)==null?void 0:fn.rate)||1):this.amount;M&&(si=this.merchantDetail)!=null&&si.taxQuoteId&&(Oi=this.merchantDetail)!=null&&Oi.totalAmount&&(M.classList.remove("hidden"),M.children[1].innerHTML=`${this.localCurrency!==this.currency?this.localCurrency:this.currency} ${xe(((Vi=this.merchantDetail)==null?void 0:Vi.totalAmount)-I,2)}`),A&&(Ui=this.merchantDetail)!=null&&Ui.taxQuoteId&&(ji=this.merchantDetail)!=null&&ji.totalAmount&&(A.classList.remove("hidden"),A.children[1].innerHTML=`${this.localCurrency!==this.currency?this.localCurrency:this.currency} ${xe(((An=this.merchantDetail)==null?void 0:An.totalAmount)-I,2)}`);const K=ll[this.localCurrency];_&&this.localCurrency&&(_.innerHTML=K?`${K} (${this.localCurrency})`:this.localCurrency),T&&this.localCurrency&&(T.innerHTML=K?`${K} (${this.localCurrency})`:this.localCurrency),this.renderPaymentOptions(this.container),this.attachListeners()}renderPaymentOptions(e){const i=e.querySelector(".payment-options"),t=this.localCurrency!==this.currency?this.localCurrency:this.currency;if(i){const o=this.merchantDetail.plan?[be.card]:this.merchantDetail.paymentMethods.filter(s=>s!=="ussd").map(s=>be[s]);if(this.isMobile){let s='<div class="">';o.forEach(a=>{s+=`
1782
+ </div>`;class vl{constructor(e){h(this,"container");h(this,"email");h(this,"amount",0);h(this,"metadata");h(this,"currency");h(this,"localCurrency");h(this,"merchantDetail");h(this,"onAction");h(this,"isMobile");h(this,"onClose");h(this,"currentPaymentMethod");this.container=e.container,this.email=e.email,this.amount=e.amount||0,this.metadata=e.metadata,this.currency=e.currency,this.localCurrency=e.localCurrency,this.merchantDetail=e.merchantDetail,this.onAction=e.onAction,this.isMobile=e.isMobile,this.onClose=e.onClose,this.currentPaymentMethod=e.currentPaymentMethod}attachListeners(){const e=this.container.querySelectorAll(".tab-button");Array.from(e).forEach(s=>{const a=s.dataset.name||"",l=s.querySelector(".tab-button-icon"),d=s.querySelector(".tab-button-label");l&&(l.innerHTML=be[a].icon),d&&(d.textContent=be[a].label),s.addEventListener("click",v=>{v.preventDefault(),this.onAction(a)})});const t=this.container.querySelector("#close-btn");t&&t.addEventListener("click",()=>{this.onClose(!0)});const o=document.getElementById("go-back");o==null||o.addEventListener("click",()=>{this.onAction("")})}renderComponent(){var G,U,F,oe,ge,V,_e,ue,Te,Me,en,vn,nn,_n,bn,Ee,tn,Mn,re,fe,Re,Pe,we,We,B,he,Q,me,Ie,$,fn,si,Ui,Vi,ji,Ki,An;this.container.innerHTML=this.render(),this.amount=this.amount;const e=this.container.querySelector("#merchant-logo-container"),i=this.container.querySelector("#merchant-logo"),t=this.container.querySelector("#merchant-email"),o=this.container.querySelector("#merchant-email-mob"),s=this.container.querySelector("#plan-name"),a=this.container.querySelector("#plan-name-mob"),l=this.container.querySelector("#payment-fees"),d=this.container.querySelector("#currency-cursor"),v=this.container.querySelector("#currency-cursor-mob"),p=this.container.querySelector("#payment-rate-display"),g=this.container.querySelector("#payment-rate-display-mob"),f=this.container.querySelector("#designated-rate"),y=this.container.querySelector("#designated-rate-mob"),k=this.container.querySelector("#designated-rate-no-plan"),C=this.container.querySelector("#source-rate"),S=this.container.querySelector("#source-rate-mob"),M=this.container.querySelector("#tax-rate"),A=this.container.querySelector("#tax-rate-mob"),_=this.container.querySelector("#tooltip-localCurrency"),T=this.container.querySelector("#tooltip-localCurrency-mob");if((G=this.merchantDetail)!=null&&G.merchantLogo?i&&i.setAttribute("src",(U=this.merchantDetail)==null?void 0:U.merchantLogo):e&&(i==null||i.remove(),e.innerHTML=`<div class="font-semibold text-tone-100 rounded-2xl w-8 h-8 bg-tone-10 container-center uppercase">${this.merchantDetail.merchantName[0]}</div>`),t&&(t.innerHTML=this.email),o&&(o.innerHTML=this.email),s){if((oe=(F=this.merchantDetail)==null?void 0:F.plan)!=null&&oe.title){const ai=((V=(ge=this.merchantDetail)==null?void 0:ge.plan)==null?void 0:V.title)||"";s.textContent=Oi(ai)}(_e=this.metadata)!=null&&_e.productName&&(s.textContent=Oi(this.metadata.productName))}if(a){if((Te=(ue=this.merchantDetail)==null?void 0:ue.plan)!=null&&Te.title){const ai=((en=(Me=this.merchantDetail)==null?void 0:Me.plan)==null?void 0:en.title)||"";a.textContent=Oi(ai)}(vn=this.metadata)!=null&&vn.productName&&(a.textContent=Oi(this.metadata.productName))}d&&(this.currency==="USD"?p&&(p.innerHTML=`1 ${((_n=(nn=this.merchantDetail)==null?void 0:nn.rate)==null?void 0:_n.to)||"-"} = ${((Ee=(bn=this.merchantDetail)==null?void 0:bn.rate)==null?void 0:Ee.from)||"-"} ${xe(((tn=this.merchantDetail.rate)==null?void 0:tn.rate)||1,2)} `):d.innerHTML=""),v&&(this.currency==="USD"?g&&(g.innerHTML=`1 ${((re=(Mn=this.merchantDetail)==null?void 0:Mn.rate)==null?void 0:re.to)||"-"} = ${((Re=(fe=this.merchantDetail)==null?void 0:fe.rate)==null?void 0:Re.from)||"-"} ${xe(((Pe=this.merchantDetail.rate)==null?void 0:Pe.rate)||1,2)} `):v.innerHTML=""),(We=(we=this.merchantDetail)==null?void 0:we.plan)!=null&&We.title||(B=this.metadata)!=null&&B.productName?f&&(f.innerHTML=`${this.currency} ${xe(this.amount,2)}`):(k&&(k.innerHTML=`<span> ${this.currency} ${xe(this.amount,2)} </span>`),s&&a&&(s.remove(),a==null||a.remove()),this.localCurrency?f==null||f.remove():l&&l.remove()),y&&(y.innerHTML=`${this.currency} ${xe(this.amount,2)}`),C&&(this.localCurrency&&this.localCurrency!==this.currency?C.children[1].innerHTML=`${this.localCurrency} ${xe(this.amount*(((Q=(he=this.merchantDetail)==null?void 0:he.rate)==null?void 0:Q.rate)||1),2)}`:C.remove()),S&&(this.localCurrency&&this.localCurrency!==this.currency?S.children[1].innerHTML=`${this.localCurrency} ${xe(this.amount*(((Ie=(me=this.merchantDetail)==null?void 0:me.rate)==null?void 0:Ie.rate)||1),2)}`:S.remove());const I=this.localCurrency!==this.currency?this.amount*(((fn=($=this.merchantDetail)==null?void 0:$.rate)==null?void 0:fn.rate)||1):this.amount;M&&(si=this.merchantDetail)!=null&&si.taxQuoteId&&(Ui=this.merchantDetail)!=null&&Ui.totalAmount&&(M.classList.remove("hidden"),M.children[1].innerHTML=`${this.localCurrency!==this.currency?this.localCurrency:this.currency} ${xe(((Vi=this.merchantDetail)==null?void 0:Vi.totalAmount)-I,2)}`),A&&(ji=this.merchantDetail)!=null&&ji.taxQuoteId&&(Ki=this.merchantDetail)!=null&&Ki.totalAmount&&(A.classList.remove("hidden"),A.children[1].innerHTML=`${this.localCurrency!==this.currency?this.localCurrency:this.currency} ${xe(((An=this.merchantDetail)==null?void 0:An.totalAmount)-I,2)}`);const K=ul[this.localCurrency];_&&this.localCurrency&&(_.innerHTML=K?`${K} (${this.localCurrency})`:this.localCurrency),T&&this.localCurrency&&(T.innerHTML=K?`${K} (${this.localCurrency})`:this.localCurrency),this.renderPaymentOptions(this.container),this.attachListeners()}renderPaymentOptions(e){const i=e.querySelector(".payment-options"),t=this.localCurrency!==this.currency?this.localCurrency:this.currency;if(i){const o=this.merchantDetail.plan?[be.card]:this.merchantDetail.paymentMethods.filter(s=>s!=="ussd").map(s=>be[s]);if(this.isMobile){let s='<div class="">';o.forEach(a=>{s+=`
1461
1783
  <div key=${a.key}>
1462
1784
  <button class="tab-button gap-2 mb-4 group" data-name="${a.key}">
1463
1785
  <div class="lg:block">${a.icon}</div>
@@ -1497,329 +1819,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1497
1819
  </div>
1498
1820
  </button>
1499
1821
  </div>
1500
- `;a+="</div>"}a+="</div>"}a+="</div>",i.innerHTML=a}}}render(){return ul}}const ml=`<div class="flex items-center justify-center md:justify-between w-full text-xxs mt-5">
1501
- <div class="text-tone-60"><span>Powered by</span> <span class="font-bold">Spotflow</span></div>
1502
- <div class="align-center text-tone-60 hidden md:flex gap-4">
1503
- <span id="test-cards-link" class="hover:font-bold">Test Cards</span>
1504
- <a href="https://ribbon-scowl-35f.notion.site/Terms-Conditions-940742f0a1b144498ffc1786c5bc6a08?pvs=4" target="_blank" class="hover:font-bold">Terms</a>
1505
- <a href="https://ribbon-scowl-35f.notion.site/Privacy-Policy-Spotflow-3997ee8d923d4cd39a3dc43b7249b713" target="_blank" class="hover:font-bold">Privacy</a>
1506
- <a href="mailto:hello@spotflow.one" class="hover:font-bold">Contact</a>
1507
- </div>
1508
- </div>`,pl=`<div class="box-container flex-1">
1509
- <!-- test-cards.html -->
1510
- <div class="bg-gray-100 py-2 px-4 rounded-lg mt-4 relative">
1511
- <div class="flex items-start gap-4 mb-4">
1512
- <nav id="test-card-tabs"
1513
- class="flex w-full font-medium items-start gap-6 border-b border-tone-10 text-base text-tone-40 mb-2">
1514
- <button class="tab-btn active-tab" data-target="no-auth">No auth</button>
1515
- <button class="tab-btn" data-target="pin">Pin</button>
1516
- <button class="tab-btn" data-target="pin-otp">Pin + OTP</button>
1517
- <button class="tab-btn" data-target="3ds">3DS</button>
1518
- <button class="tab-btn" data-target="avs">AVS</button>
1519
- </nav>
1520
- <!-- Close Icon -->
1521
- <button id="close-test-card" class="text-gray-500 hover:text-black">
1522
-
1523
- </button>
1524
- </div>
1525
-
1526
- <!-- Section contents -->
1527
- <div id="no-auth" class="tab-content grid gap-3 border border-tone-50 px-6 py-4 rounded-2xl mb-4">
1528
- <div class="flex justify-between items-center">
1529
- <span class="text-tone-60 font-medium text-sm">Number</span>
1530
- <div class="flex items-center gap-1">
1531
- <span data-copy-value="4111112000062555" class="text-tone-100 text-sm font-medium">4111112000062555</span>
1532
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1533
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1534
- <path
1535
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1536
- fill="#0D0716" />
1537
- </svg>
1538
- </button>
1539
- </div>
1540
- </div>
1541
- <div class="flex justify-between items-center">
1542
- <span class="text-tone-60 font-medium text-sm">Expiry</span>
1543
- <div class="flex items-center gap-1">
1544
- <span data-copy-value="12/2030" class="text-tone-100 text-sm font-medium">12/2030 </span>
1545
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1546
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1547
- <path
1548
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1549
- fill="#0D0716" />
1550
- </svg>
1551
- </button>
1552
- </div>
1553
- </div>
1554
- <div class="flex justify-between items-center">
1555
- <span class="text-tone-60 font-medium text-sm">CVV</span>
1556
- <div class="flex items-center gap-1">
1557
- <span data-copy-value="455" class="text-tone-100 text-sm font-medium">455 </span>
1558
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1559
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1560
- <path
1561
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1562
- fill="#0D0716" />
1563
- </svg>
1564
- </button>
1565
- </div>
1566
- </div>
1567
- </div>
1568
-
1569
- <!-- Pin -->
1570
- <div id="pin" class="hidden tab-content">
1571
- <div class=" grid gap-3 border border-tone-50 px-6 py-4 rounded-2xl mb-4">
1572
- <div class="flex justify-between items-center">
1573
- <span class="text-tone-60 font-medium text-sm">Number</span>
1574
- <div class="flex items-center gap-1">
1575
- <span data-copy-value="5555558684543932"
1576
- class="text-tone-100 text-sm font-medium">5555558684543932 </span>
1577
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1578
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1579
- xmlns="http://www.w3.org/2000/svg">
1580
- <path
1581
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1582
- fill="#0D0716" />
1583
- </svg>
1584
- </button>
1585
- </div>
1586
- </div>
1587
-
1588
- <div class="flex justify-between items-center">
1589
- <span class="text-tone-60 font-medium text-sm">Expiry</span>
1590
- <div class="flex items-center gap-1">
1591
- <span data-copy-value="12/2030" class="text-tone-100 text-sm font-medium">12/2030</span>
1592
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1593
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1594
- xmlns="http://www.w3.org/2000/svg">
1595
- <path
1596
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1597
- fill="#0D0716" />
1598
- </svg>
1599
- </button>
1600
- </div>
1601
- </div>
1602
- <div class="flex justify-between items-center">
1603
- <span class="text-tone-60 font-medium text-sm">CVV</span>
1604
- <div class="flex items-center gap-1">
1605
- <span data-copy-value="321" class="text-tone-100 text-sm font-medium">321</span>
1606
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1607
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1608
- xmlns="http://www.w3.org/2000/svg">
1609
- <path
1610
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1611
- fill="#0D0716" />
1612
- </svg>
1613
- </button>
1614
- </div>
1615
- </div>
1616
- <div class="flex justify-between items-center">
1617
- <span class="text-tone-60 font-medium text-sm">Pin</span>
1618
- <div class="flex items-center gap-1">
1619
- <span data-copy-value="4321" class="text-tone-100 text-sm font-medium">4321</span>
1620
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1621
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1622
- xmlns="http://www.w3.org/2000/svg">
1623
- <path
1624
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1625
- fill="#0D0716" />
1626
- </svg>
1627
- </button>
1628
- </div>
1629
- </div>
1630
- </div>
1631
- </div>
1632
-
1633
- <!-- Pin + OTP -->
1634
- <div id="pin-otp" class="tab-content hidden">
1635
- <div class=" grid gap-3 border border-tone-50 px-6 py-4 rounded-2xl mb-4">
1636
- <div class="flex justify-between items-center">
1637
- <span class="text-tone-60 font-medium text-sm">Number</span>
1638
- <div class="flex items-center gap-1">
1639
- <span data-copy-value="5555567973581842" class="text-tone-100 text-sm font-medium">5555567973581842</span>
1640
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1641
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1642
- xmlns="http://www.w3.org/2000/svg">
1643
- <path
1644
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1645
- fill="#0D0716" />
1646
- </svg>
1647
- </button>
1648
- </div>
1649
- </div>
1650
- <div class="flex justify-between items-center">
1651
- <span class="text-tone-60 font-medium text-sm">Expiry</span>
1652
- <div class="flex items-center gap-1">
1653
- <span data-copy-value="12/2030" class="text-tone-100 text-sm font-medium">12/2030</span>
1654
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1655
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1656
- xmlns="http://www.w3.org/2000/svg">
1657
- <path
1658
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1659
- fill="#0D0716" />
1660
- </svg>
1661
- </button>
1662
- </div>
1663
- </div>
1664
- <div class="flex justify-between items-center">
1665
- <span class="text-tone-60 font-medium text-sm">CVV</span>
1666
- <div class="flex items-center gap-1">
1667
- <span data-copy-value="321" class="text-tone-100 text-sm font-medium">321</span>
1668
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1669
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1670
- xmlns="http://www.w3.org/2000/svg">
1671
- <path
1672
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1673
- fill="#0D0716" />
1674
- </svg>
1675
- </button>
1676
- </div>
1677
- </div>
1678
- <div class="flex justify-between items-center">
1679
- <span class="text-tone-60 font-medium text-sm">Pin</span>
1680
- <div class="flex items-center gap-1">
1681
- <span data-copy-value="4321" class="text-tone-100 text-sm font-medium">4321</span>
1682
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1683
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1684
- xmlns="http://www.w3.org/2000/svg">
1685
- <path
1686
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1687
- fill="#0D0716" />
1688
- </svg>
1689
- </button>
1690
- </div>
1691
- </div>
1692
- <div class="flex justify-between items-center">
1693
- <span class="text-tone-60 font-medium text-sm">OTP</span>
1694
- <div class="flex items-center gap-1">
1695
- <span data-copy-value="654321" class="text-tone-100 text-sm font-medium">654321</span>
1696
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1697
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1698
- xmlns="http://www.w3.org/2000/svg">
1699
- <path
1700
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1701
- fill="#0D0716" />
1702
- </svg>
1703
- </button>
1704
- </div>
1705
- </div>
1706
- </div>
1707
- </div>
1708
- <!-- 3DS -->
1709
- <div id="3ds" class="tab-content hidden">
1710
- <div class=" grid gap-3 border border-tone-50 px-6 py-4 rounded-2xl mb-4">
1711
- <div class="flex justify-between items-center">
1712
- <span class="text-tone-60 font-medium text-sm">Number</span>
1713
- <div class="flex items-center gap-1">
1714
- <span data-copy-value="5555558684543932"
1715
- class="text-tone-100 text-sm font-medium">5555577124976817 </span>
1716
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1717
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1718
- xmlns="http://www.w3.org/2000/svg">
1719
- <path
1720
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1721
- fill="#0D0716" />
1722
- </svg>
1723
- </button>
1724
- </div>
1725
- </div>
1726
-
1727
- <div class="flex justify-between items-center">
1728
- <span class="text-tone-60 font-medium text-sm">Expiry</span>
1729
- <div class="flex items-center gap-1">
1730
- <span data-copy-value="12/2030" class="text-tone-100 text-sm font-medium">12/2030</span>
1731
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1732
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1733
- xmlns="http://www.w3.org/2000/svg">
1734
- <path
1735
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1736
- fill="#0D0716" />
1737
- </svg>
1738
- </button>
1739
- </div>
1740
- </div>
1741
- <div class="flex justify-between items-center">
1742
- <span class="text-tone-60 font-medium text-sm">CVV</span>
1743
- <div class="flex items-center gap-1">
1744
- <span data-copy-value="321" class="text-tone-100 text-sm font-medium">321</span>
1745
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1746
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1747
- xmlns="http://www.w3.org/2000/svg">
1748
- <path
1749
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1750
- fill="#0D0716" />
1751
- </svg>
1752
- </button>
1753
- </div>
1754
- </div>
1755
- </div>
1756
- </div>
1757
-
1758
- <!-- AVS -->
1759
- <div id="avs" class="tab-content hidden">
1760
- <div class=" grid gap-3 border border-tone-50 px-6 py-4 rounded-2xl mb-4">
1761
- <div class="flex justify-between items-center">
1762
- <span class="text-tone-60 font-medium text-sm">Number</span>
1763
- <div class="flex items-center gap-1">
1764
- <span data-copy-value="4111124373708482"
1765
- class="text-tone-100 text-sm font-medium">4111124373708482 </span>
1766
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1767
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1768
- xmlns="http://www.w3.org/2000/svg">
1769
- <path
1770
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1771
- fill="#0D0716" />
1772
- </svg>
1773
- </button>
1774
- </div>
1775
- </div>
1776
-
1777
- <div class="flex justify-between items-center">
1778
- <span class="text-tone-60 font-medium text-sm">Expiry</span>
1779
- <div class="flex items-center gap-1">
1780
- <span data-copy-value="12/2030" class="text-tone-100 text-sm font-medium">12/2030</span>
1781
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1782
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1783
- xmlns="http://www.w3.org/2000/svg">
1784
- <path
1785
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1786
- fill="#0D0716" />
1787
- </svg>
1788
- </button>
1789
- </div>
1790
- </div>
1791
- <div class="flex justify-between items-center">
1792
- <span class="text-tone-60 font-medium text-sm">CVV</span>
1793
- <div class="flex items-center gap-1">
1794
- <span data-copy-value="321" class="text-tone-100 text-sm font-medium">321</span>
1795
- <button class="copy-btn p-1 hover:opacity-80 transition-opacity">
1796
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
1797
- xmlns="http://www.w3.org/2000/svg">
1798
- <path
1799
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1800
- fill="#0D0716" />
1801
- </svg>
1802
- </button>
1803
- </div>
1804
- </div>
1805
- <div class="flex justify-between items-center">
1806
- <span class="text-tone-60 font-medium text-sm">OTP</span>
1807
- <div class="flex flex-col items-end gap-1">
1808
- <span class="text-tone-100 text-sm font-medium">Address: 1, Spotflow Street</span>
1809
- <span class="text-tone-100 text-sm font-medium">City: Lekki</span>
1810
- <span class="text-tone-100 text-sm font-medium">State: Lagos</span>
1811
- <span class="text-tone-100 text-sm font-medium">Country: Nigeria</span>
1812
- <span class="text-tone-100 text-sm font-medium">ZIP: 101233</span>
1813
- </div>
1814
- </div>
1815
- </div>
1816
- </div>
1817
- </div>
1818
- </div>`;class es{constructor({container:e,closeCallback:i}){h(this,"container");h(this,"closeCallback");this.container=e,this.closeCallback=i}render(){return pl}attachListener(){const e=this.container.querySelector("#close-test-card");e==null||e.addEventListener("click",()=>this.closeCallback());const i=this.container.querySelectorAll("#test-card-tabs .tab-btn"),t=this.container.querySelectorAll(".tab-content");i.forEach(s=>{s.addEventListener("click",()=>{i.forEach(l=>l.classList.remove("active-tab")),s.classList.add("active-tab");const a=s.getAttribute("data-target");t.forEach(l=>{l.id===a?l.classList.remove("hidden"):l.classList.add("hidden")})})}),this.container.querySelectorAll(".copy-btn").forEach(s=>{s.addEventListener("click",async a=>{const d=a.currentTarget.previousElementSibling.getAttribute("data-copy-value")||"";d&&(await navigator.clipboard.writeText(d),s.innerHTML='<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5 2V1H10V2H5ZM4.75 0C4.33579 0 4 0.335786 4 0.75V1H3.5C2.67157 1 2 1.67157 2 2.5V12.5C2 13.3284 2.67157 14 3.5 14H7V13H3.5C3.22386 13 3 12.7761 3 12.5V2.5C3 2.22386 3.22386 2 3.5 2H4V2.25C4 2.66421 4.33579 3 4.75 3H10.25C10.6642 3 11 2.66421 11 2.25V2H11.5C11.7761 2 12 2.22386 12 2.5V7H13V2.5C13 1.67157 12.3284 1 11.5 1H11V0.75C11 0.335786 10.6642 0 10.25 0H4.75ZM9 8.5C9 8.77614 8.77614 9 8.5 9C8.22386 9 8 8.77614 8 8.5C8 8.22386 8.22386 8 8.5 8C8.77614 8 9 8.22386 9 8.5ZM10.5 9C10.7761 9 11 8.77614 11 8.5C11 8.22386 10.7761 8 10.5 8C10.2239 8 10 8.22386 10 8.5C10 8.77614 10.2239 9 10.5 9ZM13 8.5C13 8.77614 12.7761 9 12.5 9C12.2239 9 12 8.77614 12 8.5C12 8.22386 12.2239 8 12.5 8C12.7761 8 13 8.22386 13 8.5ZM14.5 9C14.7761 9 15 8.77614 15 8.5C15 8.2239 14.7761 8 14.5 8C14.2239 8 14 8.22386 14 8.5C14 8.77614 14.2239 9 14.5 9ZM15 10.5C15 10.7761 14.7761 11 14.5 11C14.2239 11 14 10.7761 14 10.5C14 10.2239 14.2239 10 14.5 10C14.7761 10 15 10.2239 15 10.5ZM14.5 13C14.7761 13 15 12.7761 15 12.5C15 12.2239 14.7761 12 14.5 12C14.2239 12 14 12.2239 14 12.5C14 12.7761 14.2239 13 14.5 13ZM14.5 15C14.7761 15 15 14.7761 15 14.5C15 14.2239 14.7761 14 14.5 14C14.2239 14 14 14.2239 14 14.5C14 14.7761 14.2239 15 14.5 15ZM8.5 11C8.77614 11 9 10.7761 9 10.5C9 10.2239 8.77614 10 8.5 10C8.22386 10 8 10.2239 8 10.5C8 10.7761 8.22386 11 8.5 11ZM9 12.5C9 12.7761 8.77614 13 8.5 13C8.22386 13 8 12.7761 8 12.5C8 12.2239 8.22386 12 8.5 12C8.77614 12 9 12.2239 9 12.5ZM8.5 15C8.77614 15 9 14.7761 9 14.5C9 14.2239 8.77614 14 8.5 14C8.22386 14 8 14.2239 8 14.5C8 14.7761 8.22386 15 8.5 15ZM11 14.5C11 14.7761 10.7761 15 10.5 15C10.2239 15 10 14.7761 10 14.5C10 14.2239 10.2239 14 10.5 14C10.7761 14 11 14.2239 11 14.5ZM12.5 15C12.7761 15 13 14.7761 13 14.5C13 14.2239 12.7761 14 12.5 14C12.2239 14 12 14.2239 12 14.5C12 14.7761 12.2239 15 12.5 15Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg>',setTimeout(()=>{s.innerHTML=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1819
- <path
1820
- d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
1821
- fill="#0D0716" />
1822
- </svg>`},1e3))})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}}function vl(n){n.classList.remove("hidden"),requestAnimationFrame(()=>{n.classList.remove("opacity-0","scale-95")})}function ns(n){n.classList.add("opacity-0","scale-95"),n.addEventListener("transitionend",()=>n.classList.add("hidden"),{once:!0})}class is{constructor({container:e,testCardContainer:i}){h(this,"container");h(this,"testCardContainer");h(this,"testCardInstance",null);h(this,"isVisible",!1);this.container=e,this.testCardContainer=i}attachListener(){const e=this.container.querySelector("#test-cards-link");e&&e.addEventListener("click",()=>{if(this.isVisible){this.testCardContainer.innerHTML="",ns(this.testCardContainer),e.classList.remove("text-tone-100","font-bold"),this.isVisible=!1;return}this.testCardInstance||(this.testCardInstance=new es({container:this.testCardContainer,closeCallback:()=>{this.testCardContainer.innerHTML="",ns(this.testCardContainer),e.classList.remove("text-tone-100","font-bold"),this.isVisible=!1}})),this.testCardInstance.renderComponent(),vl(this.testCardContainer),e.classList.add("text-tone-100","font-bold"),this.isVisible=!0})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return ml}}const bl=`<div id="mobileConfirmationProgress">
1822
+ `;a+="</div>"}a+="</div>"}a+="</div>",i.innerHTML=a}}}render(){return pl}}const bl=`<div id="mobileConfirmationProgress">
1823
1823
  <div>
1824
1824
  <div>
1825
1825
  <div class=" grid grid-rows-[auto_1fr] gap-4 mx-5">
@@ -1981,7 +1981,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1981
1981
  <path
1982
1982
  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"
1983
1983
  stroke="black" stroke-width="4" stroke-linejoin="round" />
1984
- </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 Cl}}class kl{constructor(e){h(this,"container");h(this,"onAction");h(this,"callBackUrl");h(this,"paymentResponse");h(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",()=>{Ze(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return qo}}class Sl{constructor({container:e,merchantKey:i,localCurrency:t,metadata:o,callBackUrl:s,rdtCode:a,reference:l,onSuccess:d,url:v,customer:p,amount:g,totalAmount:f,token:y,currency:k,disablePaymentMethods:C,hidePaymentMethods:S,showPaymentMethods:M,onClose:A,restartTransactionProcess:_,retryingPayment:T,countryCode:I}){h(this,"contents");h(this,"mobileMoneyForm");h(this,"mobileMoneyValidationForm");h(this,"onSuccess");h(this,"mobileMoneyConfirmation");h(this,"mobileMoneyConfirmationEnd");h(this,"transactionIssuesScreen");h(this,"container");h(this,"pageLoader");h(this,"mainLoader");h(this,"_currentStep");h(this,"successScreen");h(this,"customer");h(this,"activeRef");h(this,"warningScreen");h(this,"amount");h(this,"totalAmount");h(this,"url");h(this,"reference");h(this,"metadata");h(this,"currency");h(this,"localCurrency");h(this,"token");h(this,"callBackUrl");h(this,"rdtCode");h(this,"merchantDetails");h(this,"onClose");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"disablePaymentMethods");h(this,"paymentResponse");h(this,"paymentResponseHeaders");h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);h(this,"countryCode");this.container=e,this.onSuccess=d||(()=>null),this.token=y,this.currency=k,this.amount=g,this.totalAmount=f,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.activeRef="",this.token=i,this.customer=p,this.metadata=o,this.localCurrency=t,this.callBackUrl=s,this.localCurrency=t,this.rdtCode=a,this.url=v,this.reference=l,this.merchantDetails={},this.disablePaymentMethods=C,this.hidePaymentMethods=S,this.showPaymentMethods=M,this.onClose=A,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=_,this.retryingPayment=T,this.isMaxRetriesReached=!1,this.countryCode=I,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")),(()=>{var a,l;if(this.retryingPayment){const d={channel:"mobile_money",reference:this.reference,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber,...i.otp&&{otp:i.otp}}};return ci(this.token,d,this.rdtCode,this.url)}else{const d={amount:this.amount,channel:"mobile_money",currency:this.currency||"USD",customer:this.customer,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber,...i.otp&&{otp:i.otp}},...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((a=this.merchantDetails)==null?void 0:a.taxQuoteId)&&{taxQuoteId:(l=this.merchantDetails)==null?void 0:l.taxQuoteId},...this.countryCode&&{countryCode:this.countryCode}};return xs(this.token,d,this.rdtCode,this.url)}})().then(({data:a,headers:l})=>{var d;if(this.paymentResponse=a,this.paymentResponseHeaders=l,a.status==="failed"){this.currentStep=5,a.providerMessage?this.warningScreen.setPaymentError(a.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue(),P.track("start_payment_failed",{payment_method:"Mobile Money",verification_status:"Failed",payment_error:a.providerMessage||"Payment failed"});return}else if(a.status==="success"||a.status==="successful"){this.currentStep=4,P.track("start_payment_success",{payment_method:"Mobile Money",verification_status:"Success"}),Ze(a,l,a==null?void 0:a.callBackUrl);return}else if(((d=a==null?void 0:a.authorization)==null?void 0:d.mode)==="otp"){this.activeRef=a.reference,this.currentStep=6;return}else this.currentStep=3}).catch(a=>{P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Null"}),a.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,a.message?this.warningScreen.setPaymentError(a.message):this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}showLoader(){this.pageLoader=new Ne(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")),di(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 d=this.container.querySelector("#otp-error");l.code==="invalid_otp"?(d&&(d.innerHTML=l.message),P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Failed",authentication_type:"OTP"})):this.currentStep=3}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}async verifyPaymentProcess(){try{const e=await an(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=5}}goBackToMerchant(){Ze(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderMobileMoneyContent(e){var i;if(e&&(this.merchantDetails=e),this.currentStep===3&&this.disablePaymentMethods("mobile_money"),this.currentStep!==1){const t=document.getElementById("go-back");t&&(t.classList.remove("flex","items-center","gap-2","mb-2"),t.innerHTML="")}switch(this.currentStep===6?this.hidePaymentMethods():this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.currentStep){case 1:this.mobileMoneyForm=new yl({container:this.contents,merchantKey:this.token,url:this.url,onAction:t=>o=>this.createMobileMoney.bind(this)(t,o),ref:this.activeRef,switchScreen:t=>{this.currentStep=t},rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,totalAmount:this.totalAmount,restartTransactionProcess:this.restartTransactionProcess.bind(this),merchantDetails:this.merchantDetails,countryCode:this.countryCode||""}),this.mobileMoneyForm.renderContent();break;case 2:this.mainLoader=new Ne(this.contents),this.mainLoader.mountLoader("25dvh"),this.mainLoader.updateMessage("Please wait");break;case 3:this.mobileMoneyConfirmation=new fl({container:this.contents,onAction:t=>{this.currentStep=t},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(t,o)=>{this.paymentResponse=t,this.paymentResponseHeaders=o}}),this.mobileMoneyConfirmation.renderComponent();break;case 4:this.successScreen=new qn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate}),this.successScreen.renderComponent();break;case 5:this.warningScreen=new gn({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 wl({container:this.contents,onClose:this.onClose,onAction:t=>o=>this.submitOtp.bind(this)(t,o),otpMessage:((i=this.paymentResponse)==null?void 0:i.providerMessage)||"Please enter your OTP sent to your phone"}),this.mobileMoneyValidationForm.renderComponent();break;case 7:this.pageLoader=new Ne(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 8:this.mobileMoneyConfirmationEnd=new kl({container:this.contents,onAction:t=>{this.currentStep=t},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.mobileMoneyConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new mi({container:this.contents,onAction:()=>{var t;this.currentStep=5,this.warningScreen.setPaymentError(((t=this.paymentResponse)==null?void 0:t.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"mobile_money",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break}this.attachInputListeners()}}const _l=`<div id="eft-authenticate-container">
1984
+ </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 Cl}}class kl{constructor(e){h(this,"container");h(this,"onAction");h(this,"callBackUrl");h(this,"paymentResponse");h(this,"paymentResponseHeaders");h(this,"paymentMethod");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders,this.paymentMethod=e.paymentMethod}attachListeners(){const e=this.container.querySelector(".details-form-button");e&&e.addEventListener("click",()=>{var i;P.track("redirect_to_merchant",{payment_method:this.paymentMethod,status:(i=this.paymentResponse)==null?void 0:i.status}),Ze(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){var e;this.container.innerHTML=this.render(),P.track("payment_timeout",{payment_method:this.paymentMethod,status:(e=this.paymentResponse)==null?void 0:e.status}),this.attachListeners()}render(){return Wo}}class Sl{constructor({container:e,merchantKey:i,localCurrency:t,metadata:o,callBackUrl:s,rdtCode:a,reference:l,onSuccess:d,url:v,customer:p,amount:g,totalAmount:f,token:y,currency:k,disablePaymentMethods:C,hidePaymentMethods:S,showPaymentMethods:M,onClose:A,restartTransactionProcess:_,retryingPayment:T,countryCode:I}){h(this,"contents");h(this,"mobileMoneyForm");h(this,"mobileMoneyValidationForm");h(this,"onSuccess");h(this,"mobileMoneyConfirmation");h(this,"mobileMoneyConfirmationEnd");h(this,"transactionIssuesScreen");h(this,"container");h(this,"pageLoader");h(this,"mainLoader");h(this,"_currentStep");h(this,"successScreen");h(this,"customer");h(this,"activeRef");h(this,"warningScreen");h(this,"amount");h(this,"totalAmount");h(this,"url");h(this,"reference");h(this,"metadata");h(this,"currency");h(this,"localCurrency");h(this,"token");h(this,"callBackUrl");h(this,"rdtCode");h(this,"merchantDetails");h(this,"onClose");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"disablePaymentMethods");h(this,"paymentResponse");h(this,"paymentResponseHeaders");h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);h(this,"countryCode");this.container=e,this.onSuccess=d||(()=>null),this.token=y,this.currency=k,this.amount=g,this.totalAmount=f,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.activeRef="",this.token=i,this.customer=p,this.metadata=o,this.localCurrency=t,this.callBackUrl=s,this.localCurrency=t,this.rdtCode=a,this.url=v,this.reference=l,this.merchantDetails={},this.disablePaymentMethods=C,this.hidePaymentMethods=S,this.showPaymentMethods=M,this.onClose=A,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=_,this.retryingPayment=T,this.isMaxRetriesReached=!1,this.countryCode=I,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")),(()=>{var a,l;if(this.retryingPayment){const d={channel:"mobile_money",reference:this.reference,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber,...i.otp&&{otp:i.otp}}};return ci(this.token,d,this.rdtCode,this.url)}else{const d={amount:this.amount,channel:"mobile_money",currency:this.currency||"USD",customer:this.customer,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber,...i.otp&&{otp:i.otp}},...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((a=this.merchantDetails)==null?void 0:a.taxQuoteId)&&{taxQuoteId:(l=this.merchantDetails)==null?void 0:l.taxQuoteId},...this.countryCode&&{countryCode:this.countryCode}};return xs(this.token,d,this.rdtCode,this.url)}})().then(({data:a,headers:l})=>{var d;if(this.paymentResponse=a,this.paymentResponseHeaders=l,a.status==="failed"){this.currentStep=5,a.providerMessage?this.warningScreen.setPaymentError(a.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue(),P.track("start_payment_failed",{payment_method:"Mobile Money",verification_status:"Failed",payment_error:a.providerMessage||"Payment failed"});return}else if(a.status==="success"||a.status==="successful"){this.currentStep=4,P.track("start_payment_success",{payment_method:"Mobile Money",verification_status:"Success"}),Ze(a,l,a==null?void 0:a.callBackUrl);return}else if(((d=a==null?void 0:a.authorization)==null?void 0:d.mode)==="otp"){this.activeRef=a.reference,this.currentStep=6;return}else this.currentStep=3}).catch(a=>{P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Null"}),a.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,a.message?this.warningScreen.setPaymentError(a.message):this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}showLoader(){this.pageLoader=new Ne(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")),di(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 d=this.container.querySelector("#otp-error");l.code==="invalid_otp"?(d&&(d.innerHTML=l.message),P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Failed",authentication_type:"OTP"})):this.currentStep=3}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}async verifyPaymentProcess(){try{const e=await an(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=5}}goBackToMerchant(){Ze(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderMobileMoneyContent(e){var i;if(e&&(this.merchantDetails=e),this.currentStep===3&&this.disablePaymentMethods("mobile_money"),this.currentStep!==1){const t=document.getElementById("go-back");t&&(t.classList.remove("flex","items-center","gap-2","mb-2"),t.innerHTML="")}switch(this.currentStep===6?this.hidePaymentMethods():this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.currentStep){case 1:this.mobileMoneyForm=new yl({container:this.contents,merchantKey:this.token,url:this.url,onAction:t=>o=>this.createMobileMoney.bind(this)(t,o),ref:this.activeRef,switchScreen:t=>{this.currentStep=t},rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,totalAmount:this.totalAmount,restartTransactionProcess:this.restartTransactionProcess.bind(this),merchantDetails:this.merchantDetails,countryCode:this.countryCode||""}),this.mobileMoneyForm.renderContent();break;case 2:this.mainLoader=new Ne(this.contents),this.mainLoader.mountLoader("25dvh"),this.mainLoader.updateMessage("Please wait");break;case 3:this.mobileMoneyConfirmation=new fl({container:this.contents,onAction:t=>{this.currentStep=t},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(t,o)=>{this.paymentResponse=t,this.paymentResponseHeaders=o}}),this.mobileMoneyConfirmation.renderComponent();break;case 4:this.successScreen=new qn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate}),this.successScreen.renderComponent();break;case 5:this.warningScreen=new gn({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 wl({container:this.contents,onClose:this.onClose,onAction:t=>o=>this.submitOtp.bind(this)(t,o),otpMessage:((i=this.paymentResponse)==null?void 0:i.providerMessage)||"Please enter your OTP sent to your phone"}),this.mobileMoneyValidationForm.renderComponent();break;case 7:this.pageLoader=new Ne(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 8:this.mobileMoneyConfirmationEnd=new kl({container:this.contents,onAction:t=>{this.currentStep=t},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders,paymentMethod:"Mobile Money"}),this.mobileMoneyConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new mi({container:this.contents,onAction:()=>{var t;this.currentStep=5,this.warningScreen.setPaymentError(((t=this.paymentResponse)==null?void 0:t.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"mobile_money",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break}this.attachInputListeners()}}const _l=`<div id="eft-authenticate-container">
1985
1985
  <div class="pt-3">
1986
1986
  <div class="container-center">
1987
1987
  <svg width="98" height="32" viewBox="0 0 98 32" fill="none" xmlns="http://www.w3.org/2000/svg"
@@ -2018,12 +2018,12 @@ or you can use record.mirror to access the mirror instance during recording.`;le
2018
2018
  </div>
2019
2019
  </div>
2020
2020
 
2021
- </div>`;class ts{constructor(e){h(this,"container");h(this,"payment");h(this,"warningError");h(this,"pageLoader");h(this,"onAction");h(this,"restartTransactionProcess");this.container=e.container,this.onAction=e.onAction,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new gn({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 _l}}class Ml{constructor({amount:e,totalAmount:i,container:t,customer:o,token:s,currency:a,rdtCode:l,url:d,reference:v,callBackUrl:p,metadata:g,localCurrency:f,hidePaymentMethods:y,showPaymentMethods:k,restartTransactionProcess:C,retryingPayment:S}){h(this,"contents");h(this,"eftAuthenticate");h(this,"successScreen");h(this,"pageLoader");h(this,"warningScreen");h(this,"transactionIssuesScreen");h(this,"container");h(this,"customer");h(this,"token");h(this,"amount");h(this,"totalAmount");h(this,"currency");h(this,"_currentStep");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"merchantPlanDetail",{});h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);h(this,"paymentResponse");h(this,"paymentResponseHeaders");this.currency=a,this.container=t,this.token=s,this.customer=o,this.amount=e,this.totalAmount=i,this.rdtCode=l,this.url=d,this.reference=v,this.callBackUrl=p,this.metadata=g,this.localCurrency=f,this._currentStep=1,this.contents=this.container.querySelector("#payment-content-view"),this.hidePaymentMethods=y,this.showPaymentMethods=k,this.restartTransactionProcess=C,this.retryingPayment=S,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 Ne(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(){Ze(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")),(()=>{var o,s;if(this.retryingPayment){const a={channel:"eft",reference:this.reference};return ci(this.token,a,this.rdtCode,this.url)}else{const a={amount:this.amount,channel:"eft",currency:this.currency,customer:this.customer,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((o=this.merchantPlanDetail)==null?void 0:o.taxQuoteId)&&{taxQuoteId:(s=this.merchantPlanDetail)==null?void 0:s.taxQuoteId}};return Bt(this.token,a,this.rdtCode,this.url)}})().then(({data:o,headers:s})=>{var a,l,d;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(((a=o==null?void 0:o.authorization)==null?void 0:a.mode)==="redirect"){(l=o==null?void 0:o.authorization)!=null&&l.redirectUrl&&this.redirectToOzow((d=o==null?void 0:o.authorization)==null?void 0:d.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 an(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"}),Ze(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 ts({container:this.contents,onAction:this.createEftPayment.bind(this),restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break;case 2:this.successScreen=new qn({container:this.contents,amount:this.totalAmount,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 Ne(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 4:this.warningScreen=new gn({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 mi({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 ts({container:this.contents,onAction:this.createEftPayment.bind(this),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 Al{constructor({container:e,customerDetails:i,code:t,encryption:o,merchantKey:s,modalContainer:a,amount:l,planId:d,rdtCode:v,url:p,reference:g,callBackUrl:f,metadata:y,localCurrency:k,closePayment:C,countryCode:S}){h(this,"validChannels",[]);h(this,"disabledChannels",[]);h(this,"selectedChannel");h(this,"modalContainer");h(this,"currentPaymentMethod");h(this,"mainLayout");h(this,"mainHeader");h(this,"mainFooter");h(this,"testCard");h(this,"merchantPlanDetail",{});h(this,"mainScreen");h(this,"currency");h(this,"card");h(this,"transfer");h(this,"ussd");h(this,"mobileMoney");h(this,"eft");h(this,"encryption");h(this,"merchantKey");h(this,"planId");h(this,"customerDetails");h(this,"code");h(this,"amount",0);h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"isMobile",!1);h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"closePayment");h(this,"retryingPayment");h(this,"totalAmount");h(this,"countryCode");this.validChannels=[],this.disabledChannels=[],this.selectedChannel="",this.modalContainer=a,this.encryption=o,this.planId=d||"",this.merchantKey=s,this.code=t,this.amount=l||0,this.rdtCode=v||"",this.url=p||"",this.reference=g,this.mainLayout=e,this.callBackUrl=f,this.metadata=y||{},this.localCurrency=k||"",this.isMobile=window.matchMedia("(max-width: 767px)").matches,this.currentPaymentMethod="",this.currency="",this.closePayment=C,this.retryingPayment=!1,this.totalAmount=0,this.countryCode=S||"",this.customerDetails=i}mountScreen(e,i,t,o){var a,l;t&&(this.validChannels=t),o&&(this.disabledChannels=o),this.mainLayout.innerHTML=this.render(),this.merchantPlanDetail=e,this.currency=i;const s=(l=(a=this.merchantPlanDetail.plan)==null?void 0:a.pricingOptions)==null?void 0:l.find(d=>d.currency===this.currency);this.amount=(s==null?void 0:s.amount)||this.amount,this.totalAmount=this.merchantPlanDetail.totalAmount||this.amount,this.mainHeader=new hl({container:document.getElementById("main-header"),email:this.customerDetails.email,amount:this.amount,metadata:this.metadata,currency:this.currency,localCurrency:this.localCurrency,merchantDetail:e,onAction:this.switchTab.bind(this),isMobile:this.isMobile,onClose:d=>{this.closeBTN.bind(this)(d)},currentPaymentMethod:this.currentPaymentMethod}),this.mainHeader.renderComponent(),this.testCard=new es({container:document.getElementById("test-container"),closeCallback:()=>{const d=document.getElementById("test-container");d&&(d.innerHTML="",d.classList.add("hidden"))}}),this.mainFooter=new is({container:document.getElementById("main-footer"),testCardContainer:document.getElementById("test-container")}),document.addEventListener("DOMContentLoaded",()=>{const d=document.getElementById("main-footer"),v=document.getElementById("test-container");new is({container:d,testCardContainer:v}).renderComponent()}),this.mainFooter.renderComponent(),this.setupPaymentMethodButtons(),this.selectedChannel&&(this.currentPaymentMethod=this.selectedChannel),this.updatePaymentMethodView(this.merchantKey,this.customerDetails,this.amount,this.totalAmount,this.currency),this.renderPaymentMethodContent(),this.setCurrentPaymentMethod(this.currentPaymentMethod)}setupPaymentMethodButtons(){const e=document.querySelectorAll(".tab-button");e.forEach(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">
2021
+ </div>`;class ts{constructor(e){h(this,"container");h(this,"payment");h(this,"warningError");h(this,"pageLoader");h(this,"onAction");h(this,"restartTransactionProcess");this.container=e.container,this.onAction=e.onAction,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new gn({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 _l}}class Ml{constructor({amount:e,totalAmount:i,container:t,customer:o,token:s,currency:a,rdtCode:l,url:d,reference:v,callBackUrl:p,metadata:g,localCurrency:f,hidePaymentMethods:y,showPaymentMethods:k,restartTransactionProcess:C,retryingPayment:S}){h(this,"contents");h(this,"eftAuthenticate");h(this,"successScreen");h(this,"pageLoader");h(this,"warningScreen");h(this,"transactionIssuesScreen");h(this,"container");h(this,"customer");h(this,"token");h(this,"amount");h(this,"totalAmount");h(this,"currency");h(this,"_currentStep");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"merchantPlanDetail",{});h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);h(this,"paymentResponse");h(this,"paymentResponseHeaders");this.currency=a,this.container=t,this.token=s,this.customer=o,this.amount=e,this.totalAmount=i,this.rdtCode=l,this.url=d,this.reference=v,this.callBackUrl=p,this.metadata=g,this.localCurrency=f,this._currentStep=1,this.contents=this.container.querySelector("#payment-content-view"),this.hidePaymentMethods=y,this.showPaymentMethods=k,this.restartTransactionProcess=C,this.retryingPayment=S,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 Ne(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(){Ze(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")),(()=>{var o,s;if(this.retryingPayment){const a={channel:"eft",reference:this.reference};return ci(this.token,a,this.rdtCode,this.url)}else{const a={amount:this.amount,channel:"eft",currency:this.currency,customer:this.customer,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((o=this.merchantPlanDetail)==null?void 0:o.taxQuoteId)&&{taxQuoteId:(s=this.merchantPlanDetail)==null?void 0:s.taxQuoteId}};return Nt(this.token,a,this.rdtCode,this.url)}})().then(({data:o,headers:s})=>{var a,l,d;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(((a=o==null?void 0:o.authorization)==null?void 0:a.mode)==="redirect"){(l=o==null?void 0:o.authorization)!=null&&l.redirectUrl&&this.redirectToOzow((d=o==null?void 0:o.authorization)==null?void 0:d.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 an(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"}),Ze(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 ts({container:this.contents,onAction:this.createEftPayment.bind(this),restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break;case 2:this.successScreen=new qn({container:this.contents,amount:this.totalAmount,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 Ne(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 4:this.warningScreen=new gn({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 mi({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 ts({container:this.contents,onAction:this.createEftPayment.bind(this),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 Al{constructor({container:e,customerDetails:i,code:t,encryption:o,merchantKey:s,modalContainer:a,amount:l,planId:d,rdtCode:v,url:p,reference:g,callBackUrl:f,metadata:y,localCurrency:k,closePayment:C,countryCode:S}){h(this,"validChannels",[]);h(this,"disabledChannels",[]);h(this,"selectedChannel");h(this,"modalContainer");h(this,"currentPaymentMethod");h(this,"mainLayout");h(this,"mainHeader");h(this,"mainFooter");h(this,"testCard");h(this,"merchantPlanDetail",{});h(this,"mainScreen");h(this,"currency");h(this,"card");h(this,"transfer");h(this,"ussd");h(this,"mobileMoney");h(this,"eft");h(this,"encryption");h(this,"merchantKey");h(this,"planId");h(this,"customerDetails");h(this,"code");h(this,"amount",0);h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"isMobile",!1);h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"closePayment");h(this,"retryingPayment");h(this,"totalAmount");h(this,"countryCode");this.validChannels=[],this.disabledChannels=[],this.selectedChannel="",this.modalContainer=a,this.encryption=o,this.planId=d||"",this.merchantKey=s,this.code=t,this.amount=l||0,this.rdtCode=v||"",this.url=p||"",this.reference=g,this.mainLayout=e,this.callBackUrl=f,this.metadata=y||{},this.localCurrency=k||"",this.isMobile=window.matchMedia("(max-width: 767px)").matches,this.currentPaymentMethod="",this.currency="",this.closePayment=C,this.retryingPayment=!1,this.totalAmount=0,this.countryCode=S||"",this.customerDetails=i}mountScreen(e,i,t,o){var a,l;t&&(this.validChannels=t),o&&(this.disabledChannels=o),this.mainLayout.innerHTML=this.render(),this.merchantPlanDetail=e,this.currency=i;const s=(l=(a=this.merchantPlanDetail.plan)==null?void 0:a.pricingOptions)==null?void 0:l.find(d=>d.currency===this.currency);this.amount=(s==null?void 0:s.amount)||this.amount,this.totalAmount=this.merchantPlanDetail.totalAmount||this.amount,this.mainHeader=new vl({container:document.getElementById("main-header"),email:this.customerDetails.email,amount:this.amount,metadata:this.metadata,currency:this.currency,localCurrency:this.localCurrency,merchantDetail:e,onAction:this.switchTab.bind(this),isMobile:this.isMobile,onClose:d=>{this.closeBTN.bind(this)(d)},currentPaymentMethod:this.currentPaymentMethod}),this.mainHeader.renderComponent(),this.testCard=new Jo({container:document.getElementById("test-container"),closeCallback:()=>{const d=document.getElementById("test-container");d&&(d.innerHTML="",d.classList.add("hidden"))}}),this.mainFooter=new $o({container:document.getElementById("main-footer"),testCardContainer:document.getElementById("test-container")}),document.addEventListener("DOMContentLoaded",()=>{const d=document.getElementById("main-footer"),v=document.getElementById("test-container");new $o({container:d,testCardContainer:v}).renderComponent()}),this.mainFooter.renderComponent(),this.setupPaymentMethodButtons(),this.selectedChannel&&(this.currentPaymentMethod=this.selectedChannel),this.updatePaymentMethodView(this.merchantKey,this.customerDetails,this.amount,this.totalAmount,this.currency),this.renderPaymentMethodContent(),this.setCurrentPaymentMethod(this.currentPaymentMethod)}setupPaymentMethodButtons(){const e=document.querySelectorAll(".tab-button");e.forEach(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">
2022
2022
  <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"/>
2023
2023
  </svg>
2024
2024
  <span class="text-tone-100 font-semibold">
2025
2025
  Go back
2026
- </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,s){switch(this.currentPaymentMethod){case"card":return this.card=new zr({container:this.modalContainer,amount:t,totalAmount:o,currency:s,token:e,customer:i||this.customerDetails,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:a=>{this.closeBTN.bind(this)(a)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});case"bank_transfer":return this.transfer=new el({amount:t,totalAmount:o,currency:s,closeModal:this.closeModal.bind(this),token:e,container:this.modalContainer,customer:i||this.customerDetails,rdtCode:this.rdtCode,url:this.url,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,disablePaymentMethods:a=>{this.disablePaymentMethods.bind(this)(a)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),hidePaymentMethods:this.hidePaymentMethods.bind(this),retryingPayment:this.retryingPayment});case"ussd":return this.ussd=new Xo({container:this.modalContainer,amount:t,totalAmount:o,currency:s,secret:this.merchantKey,rdtCode:this.rdtCode,url:this.url,customer:i||this.customerDetails,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,closeModal:()=>this.closeModal(),switchTab:a=>this.switchTab.bind(a),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),disablePaymentMethods:a=>{this.disablePaymentMethods.bind(this)(a)}});case"mobile_money":return this.mobileMoney=new Sl({container:this.modalContainer,customer:i||this.customerDetails,currency:s,rdtCode:this.rdtCode,url:this.url,token:e,amount:this.amount,totalAmount:this.totalAmount,metadata:this.metadata,localCurrency:this.localCurrency,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:a=>{this.disablePaymentMethods.bind(this)(a)},onClose:a=>{this.closeBTN.bind(this)(a)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment,countryCode:this.countryCode||""});case"eft":return this.eft=new Ml({container:this.modalContainer,amount:t,totalAmount:o,currency:s,customer:i||this.customerDetails,token:e,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:a=>{this.closeBTN.bind(this)(a)},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.customerDetails,this.amount,this.totalAmount,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.customerDetails,this.amount,this.totalAmount,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 Ms}}class os{constructor(e){h(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`
2026
+ </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,s){switch(this.currentPaymentMethod){case"card":return this.card=new Zr({container:this.modalContainer,amount:t,totalAmount:o,currency:s,token:e,customer:i||this.customerDetails,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:a=>{this.closeBTN.bind(this)(a)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});case"bank_transfer":return this.transfer=new tl({amount:t,totalAmount:o,currency:s,closeModal:this.closeModal.bind(this),token:e,container:this.modalContainer,customer:i||this.customerDetails,rdtCode:this.rdtCode,url:this.url,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,disablePaymentMethods:a=>{this.disablePaymentMethods.bind(this)(a)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),hidePaymentMethods:this.hidePaymentMethods.bind(this),retryingPayment:this.retryingPayment});case"ussd":return this.ussd=new is({container:this.modalContainer,amount:t,totalAmount:o,currency:s,secret:this.merchantKey,rdtCode:this.rdtCode,url:this.url,customer:i||this.customerDetails,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,closeModal:()=>this.closeModal(),switchTab:a=>this.switchTab.bind(a),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),disablePaymentMethods:a=>{this.disablePaymentMethods.bind(this)(a)}});case"mobile_money":return this.mobileMoney=new Sl({container:this.modalContainer,customer:i||this.customerDetails,currency:s,rdtCode:this.rdtCode,url:this.url,token:e,amount:this.amount,totalAmount:this.totalAmount,metadata:this.metadata,localCurrency:this.localCurrency,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:a=>{this.disablePaymentMethods.bind(this)(a)},onClose:a=>{this.closeBTN.bind(this)(a)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment,countryCode:this.countryCode||""});case"eft":return this.eft=new Ml({container:this.modalContainer,amount:t,totalAmount:o,currency:s,customer:i||this.customerDetails,token:e,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:a=>{this.closeBTN.bind(this)(a)},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.customerDetails,this.amount,this.totalAmount,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.customerDetails,this.amount,this.totalAmount,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 Ms}}class os{constructor(e){h(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`
2027
2027
  <div class="box-container">
2028
2028
 
2029
2029
  <div class="container-center h-[40vh] hidden mx-auto" id="shared-error-container">
@@ -2057,4 +2057,4 @@ or you can use record.mirror to access the mirror instance during recording.`;le
2057
2057
 
2058
2058
  </div>
2059
2059
  </div>
2060
- `}}class Tl{constructor(){h(this,"modalContainer");h(this,"mainLayout");h(this,"encryption");h(this,"mainScreen");h(this,"merchantConfigService");h(this,"mainError");h(this,"mainLoader");h(this,"merchantPlanDetail",{});h(this,"merchantKey");h(this,"planId");h(this,"email");h(this,"amount");h(this,"name");h(this,"rdtCode");h(this,"url");h(this,"phoneNumber");h(this,"code");h(this,"reference");h(this,"currency");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"countryCode");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.countryCode="",this.modalContainer.innerHTML=En,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};Ts(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=>{hi.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:a,rdtCode:l,reference:d,currency:v,url:p,callBackUrl:g,metadata:f,localCurrency:y,countryCode:k,phoneNumber:C,name:S}=e;if(this.merchantKey=o||"",this.email=i||"",this.amount=a||0,this.encryption=t||"",this.planId=s||"",this.rdtCode=l||"",this.reference=d||Bs(),this.url=p||"",this.callBackUrl=g||"",this.metadata=f||{},this.countryCode=k||"",this.phoneNumber=C||"",this.name=S||"",!o||!i)throw this.mainError=new os(this.mainLayout),this.mainError.renderContent(this.callBackUrl),this.showErrorIcon(),new Error("Merchant key or email is required");this.currency=v||"",this.merchantConfigService=new nl({token:this.merchantKey,rdtCode:this.rdtCode,url:this.url}),this.localCurrency=y||"",this.mainScreen=new Al({container:this.mainLayout,modalContainer:this.modalContainer,merchantKey:o,encryption:this.encryption,planId:this.planId,amount:this.amount,rdtCode:this.rdtCode,url:this.url,code:this.code,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,countryCode:this.countryCode,customerDetails:{email:i||this.email,...this.name?{name:this.name}:{},...this.phoneNumber?{phoneNumber:this.phoneNumber}:{}},closePayment:this.closePayment.bind(this)}),this.mainLoader=new Ne(this.mainLayout),this.mainError=new os(this.mainLayout),this.mainLoader.mountLoader(),this.getPlanDetails()}getAvailableChannels(){var s,a;const e=((s=this.merchantPlanDetail)==null?void 0:s.paymentMethods)??[],i=((a=this.merchantPlanDetail)==null?void 0:a.limits)??[],t=[],o=[];return e.forEach(l=>{const d=i.find(v=>v.channel===l);!d||this.amount<=d.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(async i=>{var a,l;if(i.taxEnabled){const d=await Is(this.merchantKey,this.localCurrency!==this.currency?this.amount*i.rate.rate:this.amount,e,this.rdtCode,this.url);this.merchantPlanDetail={...i,totalAmount:d.totalAmount,taxQuoteId:d.id}}else 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(((a=this.merchantPlanDetail)==null?void 0:a.limits)&&this.merchantPlanDetail.limits.length>0&&(t.length===0||t[0]==="ussd"&&t.length===1)){const d=new Ll(this.mainLayout);this.mainError=d;let v=0;throw(l=this.merchantPlanDetail)!=null&&l.limits&&this.merchantPlanDetail.limits.length>0&&(v=Math.max(...this.merchantPlanDetail.limits.map(p=>p.amount))),d.setLimitInfo(e,v),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",xl))}closeModal(){this.modalContainer&&this.modalContainer.parentNode&&document.body.removeChild(this.modalContainer),this.mainScreen.closeModal()}}De.CheckoutForm=Tl,Object.defineProperty(De,Symbol.toStringTag,{value:"Module"})});
2060
+ `}}class Tl{constructor(){h(this,"modalContainer");h(this,"mainLayout");h(this,"encryption");h(this,"mainScreen");h(this,"merchantConfigService");h(this,"mainError");h(this,"mainLoader");h(this,"merchantPlanDetail",{});h(this,"merchantKey");h(this,"planId");h(this,"email");h(this,"amount");h(this,"name");h(this,"rdtCode");h(this,"url");h(this,"phoneNumber");h(this,"code");h(this,"reference");h(this,"currency");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"countryCode");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.countryCode="",this.modalContainer.innerHTML=En,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};Ts(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=>{hi.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:a,rdtCode:l,reference:d,currency:v,url:p,callBackUrl:g,metadata:f,localCurrency:y,countryCode:k,phoneNumber:C,name:S}=e;if(this.merchantKey=o||"",this.email=i||"",this.amount=a||0,this.encryption=t||"",this.planId=s||"",this.rdtCode=l||"",this.reference=d||Bs(),this.url=p||"",this.callBackUrl=g||"",this.metadata=f||{},this.countryCode=k||"",this.phoneNumber=C||"",this.name=S||"",!o||!i)throw this.mainError=new os(this.mainLayout),this.mainError.renderContent(this.callBackUrl),this.showErrorIcon(),new Error("Merchant key or email is required");this.currency=v||"",this.merchantConfigService=new ol({token:this.merchantKey,rdtCode:this.rdtCode,url:this.url}),this.localCurrency=y||"",this.mainScreen=new Al({container:this.mainLayout,modalContainer:this.modalContainer,merchantKey:o,encryption:this.encryption,planId:this.planId,amount:this.amount,rdtCode:this.rdtCode,url:this.url,code:this.code,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,countryCode:this.countryCode,customerDetails:{email:i||this.email,...this.name?{name:this.name}:{},...this.phoneNumber?{phoneNumber:this.phoneNumber}:{}},closePayment:this.closePayment.bind(this)}),this.mainLoader=new Ne(this.mainLayout),this.mainError=new os(this.mainLayout),this.mainLoader.mountLoader(),this.getPlanDetails()}getAvailableChannels(){var s,a;const e=((s=this.merchantPlanDetail)==null?void 0:s.paymentMethods)??[],i=((a=this.merchantPlanDetail)==null?void 0:a.limits)??[],t=[],o=[];return e.forEach(l=>{const d=i.find(v=>v.channel===l);!d||this.amount<=d.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(async i=>{var a,l;if(i.taxEnabled){const d=await Is(this.merchantKey,this.localCurrency!==this.currency?this.amount*i.rate.rate:this.amount,e,this.rdtCode,this.url);this.merchantPlanDetail={...i,totalAmount:d.totalAmount,taxQuoteId:d.id}}else 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(((a=this.merchantPlanDetail)==null?void 0:a.limits)&&this.merchantPlanDetail.limits.length>0&&(t.length===0||t[0]==="ussd"&&t.length===1)){const d=new Ll(this.mainLayout);this.mainError=d;let v=0;throw(l=this.merchantPlanDetail)!=null&&l.limits&&this.merchantPlanDetail.limits.length>0&&(v=Math.max(...this.merchantPlanDetail.limits.map(p=>p.amount))),d.setLimitInfo(e,v),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",xl))}closeModal(){this.modalContainer&&this.modalContainer.parentNode&&document.body.removeChild(this.modalContainer),this.mainScreen.closeModal()}}De.CheckoutForm=Tl,Object.defineProperty(De,Symbol.toStringTag,{value:"Module"})});