@thepayulink/checkout 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/payulink-checkout.cjs +34 -36
- package/dist/payulink-checkout.esm.js +34 -36
- package/dist/payulink-checkout.umd.js +34 -36
- package/package.json +2 -4
- package/src/index.js +13 -25
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var j=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var ae=Object.prototype.hasOwnProperty;var te=(a,i)=>{for(var r in i)j(a,r,{get:i[r],enumerable:!0})},re=(a,i,r,y)=>{if(i&&typeof i=="object"||typeof i=="function")for(let h of le(i))!ae.call(a,h)&&h!==r&&j(a,h,{get:()=>i[h],enumerable:!(y=ee(i,h))||y.enumerable});return a};var ie=a=>re(j({},"__esModule",{value:!0}),a);var de={};te(de,{default:()=>w});module.exports=ie(de);var oe=`
|
|
2
2
|
#pl-overlay * { box-sizing: border-box; margin: 0; padding: 0; }
|
|
3
3
|
#pl-overlay { --pl-blue:#3395ff; --pl-blue-dark:#1f86f5; --pl-brand:#0b3068; --pl-ink:#1a2a44; --pl-mut:#6b7c93; --pl-line:#eceff4;
|
|
4
4
|
position: fixed; inset: 0; z-index: 2147483000; font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
@@ -237,7 +237,7 @@ var Z=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var fe=Object
|
|
|
237
237
|
#pl-overlay .pl-approw { justify-content: center; }
|
|
238
238
|
#pl-overlay .pl-validrow { margin: 0 auto; }
|
|
239
239
|
}
|
|
240
|
-
`,
|
|
240
|
+
`,B=!1;function U(a=document){if(B&&a.getElementById("pl-checkout-styles"))return;let i=a.createElement("style");i.id="pl-checkout-styles",i.textContent=oe,a.head.appendChild(i),B=!0}var ne=a=>"\u20B9"+Number(a||0).toLocaleString("en-IN",{maximumFractionDigits:2}),pe=a=>`${Math.floor(a/60)}:${a%60<10?"0":""}${a%60}`,c=a=>String(a==null?"":a).replace(/[&<>"]/g,i=>({"&":"&","<":"<",">":">",'"':"""})[i]),m=a=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${a}</svg>`,b={qr:m('<rect width="5" height="5" x="3" y="3" rx="1"/><rect width="5" height="5" x="16" y="3" rx="1"/><rect width="5" height="5" x="3" y="16" rx="1"/><path d="M21 16h-3a2 2 0 0 0-2 2v3"/><path d="M21 21v.01"/><path d="M12 7v3a2 2 0 0 1-2 2H7"/><path d="M3 12h.01"/><path d="M12 3h.01"/><path d="M12 16v.01"/><path d="M16 12h1"/><path d="M21 12v.01"/><path d="M12 21v-1"/>'),card:m('<rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/>'),netbanking:m('<path d="M10 18v-7"/><path d="M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z"/><path d="M14 18v-7"/><path d="M18 18v-7"/><path d="M3 22h18"/><path d="M6 18v-7"/>'),wallet:m('<path d="M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"/><path d="M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"/>'),emi:m('<path d="M16 14v2.2l1.6 1"/><path d="M16 2v4"/><path d="M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5"/><path d="M3 10h5"/><path d="M8 2v4"/><circle cx="16" cy="16" r="6"/>'),back:m('<path d="M15 18l-6-6 6-6"/>'),mail:m('<rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-10 5L2 7"/>'),arrow:m('<path d="M5 12h14M13 6l6 6-6 6"/>'),verified:m('<path d="M9 12l2 2 4-4"/><circle cx="12" cy="12" r="10"/>'),lock:m('<rect width="18" height="11" x="3" y="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>')},O='<svg width="13" height="13" viewBox="0 0 24 24" fill="currentColor"><path d="M12 1l9 4v6c0 5.5-3.8 10.7-9 12-5.2-1.3-9-6.5-9-12V5l9-4z"/></svg>',se=[{m:"card",t:"Cards",s:"Visa, Mastercard & RuPay",ic:"card"},{m:"netbanking",t:"Netbanking",s:"All Indian banks",ic:"netbanking"},{m:"wallet",t:"Wallet",s:"Paytm, PhonePe & more",ic:"wallet"},{m:"emi",t:"EMI",s:"EMI via cards & more",ic:"emi"}];function R(a){U(),a=Object.assign({name:"Payment",description:"",amount:0,assetBase:"/assets",logo:"/assets/payulink-logo.png",prefill:{},apiBase:""},a);let i=String(a.apiBase||"").replace(/\/$/,""),r=ne(a.amount),y=["gpay","phonepe","paytm","bhim","amazonpay"].reduce((e,t)=>(e[t]=`${a.assetBase}/upi/${t}.png`,e),{}),h=["phonepe","gpay","paytm","bhim","amazonpay"],l={screen:"loader",order:null,customer:null,timer:null,stop:null,done:!1,utr:null,expiryMs:null},n=document.createElement("div");n.id="pl-overlay",a.brandColor&&n.style.setProperty("--pl-brand",a.brandColor),n.innerHTML=`
|
|
241
241
|
<div class="pl-modal" role="dialog" aria-modal="true">
|
|
242
242
|
<div class="pl-splash" id="pl-splash">
|
|
243
243
|
<div class="pl-shield">
|
|
@@ -246,87 +246,87 @@ var Z=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var fe=Object
|
|
|
246
246
|
<path d="M60 3 L113 25 V70 C113 105 90 128 60 137 C30 128 7 105 7 70 V25 Z" fill="url(#pl-shgrad)"/>
|
|
247
247
|
</svg>
|
|
248
248
|
<span class="pl-shield-shine"></span>
|
|
249
|
-
<img class="pl-shield-logo" src="${
|
|
249
|
+
<img class="pl-shield-logo" src="${c(a.assetBase)}/payulink-logo.png" alt="payulink">
|
|
250
250
|
</div>
|
|
251
|
-
<div class="pl-splash-foot">Secured By <span class="pl-pb"><img src="${
|
|
251
|
+
<div class="pl-splash-foot">Secured By <span class="pl-pb"><img src="${c(a.assetBase)}/payulink-logo.png" alt=""><strong>payulink</strong></span></div>
|
|
252
252
|
</div>
|
|
253
253
|
<aside class="pl-left">
|
|
254
254
|
<div class="pl-brandrow">
|
|
255
|
-
<div class="pl-logo"><img src="${
|
|
255
|
+
<div class="pl-logo"><img src="${c(a.logo)}" alt=""></div>
|
|
256
256
|
<div class="pl-bmeta">
|
|
257
|
-
<div class="pl-bname">${
|
|
258
|
-
<div class="pl-btrust">${
|
|
257
|
+
<div class="pl-bname">${c(a.name)}</div>
|
|
258
|
+
<div class="pl-btrust">${b.verified}<span>Trusted Business</span></div>
|
|
259
259
|
</div>
|
|
260
260
|
</div>
|
|
261
261
|
<div class="pl-summary">
|
|
262
262
|
<div class="pl-sl">Price Summary</div>
|
|
263
|
-
<div class="pl-samt">${
|
|
264
|
-
<div class="pl-snote">${
|
|
263
|
+
<div class="pl-samt">${r}</div>
|
|
264
|
+
<div class="pl-snote">${c(a.note||"Paying for "+(a.description||a.name))}</div>
|
|
265
265
|
</div>
|
|
266
266
|
<svg class="pl-illus" viewBox="0 0 230 150" fill="none"><rect x="20" y="70" width="58" height="68" rx="5" fill="#fff" fill-opacity=".92"/><path d="M33 70c0-10 5-16 16-16s16 6 16 16" stroke="#fff" stroke-width="3.5"/><rect x="88" y="55" width="68" height="83" rx="5" fill="#fff"/><path d="M104 55c0-12 6-19 18-19s18 7 18 19" stroke="#fff" stroke-width="3.5"/><rect x="150" y="92" width="52" height="46" rx="4" fill="#fff" fill-opacity=".92"/><circle cx="178" cy="40" r="18" fill="#fff"/><path d="M178 30v20M168 40h20" stroke="currentColor" stroke-width="3.5" opacity=".5"/></svg>
|
|
267
|
-
<div class="pl-secured">${
|
|
267
|
+
<div class="pl-secured">${O}Secured by <span class="pl-pb"><img src="${c(a.assetBase)}/payulink-logo.png" alt=""><strong>payulink</strong></span></div>
|
|
268
268
|
</aside>
|
|
269
269
|
<section class="pl-main">
|
|
270
270
|
<header class="pl-head">
|
|
271
|
-
<button class="pl-hic pl-back" id="pl-back" aria-label="Back">${
|
|
271
|
+
<button class="pl-hic pl-back" id="pl-back" aria-label="Back">${b.back}</button>
|
|
272
272
|
<div class="pl-title" id="pl-title">Payment Options</div>
|
|
273
273
|
<button class="pl-hic pl-dots" aria-label="More">\u22EF</button>
|
|
274
274
|
<button class="pl-hic pl-close-x" id="pl-close" aria-label="Close">\xD7</button>
|
|
275
275
|
</header>
|
|
276
276
|
<div class="pl-vp"><div class="pl-screen pl-active" id="pl-screen"></div></div>
|
|
277
|
-
<footer class="pl-foot">${
|
|
277
|
+
<footer class="pl-foot">${b.lock}<span>Encrypted & secure payments</span></footer>
|
|
278
278
|
</section>
|
|
279
|
-
</div>`,document.body.appendChild(
|
|
279
|
+
</div>`,document.body.appendChild(n);let x=document.body.style.overflow;document.body.style.overflow="hidden";let $=n.querySelector(".pl-vp"),S=n.querySelector("#pl-title"),z=n.querySelector("#pl-back");function k(){d(),a.onDismiss&&a.onDismiss()}function d(){if(l.stop)try{l.stop()}catch{}clearInterval(l.timer),n.classList.add("pl-closing"),document.body.style.overflow=x,setTimeout(()=>n.remove(),240)}n.querySelector("#pl-close").onclick=k,n.addEventListener("mousedown",e=>{e.target.id==="pl-overlay"&&k()}),z.onclick=()=>{l.screen==="contact"||l.screen==="success"||s("options")};let u={loader:"Payment Options",contact:"Contact Details",options:"Payment Options",success:"Payment Successful"};function s(e){l.screen=e,S.textContent=u[e]||"Payment",z.classList.toggle("pl-show",e==="options"),clearInterval(l.timer);let t=document.createElement("div");t.className="pl-screen pl-active"+(e==="options"?" pl-screen-options":""),t.innerHTML=f[e]?f[e]():"",$.replaceChildren(t),N(e,t)}let g=h.slice(0,4).map(e=>`<img src="${y[e]}" alt="">`).join(""),C=h.map(e=>`<a class="pl-uapp" data-app="${e}" title="${e}"><img src="${y[e]}" alt="${e}"></a>`).join(""),f={loader:()=>`<div class="pl-loader"><div class="pl-bload"><img src="${c(a.logo)}" alt=""><span class="pl-bring"></span><span class="pl-bripple"></span><span class="pl-bripple pl-bripple2"></span></div><p>Securely loading payment options\u2026</p></div>`,contact:()=>`
|
|
280
280
|
<div class="pl-pad">
|
|
281
281
|
<div class="pl-h1">Contact details</div>
|
|
282
282
|
<div class="pl-sub">Enter your details to continue the payment</div>
|
|
283
283
|
<div class="pl-field"><label>Full Name</label>
|
|
284
|
-
<input class="pl-input" id="pl-name" type="text" placeholder="Enter your name" value="${
|
|
284
|
+
<input class="pl-input" id="pl-name" type="text" placeholder="Enter your name" value="${c(a.prefill.name||"")}"></div>
|
|
285
285
|
<div class="pl-field"><label>Mobile Number</label>
|
|
286
286
|
<div class="pl-phone"><div class="pl-cc">+91</div>
|
|
287
|
-
<input class="pl-input" id="pl-mobile" type="tel" maxlength="10" placeholder="Enter mobile number" value="${
|
|
287
|
+
<input class="pl-input" id="pl-mobile" type="tel" maxlength="10" placeholder="Enter mobile number" value="${c(a.prefill.contact||"")}"></div></div>
|
|
288
288
|
<div class="pl-field"><label>Email Address <span class="pl-opt">(optional)</span></label>
|
|
289
|
-
<div class="pl-inwrap"><span class="pl-inicon">${
|
|
290
|
-
<input class="pl-input pl-padleft" id="pl-email" type="email" placeholder="Enter email address" value="${
|
|
291
|
-
<button class="pl-cta" id="pl-continue">Continue <span class="pl-cta-arr">${
|
|
289
|
+
<div class="pl-inwrap"><span class="pl-inicon">${b.mail}</span>
|
|
290
|
+
<input class="pl-input pl-padleft" id="pl-email" type="email" placeholder="Enter email address" value="${c(a.prefill.email||"")}"></div></div>
|
|
291
|
+
<button class="pl-cta" id="pl-continue">Continue <span class="pl-cta-arr">${b.arrow}</span></button>
|
|
292
292
|
<div class="pl-err" id="pl-cerr"></div>
|
|
293
|
-
<div class="pl-trust">${
|
|
293
|
+
<div class="pl-trust">${O}100% secure payments</div>
|
|
294
294
|
</div>`,options:()=>`
|
|
295
295
|
<div class="pl-options">
|
|
296
296
|
<div class="pl-nav" id="pl-nav">
|
|
297
297
|
<div class="pl-navlabel">Recommended</div>
|
|
298
298
|
<div class="pl-navitem active" data-m="upi">
|
|
299
|
-
<div class="pl-ni-ic">${
|
|
299
|
+
<div class="pl-ni-ic">${b.qr}</div>
|
|
300
300
|
<div class="pl-ni-body"><div class="pl-ni-t">UPI</div></div>
|
|
301
|
-
<div class="pl-ni-apps">${
|
|
301
|
+
<div class="pl-ni-apps">${g}</div>
|
|
302
302
|
</div>
|
|
303
303
|
<div class="pl-navlabel">Cards, Banking & More</div>
|
|
304
|
-
${
|
|
305
|
-
<div class="pl-navitem pl-disabled" data-m="${
|
|
306
|
-
<div class="pl-ni-ic pl-ic-${
|
|
307
|
-
<div class="pl-ni-body"><div class="pl-ni-t">${
|
|
304
|
+
${se.map(e=>`
|
|
305
|
+
<div class="pl-navitem pl-disabled" data-m="${e.m}">
|
|
306
|
+
<div class="pl-ni-ic pl-ic-${e.ic}">${b[e.ic]}</div>
|
|
307
|
+
<div class="pl-ni-body"><div class="pl-ni-t">${e.t}</div><div class="pl-ni-s">${e.s}</div></div>
|
|
308
308
|
<span class="pl-soon">Coming soon</span>
|
|
309
309
|
</div>`).join("")}
|
|
310
310
|
</div>
|
|
311
|
-
<div class="pl-pane" id="pl-pane">${
|
|
312
|
-
</div>`,success:()=>{let
|
|
311
|
+
<div class="pl-pane" id="pl-pane">${A()}</div>
|
|
312
|
+
</div>`,success:()=>{let e=["#00c060","#3395ff","#ffb020","#ff5a5f","#7a52d8","#19c3c3"];return`
|
|
313
313
|
<div class="pl-success">
|
|
314
314
|
<div class="pl-burst">
|
|
315
|
-
${Array.from({length:18},(
|
|
315
|
+
${Array.from({length:18},(o,p)=>{let v=p/18*Math.PI*2+(p%2?.22:-.22),M=60+p*13%40,F=Math.round(Math.cos(v)*M),G=Math.round(Math.sin(v)*M),W=e[p%e.length],Z=(p%2?1:-1)*(140+p*14),J=p%3===0?6:8,K=p%4===0?6:12;return`<i class="pl-confetti" style="--tx:${F}px;--ty:${G}px;--c:${W};--r:${Z}deg;width:${J}px;height:${K}px;border-radius:${p%4===0?"50%":"2px"};animation-delay:${(.15+p*.024).toFixed(3)}s"></i>`}).join("")}
|
|
316
316
|
<span class="pl-ripple"></span><span class="pl-ripple pl-ripple2"></span>
|
|
317
317
|
<div class="pl-check"><svg viewBox="0 0 24 24"><path d="M5 13l4 4L19 7"/></svg></div>
|
|
318
318
|
</div>
|
|
319
319
|
<h2>Payment Successful</h2>
|
|
320
|
-
<p>${
|
|
321
|
-
<div class="pl-pid" id="pl-pid">${
|
|
322
|
-
${
|
|
323
|
-
</div>`}};function
|
|
320
|
+
<p>${r} paid${a.name?" to "+c(a.name):""}</p>
|
|
321
|
+
<div class="pl-pid" id="pl-pid">${c(l.order&&l.order.merchant_order_no||"")}</div>
|
|
322
|
+
${l.utr?`<div class="pl-pid pl-utr">UTR ${c(l.utr)}</div>`:""}
|
|
323
|
+
</div>`}};function A(){return`
|
|
324
324
|
<div class="pl-paneh">UPI QR</div>
|
|
325
325
|
<div class="pl-qrcard">
|
|
326
326
|
<div class="pl-qrbox" id="pl-qr"><div class="pl-qrloading"></div></div>
|
|
327
327
|
<div class="pl-qrside">
|
|
328
328
|
<div class="pl-scan">Scan the QR using any UPI App</div>
|
|
329
|
-
<div class="pl-approw" id="pl-applist">${
|
|
329
|
+
<div class="pl-approw" id="pl-applist">${C}</div>
|
|
330
330
|
<div class="pl-validrow"><span class="pl-dot"></span><span id="pl-timer">Valid 5:00</span></div>
|
|
331
331
|
</div>
|
|
332
332
|
</div>
|
|
@@ -335,6 +335,4 @@ var Z=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var fe=Object
|
|
|
335
335
|
<input class="pl-vpa" id="pl-vpa" placeholder="example@okhdfcbank" autocomplete="off" spellcheck="false">
|
|
336
336
|
<button class="pl-verify" id="pl-verify">Verify and Pay</button>
|
|
337
337
|
</div>
|
|
338
|
-
<div id="pl-status" class="pl-pendrow"><span class="pl-mini-spin"></span> Waiting for payment\u2026</div>`}function J(f,p){if(f==="contact")p.querySelector("#pl-continue").onclick=()=>{let k=p.querySelector("#pl-name").value.trim(),M=p.querySelector("#pl-mobile").value.replace(/\D/g,""),I=p.querySelector("#pl-email").value.trim(),H=p.querySelector("#pl-cerr");if(k.length<2)return H.textContent="Please enter your name";if(M.length!==10)return H.textContent="Enter a valid 10-digit mobile number";r.customer={name:k,mobile:M,email:I},C("options")};else if(f==="options"){p.querySelectorAll(".pl-navitem").forEach(M=>M.onclick=()=>{M.dataset.m!=="upi"&&T("Coming soon \u2014 please pay via UPI / QR for now")});let k=p.querySelector("#pl-verify");k&&(k.onclick=()=>{let M=(p.querySelector("#pl-vpa").value||"").trim();if(!/^[\w.\-]{2,}@[a-zA-Z]{2,}$/.test(M))return p.querySelector("#pl-vpa").focus(),T("Enter a valid UPI ID, e.g. name@okhdfcbank");let I=r.order&&(r.order.upi_intent_url||r.order.payment_link);I&&/Android|iPhone|iPad|Mobile/i.test(navigator.userAgent)?location.href=I:T("Scan the QR with your phone\u2019s UPI app to complete the payment.")}),B(),R(!0)}}let z=!1;async function R(f){if(f||C("options"),r.order){G();return}if(!z){z=!0;try{r.customer||(r.customer={name:o.prefill.name||"Customer",mobile:(o.prefill.contact||"").replace(/\D/g,""),email:o.prefill.email||""}),r.order=await o.createOrder(r.customer),G(),d()}catch(p){let k=t.querySelector("#pl-qr");if(k){k.innerHTML=`<div class="pl-qrerr"><span>${L(p.message||"Could not start payment")}</span><button class="pl-retry" id="pl-retry">Try again</button></div>`;let M=k.querySelector("#pl-retry");M&&(M.onclick=()=>{z=!1,k.innerHTML='<div class="pl-qrloading"></div>',R(!0)})}}finally{z=!1}}}function G(){let f=r.order;if(!f)return;l(f);let p=t.querySelector("#pl-qr");p&&(f.qr_data_url?p.innerHTML=`<img src="${f.qr_data_url}" alt="UPI QR">`:p.innerHTML='<div class="pl-qrerr"><span>QR unavailable \u2014 use a UPI app below</span></div>');let k=f.upi_intent_url||f.payment_link||"#",M=t.querySelector("#pl-applist");M&&M.querySelectorAll(".pl-uapp").forEach(I=>{I.setAttribute("href",k),I.setAttribute("target","_blank"),I.setAttribute("rel","noopener")}),B()}function l(f){f&&f.expires_at&&f.server_now?r.expiryMs=Date.now()+Math.max(0,f.expires_at-f.server_now):r.expiryMs||(r.expiryMs=Date.now()+5*60*1e3)}function u(){if(r.done)return;let f=t.querySelector("#pl-qr");f&&(f.innerHTML='<div class="pl-qrerr"><span>QR code expired</span><button class="pl-retry" id="pl-regen">Generate new QR</button></div>');let p=t.querySelector("#pl-regen");p&&(p.onclick=n);let k=t.querySelector("#pl-timer");k&&(k.textContent="Expired");let M=t.querySelector(".pl-validrow");M&&M.classList.add("pl-expired")}function n(){if(r.stop){try{r.stop()}catch{}r.stop=null}r.order=null,r.expiryMs=null,z=!1;let f=t.querySelector(".pl-validrow");f&&f.classList.remove("pl-expired");let p=t.querySelector("#pl-qr");p&&(p.innerHTML='<div class="pl-qrloading"></div>'),R(!0)}function d(){!r.order||r.stop||(r.stop=o.watchOrder(r.order.merchant_order_no,f=>{!f||typeof f.status!="number"||(f.status===0?(r.utr=f.utr||r.utr,v()):f.status===3?(clearInterval(r.timer),r.expiryMs=Date.now(),u(),s("failed","QR expired \u2014 generate a new one")):[1,4].includes(f.status)?s("failed","Payment "+(f.status_label||"failed").toLowerCase()):f.status===6&&s("pending","Processing payment\u2026"))}))}function s(f,p){let k=t.querySelector("#pl-status");k&&(k.className=f==="failed"?"pl-pendrow pl-fail":"pl-pendrow",k.innerHTML=(f==="pending"?'<span class="pl-mini-spin"></span> ':"")+L(p))}function v(){r.done||(r.done=!0,clearInterval(r.timer),C("success"),o.onSuccess&&o.onSuccess({merchant_order_no:r.order.merchant_order_no,utr:r.utr,amount:o.amount}),r.utr||w())}async function w(){for(let f=0;f<10&&!r.utr;f++){await new Promise(p=>setTimeout(p,4e3));try{let p=await fetch(`${g}/api/order/${r.order.merchant_order_no}`).then(k=>k.json());if(p.utr){r.utr=p.utr;let k=t.querySelector("#pl-pid");k&&r.screen==="success"&&k.insertAdjacentHTML("afterend",`<div class="pl-pid pl-utr">UTR ${L(p.utr)}</div>`);break}}catch{}}}function B(){clearInterval(r.timer);let f=()=>{let p=t.querySelector("#pl-timer");if(!p)return;if(!r.expiryMs){p.textContent="Valid 5:00";return}let k=Math.max(0,Math.round((r.expiryMs-Date.now())/1e3));p.textContent=k>0?"Valid "+me(k):"Expired",k<=0&&(clearInterval(r.timer),u())};f(),r.timer=setInterval(f,1e3)}function T(f){let p=document.getElementById("pl-toast");p||(p=document.createElement("div"),p.id="pl-toast",document.body.appendChild(p)),p.textContent=f,p.classList.add("pl-show"),clearTimeout(p._t),p._t=setTimeout(()=>p.classList.remove("pl-show"),2600)}return C("loader"),setTimeout(()=>{let f=o.prefill||{};f.name&&(f.contact||"").replace(/\D/g,"").length===10?(r.customer={name:f.name,mobile:f.contact.replace(/\D/g,""),email:f.email||""},C("options")):C("contact");let p=t.querySelector("#pl-splash");p&&(p.classList.add("pl-splash-hide"),setTimeout(()=>p.remove(),450))},1600),{close:y}}var Q=function(o,g){let a=o,r=F[g],t=null,e=0,h=null,m=[],b={},x=function(l,u){e=a*4+17,t=function(n){let d=new Array(n);for(let s=0;s<n;s+=1){d[s]=new Array(n);for(let v=0;v<n;v+=1)d[s][v]=null}return d}(e),y(0,0),y(e-7,0),y(0,e-7),A(),C(),E(l,u),a>=7&&P(l),h==null&&(h=z(a,r,m)),S(h,u)},y=function(l,u){for(let n=-1;n<=7;n+=1)if(!(l+n<=-1||e<=l+n))for(let d=-1;d<=7;d+=1)u+d<=-1||e<=u+d||(0<=n&&n<=6&&(d==0||d==6)||0<=d&&d<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=d&&d<=4?t[l+n][u+d]=!0:t[l+n][u+d]=!1)},_=function(){let l=0,u=0;for(let n=0;n<8;n+=1){x(!0,n);let d=N.getLostPoint(b);(n==0||l>d)&&(l=d,u=n)}return u},C=function(){for(let l=8;l<e-8;l+=1)t[l][6]==null&&(t[l][6]=l%2==0);for(let l=8;l<e-8;l+=1)t[6][l]==null&&(t[6][l]=l%2==0)},A=function(){let l=N.getPatternPosition(a);for(let u=0;u<l.length;u+=1)for(let n=0;n<l.length;n+=1){let d=l[u],s=l[n];if(t[d][s]==null)for(let v=-2;v<=2;v+=1)for(let w=-2;w<=2;w+=1)v==-2||v==2||w==-2||w==2||v==0&&w==0?t[d+v][s+w]=!0:t[d+v][s+w]=!1}},P=function(l){let u=N.getBCHTypeNumber(a);for(let n=0;n<18;n+=1){let d=!l&&(u>>n&1)==1;t[Math.floor(n/3)][n%3+e-8-3]=d}for(let n=0;n<18;n+=1){let d=!l&&(u>>n&1)==1;t[n%3+e-8-3][Math.floor(n/3)]=d}},E=function(l,u){let n=r<<3|u,d=N.getBCHTypeInfo(n);for(let s=0;s<15;s+=1){let v=!l&&(d>>s&1)==1;s<6?t[s][8]=v:s<8?t[s+1][8]=v:t[e-15+s][8]=v}for(let s=0;s<15;s+=1){let v=!l&&(d>>s&1)==1;s<8?t[8][e-s-1]=v:s<9?t[8][15-s-1+1]=v:t[8][15-s-1]=v}t[e-8][8]=!l},S=function(l,u){let n=-1,d=e-1,s=7,v=0,w=N.getMaskFunction(u);for(let B=e-1;B>0;B-=2)for(B==6&&(B-=1);;){for(let T=0;T<2;T+=1)if(t[d][B-T]==null){let f=!1;v<l.length&&(f=(l[v]>>>s&1)==1),w(d,B-T)&&(f=!f),t[d][B-T]=f,s-=1,s==-1&&(v+=1,s=7)}if(d+=n,d<0||e<=d){d-=n,n=-n;break}}},J=function(l,u){let n=0,d=0,s=0,v=new Array(u.length),w=new Array(u.length);for(let p=0;p<u.length;p+=1){let k=u[p].dataCount,M=u[p].totalCount-k;d=Math.max(d,k),s=Math.max(s,M),v[p]=new Array(k);for(let $=0;$<v[p].length;$+=1)v[p][$]=255&l.getBuffer()[$+n];n+=k;let I=N.getErrorCorrectPolynomial(M),K=V(v[p],I.getLength()-1).mod(I);w[p]=new Array(I.getLength()-1);for(let $=0;$<w[p].length;$+=1){let X=$+K.getLength()-w[p].length;w[p][$]=X>=0?K.getAt(X):0}}let B=0;for(let p=0;p<u.length;p+=1)B+=u[p].totalCount;let T=new Array(B),f=0;for(let p=0;p<d;p+=1)for(let k=0;k<u.length;k+=1)p<v[k].length&&(T[f]=v[k][p],f+=1);for(let p=0;p<s;p+=1)for(let k=0;k<u.length;k+=1)p<w[k].length&&(T[f]=w[k][p],f+=1);return T},z=function(l,u,n){let d=ne.getRSBlocks(l,u),s=oe();for(let w=0;w<n.length;w+=1){let B=n[w];s.put(B.getMode(),4),s.put(B.getLength(),N.getLengthInBits(B.getMode(),l)),B.write(s)}let v=0;for(let w=0;w<d.length;w+=1)v+=d[w].dataCount;if(s.getLengthInBits()>v*8)throw"code length overflow. ("+s.getLengthInBits()+">"+v*8+")";for(s.getLengthInBits()+4<=v*8&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;!(s.getLengthInBits()>=v*8||(s.put(236,8),s.getLengthInBits()>=v*8));)s.put(17,8);return J(s,d)};b.addData=function(l,u){u=u||"Byte";let n=null;switch(u){case"Numeric":n=we(l);break;case"Alphanumeric":n=ke(l);break;case"Byte":n=_e(l);break;case"Kanji":n=Me(l);break;default:throw"mode:"+u}m.push(n),h=null},b.isDark=function(l,u){if(l<0||e<=l||u<0||e<=u)throw l+","+u;return t[l][u]},b.getModuleCount=function(){return e},b.make=function(){if(a<1){let l=1;for(;l<40;l++){let u=ne.getRSBlocks(l,r),n=oe();for(let s=0;s<m.length;s++){let v=m[s];n.put(v.getMode(),4),n.put(v.getLength(),N.getLengthInBits(v.getMode(),l)),v.write(n)}let d=0;for(let s=0;s<u.length;s++)d+=u[s].dataCount;if(n.getLengthInBits()<=d*8)break}a=l}x(!1,_())},b.createTableTag=function(l,u){l=l||2,u=typeof u=="undefined"?l*4:u;let n="";n+='<table style="',n+=" border-width: 0px; border-style: none;",n+=" border-collapse: collapse;",n+=" padding: 0px; margin: "+u+"px;",n+='">',n+="<tbody>";for(let d=0;d<b.getModuleCount();d+=1){n+="<tr>";for(let s=0;s<b.getModuleCount();s+=1)n+='<td style="',n+=" border-width: 0px; border-style: none;",n+=" border-collapse: collapse;",n+=" padding: 0px; margin: 0px;",n+=" width: "+l+"px;",n+=" height: "+l+"px;",n+=" background-color: ",n+=b.isDark(d,s)?"#000000":"#ffffff",n+=";",n+='"/>';n+="</tr>"}return n+="</tbody>",n+="</table>",n},b.createSvgTag=function(l,u,n,d){let s={};typeof arguments[0]=="object"&&(s=arguments[0],l=s.cellSize,u=s.margin,n=s.alt,d=s.title),l=l||2,u=typeof u=="undefined"?l*4:u,n=typeof n=="string"?{text:n}:n||{},n.text=n.text||null,n.id=n.text?n.id||"qrcode-description":null,d=typeof d=="string"?{text:d}:d||{},d.text=d.text||null,d.id=d.text?d.id||"qrcode-title":null;let v=b.getModuleCount()*l+u*2,w,B,T,f,p="",k;for(k="l"+l+",0 0,"+l+" -"+l+",0 0,-"+l+"z ",p+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',p+=s.scalable?"":' width="'+v+'px" height="'+v+'px"',p+=' viewBox="0 0 '+v+" "+v+'" ',p+=' preserveAspectRatio="xMinYMin meet"',p+=d.text||n.text?' role="img" aria-labelledby="'+R([d.id,n.id].join(" ").trim())+'"':"",p+=">",p+=d.text?'<title id="'+R(d.id)+'">'+R(d.text)+"</title>":"",p+=n.text?'<description id="'+R(n.id)+'">'+R(n.text)+"</description>":"",p+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',p+='<path d="',T=0;T<b.getModuleCount();T+=1)for(f=T*l+u,w=0;w<b.getModuleCount();w+=1)b.isDark(T,w)&&(B=w*l+u,p+="M"+B+","+f+k);return p+='" stroke="transparent" fill="black"/>',p+="</svg>",p},b.createDataURL=function(l,u){l=l||2,u=typeof u=="undefined"?l*4:u;let n=b.getModuleCount()*l+u*2,d=u,s=n-u;return Te(n,n,function(v,w){if(d<=v&&v<s&&d<=w&&w<s){let B=Math.floor((v-d)/l),T=Math.floor((w-d)/l);return b.isDark(T,B)?0:1}else return 1})},b.createImgTag=function(l,u,n){l=l||2,u=typeof u=="undefined"?l*4:u;let d=b.getModuleCount()*l+u*2,s="";return s+="<img",s+=' src="',s+=b.createDataURL(l,u),s+='"',s+=' width="',s+=d,s+='"',s+=' height="',s+=d,s+='"',n&&(s+=' alt="',s+=R(n),s+='"'),s+="/>",s};let R=function(l){let u="";for(let n=0;n<l.length;n+=1){let d=l.charAt(n);switch(d){case"<":u+="<";break;case">":u+=">";break;case"&":u+="&";break;case'"':u+=""";break;default:u+=d;break}}return u},G=function(l){l=typeof l=="undefined"?1*2:l;let n=b.getModuleCount()*1+l*2,d=l,s=n-l,v,w,B,T,f,p={"\u2588\u2588":"\u2588","\u2588 ":"\u2580"," \u2588":"\u2584"," ":" "},k={"\u2588\u2588":"\u2580","\u2588 ":"\u2580"," \u2588":" "," ":" "},M="";for(v=0;v<n;v+=2){for(B=Math.floor((v-d)/1),T=Math.floor((v+1-d)/1),w=0;w<n;w+=1)f="\u2588",d<=w&&w<s&&d<=v&&v<s&&b.isDark(B,Math.floor((w-d)/1))&&(f=" "),d<=w&&w<s&&d<=v+1&&v+1<s&&b.isDark(T,Math.floor((w-d)/1))?f+=" ":f+="\u2588",M+=l<1&&v+1>=s?k[f]:p[f];M+=`
|
|
339
|
-
`}return n%2&&l>0?M.substring(0,M.length-n-1)+Array(n+1).join("\u2580"):M.substring(0,M.length-1)};return b.createASCII=function(l,u){if(l=l||1,l<2)return G(u);l-=1,u=typeof u=="undefined"?l*2:u;let n=b.getModuleCount()*l+u*2,d=u,s=n-u,v,w,B,T,f=Array(l+1).join("\u2588\u2588"),p=Array(l+1).join(" "),k="",M="";for(v=0;v<n;v+=1){for(B=Math.floor((v-d)/l),M="",w=0;w<n;w+=1)T=1,d<=w&&w<s&&d<=v&&v<s&&b.isDark(B,Math.floor((w-d)/l))&&(T=0),M+=T?f:p;for(B=0;B<l;B+=1)k+=M+`
|
|
340
|
-
`}return k.substring(0,k.length-1)},b.renderTo2dContext=function(l,u){u=u||2;let n=b.getModuleCount();for(let d=0;d<n;d++)for(let s=0;s<n;s++)l.fillStyle=b.isDark(d,s)?"black":"white",l.fillRect(s*u,d*u,u,u)},b};Q.stringToBytes=function(o){let g=[];for(let c=0;c<o.length;c+=1){let i=o.charCodeAt(c);g.push(i&255)}return g};Q.createStringToBytes=function(o,g){let c=function(){let a=Be(o),r=function(){let h=a.read();if(h==-1)throw"eof";return h},t=0,e={};for(;;){let h=a.read();if(h==-1)break;let m=r(),b=r(),x=r(),y=String.fromCharCode(h<<8|m),_=b<<8|x;e[y]=_,t+=1}if(t!=g)throw t+" != "+g;return e}(),i=63;return function(a){let r=[];for(let t=0;t<a.length;t+=1){let e=a.charCodeAt(t);if(e<128)r.push(e);else{let h=c[a.charAt(t)];typeof h=="number"?(h&255)==h?r.push(h):(r.push(h>>>8),r.push(h&255)):r.push(i)}}return r}};var D={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},F={L:1,M:0,Q:3,H:2},q={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},N=function(){let o=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],g=1335,c=7973,i=21522,a={},r=function(t){let e=0;for(;t!=0;)e+=1,t>>>=1;return e};return a.getBCHTypeInfo=function(t){let e=t<<10;for(;r(e)-r(g)>=0;)e^=g<<r(e)-r(g);return(t<<10|e)^i},a.getBCHTypeNumber=function(t){let e=t<<12;for(;r(e)-r(c)>=0;)e^=c<<r(e)-r(c);return t<<12|e},a.getPatternPosition=function(t){return o[t-1]},a.getMaskFunction=function(t){switch(t){case q.PATTERN000:return function(e,h){return(e+h)%2==0};case q.PATTERN001:return function(e,h){return e%2==0};case q.PATTERN010:return function(e,h){return h%3==0};case q.PATTERN011:return function(e,h){return(e+h)%3==0};case q.PATTERN100:return function(e,h){return(Math.floor(e/2)+Math.floor(h/3))%2==0};case q.PATTERN101:return function(e,h){return e*h%2+e*h%3==0};case q.PATTERN110:return function(e,h){return(e*h%2+e*h%3)%2==0};case q.PATTERN111:return function(e,h){return(e*h%3+(e+h)%2)%2==0};default:throw"bad maskPattern:"+t}},a.getErrorCorrectPolynomial=function(t){let e=V([1],0);for(let h=0;h<t;h+=1)e=e.multiply(V([1,j.gexp(h)],0));return e},a.getLengthInBits=function(t,e){if(1<=e&&e<10)switch(t){case D.MODE_NUMBER:return 10;case D.MODE_ALPHA_NUM:return 9;case D.MODE_8BIT_BYTE:return 8;case D.MODE_KANJI:return 8;default:throw"mode:"+t}else if(e<27)switch(t){case D.MODE_NUMBER:return 12;case D.MODE_ALPHA_NUM:return 11;case D.MODE_8BIT_BYTE:return 16;case D.MODE_KANJI:return 10;default:throw"mode:"+t}else if(e<41)switch(t){case D.MODE_NUMBER:return 14;case D.MODE_ALPHA_NUM:return 13;case D.MODE_8BIT_BYTE:return 16;case D.MODE_KANJI:return 12;default:throw"mode:"+t}else throw"type:"+e},a.getLostPoint=function(t){let e=t.getModuleCount(),h=0;for(let x=0;x<e;x+=1)for(let y=0;y<e;y+=1){let _=0,C=t.isDark(x,y);for(let A=-1;A<=1;A+=1)if(!(x+A<0||e<=x+A))for(let P=-1;P<=1;P+=1)y+P<0||e<=y+P||A==0&&P==0||C==t.isDark(x+A,y+P)&&(_+=1);_>5&&(h+=3+_-5)}for(let x=0;x<e-1;x+=1)for(let y=0;y<e-1;y+=1){let _=0;t.isDark(x,y)&&(_+=1),t.isDark(x+1,y)&&(_+=1),t.isDark(x,y+1)&&(_+=1),t.isDark(x+1,y+1)&&(_+=1),(_==0||_==4)&&(h+=3)}for(let x=0;x<e;x+=1)for(let y=0;y<e-6;y+=1)t.isDark(x,y)&&!t.isDark(x,y+1)&&t.isDark(x,y+2)&&t.isDark(x,y+3)&&t.isDark(x,y+4)&&!t.isDark(x,y+5)&&t.isDark(x,y+6)&&(h+=40);for(let x=0;x<e;x+=1)for(let y=0;y<e-6;y+=1)t.isDark(y,x)&&!t.isDark(y+1,x)&&t.isDark(y+2,x)&&t.isDark(y+3,x)&&t.isDark(y+4,x)&&!t.isDark(y+5,x)&&t.isDark(y+6,x)&&(h+=40);let m=0;for(let x=0;x<e;x+=1)for(let y=0;y<e;y+=1)t.isDark(y,x)&&(m+=1);let b=Math.abs(100*m/e/e-50)/5;return h+=b*10,h},a}(),j=function(){let o=new Array(256),g=new Array(256);for(let i=0;i<8;i+=1)o[i]=1<<i;for(let i=8;i<256;i+=1)o[i]=o[i-4]^o[i-5]^o[i-6]^o[i-8];for(let i=0;i<255;i+=1)g[o[i]]=i;let c={};return c.glog=function(i){if(i<1)throw"glog("+i+")";return g[i]},c.gexp=function(i){for(;i<0;)i+=255;for(;i>=256;)i-=255;return o[i]},c}(),V=function(o,g){if(typeof o.length=="undefined")throw o.length+"/"+g;let c=function(){let a=0;for(;a<o.length&&o[a]==0;)a+=1;let r=new Array(o.length-a+g);for(let t=0;t<o.length-a;t+=1)r[t]=o[t+a];return r}(),i={};return i.getAt=function(a){return c[a]},i.getLength=function(){return c.length},i.multiply=function(a){let r=new Array(i.getLength()+a.getLength()-1);for(let t=0;t<i.getLength();t+=1)for(let e=0;e<a.getLength();e+=1)r[t+e]^=j.gexp(j.glog(i.getAt(t))+j.glog(a.getAt(e)));return V(r,0)},i.mod=function(a){if(i.getLength()-a.getLength()<0)return i;let r=j.glog(i.getAt(0))-j.glog(a.getAt(0)),t=new Array(i.getLength());for(let e=0;e<i.getLength();e+=1)t[e]=i.getAt(e);for(let e=0;e<a.getLength();e+=1)t[e]^=j.gexp(j.glog(a.getAt(e))+r);return V(t,0).mod(a)},i},ne=function(){let o=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],g=function(a,r){let t={};return t.totalCount=a,t.dataCount=r,t},c={},i=function(a,r){switch(r){case F.L:return o[(a-1)*4+0];case F.M:return o[(a-1)*4+1];case F.Q:return o[(a-1)*4+2];case F.H:return o[(a-1)*4+3];default:return}};return c.getRSBlocks=function(a,r){let t=i(a,r);if(typeof t=="undefined")throw"bad rs block @ typeNumber:"+a+"/errorCorrectionLevel:"+r;let e=t.length/3,h=[];for(let m=0;m<e;m+=1){let b=t[m*3+0],x=t[m*3+1],y=t[m*3+2];for(let _=0;_<b;_+=1)h.push(g(x,y))}return h},c}(),oe=function(){let o=[],g=0,c={};return c.getBuffer=function(){return o},c.getAt=function(i){let a=Math.floor(i/8);return(o[a]>>>7-i%8&1)==1},c.put=function(i,a){for(let r=0;r<a;r+=1)c.putBit((i>>>a-r-1&1)==1)},c.getLengthInBits=function(){return g},c.putBit=function(i){let a=Math.floor(g/8);o.length<=a&&o.push(0),i&&(o[a]|=128>>>g%8),g+=1},c},we=function(o){let g=D.MODE_NUMBER,c=o,i={};i.getMode=function(){return g},i.getLength=function(t){return c.length},i.write=function(t){let e=c,h=0;for(;h+2<e.length;)t.put(a(e.substring(h,h+3)),10),h+=3;h<e.length&&(e.length-h==1?t.put(a(e.substring(h,h+1)),4):e.length-h==2&&t.put(a(e.substring(h,h+2)),7))};let a=function(t){let e=0;for(let h=0;h<t.length;h+=1)e=e*10+r(t.charAt(h));return e},r=function(t){if("0"<=t&&t<="9")return t.charCodeAt(0)-48;throw"illegal char :"+t};return i},ke=function(o){let g=D.MODE_ALPHA_NUM,c=o,i={};i.getMode=function(){return g},i.getLength=function(r){return c.length},i.write=function(r){let t=c,e=0;for(;e+1<t.length;)r.put(a(t.charAt(e))*45+a(t.charAt(e+1)),11),e+=2;e<t.length&&r.put(a(t.charAt(e)),6)};let a=function(r){if("0"<=r&&r<="9")return r.charCodeAt(0)-48;if("A"<=r&&r<="Z")return r.charCodeAt(0)-65+10;switch(r){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+r}};return i},_e=function(o){let g=D.MODE_8BIT_BYTE,c=o,i=Q.stringToBytes(o),a={};return a.getMode=function(){return g},a.getLength=function(r){return i.length},a.write=function(r){for(let t=0;t<i.length;t+=1)r.put(i[t],8)},a},Me=function(o){let g=D.MODE_KANJI,c=o,i=Q.stringToBytes;(function(t,e){let h=i(t);if(h.length!=2||(h[0]<<8|h[1])!=e)throw"sjis not supported."})("\u53CB",38726);let a=i(o),r={};return r.getMode=function(){return g},r.getLength=function(t){return~~(a.length/2)},r.write=function(t){let e=a,h=0;for(;h+1<e.length;){let m=(255&e[h])<<8|255&e[h+1];if(33088<=m&&m<=40956)m-=33088;else if(57408<=m&&m<=60351)m-=49472;else throw"illegal char at "+(h+1)+"/"+m;m=(m>>>8&255)*192+(m&255),t.put(m,13),h+=2}if(h<e.length)throw"illegal char at "+(h+1)},r},le=function(){let o=[],g={};return g.writeByte=function(c){o.push(c&255)},g.writeShort=function(c){g.writeByte(c),g.writeByte(c>>>8)},g.writeBytes=function(c,i,a){i=i||0,a=a||c.length;for(let r=0;r<a;r+=1)g.writeByte(c[r+i])},g.writeString=function(c){for(let i=0;i<c.length;i+=1)g.writeByte(c.charCodeAt(i))},g.toByteArray=function(){return o},g.toString=function(){let c="";c+="[";for(let i=0;i<o.length;i+=1)i>0&&(c+=","),c+=o[i];return c+="]",c},g},Ce=function(){let o=0,g=0,c=0,i="",a={},r=function(e){i+=String.fromCharCode(t(e&63))},t=function(e){if(e<0)throw"n:"+e;if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(e==62)return 43;if(e==63)return 47;throw"n:"+e};return a.writeByte=function(e){for(o=o<<8|e&255,g+=8,c+=1;g>=6;)r(o>>>g-6),g-=6},a.flush=function(){if(g>0&&(r(o<<6-g),o=0,g=0),c%3!=0){let e=3-c%3;for(let h=0;h<e;h+=1)i+="="}},a.toString=function(){return i},a},Be=function(o){let g=o,c=0,i=0,a=0,r={};r.read=function(){for(;a<8;){if(c>=g.length){if(a==0)return-1;throw"unexpected end of file./"+a}let h=g.charAt(c);if(c+=1,h=="=")return a=0,-1;if(h.match(/^\s$/))continue;i=i<<6|t(h.charCodeAt(0)),a+=6}let e=i>>>a-8&255;return a-=8,e};let t=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(e==43)return 62;if(e==47)return 63;throw"c:"+e};return r},Ae=function(o,g){let c=o,i=g,a=new Array(o*g),r={};r.setPixel=function(m,b,x){a[b*c+m]=x},r.write=function(m){m.writeString("GIF87a"),m.writeShort(c),m.writeShort(i),m.writeByte(128),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(255),m.writeByte(255),m.writeByte(255),m.writeString(","),m.writeShort(0),m.writeShort(0),m.writeShort(c),m.writeShort(i),m.writeByte(0);let b=2,x=e(b);m.writeByte(b);let y=0;for(;x.length-y>255;)m.writeByte(255),m.writeBytes(x,y,255),y+=255;m.writeByte(x.length-y),m.writeBytes(x,y,x.length-y),m.writeByte(0),m.writeString(";")};let t=function(m){let b=m,x=0,y=0,_={};return _.write=function(C,A){if(C>>>A)throw"length over";for(;x+A>=8;)b.writeByte(255&(C<<x|y)),A-=8-x,C>>>=8-x,y=0,x=0;y=C<<x|y,x=x+A},_.flush=function(){x>0&&b.writeByte(y)},_},e=function(m){let b=1<<m,x=(1<<m)+1,y=m+1,_=h();for(let S=0;S<b;S+=1)_.add(String.fromCharCode(S));_.add(String.fromCharCode(b)),_.add(String.fromCharCode(x));let C=le(),A=t(C);A.write(b,y);let P=0,E=String.fromCharCode(a[P]);for(P+=1;P<a.length;){let S=String.fromCharCode(a[P]);P+=1,_.contains(E+S)?E=E+S:(A.write(_.indexOf(E),y),_.size()<4095&&(_.size()==1<<y&&(y+=1),_.add(E+S)),E=S)}return A.write(_.indexOf(E),y),A.write(x,y),A.flush(),C.toByteArray()},h=function(){let m={},b=0,x={};return x.add=function(y){if(x.contains(y))throw"dup key:"+y;m[y]=b,b+=1},x.size=function(){return b},x.indexOf=function(y){return m[y]},x.contains=function(y){return typeof m[y]!="undefined"},x};return r},Te=function(o,g,c){let i=Ae(o,g);for(let e=0;e<g;e+=1)for(let h=0;h<o;h+=1)i.setPixel(h,e,c(h,e));let a=le();i.write(a);let r=Ce(),t=a.toByteArray();for(let e=0;e<t.length;e+=1)r.writeByte(t[e]);return r.flush(),"data:image/gif;base64,"+r},ie=Q,$e=Q.stringToBytes;var ae={apiBase:"https://payulink.io/api",assetBase:"https://assetcdn.payulink.io/checkout/v1/assets",name:null,logo:null,brandColor:null,pollMs:2500};function Ee(o){if(!o)return null;try{let g=ie(0,"M");return g.addData(String(o)),g.make(),g.createDataURL(6,2)}catch{return null}}var Y=class o{constructor(g={}){if(typeof window=="undefined"||typeof document=="undefined")throw new Error("PayuLink checkout runs in the browser only. On React Native use @thepayulink/checkout-react-native; on a server use @thepayulink/server.");let c=g.key||g.keyId||g.key_id;if(!c)throw new Error("PayuLink: `key` (your publishable pl_live_\u2026 / pl_test_\u2026 key) is required");if(/^pl_(live|test)_/.test(c)||console.warn("PayuLink: `key` should look like pl_live_\u2026 or pl_test_\u2026"),g.keySecret||g.key_secret)throw new Error("PayuLink: never pass a key_secret to the browser SDK. It belongs on your server only.");this.options=Object.assign({},ae,g,{key:c})}open(g={}){let c=Object.assign({},this.options,g),i=String(c.apiBase||"").replace(/\/$/,""),a=String(c.assetBase||`${i}/assets`).replace(/\/$/,""),r=c.order_id||c.orderId;if(!r)throw new Error("PayuLink: `order_id` is required. Create it on your server with POST /v1/orders.");let t=y=>{typeof c.onError=="function"?c.onError(y):console.error("PayuLink:",y.message||y)},e=null,h=null,m=async y=>{var A;let _=await fetch(`${i}/v1/checkout/session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key_id:c.key,order_id:r,customer:y?{name:y.name,contact:y.mobile||y.contact,email:y.email}:void 0})}),C=await _.json().catch(()=>({}));if(!_.ok)throw new Error(((A=C==null?void 0:C.error)==null?void 0:A.description)||`Could not start payment (HTTP ${_.status})`);return e=C,{merchant_order_no:C.order_id,amount:C.amount/100,upi_intent_url:C.upi_intent_url,payment_link:C.payment_link,qr_data_url:Ee(C.upi_intent_url),expires_at:C.expires_at,server_now:Math.floor(Date.now()/1e3)}},b=(y,_)=>{let C=async()=>{if(e!=null&&e.session_token)try{let E=await(await fetch(`${i}/v1/checkout/session/${encodeURIComponent(e.session_token)}`)).json().catch(()=>({}));E.status==="paid"&&E.payulink_signature&&(h={payulink_order_id:E.payulink_order_id,payulink_payment_id:E.payulink_payment_id,payulink_signature:E.payulink_signature,utr:E.utr||null,amount:E.amount}),_({status:E.status==="paid"?0:E.status==="failed"?1:E.status==="expired"?3:2,status_label:String(E.status||"pending").toUpperCase(),utr:E.utr||null})}catch{}},A=setInterval(C,c.pollMs||ae.pollMs);return C(),()=>clearInterval(A)},x={_inner:null,close(){var y;(y=this._inner)==null||y.close()}};return fetch(`${i}/v1/checkout/order/${encodeURIComponent(r)}?key_id=${encodeURIComponent(c.key)}`).then(async y=>{var C;let _=await y.json().catch(()=>({}));if(!y.ok)throw new Error(((C=_==null?void 0:_.error)==null?void 0:C.description)||"Unknown or expired order");x._inner=re(Object.assign({},{apiBase:i,assetBase:a,name:c.name||_.merchant_name,logo:c.logo||`${a}/payulink-logo.png`,brandColor:c.brandColor,note:c.note,prefill:c.prefill||{},amount:_.amount/100,description:c.description||c.item||_.merchant_name,createOrder:m,watchOrder:b,onSuccess:()=>{let A=h||{payulink_order_id:(e==null?void 0:e.order_id)||r,payulink_payment_id:null,payulink_signature:null};typeof c.handler=="function"&&c.handler(A),typeof c.onSuccess=="function"&&c.onSuccess(A)},onDismiss:()=>{typeof c.onDismiss=="function"&&c.onDismiss()},onError:t}))}).catch(t),x}static open(g={}){return new o(g).open(g)}};typeof window!="undefined"&&(window.PayuLink=Y,window.PayulinkCheckout=Y);
|
|
338
|
+
<div id="pl-status" class="pl-pendrow"><span class="pl-mini-spin"></span> Waiting for payment\u2026</div>`}function N(e,t){if(e==="contact")t.querySelector("#pl-continue").onclick=()=>{let o=t.querySelector("#pl-name").value.trim(),p=t.querySelector("#pl-mobile").value.replace(/\D/g,""),v=t.querySelector("#pl-email").value.trim(),M=t.querySelector("#pl-cerr");if(o.length<2)return M.textContent="Please enter your name";if(p.length!==10)return M.textContent="Enter a valid 10-digit mobile number";l.customer={name:o,mobile:p,email:v},s("options")};else if(e==="options"){t.querySelectorAll(".pl-navitem").forEach(p=>p.onclick=()=>{p.dataset.m!=="upi"&&P("Coming soon \u2014 please pay via UPI / QR for now")});let o=t.querySelector("#pl-verify");o&&(o.onclick=()=>{let p=(t.querySelector("#pl-vpa").value||"").trim();if(!/^[\w.\-]{2,}@[a-zA-Z]{2,}$/.test(p))return t.querySelector("#pl-vpa").focus(),P("Enter a valid UPI ID, e.g. name@okhdfcbank");let v=l.order&&(l.order.upi_intent_url||l.order.payment_link);v&&/Android|iPhone|iPad|Mobile/i.test(navigator.userAgent)?location.href=v:P("Scan the QR with your phone\u2019s UPI app to complete the payment.")}),T(),q(!0)}}let _=!1;async function q(e){if(e||s("options"),l.order){E();return}if(!_){_=!0;try{l.customer||(l.customer={name:a.prefill.name||"Customer",mobile:(a.prefill.contact||"").replace(/\D/g,""),email:a.prefill.email||""}),l.order=await a.createOrder(l.customer),E(),V()}catch(t){let o=n.querySelector("#pl-qr");if(o){o.innerHTML=`<div class="pl-qrerr"><span>${c(t.message||"Could not start payment")}</span><button class="pl-retry" id="pl-retry">Try again</button></div>`;let p=o.querySelector("#pl-retry");p&&(p.onclick=()=>{_=!1,o.innerHTML='<div class="pl-qrloading"></div>',q(!0)})}}finally{_=!1}}}function E(){let e=l.order;if(!e)return;H(e);let t=n.querySelector("#pl-qr");t&&(e.qr_data_url?t.innerHTML=`<img src="${e.qr_data_url}" alt="UPI QR">`:t.innerHTML='<div class="pl-qrerr"><span>QR unavailable \u2014 use a UPI app below</span></div>');let o=e.upi_intent_url||e.payment_link||"#",p=n.querySelector("#pl-applist");p&&p.querySelectorAll(".pl-uapp").forEach(v=>{v.setAttribute("href",o),v.setAttribute("target","_blank"),v.setAttribute("rel","noopener")}),T()}function H(e){e&&e.expires_at&&e.server_now?l.expiryMs=Date.now()+Math.max(0,e.expires_at-e.server_now):l.expiryMs||(l.expiryMs=Date.now()+5*60*1e3)}function L(){if(l.done)return;let e=n.querySelector("#pl-qr");e&&(e.innerHTML='<div class="pl-qrerr"><span>QR code expired</span><button class="pl-retry" id="pl-regen">Generate new QR</button></div>');let t=n.querySelector("#pl-regen");t&&(t.onclick=Y);let o=n.querySelector("#pl-timer");o&&(o.textContent="Expired");let p=n.querySelector(".pl-validrow");p&&p.classList.add("pl-expired")}function Y(){if(l.stop){try{l.stop()}catch{}l.stop=null}l.order=null,l.expiryMs=null,_=!1;let e=n.querySelector(".pl-validrow");e&&e.classList.remove("pl-expired");let t=n.querySelector("#pl-qr");t&&(t.innerHTML='<div class="pl-qrloading"></div>'),q(!0)}function V(){!l.order||l.stop||(l.stop=a.watchOrder(l.order.merchant_order_no,e=>{!e||typeof e.status!="number"||(e.status===0?(l.utr=e.utr||l.utr,Q()):e.status===3?(clearInterval(l.timer),l.expiryMs=Date.now(),L(),I("failed","QR expired \u2014 generate a new one")):[1,4].includes(e.status)?I("failed","Payment "+(e.status_label||"failed").toLowerCase()):e.status===6&&I("pending","Processing payment\u2026"))}))}function I(e,t){let o=n.querySelector("#pl-status");o&&(o.className=e==="failed"?"pl-pendrow pl-fail":"pl-pendrow",o.innerHTML=(e==="pending"?'<span class="pl-mini-spin"></span> ':"")+c(t))}function Q(){l.done||(l.done=!0,clearInterval(l.timer),s("success"),a.onSuccess&&a.onSuccess({merchant_order_no:l.order.merchant_order_no,utr:l.utr,amount:a.amount}),l.utr||X())}async function X(){for(let e=0;e<10&&!l.utr;e++){await new Promise(t=>setTimeout(t,4e3));try{let t=await fetch(`${i}/api/order/${l.order.merchant_order_no}`).then(o=>o.json());if(t.utr){l.utr=t.utr;let o=n.querySelector("#pl-pid");o&&l.screen==="success"&&o.insertAdjacentHTML("afterend",`<div class="pl-pid pl-utr">UTR ${c(t.utr)}</div>`);break}}catch{}}}function T(){clearInterval(l.timer);let e=()=>{let t=n.querySelector("#pl-timer");if(!t)return;if(!l.expiryMs){t.textContent="Valid 5:00";return}let o=Math.max(0,Math.round((l.expiryMs-Date.now())/1e3));t.textContent=o>0?"Valid "+pe(o):"Expired",o<=0&&(clearInterval(l.timer),L())};e(),l.timer=setInterval(e,1e3)}function P(e){let t=document.getElementById("pl-toast");t||(t=document.createElement("div"),t.id="pl-toast",document.body.appendChild(t)),t.textContent=e,t.classList.add("pl-show"),clearTimeout(t._t),t._t=setTimeout(()=>t.classList.remove("pl-show"),2600)}return s("loader"),setTimeout(()=>{let e=a.prefill||{};e.name&&(e.contact||"").replace(/\D/g,"").length===10?(l.customer={name:e.name,mobile:e.contact.replace(/\D/g,""),email:e.email||""},s("options")):s("contact");let t=n.querySelector("#pl-splash");t&&(t.classList.add("pl-splash-hide"),setTimeout(()=>t.remove(),450))},1600),{close:d}}var D={apiBase:"https://payulink.io/api",assetBase:"https://assetcdn.payulink.io/checkout/v1/assets",name:null,logo:null,brandColor:null,pollMs:2500},w=class a{constructor(i={}){if(typeof window=="undefined"||typeof document=="undefined")throw new Error("PayuLink checkout runs in the browser only. On React Native use @thepayulink/checkout-react-native; on a server use @thepayulink/server.");let r=i.key||i.keyId||i.key_id;if(!r)throw new Error("PayuLink: `key` (your publishable pl_live_\u2026 / pl_test_\u2026 key) is required");if(/^pl_(live|test)_/.test(r)||console.warn("PayuLink: `key` should look like pl_live_\u2026 or pl_test_\u2026"),i.keySecret||i.key_secret)throw new Error("PayuLink: never pass a key_secret to the browser SDK. It belongs on your server only.");this.options=Object.assign({},D,i,{key:r})}open(i={}){let r=Object.assign({},this.options,i),y=String(r.apiBase||"").replace(/\/$/,""),h=String(r.assetBase||`${y}/assets`).replace(/\/$/,""),l=r.order_id||r.orderId;if(!l)throw new Error("PayuLink: `order_id` is required. Create it on your server with POST /v1/orders.");let n=d=>{typeof r.onError=="function"?r.onError(d):console.error("PayuLink:",d.message||d)},x=null,$=null,S=async d=>{var g;let u=await fetch(`${y}/v1/checkout/session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key_id:r.key,order_id:l,customer:d?{name:d.name,contact:d.mobile||d.contact,email:d.email}:void 0})}),s=await u.json().catch(()=>({}));if(!u.ok)throw new Error(((g=s==null?void 0:s.error)==null?void 0:g.description)||`Could not start payment (HTTP ${u.status})`);return x=s,{merchant_order_no:s.order_id,amount:s.amount/100,upi_intent_url:s.upi_intent_url,payment_link:s.payment_link,qr_data_url:s.qr_data_url||null,expires_at:s.expires_at?s.expires_at*1e3:null,server_now:Date.now()}},z=(d,u)=>{let s=async()=>{if(x!=null&&x.session_token)try{let f=await(await fetch(`${y}/v1/checkout/session/${encodeURIComponent(x.session_token)}`)).json().catch(()=>({}));f.status==="paid"&&f.payulink_signature&&($={payulink_order_id:f.payulink_order_id,payulink_payment_id:f.payulink_payment_id,payulink_signature:f.payulink_signature,utr:f.utr||null,amount:f.amount}),u({status:f.status==="paid"?0:f.status==="failed"?1:f.status==="expired"?3:2,status_label:String(f.status||"pending").toUpperCase(),utr:f.utr||null})}catch{}},g=setInterval(s,r.pollMs||D.pollMs);return s(),()=>clearInterval(g)},k={_inner:null,close(){var d;(d=this._inner)==null||d.close()}};return fetch(`${y}/v1/checkout/order/${encodeURIComponent(l)}?key_id=${encodeURIComponent(r.key)}`).then(async d=>{var s;let u=await d.json().catch(()=>({}));if(!d.ok)throw new Error(((s=u==null?void 0:u.error)==null?void 0:s.description)||"Unknown or expired order");k._inner=R(Object.assign({},{apiBase:y,assetBase:h,name:r.name||u.merchant_name,logo:r.logo||`${h}/payulink-logo.png`,brandColor:r.brandColor,note:r.note,prefill:r.prefill||{},amount:u.amount/100,description:r.description||r.item||u.merchant_name,createOrder:S,watchOrder:z,onSuccess:()=>{let g=$||{payulink_order_id:(x==null?void 0:x.order_id)||l,payulink_payment_id:null,payulink_signature:null};typeof r.handler=="function"&&r.handler(g),typeof r.onSuccess=="function"&&r.onSuccess(g)},onDismiss:()=>{typeof r.onDismiss=="function"&&r.onDismiss()},onError:n}))}).catch(n),k}static open(i={}){return new a(i).open(i)}};typeof window!="undefined"&&(window.PayuLink=w,window.PayulinkCheckout=w);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var K=`
|
|
2
2
|
#pl-overlay * { box-sizing: border-box; margin: 0; padding: 0; }
|
|
3
3
|
#pl-overlay { --pl-blue:#3395ff; --pl-blue-dark:#1f86f5; --pl-brand:#0b3068; --pl-ink:#1a2a44; --pl-mut:#6b7c93; --pl-line:#eceff4;
|
|
4
4
|
position: fixed; inset: 0; z-index: 2147483000; font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
@@ -237,7 +237,7 @@ var ce=`
|
|
|
237
237
|
#pl-overlay .pl-approw { justify-content: center; }
|
|
238
238
|
#pl-overlay .pl-validrow { margin: 0 auto; }
|
|
239
239
|
}
|
|
240
|
-
`,
|
|
240
|
+
`,T=!1;function B(t=document){if(T&&t.getElementById("pl-checkout-styles"))return;let s=t.createElement("style");s.id="pl-checkout-styles",s.textContent=K,t.head.appendChild(s),T=!0}var ee=t=>"\u20B9"+Number(t||0).toLocaleString("en-IN",{maximumFractionDigits:2}),le=t=>`${Math.floor(t/60)}:${t%60<10?"0":""}${t%60}`,c=t=>String(t==null?"":t).replace(/[&<>"]/g,s=>({"&":"&","<":"<",">":">",'"':"""})[s]),h=t=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${t}</svg>`,g={qr:h('<rect width="5" height="5" x="3" y="3" rx="1"/><rect width="5" height="5" x="16" y="3" rx="1"/><rect width="5" height="5" x="3" y="16" rx="1"/><path d="M21 16h-3a2 2 0 0 0-2 2v3"/><path d="M21 21v.01"/><path d="M12 7v3a2 2 0 0 1-2 2H7"/><path d="M3 12h.01"/><path d="M12 3h.01"/><path d="M12 16v.01"/><path d="M16 12h1"/><path d="M21 12v.01"/><path d="M12 21v-1"/>'),card:h('<rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/>'),netbanking:h('<path d="M10 18v-7"/><path d="M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z"/><path d="M14 18v-7"/><path d="M18 18v-7"/><path d="M3 22h18"/><path d="M6 18v-7"/>'),wallet:h('<path d="M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"/><path d="M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"/>'),emi:h('<path d="M16 14v2.2l1.6 1"/><path d="M16 2v4"/><path d="M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5"/><path d="M3 10h5"/><path d="M8 2v4"/><circle cx="16" cy="16" r="6"/>'),back:h('<path d="M15 18l-6-6 6-6"/>'),mail:h('<rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-10 5L2 7"/>'),arrow:h('<path d="M5 12h14M13 6l6 6-6 6"/>'),verified:h('<path d="M9 12l2 2 4-4"/><circle cx="12" cy="12" r="10"/>'),lock:h('<rect width="18" height="11" x="3" y="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>')},U='<svg width="13" height="13" viewBox="0 0 24 24" fill="currentColor"><path d="M12 1l9 4v6c0 5.5-3.8 10.7-9 12-5.2-1.3-9-6.5-9-12V5l9-4z"/></svg>',ae=[{m:"card",t:"Cards",s:"Visa, Mastercard & RuPay",ic:"card"},{m:"netbanking",t:"Netbanking",s:"All Indian banks",ic:"netbanking"},{m:"wallet",t:"Wallet",s:"Paytm, PhonePe & more",ic:"wallet"},{m:"emi",t:"EMI",s:"EMI via cards & more",ic:"emi"}];function O(t){B(),t=Object.assign({name:"Payment",description:"",amount:0,assetBase:"/assets",logo:"/assets/payulink-logo.png",prefill:{},apiBase:""},t);let s=String(t.apiBase||"").replace(/\/$/,""),r=ee(t.amount),m=["gpay","phonepe","paytm","bhim","amazonpay"].reduce((e,a)=>(e[a]=`${t.assetBase}/upi/${a}.png`,e),{}),b=["phonepe","gpay","paytm","bhim","amazonpay"],l={screen:"loader",order:null,customer:null,timer:null,stop:null,done:!1,utr:null,expiryMs:null},o=document.createElement("div");o.id="pl-overlay",t.brandColor&&o.style.setProperty("--pl-brand",t.brandColor),o.innerHTML=`
|
|
241
241
|
<div class="pl-modal" role="dialog" aria-modal="true">
|
|
242
242
|
<div class="pl-splash" id="pl-splash">
|
|
243
243
|
<div class="pl-shield">
|
|
@@ -246,87 +246,87 @@ var ce=`
|
|
|
246
246
|
<path d="M60 3 L113 25 V70 C113 105 90 128 60 137 C30 128 7 105 7 70 V25 Z" fill="url(#pl-shgrad)"/>
|
|
247
247
|
</svg>
|
|
248
248
|
<span class="pl-shield-shine"></span>
|
|
249
|
-
<img class="pl-shield-logo" src="${
|
|
249
|
+
<img class="pl-shield-logo" src="${c(t.assetBase)}/payulink-logo.png" alt="payulink">
|
|
250
250
|
</div>
|
|
251
|
-
<div class="pl-splash-foot">Secured By <span class="pl-pb"><img src="${
|
|
251
|
+
<div class="pl-splash-foot">Secured By <span class="pl-pb"><img src="${c(t.assetBase)}/payulink-logo.png" alt=""><strong>payulink</strong></span></div>
|
|
252
252
|
</div>
|
|
253
253
|
<aside class="pl-left">
|
|
254
254
|
<div class="pl-brandrow">
|
|
255
|
-
<div class="pl-logo"><img src="${
|
|
255
|
+
<div class="pl-logo"><img src="${c(t.logo)}" alt=""></div>
|
|
256
256
|
<div class="pl-bmeta">
|
|
257
|
-
<div class="pl-bname">${
|
|
258
|
-
<div class="pl-btrust">${
|
|
257
|
+
<div class="pl-bname">${c(t.name)}</div>
|
|
258
|
+
<div class="pl-btrust">${g.verified}<span>Trusted Business</span></div>
|
|
259
259
|
</div>
|
|
260
260
|
</div>
|
|
261
261
|
<div class="pl-summary">
|
|
262
262
|
<div class="pl-sl">Price Summary</div>
|
|
263
|
-
<div class="pl-samt">${
|
|
264
|
-
<div class="pl-snote">${
|
|
263
|
+
<div class="pl-samt">${r}</div>
|
|
264
|
+
<div class="pl-snote">${c(t.note||"Paying for "+(t.description||t.name))}</div>
|
|
265
265
|
</div>
|
|
266
266
|
<svg class="pl-illus" viewBox="0 0 230 150" fill="none"><rect x="20" y="70" width="58" height="68" rx="5" fill="#fff" fill-opacity=".92"/><path d="M33 70c0-10 5-16 16-16s16 6 16 16" stroke="#fff" stroke-width="3.5"/><rect x="88" y="55" width="68" height="83" rx="5" fill="#fff"/><path d="M104 55c0-12 6-19 18-19s18 7 18 19" stroke="#fff" stroke-width="3.5"/><rect x="150" y="92" width="52" height="46" rx="4" fill="#fff" fill-opacity=".92"/><circle cx="178" cy="40" r="18" fill="#fff"/><path d="M178 30v20M168 40h20" stroke="currentColor" stroke-width="3.5" opacity=".5"/></svg>
|
|
267
|
-
<div class="pl-secured">${
|
|
267
|
+
<div class="pl-secured">${U}Secured by <span class="pl-pb"><img src="${c(t.assetBase)}/payulink-logo.png" alt=""><strong>payulink</strong></span></div>
|
|
268
268
|
</aside>
|
|
269
269
|
<section class="pl-main">
|
|
270
270
|
<header class="pl-head">
|
|
271
|
-
<button class="pl-hic pl-back" id="pl-back" aria-label="Back">${
|
|
271
|
+
<button class="pl-hic pl-back" id="pl-back" aria-label="Back">${g.back}</button>
|
|
272
272
|
<div class="pl-title" id="pl-title">Payment Options</div>
|
|
273
273
|
<button class="pl-hic pl-dots" aria-label="More">\u22EF</button>
|
|
274
274
|
<button class="pl-hic pl-close-x" id="pl-close" aria-label="Close">\xD7</button>
|
|
275
275
|
</header>
|
|
276
276
|
<div class="pl-vp"><div class="pl-screen pl-active" id="pl-screen"></div></div>
|
|
277
|
-
<footer class="pl-foot">${
|
|
277
|
+
<footer class="pl-foot">${g.lock}<span>Encrypted & secure payments</span></footer>
|
|
278
278
|
</section>
|
|
279
|
-
</div>`,document.body.appendChild(
|
|
279
|
+
</div>`,document.body.appendChild(o);let y=document.body.style.overflow;document.body.style.overflow="hidden";let $=o.querySelector(".pl-vp"),S=o.querySelector("#pl-title"),z=o.querySelector("#pl-back");function w(){d(),t.onDismiss&&t.onDismiss()}function d(){if(l.stop)try{l.stop()}catch{}clearInterval(l.timer),o.classList.add("pl-closing"),document.body.style.overflow=y,setTimeout(()=>o.remove(),240)}o.querySelector("#pl-close").onclick=w,o.addEventListener("mousedown",e=>{e.target.id==="pl-overlay"&&w()}),z.onclick=()=>{l.screen==="contact"||l.screen==="success"||p("options")};let u={loader:"Payment Options",contact:"Contact Details",options:"Payment Options",success:"Payment Successful"};function p(e){l.screen=e,S.textContent=u[e]||"Payment",z.classList.toggle("pl-show",e==="options"),clearInterval(l.timer);let a=document.createElement("div");a.className="pl-screen pl-active"+(e==="options"?" pl-screen-options":""),a.innerHTML=f[e]?f[e]():"",$.replaceChildren(a),A(e,a)}let x=b.slice(0,4).map(e=>`<img src="${m[e]}" alt="">`).join(""),j=b.map(e=>`<a class="pl-uapp" data-app="${e}" title="${e}"><img src="${m[e]}" alt="${e}"></a>`).join(""),f={loader:()=>`<div class="pl-loader"><div class="pl-bload"><img src="${c(t.logo)}" alt=""><span class="pl-bring"></span><span class="pl-bripple"></span><span class="pl-bripple pl-bripple2"></span></div><p>Securely loading payment options\u2026</p></div>`,contact:()=>`
|
|
280
280
|
<div class="pl-pad">
|
|
281
281
|
<div class="pl-h1">Contact details</div>
|
|
282
282
|
<div class="pl-sub">Enter your details to continue the payment</div>
|
|
283
283
|
<div class="pl-field"><label>Full Name</label>
|
|
284
|
-
<input class="pl-input" id="pl-name" type="text" placeholder="Enter your name" value="${
|
|
284
|
+
<input class="pl-input" id="pl-name" type="text" placeholder="Enter your name" value="${c(t.prefill.name||"")}"></div>
|
|
285
285
|
<div class="pl-field"><label>Mobile Number</label>
|
|
286
286
|
<div class="pl-phone"><div class="pl-cc">+91</div>
|
|
287
|
-
<input class="pl-input" id="pl-mobile" type="tel" maxlength="10" placeholder="Enter mobile number" value="${
|
|
287
|
+
<input class="pl-input" id="pl-mobile" type="tel" maxlength="10" placeholder="Enter mobile number" value="${c(t.prefill.contact||"")}"></div></div>
|
|
288
288
|
<div class="pl-field"><label>Email Address <span class="pl-opt">(optional)</span></label>
|
|
289
|
-
<div class="pl-inwrap"><span class="pl-inicon">${
|
|
290
|
-
<input class="pl-input pl-padleft" id="pl-email" type="email" placeholder="Enter email address" value="${
|
|
291
|
-
<button class="pl-cta" id="pl-continue">Continue <span class="pl-cta-arr">${
|
|
289
|
+
<div class="pl-inwrap"><span class="pl-inicon">${g.mail}</span>
|
|
290
|
+
<input class="pl-input pl-padleft" id="pl-email" type="email" placeholder="Enter email address" value="${c(t.prefill.email||"")}"></div></div>
|
|
291
|
+
<button class="pl-cta" id="pl-continue">Continue <span class="pl-cta-arr">${g.arrow}</span></button>
|
|
292
292
|
<div class="pl-err" id="pl-cerr"></div>
|
|
293
|
-
<div class="pl-trust">${
|
|
293
|
+
<div class="pl-trust">${U}100% secure payments</div>
|
|
294
294
|
</div>`,options:()=>`
|
|
295
295
|
<div class="pl-options">
|
|
296
296
|
<div class="pl-nav" id="pl-nav">
|
|
297
297
|
<div class="pl-navlabel">Recommended</div>
|
|
298
298
|
<div class="pl-navitem active" data-m="upi">
|
|
299
|
-
<div class="pl-ni-ic">${
|
|
299
|
+
<div class="pl-ni-ic">${g.qr}</div>
|
|
300
300
|
<div class="pl-ni-body"><div class="pl-ni-t">UPI</div></div>
|
|
301
|
-
<div class="pl-ni-apps">${
|
|
301
|
+
<div class="pl-ni-apps">${x}</div>
|
|
302
302
|
</div>
|
|
303
303
|
<div class="pl-navlabel">Cards, Banking & More</div>
|
|
304
|
-
${
|
|
305
|
-
<div class="pl-navitem pl-disabled" data-m="${
|
|
306
|
-
<div class="pl-ni-ic pl-ic-${
|
|
307
|
-
<div class="pl-ni-body"><div class="pl-ni-t">${
|
|
304
|
+
${ae.map(e=>`
|
|
305
|
+
<div class="pl-navitem pl-disabled" data-m="${e.m}">
|
|
306
|
+
<div class="pl-ni-ic pl-ic-${e.ic}">${g[e.ic]}</div>
|
|
307
|
+
<div class="pl-ni-body"><div class="pl-ni-t">${e.t}</div><div class="pl-ni-s">${e.s}</div></div>
|
|
308
308
|
<span class="pl-soon">Coming soon</span>
|
|
309
309
|
</div>`).join("")}
|
|
310
310
|
</div>
|
|
311
|
-
<div class="pl-pane" id="pl-pane">${
|
|
312
|
-
</div>`,success:()=>{let
|
|
311
|
+
<div class="pl-pane" id="pl-pane">${D()}</div>
|
|
312
|
+
</div>`,success:()=>{let e=["#00c060","#3395ff","#ffb020","#ff5a5f","#7a52d8","#19c3c3"];return`
|
|
313
313
|
<div class="pl-success">
|
|
314
314
|
<div class="pl-burst">
|
|
315
|
-
${Array.from({length:18},(
|
|
315
|
+
${Array.from({length:18},(i,n)=>{let v=n/18*Math.PI*2+(n%2?.22:-.22),_=60+n*13%40,X=Math.round(Math.cos(v)*_),F=Math.round(Math.sin(v)*_),G=e[n%e.length],W=(n%2?1:-1)*(140+n*14),Z=n%3===0?6:8,J=n%4===0?6:12;return`<i class="pl-confetti" style="--tx:${X}px;--ty:${F}px;--c:${G};--r:${W}deg;width:${Z}px;height:${J}px;border-radius:${n%4===0?"50%":"2px"};animation-delay:${(.15+n*.024).toFixed(3)}s"></i>`}).join("")}
|
|
316
316
|
<span class="pl-ripple"></span><span class="pl-ripple pl-ripple2"></span>
|
|
317
317
|
<div class="pl-check"><svg viewBox="0 0 24 24"><path d="M5 13l4 4L19 7"/></svg></div>
|
|
318
318
|
</div>
|
|
319
319
|
<h2>Payment Successful</h2>
|
|
320
|
-
<p>${
|
|
321
|
-
<div class="pl-pid" id="pl-pid">${
|
|
322
|
-
${
|
|
323
|
-
</div>`}};function
|
|
320
|
+
<p>${r} paid${t.name?" to "+c(t.name):""}</p>
|
|
321
|
+
<div class="pl-pid" id="pl-pid">${c(l.order&&l.order.merchant_order_no||"")}</div>
|
|
322
|
+
${l.utr?`<div class="pl-pid pl-utr">UTR ${c(l.utr)}</div>`:""}
|
|
323
|
+
</div>`}};function D(){return`
|
|
324
324
|
<div class="pl-paneh">UPI QR</div>
|
|
325
325
|
<div class="pl-qrcard">
|
|
326
326
|
<div class="pl-qrbox" id="pl-qr"><div class="pl-qrloading"></div></div>
|
|
327
327
|
<div class="pl-qrside">
|
|
328
328
|
<div class="pl-scan">Scan the QR using any UPI App</div>
|
|
329
|
-
<div class="pl-approw" id="pl-applist">${
|
|
329
|
+
<div class="pl-approw" id="pl-applist">${j}</div>
|
|
330
330
|
<div class="pl-validrow"><span class="pl-dot"></span><span id="pl-timer">Valid 5:00</span></div>
|
|
331
331
|
</div>
|
|
332
332
|
</div>
|
|
@@ -335,6 +335,4 @@ var ce=`
|
|
|
335
335
|
<input class="pl-vpa" id="pl-vpa" placeholder="example@okhdfcbank" autocomplete="off" spellcheck="false">
|
|
336
336
|
<button class="pl-verify" id="pl-verify">Verify and Pay</button>
|
|
337
337
|
</div>
|
|
338
|
-
<div id="pl-status" class="pl-pendrow"><span class="pl-mini-spin"></span> Waiting for payment\u2026</div>`}function J(d,p){if(d==="contact")p.querySelector("#pl-continue").onclick=()=>{let k=p.querySelector("#pl-name").value.trim(),M=p.querySelector("#pl-mobile").value.replace(/\D/g,""),I=p.querySelector("#pl-email").value.trim(),H=p.querySelector("#pl-cerr");if(k.length<2)return H.textContent="Please enter your name";if(M.length!==10)return H.textContent="Enter a valid 10-digit mobile number";r.customer={name:k,mobile:M,email:I},C("options")};else if(d==="options"){p.querySelectorAll(".pl-navitem").forEach(M=>M.onclick=()=>{M.dataset.m!=="upi"&&T("Coming soon \u2014 please pay via UPI / QR for now")});let k=p.querySelector("#pl-verify");k&&(k.onclick=()=>{let M=(p.querySelector("#pl-vpa").value||"").trim();if(!/^[\w.\-]{2,}@[a-zA-Z]{2,}$/.test(M))return p.querySelector("#pl-vpa").focus(),T("Enter a valid UPI ID, e.g. name@okhdfcbank");let I=r.order&&(r.order.upi_intent_url||r.order.payment_link);I&&/Android|iPhone|iPad|Mobile/i.test(navigator.userAgent)?location.href=I:T("Scan the QR with your phone\u2019s UPI app to complete the payment.")}),B(),R(!0)}}let z=!1;async function R(d){if(d||C("options"),r.order){G();return}if(!z){z=!0;try{r.customer||(r.customer={name:o.prefill.name||"Customer",mobile:(o.prefill.contact||"").replace(/\D/g,""),email:o.prefill.email||""}),r.order=await o.createOrder(r.customer),G(),c()}catch(p){let k=t.querySelector("#pl-qr");if(k){k.innerHTML=`<div class="pl-qrerr"><span>${L(p.message||"Could not start payment")}</span><button class="pl-retry" id="pl-retry">Try again</button></div>`;let M=k.querySelector("#pl-retry");M&&(M.onclick=()=>{z=!1,k.innerHTML='<div class="pl-qrloading"></div>',R(!0)})}}finally{z=!1}}}function G(){let d=r.order;if(!d)return;l(d);let p=t.querySelector("#pl-qr");p&&(d.qr_data_url?p.innerHTML=`<img src="${d.qr_data_url}" alt="UPI QR">`:p.innerHTML='<div class="pl-qrerr"><span>QR unavailable \u2014 use a UPI app below</span></div>');let k=d.upi_intent_url||d.payment_link||"#",M=t.querySelector("#pl-applist");M&&M.querySelectorAll(".pl-uapp").forEach(I=>{I.setAttribute("href",k),I.setAttribute("target","_blank"),I.setAttribute("rel","noopener")}),B()}function l(d){d&&d.expires_at&&d.server_now?r.expiryMs=Date.now()+Math.max(0,d.expires_at-d.server_now):r.expiryMs||(r.expiryMs=Date.now()+5*60*1e3)}function f(){if(r.done)return;let d=t.querySelector("#pl-qr");d&&(d.innerHTML='<div class="pl-qrerr"><span>QR code expired</span><button class="pl-retry" id="pl-regen">Generate new QR</button></div>');let p=t.querySelector("#pl-regen");p&&(p.onclick=n);let k=t.querySelector("#pl-timer");k&&(k.textContent="Expired");let M=t.querySelector(".pl-validrow");M&&M.classList.add("pl-expired")}function n(){if(r.stop){try{r.stop()}catch{}r.stop=null}r.order=null,r.expiryMs=null,z=!1;let d=t.querySelector(".pl-validrow");d&&d.classList.remove("pl-expired");let p=t.querySelector("#pl-qr");p&&(p.innerHTML='<div class="pl-qrloading"></div>'),R(!0)}function c(){!r.order||r.stop||(r.stop=o.watchOrder(r.order.merchant_order_no,d=>{!d||typeof d.status!="number"||(d.status===0?(r.utr=d.utr||r.utr,v()):d.status===3?(clearInterval(r.timer),r.expiryMs=Date.now(),f(),s("failed","QR expired \u2014 generate a new one")):[1,4].includes(d.status)?s("failed","Payment "+(d.status_label||"failed").toLowerCase()):d.status===6&&s("pending","Processing payment\u2026"))}))}function s(d,p){let k=t.querySelector("#pl-status");k&&(k.className=d==="failed"?"pl-pendrow pl-fail":"pl-pendrow",k.innerHTML=(d==="pending"?'<span class="pl-mini-spin"></span> ':"")+L(p))}function v(){r.done||(r.done=!0,clearInterval(r.timer),C("success"),o.onSuccess&&o.onSuccess({merchant_order_no:r.order.merchant_order_no,utr:r.utr,amount:o.amount}),r.utr||w())}async function w(){for(let d=0;d<10&&!r.utr;d++){await new Promise(p=>setTimeout(p,4e3));try{let p=await fetch(`${y}/api/order/${r.order.merchant_order_no}`).then(k=>k.json());if(p.utr){r.utr=p.utr;let k=t.querySelector("#pl-pid");k&&r.screen==="success"&&k.insertAdjacentHTML("afterend",`<div class="pl-pid pl-utr">UTR ${L(p.utr)}</div>`);break}}catch{}}}function B(){clearInterval(r.timer);let d=()=>{let p=t.querySelector("#pl-timer");if(!p)return;if(!r.expiryMs){p.textContent="Valid 5:00";return}let k=Math.max(0,Math.round((r.expiryMs-Date.now())/1e3));p.textContent=k>0?"Valid "+fe(k):"Expired",k<=0&&(clearInterval(r.timer),f())};d(),r.timer=setInterval(d,1e3)}function T(d){let p=document.getElementById("pl-toast");p||(p=document.createElement("div"),p.id="pl-toast",document.body.appendChild(p)),p.textContent=d,p.classList.add("pl-show"),clearTimeout(p._t),p._t=setTimeout(()=>p.classList.remove("pl-show"),2600)}return C("loader"),setTimeout(()=>{let d=o.prefill||{};d.name&&(d.contact||"").replace(/\D/g,"").length===10?(r.customer={name:d.name,mobile:d.contact.replace(/\D/g,""),email:d.email||""},C("options")):C("contact");let p=t.querySelector("#pl-splash");p&&(p.classList.add("pl-splash-hide"),setTimeout(()=>p.remove(),450))},1600),{close:g}}var Q=function(o,y){let a=o,r=Y[y],t=null,e=0,h=null,m=[],b={},x=function(l,f){e=a*4+17,t=function(n){let c=new Array(n);for(let s=0;s<n;s+=1){c[s]=new Array(n);for(let v=0;v<n;v+=1)c[s][v]=null}return c}(e),g(0,0),g(e-7,0),g(0,e-7),A(),C(),E(l,f),a>=7&&P(l),h==null&&(h=z(a,r,m)),S(h,f)},g=function(l,f){for(let n=-1;n<=7;n+=1)if(!(l+n<=-1||e<=l+n))for(let c=-1;c<=7;c+=1)f+c<=-1||e<=f+c||(0<=n&&n<=6&&(c==0||c==6)||0<=c&&c<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=c&&c<=4?t[l+n][f+c]=!0:t[l+n][f+c]=!1)},_=function(){let l=0,f=0;for(let n=0;n<8;n+=1){x(!0,n);let c=N.getLostPoint(b);(n==0||l>c)&&(l=c,f=n)}return f},C=function(){for(let l=8;l<e-8;l+=1)t[l][6]==null&&(t[l][6]=l%2==0);for(let l=8;l<e-8;l+=1)t[6][l]==null&&(t[6][l]=l%2==0)},A=function(){let l=N.getPatternPosition(a);for(let f=0;f<l.length;f+=1)for(let n=0;n<l.length;n+=1){let c=l[f],s=l[n];if(t[c][s]==null)for(let v=-2;v<=2;v+=1)for(let w=-2;w<=2;w+=1)v==-2||v==2||w==-2||w==2||v==0&&w==0?t[c+v][s+w]=!0:t[c+v][s+w]=!1}},P=function(l){let f=N.getBCHTypeNumber(a);for(let n=0;n<18;n+=1){let c=!l&&(f>>n&1)==1;t[Math.floor(n/3)][n%3+e-8-3]=c}for(let n=0;n<18;n+=1){let c=!l&&(f>>n&1)==1;t[n%3+e-8-3][Math.floor(n/3)]=c}},E=function(l,f){let n=r<<3|f,c=N.getBCHTypeInfo(n);for(let s=0;s<15;s+=1){let v=!l&&(c>>s&1)==1;s<6?t[s][8]=v:s<8?t[s+1][8]=v:t[e-15+s][8]=v}for(let s=0;s<15;s+=1){let v=!l&&(c>>s&1)==1;s<8?t[8][e-s-1]=v:s<9?t[8][15-s-1+1]=v:t[8][15-s-1]=v}t[e-8][8]=!l},S=function(l,f){let n=-1,c=e-1,s=7,v=0,w=N.getMaskFunction(f);for(let B=e-1;B>0;B-=2)for(B==6&&(B-=1);;){for(let T=0;T<2;T+=1)if(t[c][B-T]==null){let d=!1;v<l.length&&(d=(l[v]>>>s&1)==1),w(c,B-T)&&(d=!d),t[c][B-T]=d,s-=1,s==-1&&(v+=1,s=7)}if(c+=n,c<0||e<=c){c-=n,n=-n;break}}},J=function(l,f){let n=0,c=0,s=0,v=new Array(f.length),w=new Array(f.length);for(let p=0;p<f.length;p+=1){let k=f[p].dataCount,M=f[p].totalCount-k;c=Math.max(c,k),s=Math.max(s,M),v[p]=new Array(k);for(let $=0;$<v[p].length;$+=1)v[p][$]=255&l.getBuffer()[$+n];n+=k;let I=N.getErrorCorrectPolynomial(M),K=F(v[p],I.getLength()-1).mod(I);w[p]=new Array(I.getLength()-1);for(let $=0;$<w[p].length;$+=1){let X=$+K.getLength()-w[p].length;w[p][$]=X>=0?K.getAt(X):0}}let B=0;for(let p=0;p<f.length;p+=1)B+=f[p].totalCount;let T=new Array(B),d=0;for(let p=0;p<c;p+=1)for(let k=0;k<f.length;k+=1)p<v[k].length&&(T[d]=v[k][p],d+=1);for(let p=0;p<s;p+=1)for(let k=0;k<f.length;k+=1)p<w[k].length&&(T[d]=w[k][p],d+=1);return T},z=function(l,f,n){let c=re.getRSBlocks(l,f),s=ne();for(let w=0;w<n.length;w+=1){let B=n[w];s.put(B.getMode(),4),s.put(B.getLength(),N.getLengthInBits(B.getMode(),l)),B.write(s)}let v=0;for(let w=0;w<c.length;w+=1)v+=c[w].dataCount;if(s.getLengthInBits()>v*8)throw"code length overflow. ("+s.getLengthInBits()+">"+v*8+")";for(s.getLengthInBits()+4<=v*8&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;!(s.getLengthInBits()>=v*8||(s.put(236,8),s.getLengthInBits()>=v*8));)s.put(17,8);return J(s,c)};b.addData=function(l,f){f=f||"Byte";let n=null;switch(f){case"Numeric":n=he(l);break;case"Alphanumeric":n=ge(l);break;case"Byte":n=ye(l);break;case"Kanji":n=xe(l);break;default:throw"mode:"+f}m.push(n),h=null},b.isDark=function(l,f){if(l<0||e<=l||f<0||e<=f)throw l+","+f;return t[l][f]},b.getModuleCount=function(){return e},b.make=function(){if(a<1){let l=1;for(;l<40;l++){let f=re.getRSBlocks(l,r),n=ne();for(let s=0;s<m.length;s++){let v=m[s];n.put(v.getMode(),4),n.put(v.getLength(),N.getLengthInBits(v.getMode(),l)),v.write(n)}let c=0;for(let s=0;s<f.length;s++)c+=f[s].dataCount;if(n.getLengthInBits()<=c*8)break}a=l}x(!1,_())},b.createTableTag=function(l,f){l=l||2,f=typeof f=="undefined"?l*4:f;let n="";n+='<table style="',n+=" border-width: 0px; border-style: none;",n+=" border-collapse: collapse;",n+=" padding: 0px; margin: "+f+"px;",n+='">',n+="<tbody>";for(let c=0;c<b.getModuleCount();c+=1){n+="<tr>";for(let s=0;s<b.getModuleCount();s+=1)n+='<td style="',n+=" border-width: 0px; border-style: none;",n+=" border-collapse: collapse;",n+=" padding: 0px; margin: 0px;",n+=" width: "+l+"px;",n+=" height: "+l+"px;",n+=" background-color: ",n+=b.isDark(c,s)?"#000000":"#ffffff",n+=";",n+='"/>';n+="</tr>"}return n+="</tbody>",n+="</table>",n},b.createSvgTag=function(l,f,n,c){let s={};typeof arguments[0]=="object"&&(s=arguments[0],l=s.cellSize,f=s.margin,n=s.alt,c=s.title),l=l||2,f=typeof f=="undefined"?l*4:f,n=typeof n=="string"?{text:n}:n||{},n.text=n.text||null,n.id=n.text?n.id||"qrcode-description":null,c=typeof c=="string"?{text:c}:c||{},c.text=c.text||null,c.id=c.text?c.id||"qrcode-title":null;let v=b.getModuleCount()*l+f*2,w,B,T,d,p="",k;for(k="l"+l+",0 0,"+l+" -"+l+",0 0,-"+l+"z ",p+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',p+=s.scalable?"":' width="'+v+'px" height="'+v+'px"',p+=' viewBox="0 0 '+v+" "+v+'" ',p+=' preserveAspectRatio="xMinYMin meet"',p+=c.text||n.text?' role="img" aria-labelledby="'+R([c.id,n.id].join(" ").trim())+'"':"",p+=">",p+=c.text?'<title id="'+R(c.id)+'">'+R(c.text)+"</title>":"",p+=n.text?'<description id="'+R(n.id)+'">'+R(n.text)+"</description>":"",p+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',p+='<path d="',T=0;T<b.getModuleCount();T+=1)for(d=T*l+f,w=0;w<b.getModuleCount();w+=1)b.isDark(T,w)&&(B=w*l+f,p+="M"+B+","+d+k);return p+='" stroke="transparent" fill="black"/>',p+="</svg>",p},b.createDataURL=function(l,f){l=l||2,f=typeof f=="undefined"?l*4:f;let n=b.getModuleCount()*l+f*2,c=f,s=n-f;return we(n,n,function(v,w){if(c<=v&&v<s&&c<=w&&w<s){let B=Math.floor((v-c)/l),T=Math.floor((w-c)/l);return b.isDark(T,B)?0:1}else return 1})},b.createImgTag=function(l,f,n){l=l||2,f=typeof f=="undefined"?l*4:f;let c=b.getModuleCount()*l+f*2,s="";return s+="<img",s+=' src="',s+=b.createDataURL(l,f),s+='"',s+=' width="',s+=c,s+='"',s+=' height="',s+=c,s+='"',n&&(s+=' alt="',s+=R(n),s+='"'),s+="/>",s};let R=function(l){let f="";for(let n=0;n<l.length;n+=1){let c=l.charAt(n);switch(c){case"<":f+="<";break;case">":f+=">";break;case"&":f+="&";break;case'"':f+=""";break;default:f+=c;break}}return f},G=function(l){l=typeof l=="undefined"?1*2:l;let n=b.getModuleCount()*1+l*2,c=l,s=n-l,v,w,B,T,d,p={"\u2588\u2588":"\u2588","\u2588 ":"\u2580"," \u2588":"\u2584"," ":" "},k={"\u2588\u2588":"\u2580","\u2588 ":"\u2580"," \u2588":" "," ":" "},M="";for(v=0;v<n;v+=2){for(B=Math.floor((v-c)/1),T=Math.floor((v+1-c)/1),w=0;w<n;w+=1)d="\u2588",c<=w&&w<s&&c<=v&&v<s&&b.isDark(B,Math.floor((w-c)/1))&&(d=" "),c<=w&&w<s&&c<=v+1&&v+1<s&&b.isDark(T,Math.floor((w-c)/1))?d+=" ":d+="\u2588",M+=l<1&&v+1>=s?k[d]:p[d];M+=`
|
|
339
|
-
`}return n%2&&l>0?M.substring(0,M.length-n-1)+Array(n+1).join("\u2580"):M.substring(0,M.length-1)};return b.createASCII=function(l,f){if(l=l||1,l<2)return G(f);l-=1,f=typeof f=="undefined"?l*2:f;let n=b.getModuleCount()*l+f*2,c=f,s=n-f,v,w,B,T,d=Array(l+1).join("\u2588\u2588"),p=Array(l+1).join(" "),k="",M="";for(v=0;v<n;v+=1){for(B=Math.floor((v-c)/l),M="",w=0;w<n;w+=1)T=1,c<=w&&w<s&&c<=v&&v<s&&b.isDark(B,Math.floor((w-c)/l))&&(T=0),M+=T?d:p;for(B=0;B<l;B+=1)k+=M+`
|
|
340
|
-
`}return k.substring(0,k.length-1)},b.renderTo2dContext=function(l,f){f=f||2;let n=b.getModuleCount();for(let c=0;c<n;c++)for(let s=0;s<n;s++)l.fillStyle=b.isDark(c,s)?"black":"white",l.fillRect(s*f,c*f,f,f)},b};Q.stringToBytes=function(o){let y=[];for(let u=0;u<o.length;u+=1){let i=o.charCodeAt(u);y.push(i&255)}return y};Q.createStringToBytes=function(o,y){let u=function(){let a=me(o),r=function(){let h=a.read();if(h==-1)throw"eof";return h},t=0,e={};for(;;){let h=a.read();if(h==-1)break;let m=r(),b=r(),x=r(),g=String.fromCharCode(h<<8|m),_=b<<8|x;e[g]=_,t+=1}if(t!=y)throw t+" != "+y;return e}(),i=63;return function(a){let r=[];for(let t=0;t<a.length;t+=1){let e=a.charCodeAt(t);if(e<128)r.push(e);else{let h=u[a.charAt(t)];typeof h=="number"?(h&255)==h?r.push(h):(r.push(h>>>8),r.push(h&255)):r.push(i)}}return r}};var D={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Y={L:1,M:0,Q:3,H:2},q={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},N=function(){let o=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],y=1335,u=7973,i=21522,a={},r=function(t){let e=0;for(;t!=0;)e+=1,t>>>=1;return e};return a.getBCHTypeInfo=function(t){let e=t<<10;for(;r(e)-r(y)>=0;)e^=y<<r(e)-r(y);return(t<<10|e)^i},a.getBCHTypeNumber=function(t){let e=t<<12;for(;r(e)-r(u)>=0;)e^=u<<r(e)-r(u);return t<<12|e},a.getPatternPosition=function(t){return o[t-1]},a.getMaskFunction=function(t){switch(t){case q.PATTERN000:return function(e,h){return(e+h)%2==0};case q.PATTERN001:return function(e,h){return e%2==0};case q.PATTERN010:return function(e,h){return h%3==0};case q.PATTERN011:return function(e,h){return(e+h)%3==0};case q.PATTERN100:return function(e,h){return(Math.floor(e/2)+Math.floor(h/3))%2==0};case q.PATTERN101:return function(e,h){return e*h%2+e*h%3==0};case q.PATTERN110:return function(e,h){return(e*h%2+e*h%3)%2==0};case q.PATTERN111:return function(e,h){return(e*h%3+(e+h)%2)%2==0};default:throw"bad maskPattern:"+t}},a.getErrorCorrectPolynomial=function(t){let e=F([1],0);for(let h=0;h<t;h+=1)e=e.multiply(F([1,j.gexp(h)],0));return e},a.getLengthInBits=function(t,e){if(1<=e&&e<10)switch(t){case D.MODE_NUMBER:return 10;case D.MODE_ALPHA_NUM:return 9;case D.MODE_8BIT_BYTE:return 8;case D.MODE_KANJI:return 8;default:throw"mode:"+t}else if(e<27)switch(t){case D.MODE_NUMBER:return 12;case D.MODE_ALPHA_NUM:return 11;case D.MODE_8BIT_BYTE:return 16;case D.MODE_KANJI:return 10;default:throw"mode:"+t}else if(e<41)switch(t){case D.MODE_NUMBER:return 14;case D.MODE_ALPHA_NUM:return 13;case D.MODE_8BIT_BYTE:return 16;case D.MODE_KANJI:return 12;default:throw"mode:"+t}else throw"type:"+e},a.getLostPoint=function(t){let e=t.getModuleCount(),h=0;for(let x=0;x<e;x+=1)for(let g=0;g<e;g+=1){let _=0,C=t.isDark(x,g);for(let A=-1;A<=1;A+=1)if(!(x+A<0||e<=x+A))for(let P=-1;P<=1;P+=1)g+P<0||e<=g+P||A==0&&P==0||C==t.isDark(x+A,g+P)&&(_+=1);_>5&&(h+=3+_-5)}for(let x=0;x<e-1;x+=1)for(let g=0;g<e-1;g+=1){let _=0;t.isDark(x,g)&&(_+=1),t.isDark(x+1,g)&&(_+=1),t.isDark(x,g+1)&&(_+=1),t.isDark(x+1,g+1)&&(_+=1),(_==0||_==4)&&(h+=3)}for(let x=0;x<e;x+=1)for(let g=0;g<e-6;g+=1)t.isDark(x,g)&&!t.isDark(x,g+1)&&t.isDark(x,g+2)&&t.isDark(x,g+3)&&t.isDark(x,g+4)&&!t.isDark(x,g+5)&&t.isDark(x,g+6)&&(h+=40);for(let x=0;x<e;x+=1)for(let g=0;g<e-6;g+=1)t.isDark(g,x)&&!t.isDark(g+1,x)&&t.isDark(g+2,x)&&t.isDark(g+3,x)&&t.isDark(g+4,x)&&!t.isDark(g+5,x)&&t.isDark(g+6,x)&&(h+=40);let m=0;for(let x=0;x<e;x+=1)for(let g=0;g<e;g+=1)t.isDark(g,x)&&(m+=1);let b=Math.abs(100*m/e/e-50)/5;return h+=b*10,h},a}(),j=function(){let o=new Array(256),y=new Array(256);for(let i=0;i<8;i+=1)o[i]=1<<i;for(let i=8;i<256;i+=1)o[i]=o[i-4]^o[i-5]^o[i-6]^o[i-8];for(let i=0;i<255;i+=1)y[o[i]]=i;let u={};return u.glog=function(i){if(i<1)throw"glog("+i+")";return y[i]},u.gexp=function(i){for(;i<0;)i+=255;for(;i>=256;)i-=255;return o[i]},u}(),F=function(o,y){if(typeof o.length=="undefined")throw o.length+"/"+y;let u=function(){let a=0;for(;a<o.length&&o[a]==0;)a+=1;let r=new Array(o.length-a+y);for(let t=0;t<o.length-a;t+=1)r[t]=o[t+a];return r}(),i={};return i.getAt=function(a){return u[a]},i.getLength=function(){return u.length},i.multiply=function(a){let r=new Array(i.getLength()+a.getLength()-1);for(let t=0;t<i.getLength();t+=1)for(let e=0;e<a.getLength();e+=1)r[t+e]^=j.gexp(j.glog(i.getAt(t))+j.glog(a.getAt(e)));return F(r,0)},i.mod=function(a){if(i.getLength()-a.getLength()<0)return i;let r=j.glog(i.getAt(0))-j.glog(a.getAt(0)),t=new Array(i.getLength());for(let e=0;e<i.getLength();e+=1)t[e]=i.getAt(e);for(let e=0;e<a.getLength();e+=1)t[e]^=j.gexp(j.glog(a.getAt(e))+r);return F(t,0).mod(a)},i},re=function(){let o=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],y=function(a,r){let t={};return t.totalCount=a,t.dataCount=r,t},u={},i=function(a,r){switch(r){case Y.L:return o[(a-1)*4+0];case Y.M:return o[(a-1)*4+1];case Y.Q:return o[(a-1)*4+2];case Y.H:return o[(a-1)*4+3];default:return}};return u.getRSBlocks=function(a,r){let t=i(a,r);if(typeof t=="undefined")throw"bad rs block @ typeNumber:"+a+"/errorCorrectionLevel:"+r;let e=t.length/3,h=[];for(let m=0;m<e;m+=1){let b=t[m*3+0],x=t[m*3+1],g=t[m*3+2];for(let _=0;_<b;_+=1)h.push(y(x,g))}return h},u}(),ne=function(){let o=[],y=0,u={};return u.getBuffer=function(){return o},u.getAt=function(i){let a=Math.floor(i/8);return(o[a]>>>7-i%8&1)==1},u.put=function(i,a){for(let r=0;r<a;r+=1)u.putBit((i>>>a-r-1&1)==1)},u.getLengthInBits=function(){return y},u.putBit=function(i){let a=Math.floor(y/8);o.length<=a&&o.push(0),i&&(o[a]|=128>>>y%8),y+=1},u},he=function(o){let y=D.MODE_NUMBER,u=o,i={};i.getMode=function(){return y},i.getLength=function(t){return u.length},i.write=function(t){let e=u,h=0;for(;h+2<e.length;)t.put(a(e.substring(h,h+3)),10),h+=3;h<e.length&&(e.length-h==1?t.put(a(e.substring(h,h+1)),4):e.length-h==2&&t.put(a(e.substring(h,h+2)),7))};let a=function(t){let e=0;for(let h=0;h<t.length;h+=1)e=e*10+r(t.charAt(h));return e},r=function(t){if("0"<=t&&t<="9")return t.charCodeAt(0)-48;throw"illegal char :"+t};return i},ge=function(o){let y=D.MODE_ALPHA_NUM,u=o,i={};i.getMode=function(){return y},i.getLength=function(r){return u.length},i.write=function(r){let t=u,e=0;for(;e+1<t.length;)r.put(a(t.charAt(e))*45+a(t.charAt(e+1)),11),e+=2;e<t.length&&r.put(a(t.charAt(e)),6)};let a=function(r){if("0"<=r&&r<="9")return r.charCodeAt(0)-48;if("A"<=r&&r<="Z")return r.charCodeAt(0)-65+10;switch(r){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+r}};return i},ye=function(o){let y=D.MODE_8BIT_BYTE,u=o,i=Q.stringToBytes(o),a={};return a.getMode=function(){return y},a.getLength=function(r){return i.length},a.write=function(r){for(let t=0;t<i.length;t+=1)r.put(i[t],8)},a},xe=function(o){let y=D.MODE_KANJI,u=o,i=Q.stringToBytes;(function(t,e){let h=i(t);if(h.length!=2||(h[0]<<8|h[1])!=e)throw"sjis not supported."})("\u53CB",38726);let a=i(o),r={};return r.getMode=function(){return y},r.getLength=function(t){return~~(a.length/2)},r.write=function(t){let e=a,h=0;for(;h+1<e.length;){let m=(255&e[h])<<8|255&e[h+1];if(33088<=m&&m<=40956)m-=33088;else if(57408<=m&&m<=60351)m-=49472;else throw"illegal char at "+(h+1)+"/"+m;m=(m>>>8&255)*192+(m&255),t.put(m,13),h+=2}if(h<e.length)throw"illegal char at "+(h+1)},r},oe=function(){let o=[],y={};return y.writeByte=function(u){o.push(u&255)},y.writeShort=function(u){y.writeByte(u),y.writeByte(u>>>8)},y.writeBytes=function(u,i,a){i=i||0,a=a||u.length;for(let r=0;r<a;r+=1)y.writeByte(u[r+i])},y.writeString=function(u){for(let i=0;i<u.length;i+=1)y.writeByte(u.charCodeAt(i))},y.toByteArray=function(){return o},y.toString=function(){let u="";u+="[";for(let i=0;i<o.length;i+=1)i>0&&(u+=","),u+=o[i];return u+="]",u},y},ve=function(){let o=0,y=0,u=0,i="",a={},r=function(e){i+=String.fromCharCode(t(e&63))},t=function(e){if(e<0)throw"n:"+e;if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(e==62)return 43;if(e==63)return 47;throw"n:"+e};return a.writeByte=function(e){for(o=o<<8|e&255,y+=8,u+=1;y>=6;)r(o>>>y-6),y-=6},a.flush=function(){if(y>0&&(r(o<<6-y),o=0,y=0),u%3!=0){let e=3-u%3;for(let h=0;h<e;h+=1)i+="="}},a.toString=function(){return i},a},me=function(o){let y=o,u=0,i=0,a=0,r={};r.read=function(){for(;a<8;){if(u>=y.length){if(a==0)return-1;throw"unexpected end of file./"+a}let h=y.charAt(u);if(u+=1,h=="=")return a=0,-1;if(h.match(/^\s$/))continue;i=i<<6|t(h.charCodeAt(0)),a+=6}let e=i>>>a-8&255;return a-=8,e};let t=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(e==43)return 62;if(e==47)return 63;throw"c:"+e};return r},be=function(o,y){let u=o,i=y,a=new Array(o*y),r={};r.setPixel=function(m,b,x){a[b*u+m]=x},r.write=function(m){m.writeString("GIF87a"),m.writeShort(u),m.writeShort(i),m.writeByte(128),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(255),m.writeByte(255),m.writeByte(255),m.writeString(","),m.writeShort(0),m.writeShort(0),m.writeShort(u),m.writeShort(i),m.writeByte(0);let b=2,x=e(b);m.writeByte(b);let g=0;for(;x.length-g>255;)m.writeByte(255),m.writeBytes(x,g,255),g+=255;m.writeByte(x.length-g),m.writeBytes(x,g,x.length-g),m.writeByte(0),m.writeString(";")};let t=function(m){let b=m,x=0,g=0,_={};return _.write=function(C,A){if(C>>>A)throw"length over";for(;x+A>=8;)b.writeByte(255&(C<<x|g)),A-=8-x,C>>>=8-x,g=0,x=0;g=C<<x|g,x=x+A},_.flush=function(){x>0&&b.writeByte(g)},_},e=function(m){let b=1<<m,x=(1<<m)+1,g=m+1,_=h();for(let S=0;S<b;S+=1)_.add(String.fromCharCode(S));_.add(String.fromCharCode(b)),_.add(String.fromCharCode(x));let C=oe(),A=t(C);A.write(b,g);let P=0,E=String.fromCharCode(a[P]);for(P+=1;P<a.length;){let S=String.fromCharCode(a[P]);P+=1,_.contains(E+S)?E=E+S:(A.write(_.indexOf(E),g),_.size()<4095&&(_.size()==1<<g&&(g+=1),_.add(E+S)),E=S)}return A.write(_.indexOf(E),g),A.write(x,g),A.flush(),C.toByteArray()},h=function(){let m={},b=0,x={};return x.add=function(g){if(x.contains(g))throw"dup key:"+g;m[g]=b,b+=1},x.size=function(){return b},x.indexOf=function(g){return m[g]},x.contains=function(g){return typeof m[g]!="undefined"},x};return r},we=function(o,y,u){let i=be(o,y);for(let e=0;e<y;e+=1)for(let h=0;h<o;h+=1)i.setPixel(h,e,u(h,e));let a=oe();i.write(a);let r=ve(),t=a.toByteArray();for(let e=0;e<t.length;e+=1)r.writeByte(t[e]);return r.flush(),"data:image/gif;base64,"+r},le=Q,Be=Q.stringToBytes;var ie={apiBase:"https://payulink.io/api",assetBase:"https://assetcdn.payulink.io/checkout/v1/assets",name:null,logo:null,brandColor:null,pollMs:2500};function ke(o){if(!o)return null;try{let y=le(0,"M");return y.addData(String(o)),y.make(),y.createDataURL(6,2)}catch{return null}}var V=class o{constructor(y={}){if(typeof window=="undefined"||typeof document=="undefined")throw new Error("PayuLink checkout runs in the browser only. On React Native use @thepayulink/checkout-react-native; on a server use @thepayulink/server.");let u=y.key||y.keyId||y.key_id;if(!u)throw new Error("PayuLink: `key` (your publishable pl_live_\u2026 / pl_test_\u2026 key) is required");if(/^pl_(live|test)_/.test(u)||console.warn("PayuLink: `key` should look like pl_live_\u2026 or pl_test_\u2026"),y.keySecret||y.key_secret)throw new Error("PayuLink: never pass a key_secret to the browser SDK. It belongs on your server only.");this.options=Object.assign({},ie,y,{key:u})}open(y={}){let u=Object.assign({},this.options,y),i=String(u.apiBase||"").replace(/\/$/,""),a=String(u.assetBase||`${i}/assets`).replace(/\/$/,""),r=u.order_id||u.orderId;if(!r)throw new Error("PayuLink: `order_id` is required. Create it on your server with POST /v1/orders.");let t=g=>{typeof u.onError=="function"?u.onError(g):console.error("PayuLink:",g.message||g)},e=null,h=null,m=async g=>{var A;let _=await fetch(`${i}/v1/checkout/session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key_id:u.key,order_id:r,customer:g?{name:g.name,contact:g.mobile||g.contact,email:g.email}:void 0})}),C=await _.json().catch(()=>({}));if(!_.ok)throw new Error(((A=C==null?void 0:C.error)==null?void 0:A.description)||`Could not start payment (HTTP ${_.status})`);return e=C,{merchant_order_no:C.order_id,amount:C.amount/100,upi_intent_url:C.upi_intent_url,payment_link:C.payment_link,qr_data_url:ke(C.upi_intent_url),expires_at:C.expires_at,server_now:Math.floor(Date.now()/1e3)}},b=(g,_)=>{let C=async()=>{if(e!=null&&e.session_token)try{let E=await(await fetch(`${i}/v1/checkout/session/${encodeURIComponent(e.session_token)}`)).json().catch(()=>({}));E.status==="paid"&&E.payulink_signature&&(h={payulink_order_id:E.payulink_order_id,payulink_payment_id:E.payulink_payment_id,payulink_signature:E.payulink_signature,utr:E.utr||null,amount:E.amount}),_({status:E.status==="paid"?0:E.status==="failed"?1:E.status==="expired"?3:2,status_label:String(E.status||"pending").toUpperCase(),utr:E.utr||null})}catch{}},A=setInterval(C,u.pollMs||ie.pollMs);return C(),()=>clearInterval(A)},x={_inner:null,close(){var g;(g=this._inner)==null||g.close()}};return fetch(`${i}/v1/checkout/order/${encodeURIComponent(r)}?key_id=${encodeURIComponent(u.key)}`).then(async g=>{var C;let _=await g.json().catch(()=>({}));if(!g.ok)throw new Error(((C=_==null?void 0:_.error)==null?void 0:C.description)||"Unknown or expired order");x._inner=te(Object.assign({},{apiBase:i,assetBase:a,name:u.name||_.merchant_name,logo:u.logo||`${a}/payulink-logo.png`,brandColor:u.brandColor,note:u.note,prefill:u.prefill||{},amount:_.amount/100,description:u.description||u.item||_.merchant_name,createOrder:m,watchOrder:b,onSuccess:()=>{let A=h||{payulink_order_id:(e==null?void 0:e.order_id)||r,payulink_payment_id:null,payulink_signature:null};typeof u.handler=="function"&&u.handler(A),typeof u.onSuccess=="function"&&u.onSuccess(A)},onDismiss:()=>{typeof u.onDismiss=="function"&&u.onDismiss()},onError:t}))}).catch(t),x}static open(y={}){return new o(y).open(y)}};typeof window!="undefined"&&(window.PayuLink=V,window.PayulinkCheckout=V);export{V as default};
|
|
338
|
+
<div id="pl-status" class="pl-pendrow"><span class="pl-mini-spin"></span> Waiting for payment\u2026</div>`}function A(e,a){if(e==="contact")a.querySelector("#pl-continue").onclick=()=>{let i=a.querySelector("#pl-name").value.trim(),n=a.querySelector("#pl-mobile").value.replace(/\D/g,""),v=a.querySelector("#pl-email").value.trim(),_=a.querySelector("#pl-cerr");if(i.length<2)return _.textContent="Please enter your name";if(n.length!==10)return _.textContent="Enter a valid 10-digit mobile number";l.customer={name:i,mobile:n,email:v},p("options")};else if(e==="options"){a.querySelectorAll(".pl-navitem").forEach(n=>n.onclick=()=>{n.dataset.m!=="upi"&&P("Coming soon \u2014 please pay via UPI / QR for now")});let i=a.querySelector("#pl-verify");i&&(i.onclick=()=>{let n=(a.querySelector("#pl-vpa").value||"").trim();if(!/^[\w.\-]{2,}@[a-zA-Z]{2,}$/.test(n))return a.querySelector("#pl-vpa").focus(),P("Enter a valid UPI ID, e.g. name@okhdfcbank");let v=l.order&&(l.order.upi_intent_url||l.order.payment_link);v&&/Android|iPhone|iPad|Mobile/i.test(navigator.userAgent)?location.href=v:P("Scan the QR with your phone\u2019s UPI app to complete the payment.")}),L(),q(!0)}}let k=!1;async function q(e){if(e||p("options"),l.order){C();return}if(!k){k=!0;try{l.customer||(l.customer={name:t.prefill.name||"Customer",mobile:(t.prefill.contact||"").replace(/\D/g,""),email:t.prefill.email||""}),l.order=await t.createOrder(l.customer),C(),Y()}catch(a){let i=o.querySelector("#pl-qr");if(i){i.innerHTML=`<div class="pl-qrerr"><span>${c(a.message||"Could not start payment")}</span><button class="pl-retry" id="pl-retry">Try again</button></div>`;let n=i.querySelector("#pl-retry");n&&(n.onclick=()=>{k=!1,i.innerHTML='<div class="pl-qrloading"></div>',q(!0)})}}finally{k=!1}}}function C(){let e=l.order;if(!e)return;N(e);let a=o.querySelector("#pl-qr");a&&(e.qr_data_url?a.innerHTML=`<img src="${e.qr_data_url}" alt="UPI QR">`:a.innerHTML='<div class="pl-qrerr"><span>QR unavailable \u2014 use a UPI app below</span></div>');let i=e.upi_intent_url||e.payment_link||"#",n=o.querySelector("#pl-applist");n&&n.querySelectorAll(".pl-uapp").forEach(v=>{v.setAttribute("href",i),v.setAttribute("target","_blank"),v.setAttribute("rel","noopener")}),L()}function N(e){e&&e.expires_at&&e.server_now?l.expiryMs=Date.now()+Math.max(0,e.expires_at-e.server_now):l.expiryMs||(l.expiryMs=Date.now()+5*60*1e3)}function E(){if(l.done)return;let e=o.querySelector("#pl-qr");e&&(e.innerHTML='<div class="pl-qrerr"><span>QR code expired</span><button class="pl-retry" id="pl-regen">Generate new QR</button></div>');let a=o.querySelector("#pl-regen");a&&(a.onclick=H);let i=o.querySelector("#pl-timer");i&&(i.textContent="Expired");let n=o.querySelector(".pl-validrow");n&&n.classList.add("pl-expired")}function H(){if(l.stop){try{l.stop()}catch{}l.stop=null}l.order=null,l.expiryMs=null,k=!1;let e=o.querySelector(".pl-validrow");e&&e.classList.remove("pl-expired");let a=o.querySelector("#pl-qr");a&&(a.innerHTML='<div class="pl-qrloading"></div>'),q(!0)}function Y(){!l.order||l.stop||(l.stop=t.watchOrder(l.order.merchant_order_no,e=>{!e||typeof e.status!="number"||(e.status===0?(l.utr=e.utr||l.utr,V()):e.status===3?(clearInterval(l.timer),l.expiryMs=Date.now(),E(),I("failed","QR expired \u2014 generate a new one")):[1,4].includes(e.status)?I("failed","Payment "+(e.status_label||"failed").toLowerCase()):e.status===6&&I("pending","Processing payment\u2026"))}))}function I(e,a){let i=o.querySelector("#pl-status");i&&(i.className=e==="failed"?"pl-pendrow pl-fail":"pl-pendrow",i.innerHTML=(e==="pending"?'<span class="pl-mini-spin"></span> ':"")+c(a))}function V(){l.done||(l.done=!0,clearInterval(l.timer),p("success"),t.onSuccess&&t.onSuccess({merchant_order_no:l.order.merchant_order_no,utr:l.utr,amount:t.amount}),l.utr||Q())}async function Q(){for(let e=0;e<10&&!l.utr;e++){await new Promise(a=>setTimeout(a,4e3));try{let a=await fetch(`${s}/api/order/${l.order.merchant_order_no}`).then(i=>i.json());if(a.utr){l.utr=a.utr;let i=o.querySelector("#pl-pid");i&&l.screen==="success"&&i.insertAdjacentHTML("afterend",`<div class="pl-pid pl-utr">UTR ${c(a.utr)}</div>`);break}}catch{}}}function L(){clearInterval(l.timer);let e=()=>{let a=o.querySelector("#pl-timer");if(!a)return;if(!l.expiryMs){a.textContent="Valid 5:00";return}let i=Math.max(0,Math.round((l.expiryMs-Date.now())/1e3));a.textContent=i>0?"Valid "+le(i):"Expired",i<=0&&(clearInterval(l.timer),E())};e(),l.timer=setInterval(e,1e3)}function P(e){let a=document.getElementById("pl-toast");a||(a=document.createElement("div"),a.id="pl-toast",document.body.appendChild(a)),a.textContent=e,a.classList.add("pl-show"),clearTimeout(a._t),a._t=setTimeout(()=>a.classList.remove("pl-show"),2600)}return p("loader"),setTimeout(()=>{let e=t.prefill||{};e.name&&(e.contact||"").replace(/\D/g,"").length===10?(l.customer={name:e.name,mobile:e.contact.replace(/\D/g,""),email:e.email||""},p("options")):p("contact");let a=o.querySelector("#pl-splash");a&&(a.classList.add("pl-splash-hide"),setTimeout(()=>a.remove(),450))},1600),{close:d}}var R={apiBase:"https://payulink.io/api",assetBase:"https://assetcdn.payulink.io/checkout/v1/assets",name:null,logo:null,brandColor:null,pollMs:2500},M=class t{constructor(s={}){if(typeof window=="undefined"||typeof document=="undefined")throw new Error("PayuLink checkout runs in the browser only. On React Native use @thepayulink/checkout-react-native; on a server use @thepayulink/server.");let r=s.key||s.keyId||s.key_id;if(!r)throw new Error("PayuLink: `key` (your publishable pl_live_\u2026 / pl_test_\u2026 key) is required");if(/^pl_(live|test)_/.test(r)||console.warn("PayuLink: `key` should look like pl_live_\u2026 or pl_test_\u2026"),s.keySecret||s.key_secret)throw new Error("PayuLink: never pass a key_secret to the browser SDK. It belongs on your server only.");this.options=Object.assign({},R,s,{key:r})}open(s={}){let r=Object.assign({},this.options,s),m=String(r.apiBase||"").replace(/\/$/,""),b=String(r.assetBase||`${m}/assets`).replace(/\/$/,""),l=r.order_id||r.orderId;if(!l)throw new Error("PayuLink: `order_id` is required. Create it on your server with POST /v1/orders.");let o=d=>{typeof r.onError=="function"?r.onError(d):console.error("PayuLink:",d.message||d)},y=null,$=null,S=async d=>{var x;let u=await fetch(`${m}/v1/checkout/session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key_id:r.key,order_id:l,customer:d?{name:d.name,contact:d.mobile||d.contact,email:d.email}:void 0})}),p=await u.json().catch(()=>({}));if(!u.ok)throw new Error(((x=p==null?void 0:p.error)==null?void 0:x.description)||`Could not start payment (HTTP ${u.status})`);return y=p,{merchant_order_no:p.order_id,amount:p.amount/100,upi_intent_url:p.upi_intent_url,payment_link:p.payment_link,qr_data_url:p.qr_data_url||null,expires_at:p.expires_at?p.expires_at*1e3:null,server_now:Date.now()}},z=(d,u)=>{let p=async()=>{if(y!=null&&y.session_token)try{let f=await(await fetch(`${m}/v1/checkout/session/${encodeURIComponent(y.session_token)}`)).json().catch(()=>({}));f.status==="paid"&&f.payulink_signature&&($={payulink_order_id:f.payulink_order_id,payulink_payment_id:f.payulink_payment_id,payulink_signature:f.payulink_signature,utr:f.utr||null,amount:f.amount}),u({status:f.status==="paid"?0:f.status==="failed"?1:f.status==="expired"?3:2,status_label:String(f.status||"pending").toUpperCase(),utr:f.utr||null})}catch{}},x=setInterval(p,r.pollMs||R.pollMs);return p(),()=>clearInterval(x)},w={_inner:null,close(){var d;(d=this._inner)==null||d.close()}};return fetch(`${m}/v1/checkout/order/${encodeURIComponent(l)}?key_id=${encodeURIComponent(r.key)}`).then(async d=>{var p;let u=await d.json().catch(()=>({}));if(!d.ok)throw new Error(((p=u==null?void 0:u.error)==null?void 0:p.description)||"Unknown or expired order");w._inner=O(Object.assign({},{apiBase:m,assetBase:b,name:r.name||u.merchant_name,logo:r.logo||`${b}/payulink-logo.png`,brandColor:r.brandColor,note:r.note,prefill:r.prefill||{},amount:u.amount/100,description:r.description||r.item||u.merchant_name,createOrder:S,watchOrder:z,onSuccess:()=>{let x=$||{payulink_order_id:(y==null?void 0:y.order_id)||l,payulink_payment_id:null,payulink_signature:null};typeof r.handler=="function"&&r.handler(x),typeof r.onSuccess=="function"&&r.onSuccess(x)},onDismiss:()=>{typeof r.onDismiss=="function"&&r.onDismiss()},onError:o}))}).catch(o),w}static open(s={}){return new t(s).open(s)}};typeof window!="undefined"&&(window.PayuLink=M,window.PayulinkCheckout=M);export{M as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var PayulinkCheckoutNS=(()=>{var
|
|
1
|
+
var PayulinkCheckoutNS=(()=>{var j=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var ae=Object.prototype.hasOwnProperty;var te=(a,i)=>{for(var r in i)j(a,r,{get:i[r],enumerable:!0})},re=(a,i,r,y)=>{if(i&&typeof i=="object"||typeof i=="function")for(let h of le(i))!ae.call(a,h)&&h!==r&&j(a,h,{get:()=>i[h],enumerable:!(y=ee(i,h))||y.enumerable});return a};var ie=a=>re(j({},"__esModule",{value:!0}),a);var de={};te(de,{default:()=>w});var oe=`
|
|
2
2
|
#pl-overlay * { box-sizing: border-box; margin: 0; padding: 0; }
|
|
3
3
|
#pl-overlay { --pl-blue:#3395ff; --pl-blue-dark:#1f86f5; --pl-brand:#0b3068; --pl-ink:#1a2a44; --pl-mut:#6b7c93; --pl-line:#eceff4;
|
|
4
4
|
position: fixed; inset: 0; z-index: 2147483000; font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
@@ -237,7 +237,7 @@ var PayulinkCheckoutNS=(()=>{var Z=Object.defineProperty;var de=Object.getOwnPro
|
|
|
237
237
|
#pl-overlay .pl-approw { justify-content: center; }
|
|
238
238
|
#pl-overlay .pl-validrow { margin: 0 auto; }
|
|
239
239
|
}
|
|
240
|
-
`,
|
|
240
|
+
`,B=!1;function U(a=document){if(B&&a.getElementById("pl-checkout-styles"))return;let i=a.createElement("style");i.id="pl-checkout-styles",i.textContent=oe,a.head.appendChild(i),B=!0}var ne=a=>"\u20B9"+Number(a||0).toLocaleString("en-IN",{maximumFractionDigits:2}),pe=a=>`${Math.floor(a/60)}:${a%60<10?"0":""}${a%60}`,c=a=>String(a==null?"":a).replace(/[&<>"]/g,i=>({"&":"&","<":"<",">":">",'"':"""})[i]),m=a=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${a}</svg>`,b={qr:m('<rect width="5" height="5" x="3" y="3" rx="1"/><rect width="5" height="5" x="16" y="3" rx="1"/><rect width="5" height="5" x="3" y="16" rx="1"/><path d="M21 16h-3a2 2 0 0 0-2 2v3"/><path d="M21 21v.01"/><path d="M12 7v3a2 2 0 0 1-2 2H7"/><path d="M3 12h.01"/><path d="M12 3h.01"/><path d="M12 16v.01"/><path d="M16 12h1"/><path d="M21 12v.01"/><path d="M12 21v-1"/>'),card:m('<rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/>'),netbanking:m('<path d="M10 18v-7"/><path d="M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z"/><path d="M14 18v-7"/><path d="M18 18v-7"/><path d="M3 22h18"/><path d="M6 18v-7"/>'),wallet:m('<path d="M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"/><path d="M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"/>'),emi:m('<path d="M16 14v2.2l1.6 1"/><path d="M16 2v4"/><path d="M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5"/><path d="M3 10h5"/><path d="M8 2v4"/><circle cx="16" cy="16" r="6"/>'),back:m('<path d="M15 18l-6-6 6-6"/>'),mail:m('<rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-10 5L2 7"/>'),arrow:m('<path d="M5 12h14M13 6l6 6-6 6"/>'),verified:m('<path d="M9 12l2 2 4-4"/><circle cx="12" cy="12" r="10"/>'),lock:m('<rect width="18" height="11" x="3" y="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>')},O='<svg width="13" height="13" viewBox="0 0 24 24" fill="currentColor"><path d="M12 1l9 4v6c0 5.5-3.8 10.7-9 12-5.2-1.3-9-6.5-9-12V5l9-4z"/></svg>',se=[{m:"card",t:"Cards",s:"Visa, Mastercard & RuPay",ic:"card"},{m:"netbanking",t:"Netbanking",s:"All Indian banks",ic:"netbanking"},{m:"wallet",t:"Wallet",s:"Paytm, PhonePe & more",ic:"wallet"},{m:"emi",t:"EMI",s:"EMI via cards & more",ic:"emi"}];function R(a){U(),a=Object.assign({name:"Payment",description:"",amount:0,assetBase:"/assets",logo:"/assets/payulink-logo.png",prefill:{},apiBase:""},a);let i=String(a.apiBase||"").replace(/\/$/,""),r=ne(a.amount),y=["gpay","phonepe","paytm","bhim","amazonpay"].reduce((e,t)=>(e[t]=`${a.assetBase}/upi/${t}.png`,e),{}),h=["phonepe","gpay","paytm","bhim","amazonpay"],l={screen:"loader",order:null,customer:null,timer:null,stop:null,done:!1,utr:null,expiryMs:null},n=document.createElement("div");n.id="pl-overlay",a.brandColor&&n.style.setProperty("--pl-brand",a.brandColor),n.innerHTML=`
|
|
241
241
|
<div class="pl-modal" role="dialog" aria-modal="true">
|
|
242
242
|
<div class="pl-splash" id="pl-splash">
|
|
243
243
|
<div class="pl-shield">
|
|
@@ -246,87 +246,87 @@ var PayulinkCheckoutNS=(()=>{var Z=Object.defineProperty;var de=Object.getOwnPro
|
|
|
246
246
|
<path d="M60 3 L113 25 V70 C113 105 90 128 60 137 C30 128 7 105 7 70 V25 Z" fill="url(#pl-shgrad)"/>
|
|
247
247
|
</svg>
|
|
248
248
|
<span class="pl-shield-shine"></span>
|
|
249
|
-
<img class="pl-shield-logo" src="${
|
|
249
|
+
<img class="pl-shield-logo" src="${c(a.assetBase)}/payulink-logo.png" alt="payulink">
|
|
250
250
|
</div>
|
|
251
|
-
<div class="pl-splash-foot">Secured By <span class="pl-pb"><img src="${
|
|
251
|
+
<div class="pl-splash-foot">Secured By <span class="pl-pb"><img src="${c(a.assetBase)}/payulink-logo.png" alt=""><strong>payulink</strong></span></div>
|
|
252
252
|
</div>
|
|
253
253
|
<aside class="pl-left">
|
|
254
254
|
<div class="pl-brandrow">
|
|
255
|
-
<div class="pl-logo"><img src="${
|
|
255
|
+
<div class="pl-logo"><img src="${c(a.logo)}" alt=""></div>
|
|
256
256
|
<div class="pl-bmeta">
|
|
257
|
-
<div class="pl-bname">${
|
|
258
|
-
<div class="pl-btrust">${
|
|
257
|
+
<div class="pl-bname">${c(a.name)}</div>
|
|
258
|
+
<div class="pl-btrust">${b.verified}<span>Trusted Business</span></div>
|
|
259
259
|
</div>
|
|
260
260
|
</div>
|
|
261
261
|
<div class="pl-summary">
|
|
262
262
|
<div class="pl-sl">Price Summary</div>
|
|
263
|
-
<div class="pl-samt">${
|
|
264
|
-
<div class="pl-snote">${
|
|
263
|
+
<div class="pl-samt">${r}</div>
|
|
264
|
+
<div class="pl-snote">${c(a.note||"Paying for "+(a.description||a.name))}</div>
|
|
265
265
|
</div>
|
|
266
266
|
<svg class="pl-illus" viewBox="0 0 230 150" fill="none"><rect x="20" y="70" width="58" height="68" rx="5" fill="#fff" fill-opacity=".92"/><path d="M33 70c0-10 5-16 16-16s16 6 16 16" stroke="#fff" stroke-width="3.5"/><rect x="88" y="55" width="68" height="83" rx="5" fill="#fff"/><path d="M104 55c0-12 6-19 18-19s18 7 18 19" stroke="#fff" stroke-width="3.5"/><rect x="150" y="92" width="52" height="46" rx="4" fill="#fff" fill-opacity=".92"/><circle cx="178" cy="40" r="18" fill="#fff"/><path d="M178 30v20M168 40h20" stroke="currentColor" stroke-width="3.5" opacity=".5"/></svg>
|
|
267
|
-
<div class="pl-secured">${
|
|
267
|
+
<div class="pl-secured">${O}Secured by <span class="pl-pb"><img src="${c(a.assetBase)}/payulink-logo.png" alt=""><strong>payulink</strong></span></div>
|
|
268
268
|
</aside>
|
|
269
269
|
<section class="pl-main">
|
|
270
270
|
<header class="pl-head">
|
|
271
|
-
<button class="pl-hic pl-back" id="pl-back" aria-label="Back">${
|
|
271
|
+
<button class="pl-hic pl-back" id="pl-back" aria-label="Back">${b.back}</button>
|
|
272
272
|
<div class="pl-title" id="pl-title">Payment Options</div>
|
|
273
273
|
<button class="pl-hic pl-dots" aria-label="More">\u22EF</button>
|
|
274
274
|
<button class="pl-hic pl-close-x" id="pl-close" aria-label="Close">\xD7</button>
|
|
275
275
|
</header>
|
|
276
276
|
<div class="pl-vp"><div class="pl-screen pl-active" id="pl-screen"></div></div>
|
|
277
|
-
<footer class="pl-foot">${
|
|
277
|
+
<footer class="pl-foot">${b.lock}<span>Encrypted & secure payments</span></footer>
|
|
278
278
|
</section>
|
|
279
|
-
</div>`,document.body.appendChild(
|
|
279
|
+
</div>`,document.body.appendChild(n);let x=document.body.style.overflow;document.body.style.overflow="hidden";let $=n.querySelector(".pl-vp"),S=n.querySelector("#pl-title"),z=n.querySelector("#pl-back");function k(){d(),a.onDismiss&&a.onDismiss()}function d(){if(l.stop)try{l.stop()}catch{}clearInterval(l.timer),n.classList.add("pl-closing"),document.body.style.overflow=x,setTimeout(()=>n.remove(),240)}n.querySelector("#pl-close").onclick=k,n.addEventListener("mousedown",e=>{e.target.id==="pl-overlay"&&k()}),z.onclick=()=>{l.screen==="contact"||l.screen==="success"||s("options")};let u={loader:"Payment Options",contact:"Contact Details",options:"Payment Options",success:"Payment Successful"};function s(e){l.screen=e,S.textContent=u[e]||"Payment",z.classList.toggle("pl-show",e==="options"),clearInterval(l.timer);let t=document.createElement("div");t.className="pl-screen pl-active"+(e==="options"?" pl-screen-options":""),t.innerHTML=f[e]?f[e]():"",$.replaceChildren(t),N(e,t)}let g=h.slice(0,4).map(e=>`<img src="${y[e]}" alt="">`).join(""),C=h.map(e=>`<a class="pl-uapp" data-app="${e}" title="${e}"><img src="${y[e]}" alt="${e}"></a>`).join(""),f={loader:()=>`<div class="pl-loader"><div class="pl-bload"><img src="${c(a.logo)}" alt=""><span class="pl-bring"></span><span class="pl-bripple"></span><span class="pl-bripple pl-bripple2"></span></div><p>Securely loading payment options\u2026</p></div>`,contact:()=>`
|
|
280
280
|
<div class="pl-pad">
|
|
281
281
|
<div class="pl-h1">Contact details</div>
|
|
282
282
|
<div class="pl-sub">Enter your details to continue the payment</div>
|
|
283
283
|
<div class="pl-field"><label>Full Name</label>
|
|
284
|
-
<input class="pl-input" id="pl-name" type="text" placeholder="Enter your name" value="${
|
|
284
|
+
<input class="pl-input" id="pl-name" type="text" placeholder="Enter your name" value="${c(a.prefill.name||"")}"></div>
|
|
285
285
|
<div class="pl-field"><label>Mobile Number</label>
|
|
286
286
|
<div class="pl-phone"><div class="pl-cc">+91</div>
|
|
287
|
-
<input class="pl-input" id="pl-mobile" type="tel" maxlength="10" placeholder="Enter mobile number" value="${
|
|
287
|
+
<input class="pl-input" id="pl-mobile" type="tel" maxlength="10" placeholder="Enter mobile number" value="${c(a.prefill.contact||"")}"></div></div>
|
|
288
288
|
<div class="pl-field"><label>Email Address <span class="pl-opt">(optional)</span></label>
|
|
289
|
-
<div class="pl-inwrap"><span class="pl-inicon">${
|
|
290
|
-
<input class="pl-input pl-padleft" id="pl-email" type="email" placeholder="Enter email address" value="${
|
|
291
|
-
<button class="pl-cta" id="pl-continue">Continue <span class="pl-cta-arr">${
|
|
289
|
+
<div class="pl-inwrap"><span class="pl-inicon">${b.mail}</span>
|
|
290
|
+
<input class="pl-input pl-padleft" id="pl-email" type="email" placeholder="Enter email address" value="${c(a.prefill.email||"")}"></div></div>
|
|
291
|
+
<button class="pl-cta" id="pl-continue">Continue <span class="pl-cta-arr">${b.arrow}</span></button>
|
|
292
292
|
<div class="pl-err" id="pl-cerr"></div>
|
|
293
|
-
<div class="pl-trust">${
|
|
293
|
+
<div class="pl-trust">${O}100% secure payments</div>
|
|
294
294
|
</div>`,options:()=>`
|
|
295
295
|
<div class="pl-options">
|
|
296
296
|
<div class="pl-nav" id="pl-nav">
|
|
297
297
|
<div class="pl-navlabel">Recommended</div>
|
|
298
298
|
<div class="pl-navitem active" data-m="upi">
|
|
299
|
-
<div class="pl-ni-ic">${
|
|
299
|
+
<div class="pl-ni-ic">${b.qr}</div>
|
|
300
300
|
<div class="pl-ni-body"><div class="pl-ni-t">UPI</div></div>
|
|
301
|
-
<div class="pl-ni-apps">${
|
|
301
|
+
<div class="pl-ni-apps">${g}</div>
|
|
302
302
|
</div>
|
|
303
303
|
<div class="pl-navlabel">Cards, Banking & More</div>
|
|
304
|
-
${
|
|
305
|
-
<div class="pl-navitem pl-disabled" data-m="${
|
|
306
|
-
<div class="pl-ni-ic pl-ic-${
|
|
307
|
-
<div class="pl-ni-body"><div class="pl-ni-t">${
|
|
304
|
+
${se.map(e=>`
|
|
305
|
+
<div class="pl-navitem pl-disabled" data-m="${e.m}">
|
|
306
|
+
<div class="pl-ni-ic pl-ic-${e.ic}">${b[e.ic]}</div>
|
|
307
|
+
<div class="pl-ni-body"><div class="pl-ni-t">${e.t}</div><div class="pl-ni-s">${e.s}</div></div>
|
|
308
308
|
<span class="pl-soon">Coming soon</span>
|
|
309
309
|
</div>`).join("")}
|
|
310
310
|
</div>
|
|
311
|
-
<div class="pl-pane" id="pl-pane">${
|
|
312
|
-
</div>`,success:()=>{let
|
|
311
|
+
<div class="pl-pane" id="pl-pane">${A()}</div>
|
|
312
|
+
</div>`,success:()=>{let e=["#00c060","#3395ff","#ffb020","#ff5a5f","#7a52d8","#19c3c3"];return`
|
|
313
313
|
<div class="pl-success">
|
|
314
314
|
<div class="pl-burst">
|
|
315
|
-
${Array.from({length:18},(
|
|
315
|
+
${Array.from({length:18},(o,p)=>{let v=p/18*Math.PI*2+(p%2?.22:-.22),M=60+p*13%40,F=Math.round(Math.cos(v)*M),G=Math.round(Math.sin(v)*M),W=e[p%e.length],Z=(p%2?1:-1)*(140+p*14),J=p%3===0?6:8,K=p%4===0?6:12;return`<i class="pl-confetti" style="--tx:${F}px;--ty:${G}px;--c:${W};--r:${Z}deg;width:${J}px;height:${K}px;border-radius:${p%4===0?"50%":"2px"};animation-delay:${(.15+p*.024).toFixed(3)}s"></i>`}).join("")}
|
|
316
316
|
<span class="pl-ripple"></span><span class="pl-ripple pl-ripple2"></span>
|
|
317
317
|
<div class="pl-check"><svg viewBox="0 0 24 24"><path d="M5 13l4 4L19 7"/></svg></div>
|
|
318
318
|
</div>
|
|
319
319
|
<h2>Payment Successful</h2>
|
|
320
|
-
<p>${
|
|
321
|
-
<div class="pl-pid" id="pl-pid">${
|
|
322
|
-
${
|
|
323
|
-
</div>`}};function
|
|
320
|
+
<p>${r} paid${a.name?" to "+c(a.name):""}</p>
|
|
321
|
+
<div class="pl-pid" id="pl-pid">${c(l.order&&l.order.merchant_order_no||"")}</div>
|
|
322
|
+
${l.utr?`<div class="pl-pid pl-utr">UTR ${c(l.utr)}</div>`:""}
|
|
323
|
+
</div>`}};function A(){return`
|
|
324
324
|
<div class="pl-paneh">UPI QR</div>
|
|
325
325
|
<div class="pl-qrcard">
|
|
326
326
|
<div class="pl-qrbox" id="pl-qr"><div class="pl-qrloading"></div></div>
|
|
327
327
|
<div class="pl-qrside">
|
|
328
328
|
<div class="pl-scan">Scan the QR using any UPI App</div>
|
|
329
|
-
<div class="pl-approw" id="pl-applist">${
|
|
329
|
+
<div class="pl-approw" id="pl-applist">${C}</div>
|
|
330
330
|
<div class="pl-validrow"><span class="pl-dot"></span><span id="pl-timer">Valid 5:00</span></div>
|
|
331
331
|
</div>
|
|
332
332
|
</div>
|
|
@@ -335,7 +335,5 @@ var PayulinkCheckoutNS=(()=>{var Z=Object.defineProperty;var de=Object.getOwnPro
|
|
|
335
335
|
<input class="pl-vpa" id="pl-vpa" placeholder="example@okhdfcbank" autocomplete="off" spellcheck="false">
|
|
336
336
|
<button class="pl-verify" id="pl-verify">Verify and Pay</button>
|
|
337
337
|
</div>
|
|
338
|
-
<div id="pl-status" class="pl-pendrow"><span class="pl-mini-spin"></span> Waiting for payment\u2026</div>`}function J(f,p){if(f==="contact")p.querySelector("#pl-continue").onclick=()=>{let k=p.querySelector("#pl-name").value.trim(),M=p.querySelector("#pl-mobile").value.replace(/\D/g,""),I=p.querySelector("#pl-email").value.trim(),H=p.querySelector("#pl-cerr");if(k.length<2)return H.textContent="Please enter your name";if(M.length!==10)return H.textContent="Enter a valid 10-digit mobile number";r.customer={name:k,mobile:M,email:I},C("options")};else if(f==="options"){p.querySelectorAll(".pl-navitem").forEach(M=>M.onclick=()=>{M.dataset.m!=="upi"&&T("Coming soon \u2014 please pay via UPI / QR for now")});let k=p.querySelector("#pl-verify");k&&(k.onclick=()=>{let M=(p.querySelector("#pl-vpa").value||"").trim();if(!/^[\w.\-]{2,}@[a-zA-Z]{2,}$/.test(M))return p.querySelector("#pl-vpa").focus(),T("Enter a valid UPI ID, e.g. name@okhdfcbank");let I=r.order&&(r.order.upi_intent_url||r.order.payment_link);I&&/Android|iPhone|iPad|Mobile/i.test(navigator.userAgent)?location.href=I:T("Scan the QR with your phone\u2019s UPI app to complete the payment.")}),B(),R(!0)}}let z=!1;async function R(f){if(f||C("options"),r.order){G();return}if(!z){z=!0;try{r.customer||(r.customer={name:o.prefill.name||"Customer",mobile:(o.prefill.contact||"").replace(/\D/g,""),email:o.prefill.email||""}),r.order=await o.createOrder(r.customer),G(),d()}catch(p){let k=t.querySelector("#pl-qr");if(k){k.innerHTML=`<div class="pl-qrerr"><span>${L(p.message||"Could not start payment")}</span><button class="pl-retry" id="pl-retry">Try again</button></div>`;let M=k.querySelector("#pl-retry");M&&(M.onclick=()=>{z=!1,k.innerHTML='<div class="pl-qrloading"></div>',R(!0)})}}finally{z=!1}}}function G(){let f=r.order;if(!f)return;l(f);let p=t.querySelector("#pl-qr");p&&(f.qr_data_url?p.innerHTML=`<img src="${f.qr_data_url}" alt="UPI QR">`:p.innerHTML='<div class="pl-qrerr"><span>QR unavailable \u2014 use a UPI app below</span></div>');let k=f.upi_intent_url||f.payment_link||"#",M=t.querySelector("#pl-applist");M&&M.querySelectorAll(".pl-uapp").forEach(I=>{I.setAttribute("href",k),I.setAttribute("target","_blank"),I.setAttribute("rel","noopener")}),B()}function l(f){f&&f.expires_at&&f.server_now?r.expiryMs=Date.now()+Math.max(0,f.expires_at-f.server_now):r.expiryMs||(r.expiryMs=Date.now()+5*60*1e3)}function u(){if(r.done)return;let f=t.querySelector("#pl-qr");f&&(f.innerHTML='<div class="pl-qrerr"><span>QR code expired</span><button class="pl-retry" id="pl-regen">Generate new QR</button></div>');let p=t.querySelector("#pl-regen");p&&(p.onclick=n);let k=t.querySelector("#pl-timer");k&&(k.textContent="Expired");let M=t.querySelector(".pl-validrow");M&&M.classList.add("pl-expired")}function n(){if(r.stop){try{r.stop()}catch{}r.stop=null}r.order=null,r.expiryMs=null,z=!1;let f=t.querySelector(".pl-validrow");f&&f.classList.remove("pl-expired");let p=t.querySelector("#pl-qr");p&&(p.innerHTML='<div class="pl-qrloading"></div>'),R(!0)}function d(){!r.order||r.stop||(r.stop=o.watchOrder(r.order.merchant_order_no,f=>{!f||typeof f.status!="number"||(f.status===0?(r.utr=f.utr||r.utr,v()):f.status===3?(clearInterval(r.timer),r.expiryMs=Date.now(),u(),s("failed","QR expired \u2014 generate a new one")):[1,4].includes(f.status)?s("failed","Payment "+(f.status_label||"failed").toLowerCase()):f.status===6&&s("pending","Processing payment\u2026"))}))}function s(f,p){let k=t.querySelector("#pl-status");k&&(k.className=f==="failed"?"pl-pendrow pl-fail":"pl-pendrow",k.innerHTML=(f==="pending"?'<span class="pl-mini-spin"></span> ':"")+L(p))}function v(){r.done||(r.done=!0,clearInterval(r.timer),C("success"),o.onSuccess&&o.onSuccess({merchant_order_no:r.order.merchant_order_no,utr:r.utr,amount:o.amount}),r.utr||w())}async function w(){for(let f=0;f<10&&!r.utr;f++){await new Promise(p=>setTimeout(p,4e3));try{let p=await fetch(`${g}/api/order/${r.order.merchant_order_no}`).then(k=>k.json());if(p.utr){r.utr=p.utr;let k=t.querySelector("#pl-pid");k&&r.screen==="success"&&k.insertAdjacentHTML("afterend",`<div class="pl-pid pl-utr">UTR ${L(p.utr)}</div>`);break}}catch{}}}function B(){clearInterval(r.timer);let f=()=>{let p=t.querySelector("#pl-timer");if(!p)return;if(!r.expiryMs){p.textContent="Valid 5:00";return}let k=Math.max(0,Math.round((r.expiryMs-Date.now())/1e3));p.textContent=k>0?"Valid "+me(k):"Expired",k<=0&&(clearInterval(r.timer),u())};f(),r.timer=setInterval(f,1e3)}function T(f){let p=document.getElementById("pl-toast");p||(p=document.createElement("div"),p.id="pl-toast",document.body.appendChild(p)),p.textContent=f,p.classList.add("pl-show"),clearTimeout(p._t),p._t=setTimeout(()=>p.classList.remove("pl-show"),2600)}return C("loader"),setTimeout(()=>{let f=o.prefill||{};f.name&&(f.contact||"").replace(/\D/g,"").length===10?(r.customer={name:f.name,mobile:f.contact.replace(/\D/g,""),email:f.email||""},C("options")):C("contact");let p=t.querySelector("#pl-splash");p&&(p.classList.add("pl-splash-hide"),setTimeout(()=>p.remove(),450))},1600),{close:y}}var Q=function(o,g){let a=o,r=F[g],t=null,e=0,h=null,m=[],b={},x=function(l,u){e=a*4+17,t=function(n){let d=new Array(n);for(let s=0;s<n;s+=1){d[s]=new Array(n);for(let v=0;v<n;v+=1)d[s][v]=null}return d}(e),y(0,0),y(e-7,0),y(0,e-7),A(),C(),E(l,u),a>=7&&P(l),h==null&&(h=z(a,r,m)),S(h,u)},y=function(l,u){for(let n=-1;n<=7;n+=1)if(!(l+n<=-1||e<=l+n))for(let d=-1;d<=7;d+=1)u+d<=-1||e<=u+d||(0<=n&&n<=6&&(d==0||d==6)||0<=d&&d<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=d&&d<=4?t[l+n][u+d]=!0:t[l+n][u+d]=!1)},_=function(){let l=0,u=0;for(let n=0;n<8;n+=1){x(!0,n);let d=N.getLostPoint(b);(n==0||l>d)&&(l=d,u=n)}return u},C=function(){for(let l=8;l<e-8;l+=1)t[l][6]==null&&(t[l][6]=l%2==0);for(let l=8;l<e-8;l+=1)t[6][l]==null&&(t[6][l]=l%2==0)},A=function(){let l=N.getPatternPosition(a);for(let u=0;u<l.length;u+=1)for(let n=0;n<l.length;n+=1){let d=l[u],s=l[n];if(t[d][s]==null)for(let v=-2;v<=2;v+=1)for(let w=-2;w<=2;w+=1)v==-2||v==2||w==-2||w==2||v==0&&w==0?t[d+v][s+w]=!0:t[d+v][s+w]=!1}},P=function(l){let u=N.getBCHTypeNumber(a);for(let n=0;n<18;n+=1){let d=!l&&(u>>n&1)==1;t[Math.floor(n/3)][n%3+e-8-3]=d}for(let n=0;n<18;n+=1){let d=!l&&(u>>n&1)==1;t[n%3+e-8-3][Math.floor(n/3)]=d}},E=function(l,u){let n=r<<3|u,d=N.getBCHTypeInfo(n);for(let s=0;s<15;s+=1){let v=!l&&(d>>s&1)==1;s<6?t[s][8]=v:s<8?t[s+1][8]=v:t[e-15+s][8]=v}for(let s=0;s<15;s+=1){let v=!l&&(d>>s&1)==1;s<8?t[8][e-s-1]=v:s<9?t[8][15-s-1+1]=v:t[8][15-s-1]=v}t[e-8][8]=!l},S=function(l,u){let n=-1,d=e-1,s=7,v=0,w=N.getMaskFunction(u);for(let B=e-1;B>0;B-=2)for(B==6&&(B-=1);;){for(let T=0;T<2;T+=1)if(t[d][B-T]==null){let f=!1;v<l.length&&(f=(l[v]>>>s&1)==1),w(d,B-T)&&(f=!f),t[d][B-T]=f,s-=1,s==-1&&(v+=1,s=7)}if(d+=n,d<0||e<=d){d-=n,n=-n;break}}},J=function(l,u){let n=0,d=0,s=0,v=new Array(u.length),w=new Array(u.length);for(let p=0;p<u.length;p+=1){let k=u[p].dataCount,M=u[p].totalCount-k;d=Math.max(d,k),s=Math.max(s,M),v[p]=new Array(k);for(let $=0;$<v[p].length;$+=1)v[p][$]=255&l.getBuffer()[$+n];n+=k;let I=N.getErrorCorrectPolynomial(M),K=V(v[p],I.getLength()-1).mod(I);w[p]=new Array(I.getLength()-1);for(let $=0;$<w[p].length;$+=1){let X=$+K.getLength()-w[p].length;w[p][$]=X>=0?K.getAt(X):0}}let B=0;for(let p=0;p<u.length;p+=1)B+=u[p].totalCount;let T=new Array(B),f=0;for(let p=0;p<d;p+=1)for(let k=0;k<u.length;k+=1)p<v[k].length&&(T[f]=v[k][p],f+=1);for(let p=0;p<s;p+=1)for(let k=0;k<u.length;k+=1)p<w[k].length&&(T[f]=w[k][p],f+=1);return T},z=function(l,u,n){let d=ne.getRSBlocks(l,u),s=oe();for(let w=0;w<n.length;w+=1){let B=n[w];s.put(B.getMode(),4),s.put(B.getLength(),N.getLengthInBits(B.getMode(),l)),B.write(s)}let v=0;for(let w=0;w<d.length;w+=1)v+=d[w].dataCount;if(s.getLengthInBits()>v*8)throw"code length overflow. ("+s.getLengthInBits()+">"+v*8+")";for(s.getLengthInBits()+4<=v*8&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;!(s.getLengthInBits()>=v*8||(s.put(236,8),s.getLengthInBits()>=v*8));)s.put(17,8);return J(s,d)};b.addData=function(l,u){u=u||"Byte";let n=null;switch(u){case"Numeric":n=we(l);break;case"Alphanumeric":n=ke(l);break;case"Byte":n=_e(l);break;case"Kanji":n=Me(l);break;default:throw"mode:"+u}m.push(n),h=null},b.isDark=function(l,u){if(l<0||e<=l||u<0||e<=u)throw l+","+u;return t[l][u]},b.getModuleCount=function(){return e},b.make=function(){if(a<1){let l=1;for(;l<40;l++){let u=ne.getRSBlocks(l,r),n=oe();for(let s=0;s<m.length;s++){let v=m[s];n.put(v.getMode(),4),n.put(v.getLength(),N.getLengthInBits(v.getMode(),l)),v.write(n)}let d=0;for(let s=0;s<u.length;s++)d+=u[s].dataCount;if(n.getLengthInBits()<=d*8)break}a=l}x(!1,_())},b.createTableTag=function(l,u){l=l||2,u=typeof u=="undefined"?l*4:u;let n="";n+='<table style="',n+=" border-width: 0px; border-style: none;",n+=" border-collapse: collapse;",n+=" padding: 0px; margin: "+u+"px;",n+='">',n+="<tbody>";for(let d=0;d<b.getModuleCount();d+=1){n+="<tr>";for(let s=0;s<b.getModuleCount();s+=1)n+='<td style="',n+=" border-width: 0px; border-style: none;",n+=" border-collapse: collapse;",n+=" padding: 0px; margin: 0px;",n+=" width: "+l+"px;",n+=" height: "+l+"px;",n+=" background-color: ",n+=b.isDark(d,s)?"#000000":"#ffffff",n+=";",n+='"/>';n+="</tr>"}return n+="</tbody>",n+="</table>",n},b.createSvgTag=function(l,u,n,d){let s={};typeof arguments[0]=="object"&&(s=arguments[0],l=s.cellSize,u=s.margin,n=s.alt,d=s.title),l=l||2,u=typeof u=="undefined"?l*4:u,n=typeof n=="string"?{text:n}:n||{},n.text=n.text||null,n.id=n.text?n.id||"qrcode-description":null,d=typeof d=="string"?{text:d}:d||{},d.text=d.text||null,d.id=d.text?d.id||"qrcode-title":null;let v=b.getModuleCount()*l+u*2,w,B,T,f,p="",k;for(k="l"+l+",0 0,"+l+" -"+l+",0 0,-"+l+"z ",p+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',p+=s.scalable?"":' width="'+v+'px" height="'+v+'px"',p+=' viewBox="0 0 '+v+" "+v+'" ',p+=' preserveAspectRatio="xMinYMin meet"',p+=d.text||n.text?' role="img" aria-labelledby="'+R([d.id,n.id].join(" ").trim())+'"':"",p+=">",p+=d.text?'<title id="'+R(d.id)+'">'+R(d.text)+"</title>":"",p+=n.text?'<description id="'+R(n.id)+'">'+R(n.text)+"</description>":"",p+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',p+='<path d="',T=0;T<b.getModuleCount();T+=1)for(f=T*l+u,w=0;w<b.getModuleCount();w+=1)b.isDark(T,w)&&(B=w*l+u,p+="M"+B+","+f+k);return p+='" stroke="transparent" fill="black"/>',p+="</svg>",p},b.createDataURL=function(l,u){l=l||2,u=typeof u=="undefined"?l*4:u;let n=b.getModuleCount()*l+u*2,d=u,s=n-u;return Te(n,n,function(v,w){if(d<=v&&v<s&&d<=w&&w<s){let B=Math.floor((v-d)/l),T=Math.floor((w-d)/l);return b.isDark(T,B)?0:1}else return 1})},b.createImgTag=function(l,u,n){l=l||2,u=typeof u=="undefined"?l*4:u;let d=b.getModuleCount()*l+u*2,s="";return s+="<img",s+=' src="',s+=b.createDataURL(l,u),s+='"',s+=' width="',s+=d,s+='"',s+=' height="',s+=d,s+='"',n&&(s+=' alt="',s+=R(n),s+='"'),s+="/>",s};let R=function(l){let u="";for(let n=0;n<l.length;n+=1){let d=l.charAt(n);switch(d){case"<":u+="<";break;case">":u+=">";break;case"&":u+="&";break;case'"':u+=""";break;default:u+=d;break}}return u},G=function(l){l=typeof l=="undefined"?1*2:l;let n=b.getModuleCount()*1+l*2,d=l,s=n-l,v,w,B,T,f,p={"\u2588\u2588":"\u2588","\u2588 ":"\u2580"," \u2588":"\u2584"," ":" "},k={"\u2588\u2588":"\u2580","\u2588 ":"\u2580"," \u2588":" "," ":" "},M="";for(v=0;v<n;v+=2){for(B=Math.floor((v-d)/1),T=Math.floor((v+1-d)/1),w=0;w<n;w+=1)f="\u2588",d<=w&&w<s&&d<=v&&v<s&&b.isDark(B,Math.floor((w-d)/1))&&(f=" "),d<=w&&w<s&&d<=v+1&&v+1<s&&b.isDark(T,Math.floor((w-d)/1))?f+=" ":f+="\u2588",M+=l<1&&v+1>=s?k[f]:p[f];M+=`
|
|
339
|
-
`}return n%2&&l>0?M.substring(0,M.length-n-1)+Array(n+1).join("\u2580"):M.substring(0,M.length-1)};return b.createASCII=function(l,u){if(l=l||1,l<2)return G(u);l-=1,u=typeof u=="undefined"?l*2:u;let n=b.getModuleCount()*l+u*2,d=u,s=n-u,v,w,B,T,f=Array(l+1).join("\u2588\u2588"),p=Array(l+1).join(" "),k="",M="";for(v=0;v<n;v+=1){for(B=Math.floor((v-d)/l),M="",w=0;w<n;w+=1)T=1,d<=w&&w<s&&d<=v&&v<s&&b.isDark(B,Math.floor((w-d)/l))&&(T=0),M+=T?f:p;for(B=0;B<l;B+=1)k+=M+`
|
|
340
|
-
`}return k.substring(0,k.length-1)},b.renderTo2dContext=function(l,u){u=u||2;let n=b.getModuleCount();for(let d=0;d<n;d++)for(let s=0;s<n;s++)l.fillStyle=b.isDark(d,s)?"black":"white",l.fillRect(s*u,d*u,u,u)},b};Q.stringToBytes=function(o){let g=[];for(let c=0;c<o.length;c+=1){let i=o.charCodeAt(c);g.push(i&255)}return g};Q.createStringToBytes=function(o,g){let c=function(){let a=Be(o),r=function(){let h=a.read();if(h==-1)throw"eof";return h},t=0,e={};for(;;){let h=a.read();if(h==-1)break;let m=r(),b=r(),x=r(),y=String.fromCharCode(h<<8|m),_=b<<8|x;e[y]=_,t+=1}if(t!=g)throw t+" != "+g;return e}(),i=63;return function(a){let r=[];for(let t=0;t<a.length;t+=1){let e=a.charCodeAt(t);if(e<128)r.push(e);else{let h=c[a.charAt(t)];typeof h=="number"?(h&255)==h?r.push(h):(r.push(h>>>8),r.push(h&255)):r.push(i)}}return r}};var D={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},F={L:1,M:0,Q:3,H:2},q={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},N=function(){let o=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],g=1335,c=7973,i=21522,a={},r=function(t){let e=0;for(;t!=0;)e+=1,t>>>=1;return e};return a.getBCHTypeInfo=function(t){let e=t<<10;for(;r(e)-r(g)>=0;)e^=g<<r(e)-r(g);return(t<<10|e)^i},a.getBCHTypeNumber=function(t){let e=t<<12;for(;r(e)-r(c)>=0;)e^=c<<r(e)-r(c);return t<<12|e},a.getPatternPosition=function(t){return o[t-1]},a.getMaskFunction=function(t){switch(t){case q.PATTERN000:return function(e,h){return(e+h)%2==0};case q.PATTERN001:return function(e,h){return e%2==0};case q.PATTERN010:return function(e,h){return h%3==0};case q.PATTERN011:return function(e,h){return(e+h)%3==0};case q.PATTERN100:return function(e,h){return(Math.floor(e/2)+Math.floor(h/3))%2==0};case q.PATTERN101:return function(e,h){return e*h%2+e*h%3==0};case q.PATTERN110:return function(e,h){return(e*h%2+e*h%3)%2==0};case q.PATTERN111:return function(e,h){return(e*h%3+(e+h)%2)%2==0};default:throw"bad maskPattern:"+t}},a.getErrorCorrectPolynomial=function(t){let e=V([1],0);for(let h=0;h<t;h+=1)e=e.multiply(V([1,j.gexp(h)],0));return e},a.getLengthInBits=function(t,e){if(1<=e&&e<10)switch(t){case D.MODE_NUMBER:return 10;case D.MODE_ALPHA_NUM:return 9;case D.MODE_8BIT_BYTE:return 8;case D.MODE_KANJI:return 8;default:throw"mode:"+t}else if(e<27)switch(t){case D.MODE_NUMBER:return 12;case D.MODE_ALPHA_NUM:return 11;case D.MODE_8BIT_BYTE:return 16;case D.MODE_KANJI:return 10;default:throw"mode:"+t}else if(e<41)switch(t){case D.MODE_NUMBER:return 14;case D.MODE_ALPHA_NUM:return 13;case D.MODE_8BIT_BYTE:return 16;case D.MODE_KANJI:return 12;default:throw"mode:"+t}else throw"type:"+e},a.getLostPoint=function(t){let e=t.getModuleCount(),h=0;for(let x=0;x<e;x+=1)for(let y=0;y<e;y+=1){let _=0,C=t.isDark(x,y);for(let A=-1;A<=1;A+=1)if(!(x+A<0||e<=x+A))for(let P=-1;P<=1;P+=1)y+P<0||e<=y+P||A==0&&P==0||C==t.isDark(x+A,y+P)&&(_+=1);_>5&&(h+=3+_-5)}for(let x=0;x<e-1;x+=1)for(let y=0;y<e-1;y+=1){let _=0;t.isDark(x,y)&&(_+=1),t.isDark(x+1,y)&&(_+=1),t.isDark(x,y+1)&&(_+=1),t.isDark(x+1,y+1)&&(_+=1),(_==0||_==4)&&(h+=3)}for(let x=0;x<e;x+=1)for(let y=0;y<e-6;y+=1)t.isDark(x,y)&&!t.isDark(x,y+1)&&t.isDark(x,y+2)&&t.isDark(x,y+3)&&t.isDark(x,y+4)&&!t.isDark(x,y+5)&&t.isDark(x,y+6)&&(h+=40);for(let x=0;x<e;x+=1)for(let y=0;y<e-6;y+=1)t.isDark(y,x)&&!t.isDark(y+1,x)&&t.isDark(y+2,x)&&t.isDark(y+3,x)&&t.isDark(y+4,x)&&!t.isDark(y+5,x)&&t.isDark(y+6,x)&&(h+=40);let m=0;for(let x=0;x<e;x+=1)for(let y=0;y<e;y+=1)t.isDark(y,x)&&(m+=1);let b=Math.abs(100*m/e/e-50)/5;return h+=b*10,h},a}(),j=function(){let o=new Array(256),g=new Array(256);for(let i=0;i<8;i+=1)o[i]=1<<i;for(let i=8;i<256;i+=1)o[i]=o[i-4]^o[i-5]^o[i-6]^o[i-8];for(let i=0;i<255;i+=1)g[o[i]]=i;let c={};return c.glog=function(i){if(i<1)throw"glog("+i+")";return g[i]},c.gexp=function(i){for(;i<0;)i+=255;for(;i>=256;)i-=255;return o[i]},c}(),V=function(o,g){if(typeof o.length=="undefined")throw o.length+"/"+g;let c=function(){let a=0;for(;a<o.length&&o[a]==0;)a+=1;let r=new Array(o.length-a+g);for(let t=0;t<o.length-a;t+=1)r[t]=o[t+a];return r}(),i={};return i.getAt=function(a){return c[a]},i.getLength=function(){return c.length},i.multiply=function(a){let r=new Array(i.getLength()+a.getLength()-1);for(let t=0;t<i.getLength();t+=1)for(let e=0;e<a.getLength();e+=1)r[t+e]^=j.gexp(j.glog(i.getAt(t))+j.glog(a.getAt(e)));return V(r,0)},i.mod=function(a){if(i.getLength()-a.getLength()<0)return i;let r=j.glog(i.getAt(0))-j.glog(a.getAt(0)),t=new Array(i.getLength());for(let e=0;e<i.getLength();e+=1)t[e]=i.getAt(e);for(let e=0;e<a.getLength();e+=1)t[e]^=j.gexp(j.glog(a.getAt(e))+r);return V(t,0).mod(a)},i},ne=function(){let o=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],g=function(a,r){let t={};return t.totalCount=a,t.dataCount=r,t},c={},i=function(a,r){switch(r){case F.L:return o[(a-1)*4+0];case F.M:return o[(a-1)*4+1];case F.Q:return o[(a-1)*4+2];case F.H:return o[(a-1)*4+3];default:return}};return c.getRSBlocks=function(a,r){let t=i(a,r);if(typeof t=="undefined")throw"bad rs block @ typeNumber:"+a+"/errorCorrectionLevel:"+r;let e=t.length/3,h=[];for(let m=0;m<e;m+=1){let b=t[m*3+0],x=t[m*3+1],y=t[m*3+2];for(let _=0;_<b;_+=1)h.push(g(x,y))}return h},c}(),oe=function(){let o=[],g=0,c={};return c.getBuffer=function(){return o},c.getAt=function(i){let a=Math.floor(i/8);return(o[a]>>>7-i%8&1)==1},c.put=function(i,a){for(let r=0;r<a;r+=1)c.putBit((i>>>a-r-1&1)==1)},c.getLengthInBits=function(){return g},c.putBit=function(i){let a=Math.floor(g/8);o.length<=a&&o.push(0),i&&(o[a]|=128>>>g%8),g+=1},c},we=function(o){let g=D.MODE_NUMBER,c=o,i={};i.getMode=function(){return g},i.getLength=function(t){return c.length},i.write=function(t){let e=c,h=0;for(;h+2<e.length;)t.put(a(e.substring(h,h+3)),10),h+=3;h<e.length&&(e.length-h==1?t.put(a(e.substring(h,h+1)),4):e.length-h==2&&t.put(a(e.substring(h,h+2)),7))};let a=function(t){let e=0;for(let h=0;h<t.length;h+=1)e=e*10+r(t.charAt(h));return e},r=function(t){if("0"<=t&&t<="9")return t.charCodeAt(0)-48;throw"illegal char :"+t};return i},ke=function(o){let g=D.MODE_ALPHA_NUM,c=o,i={};i.getMode=function(){return g},i.getLength=function(r){return c.length},i.write=function(r){let t=c,e=0;for(;e+1<t.length;)r.put(a(t.charAt(e))*45+a(t.charAt(e+1)),11),e+=2;e<t.length&&r.put(a(t.charAt(e)),6)};let a=function(r){if("0"<=r&&r<="9")return r.charCodeAt(0)-48;if("A"<=r&&r<="Z")return r.charCodeAt(0)-65+10;switch(r){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+r}};return i},_e=function(o){let g=D.MODE_8BIT_BYTE,c=o,i=Q.stringToBytes(o),a={};return a.getMode=function(){return g},a.getLength=function(r){return i.length},a.write=function(r){for(let t=0;t<i.length;t+=1)r.put(i[t],8)},a},Me=function(o){let g=D.MODE_KANJI,c=o,i=Q.stringToBytes;(function(t,e){let h=i(t);if(h.length!=2||(h[0]<<8|h[1])!=e)throw"sjis not supported."})("\u53CB",38726);let a=i(o),r={};return r.getMode=function(){return g},r.getLength=function(t){return~~(a.length/2)},r.write=function(t){let e=a,h=0;for(;h+1<e.length;){let m=(255&e[h])<<8|255&e[h+1];if(33088<=m&&m<=40956)m-=33088;else if(57408<=m&&m<=60351)m-=49472;else throw"illegal char at "+(h+1)+"/"+m;m=(m>>>8&255)*192+(m&255),t.put(m,13),h+=2}if(h<e.length)throw"illegal char at "+(h+1)},r},le=function(){let o=[],g={};return g.writeByte=function(c){o.push(c&255)},g.writeShort=function(c){g.writeByte(c),g.writeByte(c>>>8)},g.writeBytes=function(c,i,a){i=i||0,a=a||c.length;for(let r=0;r<a;r+=1)g.writeByte(c[r+i])},g.writeString=function(c){for(let i=0;i<c.length;i+=1)g.writeByte(c.charCodeAt(i))},g.toByteArray=function(){return o},g.toString=function(){let c="";c+="[";for(let i=0;i<o.length;i+=1)i>0&&(c+=","),c+=o[i];return c+="]",c},g},Ce=function(){let o=0,g=0,c=0,i="",a={},r=function(e){i+=String.fromCharCode(t(e&63))},t=function(e){if(e<0)throw"n:"+e;if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(e==62)return 43;if(e==63)return 47;throw"n:"+e};return a.writeByte=function(e){for(o=o<<8|e&255,g+=8,c+=1;g>=6;)r(o>>>g-6),g-=6},a.flush=function(){if(g>0&&(r(o<<6-g),o=0,g=0),c%3!=0){let e=3-c%3;for(let h=0;h<e;h+=1)i+="="}},a.toString=function(){return i},a},Be=function(o){let g=o,c=0,i=0,a=0,r={};r.read=function(){for(;a<8;){if(c>=g.length){if(a==0)return-1;throw"unexpected end of file./"+a}let h=g.charAt(c);if(c+=1,h=="=")return a=0,-1;if(h.match(/^\s$/))continue;i=i<<6|t(h.charCodeAt(0)),a+=6}let e=i>>>a-8&255;return a-=8,e};let t=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(e==43)return 62;if(e==47)return 63;throw"c:"+e};return r},Ae=function(o,g){let c=o,i=g,a=new Array(o*g),r={};r.setPixel=function(m,b,x){a[b*c+m]=x},r.write=function(m){m.writeString("GIF87a"),m.writeShort(c),m.writeShort(i),m.writeByte(128),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(255),m.writeByte(255),m.writeByte(255),m.writeString(","),m.writeShort(0),m.writeShort(0),m.writeShort(c),m.writeShort(i),m.writeByte(0);let b=2,x=e(b);m.writeByte(b);let y=0;for(;x.length-y>255;)m.writeByte(255),m.writeBytes(x,y,255),y+=255;m.writeByte(x.length-y),m.writeBytes(x,y,x.length-y),m.writeByte(0),m.writeString(";")};let t=function(m){let b=m,x=0,y=0,_={};return _.write=function(C,A){if(C>>>A)throw"length over";for(;x+A>=8;)b.writeByte(255&(C<<x|y)),A-=8-x,C>>>=8-x,y=0,x=0;y=C<<x|y,x=x+A},_.flush=function(){x>0&&b.writeByte(y)},_},e=function(m){let b=1<<m,x=(1<<m)+1,y=m+1,_=h();for(let S=0;S<b;S+=1)_.add(String.fromCharCode(S));_.add(String.fromCharCode(b)),_.add(String.fromCharCode(x));let C=le(),A=t(C);A.write(b,y);let P=0,E=String.fromCharCode(a[P]);for(P+=1;P<a.length;){let S=String.fromCharCode(a[P]);P+=1,_.contains(E+S)?E=E+S:(A.write(_.indexOf(E),y),_.size()<4095&&(_.size()==1<<y&&(y+=1),_.add(E+S)),E=S)}return A.write(_.indexOf(E),y),A.write(x,y),A.flush(),C.toByteArray()},h=function(){let m={},b=0,x={};return x.add=function(y){if(x.contains(y))throw"dup key:"+y;m[y]=b,b+=1},x.size=function(){return b},x.indexOf=function(y){return m[y]},x.contains=function(y){return typeof m[y]!="undefined"},x};return r},Te=function(o,g,c){let i=Ae(o,g);for(let e=0;e<g;e+=1)for(let h=0;h<o;h+=1)i.setPixel(h,e,c(h,e));let a=le();i.write(a);let r=Ce(),t=a.toByteArray();for(let e=0;e<t.length;e+=1)r.writeByte(t[e]);return r.flush(),"data:image/gif;base64,"+r},ie=Q,$e=Q.stringToBytes;var ae={apiBase:"https://payulink.io/api",assetBase:"https://assetcdn.payulink.io/checkout/v1/assets",name:null,logo:null,brandColor:null,pollMs:2500};function Ee(o){if(!o)return null;try{let g=ie(0,"M");return g.addData(String(o)),g.make(),g.createDataURL(6,2)}catch{return null}}var Y=class o{constructor(g={}){if(typeof window=="undefined"||typeof document=="undefined")throw new Error("PayuLink checkout runs in the browser only. On React Native use @thepayulink/checkout-react-native; on a server use @thepayulink/server.");let c=g.key||g.keyId||g.key_id;if(!c)throw new Error("PayuLink: `key` (your publishable pl_live_\u2026 / pl_test_\u2026 key) is required");if(/^pl_(live|test)_/.test(c)||console.warn("PayuLink: `key` should look like pl_live_\u2026 or pl_test_\u2026"),g.keySecret||g.key_secret)throw new Error("PayuLink: never pass a key_secret to the browser SDK. It belongs on your server only.");this.options=Object.assign({},ae,g,{key:c})}open(g={}){let c=Object.assign({},this.options,g),i=String(c.apiBase||"").replace(/\/$/,""),a=String(c.assetBase||`${i}/assets`).replace(/\/$/,""),r=c.order_id||c.orderId;if(!r)throw new Error("PayuLink: `order_id` is required. Create it on your server with POST /v1/orders.");let t=y=>{typeof c.onError=="function"?c.onError(y):console.error("PayuLink:",y.message||y)},e=null,h=null,m=async y=>{var A;let _=await fetch(`${i}/v1/checkout/session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key_id:c.key,order_id:r,customer:y?{name:y.name,contact:y.mobile||y.contact,email:y.email}:void 0})}),C=await _.json().catch(()=>({}));if(!_.ok)throw new Error(((A=C==null?void 0:C.error)==null?void 0:A.description)||`Could not start payment (HTTP ${_.status})`);return e=C,{merchant_order_no:C.order_id,amount:C.amount/100,upi_intent_url:C.upi_intent_url,payment_link:C.payment_link,qr_data_url:Ee(C.upi_intent_url),expires_at:C.expires_at,server_now:Math.floor(Date.now()/1e3)}},b=(y,_)=>{let C=async()=>{if(e!=null&&e.session_token)try{let E=await(await fetch(`${i}/v1/checkout/session/${encodeURIComponent(e.session_token)}`)).json().catch(()=>({}));E.status==="paid"&&E.payulink_signature&&(h={payulink_order_id:E.payulink_order_id,payulink_payment_id:E.payulink_payment_id,payulink_signature:E.payulink_signature,utr:E.utr||null,amount:E.amount}),_({status:E.status==="paid"?0:E.status==="failed"?1:E.status==="expired"?3:2,status_label:String(E.status||"pending").toUpperCase(),utr:E.utr||null})}catch{}},A=setInterval(C,c.pollMs||ae.pollMs);return C(),()=>clearInterval(A)},x={_inner:null,close(){var y;(y=this._inner)==null||y.close()}};return fetch(`${i}/v1/checkout/order/${encodeURIComponent(r)}?key_id=${encodeURIComponent(c.key)}`).then(async y=>{var C;let _=await y.json().catch(()=>({}));if(!y.ok)throw new Error(((C=_==null?void 0:_.error)==null?void 0:C.description)||"Unknown or expired order");x._inner=re(Object.assign({},{apiBase:i,assetBase:a,name:c.name||_.merchant_name,logo:c.logo||`${a}/payulink-logo.png`,brandColor:c.brandColor,note:c.note,prefill:c.prefill||{},amount:_.amount/100,description:c.description||c.item||_.merchant_name,createOrder:m,watchOrder:b,onSuccess:()=>{let A=h||{payulink_order_id:(e==null?void 0:e.order_id)||r,payulink_payment_id:null,payulink_signature:null};typeof c.handler=="function"&&c.handler(A),typeof c.onSuccess=="function"&&c.onSuccess(A)},onDismiss:()=>{typeof c.onDismiss=="function"&&c.onDismiss()},onError:t}))}).catch(t),x}static open(g={}){return new o(g).open(g)}};typeof window!="undefined"&&(window.PayuLink=Y,window.PayulinkCheckout=Y);return ye(Pe);})();
|
|
338
|
+
<div id="pl-status" class="pl-pendrow"><span class="pl-mini-spin"></span> Waiting for payment\u2026</div>`}function N(e,t){if(e==="contact")t.querySelector("#pl-continue").onclick=()=>{let o=t.querySelector("#pl-name").value.trim(),p=t.querySelector("#pl-mobile").value.replace(/\D/g,""),v=t.querySelector("#pl-email").value.trim(),M=t.querySelector("#pl-cerr");if(o.length<2)return M.textContent="Please enter your name";if(p.length!==10)return M.textContent="Enter a valid 10-digit mobile number";l.customer={name:o,mobile:p,email:v},s("options")};else if(e==="options"){t.querySelectorAll(".pl-navitem").forEach(p=>p.onclick=()=>{p.dataset.m!=="upi"&&P("Coming soon \u2014 please pay via UPI / QR for now")});let o=t.querySelector("#pl-verify");o&&(o.onclick=()=>{let p=(t.querySelector("#pl-vpa").value||"").trim();if(!/^[\w.\-]{2,}@[a-zA-Z]{2,}$/.test(p))return t.querySelector("#pl-vpa").focus(),P("Enter a valid UPI ID, e.g. name@okhdfcbank");let v=l.order&&(l.order.upi_intent_url||l.order.payment_link);v&&/Android|iPhone|iPad|Mobile/i.test(navigator.userAgent)?location.href=v:P("Scan the QR with your phone\u2019s UPI app to complete the payment.")}),T(),q(!0)}}let _=!1;async function q(e){if(e||s("options"),l.order){E();return}if(!_){_=!0;try{l.customer||(l.customer={name:a.prefill.name||"Customer",mobile:(a.prefill.contact||"").replace(/\D/g,""),email:a.prefill.email||""}),l.order=await a.createOrder(l.customer),E(),V()}catch(t){let o=n.querySelector("#pl-qr");if(o){o.innerHTML=`<div class="pl-qrerr"><span>${c(t.message||"Could not start payment")}</span><button class="pl-retry" id="pl-retry">Try again</button></div>`;let p=o.querySelector("#pl-retry");p&&(p.onclick=()=>{_=!1,o.innerHTML='<div class="pl-qrloading"></div>',q(!0)})}}finally{_=!1}}}function E(){let e=l.order;if(!e)return;H(e);let t=n.querySelector("#pl-qr");t&&(e.qr_data_url?t.innerHTML=`<img src="${e.qr_data_url}" alt="UPI QR">`:t.innerHTML='<div class="pl-qrerr"><span>QR unavailable \u2014 use a UPI app below</span></div>');let o=e.upi_intent_url||e.payment_link||"#",p=n.querySelector("#pl-applist");p&&p.querySelectorAll(".pl-uapp").forEach(v=>{v.setAttribute("href",o),v.setAttribute("target","_blank"),v.setAttribute("rel","noopener")}),T()}function H(e){e&&e.expires_at&&e.server_now?l.expiryMs=Date.now()+Math.max(0,e.expires_at-e.server_now):l.expiryMs||(l.expiryMs=Date.now()+5*60*1e3)}function L(){if(l.done)return;let e=n.querySelector("#pl-qr");e&&(e.innerHTML='<div class="pl-qrerr"><span>QR code expired</span><button class="pl-retry" id="pl-regen">Generate new QR</button></div>');let t=n.querySelector("#pl-regen");t&&(t.onclick=Y);let o=n.querySelector("#pl-timer");o&&(o.textContent="Expired");let p=n.querySelector(".pl-validrow");p&&p.classList.add("pl-expired")}function Y(){if(l.stop){try{l.stop()}catch{}l.stop=null}l.order=null,l.expiryMs=null,_=!1;let e=n.querySelector(".pl-validrow");e&&e.classList.remove("pl-expired");let t=n.querySelector("#pl-qr");t&&(t.innerHTML='<div class="pl-qrloading"></div>'),q(!0)}function V(){!l.order||l.stop||(l.stop=a.watchOrder(l.order.merchant_order_no,e=>{!e||typeof e.status!="number"||(e.status===0?(l.utr=e.utr||l.utr,Q()):e.status===3?(clearInterval(l.timer),l.expiryMs=Date.now(),L(),I("failed","QR expired \u2014 generate a new one")):[1,4].includes(e.status)?I("failed","Payment "+(e.status_label||"failed").toLowerCase()):e.status===6&&I("pending","Processing payment\u2026"))}))}function I(e,t){let o=n.querySelector("#pl-status");o&&(o.className=e==="failed"?"pl-pendrow pl-fail":"pl-pendrow",o.innerHTML=(e==="pending"?'<span class="pl-mini-spin"></span> ':"")+c(t))}function Q(){l.done||(l.done=!0,clearInterval(l.timer),s("success"),a.onSuccess&&a.onSuccess({merchant_order_no:l.order.merchant_order_no,utr:l.utr,amount:a.amount}),l.utr||X())}async function X(){for(let e=0;e<10&&!l.utr;e++){await new Promise(t=>setTimeout(t,4e3));try{let t=await fetch(`${i}/api/order/${l.order.merchant_order_no}`).then(o=>o.json());if(t.utr){l.utr=t.utr;let o=n.querySelector("#pl-pid");o&&l.screen==="success"&&o.insertAdjacentHTML("afterend",`<div class="pl-pid pl-utr">UTR ${c(t.utr)}</div>`);break}}catch{}}}function T(){clearInterval(l.timer);let e=()=>{let t=n.querySelector("#pl-timer");if(!t)return;if(!l.expiryMs){t.textContent="Valid 5:00";return}let o=Math.max(0,Math.round((l.expiryMs-Date.now())/1e3));t.textContent=o>0?"Valid "+pe(o):"Expired",o<=0&&(clearInterval(l.timer),L())};e(),l.timer=setInterval(e,1e3)}function P(e){let t=document.getElementById("pl-toast");t||(t=document.createElement("div"),t.id="pl-toast",document.body.appendChild(t)),t.textContent=e,t.classList.add("pl-show"),clearTimeout(t._t),t._t=setTimeout(()=>t.classList.remove("pl-show"),2600)}return s("loader"),setTimeout(()=>{let e=a.prefill||{};e.name&&(e.contact||"").replace(/\D/g,"").length===10?(l.customer={name:e.name,mobile:e.contact.replace(/\D/g,""),email:e.email||""},s("options")):s("contact");let t=n.querySelector("#pl-splash");t&&(t.classList.add("pl-splash-hide"),setTimeout(()=>t.remove(),450))},1600),{close:d}}var D={apiBase:"https://payulink.io/api",assetBase:"https://assetcdn.payulink.io/checkout/v1/assets",name:null,logo:null,brandColor:null,pollMs:2500},w=class a{constructor(i={}){if(typeof window=="undefined"||typeof document=="undefined")throw new Error("PayuLink checkout runs in the browser only. On React Native use @thepayulink/checkout-react-native; on a server use @thepayulink/server.");let r=i.key||i.keyId||i.key_id;if(!r)throw new Error("PayuLink: `key` (your publishable pl_live_\u2026 / pl_test_\u2026 key) is required");if(/^pl_(live|test)_/.test(r)||console.warn("PayuLink: `key` should look like pl_live_\u2026 or pl_test_\u2026"),i.keySecret||i.key_secret)throw new Error("PayuLink: never pass a key_secret to the browser SDK. It belongs on your server only.");this.options=Object.assign({},D,i,{key:r})}open(i={}){let r=Object.assign({},this.options,i),y=String(r.apiBase||"").replace(/\/$/,""),h=String(r.assetBase||`${y}/assets`).replace(/\/$/,""),l=r.order_id||r.orderId;if(!l)throw new Error("PayuLink: `order_id` is required. Create it on your server with POST /v1/orders.");let n=d=>{typeof r.onError=="function"?r.onError(d):console.error("PayuLink:",d.message||d)},x=null,$=null,S=async d=>{var g;let u=await fetch(`${y}/v1/checkout/session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key_id:r.key,order_id:l,customer:d?{name:d.name,contact:d.mobile||d.contact,email:d.email}:void 0})}),s=await u.json().catch(()=>({}));if(!u.ok)throw new Error(((g=s==null?void 0:s.error)==null?void 0:g.description)||`Could not start payment (HTTP ${u.status})`);return x=s,{merchant_order_no:s.order_id,amount:s.amount/100,upi_intent_url:s.upi_intent_url,payment_link:s.payment_link,qr_data_url:s.qr_data_url||null,expires_at:s.expires_at?s.expires_at*1e3:null,server_now:Date.now()}},z=(d,u)=>{let s=async()=>{if(x!=null&&x.session_token)try{let f=await(await fetch(`${y}/v1/checkout/session/${encodeURIComponent(x.session_token)}`)).json().catch(()=>({}));f.status==="paid"&&f.payulink_signature&&($={payulink_order_id:f.payulink_order_id,payulink_payment_id:f.payulink_payment_id,payulink_signature:f.payulink_signature,utr:f.utr||null,amount:f.amount}),u({status:f.status==="paid"?0:f.status==="failed"?1:f.status==="expired"?3:2,status_label:String(f.status||"pending").toUpperCase(),utr:f.utr||null})}catch{}},g=setInterval(s,r.pollMs||D.pollMs);return s(),()=>clearInterval(g)},k={_inner:null,close(){var d;(d=this._inner)==null||d.close()}};return fetch(`${y}/v1/checkout/order/${encodeURIComponent(l)}?key_id=${encodeURIComponent(r.key)}`).then(async d=>{var s;let u=await d.json().catch(()=>({}));if(!d.ok)throw new Error(((s=u==null?void 0:u.error)==null?void 0:s.description)||"Unknown or expired order");k._inner=R(Object.assign({},{apiBase:y,assetBase:h,name:r.name||u.merchant_name,logo:r.logo||`${h}/payulink-logo.png`,brandColor:r.brandColor,note:r.note,prefill:r.prefill||{},amount:u.amount/100,description:r.description||r.item||u.merchant_name,createOrder:S,watchOrder:z,onSuccess:()=>{let g=$||{payulink_order_id:(x==null?void 0:x.order_id)||l,payulink_payment_id:null,payulink_signature:null};typeof r.handler=="function"&&r.handler(g),typeof r.onSuccess=="function"&&r.onSuccess(g)},onDismiss:()=>{typeof r.onDismiss=="function"&&r.onDismiss()},onError:n}))}).catch(n),k}static open(i={}){return new a(i).open(i)}};typeof window!="undefined"&&(window.PayuLink=w,window.PayulinkCheckout=w);return ie(de);})();
|
|
341
339
|
window.PayulinkCheckout=PayulinkCheckoutNS.default||PayulinkCheckoutNS;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thepayulink/checkout",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "PayuLink Checkout — open a server-created order in the browser with your publishable key.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/payulink-checkout.cjs",
|
|
@@ -39,7 +39,5 @@
|
|
|
39
39
|
"esbuild": "^0.23.0"
|
|
40
40
|
},
|
|
41
41
|
"homepage": "https://payulink.io",
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"qrcode-generator": "^1.4.4"
|
|
44
|
-
}
|
|
42
|
+
"dependencies": {}
|
|
45
43
|
}
|
package/src/index.js
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
// and the amount always comes from the stored order, so nothing the browser does
|
|
17
17
|
// can change what is charged.
|
|
18
18
|
import { openModal } from './modal.js';
|
|
19
|
-
import qrcode from 'qrcode-generator';
|
|
20
19
|
|
|
21
20
|
const DEFAULTS = {
|
|
22
21
|
apiBase: 'https://payulink.io/api',
|
|
@@ -27,26 +26,6 @@ const DEFAULTS = {
|
|
|
27
26
|
pollMs: 2500,
|
|
28
27
|
};
|
|
29
28
|
|
|
30
|
-
/**
|
|
31
|
-
* Encode the UPI intent as a QR in the browser.
|
|
32
|
-
*
|
|
33
|
-
* The gateway mints the tracked QR server-side and hands us its `upi_intent_url`;
|
|
34
|
-
* we only draw it. That keeps a single source of truth for the payment itself —
|
|
35
|
-
* we are not re-implementing QR/pool logic here, and status still comes solely
|
|
36
|
-
* from the session endpoint.
|
|
37
|
-
*/
|
|
38
|
-
function toQrDataUrl(text) {
|
|
39
|
-
if (!text) return null;
|
|
40
|
-
try {
|
|
41
|
-
const qr = qrcode(0, 'M'); // type 0 = auto-size, medium ECC
|
|
42
|
-
qr.addData(String(text));
|
|
43
|
-
qr.make();
|
|
44
|
-
return qr.createDataURL(6, 2); // cell size, margin
|
|
45
|
-
} catch {
|
|
46
|
-
return null; // modal falls back to the intent link
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
29
|
export default class PayuLink {
|
|
51
30
|
constructor(options = {}) {
|
|
52
31
|
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
@@ -116,10 +95,19 @@ export default class PayuLink {
|
|
|
116
95
|
amount: s.amount / 100,
|
|
117
96
|
upi_intent_url: s.upi_intent_url,
|
|
118
97
|
payment_link: s.payment_link,
|
|
119
|
-
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
|
|
98
|
+
// The backend mints the TRACKED QR (unique txnNote + refId) server-side at
|
|
99
|
+
// session creation, calling Freecharge/PhonePe itself — same as the merchant
|
|
100
|
+
// API always did. Render exactly that. We must NOT draw our own QR from the
|
|
101
|
+
// intent: the static fallback carries an identical note on every order, which
|
|
102
|
+
// silently defeats auto-detection.
|
|
103
|
+
qr_data_url: s.qr_data_url || null,
|
|
104
|
+
// UNITS: modal.js does `Date.now() + (expires_at - server_now)`, and
|
|
105
|
+
// Date.now() is MILLISECONDS — so the delta must be ms too, not just
|
|
106
|
+
// "the same unit as each other". /v1 returns expires_at in epoch
|
|
107
|
+
// SECONDS, so convert. Passing seconds made a 30-min TTL expire in
|
|
108
|
+
// 1800ms (~2s) — the QR looked dead on arrival.
|
|
109
|
+
expires_at: s.expires_at ? s.expires_at * 1000 : null,
|
|
110
|
+
server_now: Date.now(),
|
|
123
111
|
};
|
|
124
112
|
};
|
|
125
113
|
|