@zippypay/checkout 1.0.0 → 1.1.11
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/README.md +93 -37
- package/dist/index.cjs +870 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +151 -9
- package/dist/index.d.ts +151 -9
- package/dist/index.min.js +870 -55
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +870 -55
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var
|
|
2
|
-
${
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var Y=["COMPLETED","EXPIRED","CANCELLED","FAILED"],xe=["CREATED","AWAITING_PAYMENT"],I=class extends Error{constructor(e){let t=e.detail??e.title??"An unexpected error occurred";super(t),this.name="ZippyPayError",this.code=e.code??"unknown",this.status=e.status??500,this.detail=t,this.correlationId=e.correlationId;}};var le={production:"https://api.zippypay.io",staging:"https://staging.api.zippypay.io",development:""},we="/api/v1";function Je(n){return n in le}function Pe(n){return le[n].replace(/\/+$/,"")}function j(n){let e=n.trim().toLowerCase();if(!Je(e))throw new Error(`Zippy Pay: invalid environment "${n}". Expected one of: ${Object.keys(le).join(", ")}.`);return e}var ke=/^(?=.{3,20}$)[a-z0-9]+(?:\.[a-z0-9]+)?$/,et=/^\+[1-9]\d{7,14}$/,tt=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function V(n){return n.trim().toLowerCase()}function $(n){let e=n.trim();return e.includes("@")?e.toLowerCase():e.startsWith("+")?e:e.toLowerCase()}function Rt(n){return ke.test(V(n))}function ze(n){let e=n.trim();return e.length<3||e.length>100||/\s/.test(e)||/[\x00-\x1f\x7f]/.test(e)?false:e.includes("@")?tt.test(e):e.startsWith("+")?et.test(e):ke.test(e.toLowerCase())}function Ht(){return "Enter 3\u201320 lowercase letters or digits, with at most one dot (e.g. john.doe12)."}function Ee(){return "Enter a Zippy ID, email, or phone number in E.164 format (e.g. +15551234567)."}function it(n){return /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(n)}var Ut={USD:"en-US"};function Ce(n,e){let t=Number.parseFloat(n);if(Number.isNaN(t))return `${n} ${e}`;let i=Ut[e]??"en-US";return new Intl.NumberFormat(i,{style:"currency",currency:e,minimumFractionDigits:2,maximumFractionDigits:2}).format(t)}var Ae=7;function nt(n,e,t="success"){return n==="redirect"?t==="failure"?"You will be redirected shortly in":"You will be redirected in":e==="modal"?"This window will close automatically in":"This checkout will close automatically in"}function rt(n){switch(n){case "success":return {kind:"success",title:"Payment complete",detail:"Your payment was successful."};case "expired":return {kind:"failure",title:"Payment timed out",detail:"The time to complete this payment has ended. Return to the merchant and try again."};case "failed":return {kind:"failure",title:"Payment failed",detail:"Your payment could not be completed. Please try again or contact the merchant."};case "cancelled":return {kind:"failure",title:"Payment cancelled",detail:"This payment was cancelled."};case "declined":return {kind:"failure",title:"Payment declined",detail:"Your payment was declined. Please try again or contact the merchant."};case "invalid-session":return {kind:"failure",title:"Checkout unavailable",detail:"This checkout link is no longer valid. Please ask the merchant for a new one."};default:return {kind:"failure",title:"Something went wrong",detail:"Please try again or contact the merchant."}}}function Me(n){let e=Math.max(0,Math.ceil(n/1e3)),t=Math.floor(e/60),i=e%60;if(t>=60){let r=Math.floor(t/60),a=t%60;return a>0?`${r}h ${a}m`:`${r}h`}return t>0?`${t}m ${i.toString().padStart(2,"0")}s`:`${i}s`}function Se(n){let e=Math.max(0,Math.ceil(n/1e3)),t=Math.floor(e/60),i=e%60;if(t>=60){let r=Math.floor(t/60),a=t%60,o=[`${r} hour${r===1?"":"s"}`];return a>0&&o.push(`${a} minute${a===1?"":"s"}`),o.join(" ")}return t>0?i>0?`${t} minute${t===1?"":"s"} ${i} second${i===1?"":"s"}`:`${t} minute${t===1?"":"s"}`:`${i} second${i===1?"":"s"}`}function ot(n){let e=n.trim().split(/\s+/).filter(Boolean);return e.length===0?"?":e.length===1?e[0].charAt(0).toUpperCase():`${e[0].charAt(0)}${e[e.length-1].charAt(0)}`.toUpperCase()}function at(n){if(typeof n!="string")return n;let e=document.querySelector(n);if(!e)throw new Error(`Zippy Pay: container not found: ${n}`);return e}function st(n){return n.replace(/\/+$/,"")}function Te(n,e){let t=/^https?:\/\//i.test(n),i=typeof window<"u"?window.location.href:"https://localhost/",r=new URL(n,i);for(let[a,o]of Object.entries(e))o!=null&&o!==""&&r.searchParams.set(a,o);return t?r.toString():`${r.pathname}${r.search}${r.hash}`}var G=class{constructor(e){this.baseUrl=st(e.baseUrl),this.sessionId=e.sessionId,this.clientToken=e.clientToken;}async getSession(){return this.request("GET",this.sessionPath())}async bindCheckoutPolicy(e){return this.request("POST",`${this.sessionPath()}/checkout/bind-policy`,e)}async verifyPayer(e){return this.request("POST",`${this.sessionPath()}/payer/verify`,{query:$(e)})}async attachPayer(e){return this.request("POST",`${this.sessionPath()}/payer`,{paymentId:V(e)})}async startCheckout(e,t){let i={method:e,surface:t};return this.request("POST",`${this.sessionPath()}/checkout/start`,i)}startQrCheckout(e){return this.startCheckout("QR",e)}startMobileAppCheckout(e){return this.startCheckout("MOBILE_APP",e)}startManualCheckout(e){return this.startCheckout("MANUAL",e)}sessionPath(){return `${we}/payment-sessions/${this.sessionId}`}headers(){return {Accept:"application/json","Content-Type":"application/json","X-Payment-Session-Token":this.clientToken}}async request(e,t,i){let r=await fetch(`${this.baseUrl}${t}`,{method:e,headers:this.headers(),body:i===void 0?void 0:JSON.stringify(i)});if(r.ok)return await r.json();throw await this.parseError(r)}async parseError(e){if((e.headers.get("content-type")??"").includes("application/problem+json")){let i=await e.json();return new I({...i,status:i.status??e.status})}return new I({status:e.status,code:"unknown",title:"Request failed",detail:e.statusText||"Request failed"})}};async function Le(n,e){try{return await n.attachPayer(e)}catch(t){if(!(t instanceof I)||t.code!=="payment-session.payer-attached")throw t;let i=await n.getSession();if(i.payer?.paymentId===V(e))return i;throw t}}var pt={primary:"#3f63f3",primaryForeground:"#ffffff",primaryGradientEnd:"#6b84ff",primaryHover:"#2f4fd1",primarySoft:"#eef2ff",background:"#ffffff",surface:"#ffffff",surfaceMuted:"#f6f8fb",text:"#0f172a",textMuted:"#64748b",border:"#e2e8f0",error:"#dc2626",success:"#059669",borderRadius:"20px",radiusButton:"24px",radiusInput:"12px",radiusCard:"20px",fontFamily:"'DM Sans', system-ui, -apple-system, sans-serif",mode:"light"},Dt={background:"#0f172a",surface:"#1e293b",text:"#f8fafc",textMuted:"#94a3b8",border:"#334155"};function lt(n){let e={...pt,...n},t=typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches,i=e.mode==="auto"?t?"dark":"light":e.mode??"light";return i==="dark"?{...e,...Dt,mode:i}:{...e,mode:i}}function Ie(n,e){let t=lt(e);n.style.setProperty("--zippy-primary",t.primary),n.style.setProperty("--zippy-primary-foreground",t.primaryForeground),n.style.setProperty("--zippy-primary-gradient-end",t.primaryGradientEnd),n.style.setProperty("--zippy-primary-hover",t.primaryHover),n.style.setProperty("--zippy-primary-soft",t.primarySoft),n.style.setProperty("--zippy-background",t.background),n.style.setProperty("--zippy-surface",t.surface),n.style.setProperty("--zippy-surface-muted",t.surfaceMuted),n.style.setProperty("--zippy-text",t.text),n.style.setProperty("--zippy-text-muted",t.textMuted),n.style.setProperty("--zippy-border",t.border),n.style.setProperty("--zippy-error",t.error),n.style.setProperty("--zippy-success",t.success),n.style.setProperty("--zippy-radius",t.borderRadius),n.style.setProperty("--zippy-radius-button",t.radiusButton),n.style.setProperty("--zippy-radius-input",t.radiusInput),n.style.setProperty("--zippy-radius-card",t.radiusCard),n.style.setProperty("--zippy-font-family",t.fontFamily);}var Ft="@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&display=swap');",ct=`
|
|
2
|
+
${Ft}
|
|
3
3
|
|
|
4
4
|
:host {
|
|
5
5
|
display: block;
|
|
@@ -87,10 +87,66 @@ input {
|
|
|
87
87
|
letter-spacing: -0.01em;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
.zippy-back-btn {
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
gap: 4px;
|
|
94
|
+
align-self: flex-start;
|
|
95
|
+
margin: 0 0 2px;
|
|
96
|
+
padding: 0.375rem 0.625rem 0.375rem 0.375rem;
|
|
97
|
+
border: 0;
|
|
98
|
+
border-radius: 999px;
|
|
99
|
+
background: transparent;
|
|
100
|
+
color: var(--zippy-text-muted);
|
|
101
|
+
font: inherit;
|
|
102
|
+
font-size: 0.8125rem;
|
|
103
|
+
font-weight: 600;
|
|
104
|
+
line-height: 1;
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
transition:
|
|
107
|
+
color 150ms ease,
|
|
108
|
+
background-color 150ms ease;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.zippy-back-btn:hover:not(:disabled) {
|
|
112
|
+
color: var(--zippy-text);
|
|
113
|
+
background: color-mix(in srgb, var(--zippy-text-muted) 10%, transparent);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.zippy-back-btn:focus-visible {
|
|
117
|
+
outline: 2px solid color-mix(in srgb, var(--zippy-primary) 45%, transparent);
|
|
118
|
+
outline-offset: 2px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.zippy-back-btn:disabled {
|
|
122
|
+
opacity: 0.45;
|
|
123
|
+
cursor: not-allowed;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.zippy-back-btn-icon {
|
|
127
|
+
flex-shrink: 0;
|
|
128
|
+
width: 1rem;
|
|
129
|
+
height: 1rem;
|
|
130
|
+
}
|
|
131
|
+
|
|
90
132
|
.zippy-choose {
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-direction: column;
|
|
135
|
+
gap: 16px;
|
|
91
136
|
margin: 0;
|
|
92
137
|
}
|
|
93
138
|
|
|
139
|
+
.zippy-choose-mobile-app {
|
|
140
|
+
display: flex;
|
|
141
|
+
justify-content: center;
|
|
142
|
+
width: 100%;
|
|
143
|
+
padding-top: 2px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.zippy-choose-mobile-app .zippy-mobile-app-pay-btn {
|
|
147
|
+
max-width: none;
|
|
148
|
+
}
|
|
149
|
+
|
|
94
150
|
.zippy-choose-options {
|
|
95
151
|
display: grid;
|
|
96
152
|
grid-template-columns: 1fr 1fr;
|
|
@@ -173,6 +229,11 @@ input {
|
|
|
173
229
|
gap: 18px;
|
|
174
230
|
}
|
|
175
231
|
|
|
232
|
+
.zippy-flow--centered {
|
|
233
|
+
align-items: center;
|
|
234
|
+
text-align: center;
|
|
235
|
+
}
|
|
236
|
+
|
|
176
237
|
.zippy-flow-awaiting {
|
|
177
238
|
align-items: center;
|
|
178
239
|
text-align: center;
|
|
@@ -209,45 +270,217 @@ input {
|
|
|
209
270
|
will-change: transform;
|
|
210
271
|
}
|
|
211
272
|
|
|
212
|
-
.zippy-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
273
|
+
.zippy-flow-hint {
|
|
274
|
+
width: 100%;
|
|
275
|
+
max-width: 18rem;
|
|
276
|
+
margin: 0 auto;
|
|
277
|
+
padding: 0 0.5rem;
|
|
278
|
+
font-size: 0.8125rem;
|
|
279
|
+
line-height: 1.45;
|
|
280
|
+
color: var(--zippy-text-muted);
|
|
281
|
+
text-align: center;
|
|
216
282
|
}
|
|
217
283
|
|
|
218
|
-
.zippy-
|
|
284
|
+
.zippy-qr-section {
|
|
219
285
|
display: flex;
|
|
220
|
-
|
|
286
|
+
flex-direction: column;
|
|
287
|
+
align-items: center;
|
|
221
288
|
gap: 12px;
|
|
289
|
+
padding: 2px 0 4px;
|
|
222
290
|
}
|
|
223
291
|
|
|
224
|
-
.zippy-
|
|
225
|
-
flex-shrink: 0;
|
|
226
|
-
width: 22px;
|
|
227
|
-
height: 22px;
|
|
228
|
-
border-radius: 50%;
|
|
292
|
+
.zippy-mobile-app-section {
|
|
229
293
|
display: flex;
|
|
294
|
+
flex-direction: column;
|
|
295
|
+
align-items: center;
|
|
296
|
+
gap: 14px;
|
|
297
|
+
width: 100%;
|
|
298
|
+
padding: 4px 0 8px;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.zippy-mobile-app-section .zippy-pay-timer-slot {
|
|
302
|
+
margin: 0;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.zippy-mobile-app-pay-btn {
|
|
306
|
+
display: inline-flex;
|
|
230
307
|
align-items: center;
|
|
231
308
|
justify-content: center;
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
309
|
+
width: 100%;
|
|
310
|
+
max-width: 18rem;
|
|
311
|
+
min-height: 3rem;
|
|
312
|
+
padding: 0.75rem 1.25rem;
|
|
313
|
+
border: 0;
|
|
314
|
+
border-radius: 9999px;
|
|
315
|
+
background: var(--zippy-primary);
|
|
316
|
+
color: var(--zippy-primary-foreground);
|
|
317
|
+
font-family: inherit;
|
|
318
|
+
font-size: 1rem;
|
|
319
|
+
font-weight: 600;
|
|
320
|
+
letter-spacing: -0.01em;
|
|
321
|
+
cursor: pointer;
|
|
322
|
+
transition:
|
|
323
|
+
background-color 150ms ease,
|
|
324
|
+
opacity 150ms ease,
|
|
325
|
+
transform 150ms ease;
|
|
236
326
|
}
|
|
237
327
|
|
|
238
|
-
.zippy-
|
|
239
|
-
|
|
328
|
+
.zippy-mobile-app-pay-btn:hover:not(:disabled) {
|
|
329
|
+
background: color-mix(in srgb, var(--zippy-primary) 88%, #000);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.zippy-mobile-app-pay-btn:focus-visible {
|
|
333
|
+
outline: 2px solid color-mix(in srgb, var(--zippy-primary) 45%, transparent);
|
|
334
|
+
outline-offset: 2px;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.zippy-mobile-app-pay-btn:disabled {
|
|
338
|
+
opacity: 0.55;
|
|
339
|
+
cursor: not-allowed;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.zippy-mobile-app-pay-btn--opening {
|
|
343
|
+
display: inline-flex;
|
|
344
|
+
align-items: center;
|
|
345
|
+
justify-content: center;
|
|
346
|
+
gap: 0.625rem;
|
|
347
|
+
cursor: wait;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.zippy-mobile-app-pay-btn--opening:disabled {
|
|
351
|
+
opacity: 1;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.zippy-mobile-app-pay-btn--opening .zippy-mobile-app-pay-btn-spinner {
|
|
355
|
+
width: 1rem;
|
|
356
|
+
height: 1rem;
|
|
357
|
+
border-color: color-mix(in srgb, var(--zippy-primary-foreground) 35%, transparent);
|
|
358
|
+
border-top-color: var(--zippy-primary-foreground);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.zippy-mobile-app-opened-hint {
|
|
362
|
+
margin: 0;
|
|
363
|
+
max-width: 18rem;
|
|
364
|
+
font-size: 0.9375rem;
|
|
240
365
|
line-height: 1.45;
|
|
241
366
|
color: var(--zippy-text-muted);
|
|
242
|
-
|
|
367
|
+
text-align: center;
|
|
243
368
|
}
|
|
244
369
|
|
|
245
|
-
.zippy-
|
|
370
|
+
.zippy-mobile-app-method-switching {
|
|
246
371
|
display: flex;
|
|
247
372
|
flex-direction: column;
|
|
248
373
|
align-items: center;
|
|
249
374
|
gap: 12px;
|
|
250
|
-
|
|
375
|
+
width: 100%;
|
|
376
|
+
padding: 8px 0;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.zippy-mobile-app-method-switching-title {
|
|
380
|
+
margin: 0;
|
|
381
|
+
font-size: 0.9375rem;
|
|
382
|
+
font-weight: 500;
|
|
383
|
+
color: var(--zippy-text-muted);
|
|
384
|
+
text-align: center;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.zippy-mobile-app-handoff-failed {
|
|
388
|
+
display: flex;
|
|
389
|
+
flex-direction: column;
|
|
390
|
+
align-items: center;
|
|
391
|
+
gap: 14px;
|
|
392
|
+
width: 100%;
|
|
393
|
+
padding: 4px 0;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.zippy-mobile-app-handoff-message {
|
|
397
|
+
margin: 0;
|
|
398
|
+
max-width: 20rem;
|
|
399
|
+
font-size: 0.9375rem;
|
|
400
|
+
line-height: 1.45;
|
|
401
|
+
color: var(--zippy-text);
|
|
402
|
+
text-align: center;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.zippy-mobile-app-handoff-failed .zippy-install-zippy-btn {
|
|
406
|
+
margin-top: 6px;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.zippy-install-zippy-btn {
|
|
410
|
+
display: inline-flex;
|
|
411
|
+
align-items: center;
|
|
412
|
+
justify-content: center;
|
|
413
|
+
width: 100%;
|
|
414
|
+
max-width: 18rem;
|
|
415
|
+
min-height: 3rem;
|
|
416
|
+
padding: 0.75rem 1.25rem;
|
|
417
|
+
border: 1px solid var(--zippy-border);
|
|
418
|
+
border-radius: var(--zippy-radius-button);
|
|
419
|
+
background: var(--zippy-surface);
|
|
420
|
+
color: var(--zippy-text);
|
|
421
|
+
font-family: inherit;
|
|
422
|
+
font-size: 1rem;
|
|
423
|
+
font-weight: 600;
|
|
424
|
+
letter-spacing: -0.01em;
|
|
425
|
+
cursor: pointer;
|
|
426
|
+
transition:
|
|
427
|
+
background-color 150ms ease,
|
|
428
|
+
border-color 150ms ease;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.zippy-install-zippy-btn:hover {
|
|
432
|
+
background: color-mix(in srgb, var(--zippy-surface) 92%, var(--zippy-text));
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.zippy-install-zippy-btn:focus-visible {
|
|
436
|
+
outline: 2px solid color-mix(in srgb, var(--zippy-primary) 45%, transparent);
|
|
437
|
+
outline-offset: 2px;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.zippy-mobile-app-fallback {
|
|
441
|
+
display: flex;
|
|
442
|
+
flex-direction: column;
|
|
443
|
+
align-items: stretch;
|
|
444
|
+
gap: 10px;
|
|
445
|
+
width: 100%;
|
|
446
|
+
margin-top: 4px;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.zippy-mobile-app-fallback-label {
|
|
450
|
+
margin: 0;
|
|
451
|
+
font-size: 0.8125rem;
|
|
452
|
+
font-weight: 600;
|
|
453
|
+
letter-spacing: 0.02em;
|
|
454
|
+
text-transform: uppercase;
|
|
455
|
+
color: var(--zippy-text-muted);
|
|
456
|
+
text-align: center;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.zippy-choose-options--compact {
|
|
460
|
+
gap: 10px;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.zippy-mobile-app-retry {
|
|
464
|
+
margin: 0;
|
|
465
|
+
padding: 0;
|
|
466
|
+
border: 0;
|
|
467
|
+
background: transparent;
|
|
468
|
+
color: var(--zippy-primary);
|
|
469
|
+
font-family: inherit;
|
|
470
|
+
font-size: 0.875rem;
|
|
471
|
+
font-weight: 600;
|
|
472
|
+
text-decoration: underline;
|
|
473
|
+
text-underline-offset: 2px;
|
|
474
|
+
cursor: pointer;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.zippy-mobile-app-retry:hover {
|
|
478
|
+
color: color-mix(in srgb, var(--zippy-primary) 82%, #000);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.zippy-mobile-app-retry:focus-visible {
|
|
482
|
+
outline: 2px solid color-mix(in srgb, var(--zippy-primary) 45%, transparent);
|
|
483
|
+
outline-offset: 2px;
|
|
251
484
|
}
|
|
252
485
|
|
|
253
486
|
.zippy-pay-timer-slot {
|
|
@@ -267,32 +500,32 @@ input {
|
|
|
267
500
|
flex-direction: column;
|
|
268
501
|
align-items: center;
|
|
269
502
|
justify-content: center;
|
|
270
|
-
gap: 0.
|
|
271
|
-
min-width:
|
|
272
|
-
padding: 0.
|
|
503
|
+
gap: 0.25rem;
|
|
504
|
+
min-width: 6.75rem;
|
|
505
|
+
padding: 0.5625rem 1.25rem 0.5rem;
|
|
273
506
|
border-radius: 16px;
|
|
274
507
|
background: var(--zippy-primary-soft);
|
|
508
|
+
border: 1px solid color-mix(in srgb, var(--zippy-primary) 14%, transparent);
|
|
275
509
|
color: var(--zippy-primary);
|
|
276
510
|
}
|
|
277
511
|
|
|
512
|
+
.zippy-pay-timer-label {
|
|
513
|
+
font-size: 0.75rem;
|
|
514
|
+
font-weight: 500;
|
|
515
|
+
line-height: 1.2;
|
|
516
|
+
letter-spacing: 0;
|
|
517
|
+
white-space: nowrap;
|
|
518
|
+
color: color-mix(in srgb, var(--zippy-primary) 72%, var(--zippy-text-muted));
|
|
519
|
+
}
|
|
520
|
+
|
|
278
521
|
.zippy-pay-timer-value {
|
|
279
|
-
|
|
280
|
-
font-size: 1.125rem;
|
|
522
|
+
font-size: 1.25rem;
|
|
281
523
|
font-weight: 700;
|
|
282
524
|
font-variant-numeric: tabular-nums;
|
|
283
|
-
letter-spacing: 0;
|
|
525
|
+
letter-spacing: -0.01em;
|
|
284
526
|
text-align: center;
|
|
285
527
|
line-height: 1;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
.zippy-pay-timer-label {
|
|
289
|
-
font-size: 0.6875rem;
|
|
290
|
-
font-weight: 600;
|
|
291
|
-
line-height: 1;
|
|
292
|
-
letter-spacing: 0.02em;
|
|
293
|
-
text-transform: uppercase;
|
|
294
528
|
white-space: nowrap;
|
|
295
|
-
color: color-mix(in srgb, var(--zippy-primary) 72%, var(--zippy-text-muted));
|
|
296
529
|
}
|
|
297
530
|
|
|
298
531
|
.zippy-qr-frame {
|
|
@@ -374,6 +607,15 @@ input {
|
|
|
374
607
|
box-shadow: 0 0 0 3px color-mix(in srgb, var(--zippy-success) 12%, transparent);
|
|
375
608
|
}
|
|
376
609
|
|
|
610
|
+
.zippy-input-combo-input-wrap {
|
|
611
|
+
position: relative;
|
|
612
|
+
flex: 1;
|
|
613
|
+
min-width: 0;
|
|
614
|
+
align-self: stretch;
|
|
615
|
+
display: flex;
|
|
616
|
+
align-items: center;
|
|
617
|
+
}
|
|
618
|
+
|
|
377
619
|
.zippy-input-combo-field {
|
|
378
620
|
flex: 1;
|
|
379
621
|
min-width: 0;
|
|
@@ -386,6 +628,11 @@ input {
|
|
|
386
628
|
border: none;
|
|
387
629
|
background: transparent;
|
|
388
630
|
outline: none;
|
|
631
|
+
transition: padding-right 150ms ease;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
.zippy-input-combo-input-wrap--has-value .zippy-input-combo-field {
|
|
635
|
+
padding-right: 2.375rem;
|
|
389
636
|
}
|
|
390
637
|
|
|
391
638
|
.zippy-input-combo-field::placeholder {
|
|
@@ -402,6 +649,63 @@ input {
|
|
|
402
649
|
cursor: not-allowed;
|
|
403
650
|
}
|
|
404
651
|
|
|
652
|
+
.zippy-input-combo-clear {
|
|
653
|
+
position: absolute;
|
|
654
|
+
top: 0;
|
|
655
|
+
bottom: 0;
|
|
656
|
+
right: 0.375rem;
|
|
657
|
+
display: inline-flex;
|
|
658
|
+
align-items: center;
|
|
659
|
+
justify-content: center;
|
|
660
|
+
width: 1.75rem;
|
|
661
|
+
height: 1.75rem;
|
|
662
|
+
margin-top: auto;
|
|
663
|
+
margin-bottom: auto;
|
|
664
|
+
padding: 0;
|
|
665
|
+
border: 0;
|
|
666
|
+
border-radius: 999px;
|
|
667
|
+
background: transparent;
|
|
668
|
+
color: var(--zippy-text-muted);
|
|
669
|
+
cursor: pointer;
|
|
670
|
+
appearance: none;
|
|
671
|
+
opacity: 0;
|
|
672
|
+
visibility: hidden;
|
|
673
|
+
pointer-events: none;
|
|
674
|
+
transition:
|
|
675
|
+
background-color 150ms ease,
|
|
676
|
+
color 150ms ease,
|
|
677
|
+
opacity 150ms ease,
|
|
678
|
+
visibility 150ms ease;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
.zippy-input-combo-input-wrap--has-value .zippy-input-combo-clear {
|
|
682
|
+
opacity: 1;
|
|
683
|
+
visibility: visible;
|
|
684
|
+
pointer-events: auto;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
.zippy-input-combo-clear:hover:not(:disabled) {
|
|
688
|
+
background: color-mix(in srgb, var(--zippy-text-muted) 16%, transparent);
|
|
689
|
+
color: var(--zippy-text);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
.zippy-input-combo-clear:focus-visible {
|
|
693
|
+
outline: 2px solid color-mix(in srgb, var(--zippy-primary) 45%, transparent);
|
|
694
|
+
outline-offset: 1px;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
.zippy-input-combo-clear:disabled {
|
|
698
|
+
opacity: 0.45;
|
|
699
|
+
cursor: not-allowed;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
.zippy-input-combo-clear-icon {
|
|
703
|
+
display: block;
|
|
704
|
+
width: 0.875rem;
|
|
705
|
+
height: 0.875rem;
|
|
706
|
+
flex-shrink: 0;
|
|
707
|
+
}
|
|
708
|
+
|
|
405
709
|
.zippy-input-combo-divider {
|
|
406
710
|
flex-shrink: 0;
|
|
407
711
|
align-self: center;
|
|
@@ -527,9 +831,140 @@ input {
|
|
|
527
831
|
background: var(--zippy-error);
|
|
528
832
|
}
|
|
529
833
|
|
|
530
|
-
.zippy-
|
|
531
|
-
margin:
|
|
532
|
-
font-size: 0.
|
|
834
|
+
.zippy-field-hint {
|
|
835
|
+
margin: 0;
|
|
836
|
+
font-size: 0.75rem;
|
|
837
|
+
line-height: 1.45;
|
|
838
|
+
color: var(--zippy-text-muted);
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
.zippy-query-hint {
|
|
842
|
+
display: flex;
|
|
843
|
+
flex-direction: column;
|
|
844
|
+
gap: 10px;
|
|
845
|
+
padding: 12px 14px;
|
|
846
|
+
border-radius: calc(var(--zippy-radius-input) + 2px);
|
|
847
|
+
background: color-mix(in srgb, var(--zippy-text-muted) 5%, var(--zippy-surface-muted));
|
|
848
|
+
border: 1px solid color-mix(in srgb, var(--zippy-border) 85%, transparent);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
.zippy-query-hint-lead {
|
|
852
|
+
margin: 0;
|
|
853
|
+
font-size: 0.75rem;
|
|
854
|
+
font-weight: 600;
|
|
855
|
+
line-height: 1.4;
|
|
856
|
+
color: var(--zippy-text-muted);
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
.zippy-query-hint-list {
|
|
860
|
+
display: flex;
|
|
861
|
+
flex-direction: column;
|
|
862
|
+
gap: 8px;
|
|
863
|
+
margin: 0;
|
|
864
|
+
padding: 0;
|
|
865
|
+
list-style: none;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
.zippy-query-hint-item {
|
|
869
|
+
display: grid;
|
|
870
|
+
grid-template-columns: minmax(4.5rem, 5.25rem) minmax(0, 1fr);
|
|
871
|
+
align-items: start;
|
|
872
|
+
gap: 8px 10px;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
.zippy-query-hint-label {
|
|
876
|
+
padding-top: 0.1875rem;
|
|
877
|
+
font-size: 0.6875rem;
|
|
878
|
+
font-weight: 600;
|
|
879
|
+
letter-spacing: 0.02em;
|
|
880
|
+
text-transform: uppercase;
|
|
881
|
+
color: var(--zippy-text-muted);
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
.zippy-query-hint-example-wrap {
|
|
885
|
+
display: flex;
|
|
886
|
+
flex-direction: column;
|
|
887
|
+
align-items: flex-start;
|
|
888
|
+
gap: 3px;
|
|
889
|
+
min-width: 0;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
.zippy-query-hint-example {
|
|
893
|
+
display: inline-block;
|
|
894
|
+
max-width: 100%;
|
|
895
|
+
padding: 0.1875rem 0.5rem;
|
|
896
|
+
border-radius: 999px;
|
|
897
|
+
background: var(--zippy-background);
|
|
898
|
+
border: 1px solid color-mix(in srgb, var(--zippy-border) 90%, transparent);
|
|
899
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
900
|
+
font-size: 0.75rem;
|
|
901
|
+
font-weight: 500;
|
|
902
|
+
line-height: 1.35;
|
|
903
|
+
color: var(--zippy-text);
|
|
904
|
+
white-space: nowrap;
|
|
905
|
+
overflow: hidden;
|
|
906
|
+
text-overflow: ellipsis;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
.zippy-query-hint-note {
|
|
910
|
+
font-size: 0.6875rem;
|
|
911
|
+
line-height: 1.35;
|
|
912
|
+
color: var(--zippy-text-muted);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
.zippy-picker-lead {
|
|
916
|
+
margin: 0;
|
|
917
|
+
font-size: 0.8125rem;
|
|
918
|
+
line-height: 1.5;
|
|
919
|
+
color: var(--zippy-text-muted);
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
.zippy-picker-list {
|
|
923
|
+
display: flex;
|
|
924
|
+
flex-direction: column;
|
|
925
|
+
gap: 8px;
|
|
926
|
+
width: 100%;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
.zippy-picker-option {
|
|
930
|
+
display: block;
|
|
931
|
+
width: 100%;
|
|
932
|
+
padding: 0;
|
|
933
|
+
border: 1px solid color-mix(in srgb, var(--zippy-border) 90%, transparent);
|
|
934
|
+
border-radius: calc(var(--zippy-radius-input) + 2px);
|
|
935
|
+
background: var(--zippy-surface);
|
|
936
|
+
text-align: left;
|
|
937
|
+
cursor: pointer;
|
|
938
|
+
transition:
|
|
939
|
+
border-color 150ms ease,
|
|
940
|
+
background-color 150ms ease,
|
|
941
|
+
box-shadow 150ms ease;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
.zippy-picker-option:hover:not(:disabled) {
|
|
945
|
+
border-color: color-mix(in srgb, var(--zippy-primary) 35%, var(--zippy-border));
|
|
946
|
+
background: color-mix(in srgb, var(--zippy-primary) 4%, var(--zippy-surface));
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
.zippy-picker-option:focus-visible {
|
|
950
|
+
outline: 2px solid color-mix(in srgb, var(--zippy-primary) 45%, transparent);
|
|
951
|
+
outline-offset: 2px;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
.zippy-picker-option:disabled {
|
|
955
|
+
opacity: 0.55;
|
|
956
|
+
cursor: not-allowed;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
.zippy-picker-option .zippy-identity-card {
|
|
960
|
+
margin: 0;
|
|
961
|
+
border: 0;
|
|
962
|
+
background: transparent;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
.zippy-idle-hint {
|
|
966
|
+
margin: -6px 0 0;
|
|
967
|
+
font-size: 0.8125rem;
|
|
533
968
|
color: var(--zippy-text-muted);
|
|
534
969
|
text-align: center;
|
|
535
970
|
line-height: 1.45;
|
|
@@ -545,6 +980,55 @@ input {
|
|
|
545
980
|
border: 1px solid var(--zippy-border);
|
|
546
981
|
}
|
|
547
982
|
|
|
983
|
+
.zippy-identity-card--dismissible {
|
|
984
|
+
position: relative;
|
|
985
|
+
padding-right: 2.75rem;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
.zippy-identity-card-dismiss {
|
|
989
|
+
position: absolute;
|
|
990
|
+
top: 50%;
|
|
991
|
+
right: 10px;
|
|
992
|
+
display: inline-flex;
|
|
993
|
+
align-items: center;
|
|
994
|
+
justify-content: center;
|
|
995
|
+
width: 2rem;
|
|
996
|
+
height: 2rem;
|
|
997
|
+
padding: 0;
|
|
998
|
+
border: 0;
|
|
999
|
+
border-radius: 999px;
|
|
1000
|
+
background: transparent;
|
|
1001
|
+
color: var(--zippy-text-muted);
|
|
1002
|
+
cursor: pointer;
|
|
1003
|
+
appearance: none;
|
|
1004
|
+
transform: translateY(-50%);
|
|
1005
|
+
transition:
|
|
1006
|
+
background-color 0.15s ease,
|
|
1007
|
+
color 0.15s ease;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
.zippy-identity-card-dismiss:hover:not(:disabled) {
|
|
1011
|
+
background: color-mix(in srgb, var(--zippy-text-muted) 16%, transparent);
|
|
1012
|
+
color: var(--zippy-text);
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
.zippy-identity-card-dismiss:focus-visible {
|
|
1016
|
+
outline: 2px solid color-mix(in srgb, var(--zippy-primary) 45%, transparent);
|
|
1017
|
+
outline-offset: 2px;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
.zippy-identity-card-dismiss:disabled {
|
|
1021
|
+
opacity: 0.45;
|
|
1022
|
+
cursor: not-allowed;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
.zippy-identity-card-dismiss-icon {
|
|
1026
|
+
display: block;
|
|
1027
|
+
width: 1rem;
|
|
1028
|
+
height: 1rem;
|
|
1029
|
+
flex-shrink: 0;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
548
1032
|
.zippy-identity-avatar {
|
|
549
1033
|
flex-shrink: 0;
|
|
550
1034
|
width: 48px;
|
|
@@ -644,27 +1128,28 @@ input {
|
|
|
644
1128
|
}
|
|
645
1129
|
|
|
646
1130
|
.zippy-footnote {
|
|
647
|
-
|
|
1131
|
+
width: 100%;
|
|
1132
|
+
max-width: 18rem;
|
|
1133
|
+
margin: 0 auto;
|
|
1134
|
+
padding: 0 0.5rem;
|
|
648
1135
|
font-size: 0.75rem;
|
|
649
1136
|
line-height: 1.5;
|
|
650
1137
|
color: var(--zippy-text-muted);
|
|
651
1138
|
text-align: center;
|
|
652
1139
|
}
|
|
653
1140
|
|
|
654
|
-
.zippy-flow .zippy-
|
|
1141
|
+
.zippy-flow--centered .zippy-identity-card {
|
|
1142
|
+
width: 100%;
|
|
655
1143
|
text-align: left;
|
|
656
1144
|
}
|
|
657
1145
|
|
|
658
|
-
.zippy-flow-awaiting .zippy-footnote {
|
|
659
|
-
text-align: center;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
1146
|
.zippy-brand-footer {
|
|
663
1147
|
display: flex;
|
|
1148
|
+
flex-direction: column;
|
|
664
1149
|
align-items: center;
|
|
665
|
-
|
|
1150
|
+
gap: 10px;
|
|
666
1151
|
margin-top: auto;
|
|
667
|
-
padding-top:
|
|
1152
|
+
padding-top: 14px;
|
|
668
1153
|
}
|
|
669
1154
|
|
|
670
1155
|
.zippy-root--terminal .zippy-brand-footer {
|
|
@@ -673,6 +1158,315 @@ input {
|
|
|
673
1158
|
border-top: 1px solid color-mix(in srgb, var(--zippy-border) 80%, transparent);
|
|
674
1159
|
}
|
|
675
1160
|
|
|
1161
|
+
.zippy-app-links {
|
|
1162
|
+
display: flex;
|
|
1163
|
+
flex-direction: column;
|
|
1164
|
+
align-items: center;
|
|
1165
|
+
gap: 8px;
|
|
1166
|
+
width: 100%;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
.zippy-app-links-label {
|
|
1170
|
+
margin: 0;
|
|
1171
|
+
font-size: 0.6875rem;
|
|
1172
|
+
font-weight: 600;
|
|
1173
|
+
letter-spacing: 0.02em;
|
|
1174
|
+
text-transform: uppercase;
|
|
1175
|
+
color: var(--zippy-text-muted);
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
.zippy-app-links-badges {
|
|
1179
|
+
display: flex;
|
|
1180
|
+
flex-wrap: wrap;
|
|
1181
|
+
align-items: center;
|
|
1182
|
+
justify-content: center;
|
|
1183
|
+
gap: 8px;
|
|
1184
|
+
width: 100%;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
.zippy-app-link {
|
|
1188
|
+
display: inline-flex;
|
|
1189
|
+
align-items: center;
|
|
1190
|
+
justify-content: center;
|
|
1191
|
+
gap: 6px;
|
|
1192
|
+
min-width: 0;
|
|
1193
|
+
flex: 1 1 8.5rem;
|
|
1194
|
+
max-width: 11rem;
|
|
1195
|
+
min-height: 2rem;
|
|
1196
|
+
padding: 0.375rem 0.625rem;
|
|
1197
|
+
border: 1px solid color-mix(in srgb, var(--zippy-border) 90%, transparent);
|
|
1198
|
+
border-radius: 999px;
|
|
1199
|
+
background: var(--zippy-surface);
|
|
1200
|
+
color: var(--zippy-text);
|
|
1201
|
+
font: inherit;
|
|
1202
|
+
font-size: 0.6875rem;
|
|
1203
|
+
font-weight: 600;
|
|
1204
|
+
line-height: 1;
|
|
1205
|
+
text-decoration: none;
|
|
1206
|
+
appearance: none;
|
|
1207
|
+
cursor: pointer;
|
|
1208
|
+
transition:
|
|
1209
|
+
border-color 0.15s ease,
|
|
1210
|
+
background-color 0.15s ease,
|
|
1211
|
+
color 0.15s ease;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
.zippy-app-link--icon-only {
|
|
1215
|
+
flex: 0 0 auto;
|
|
1216
|
+
width: 2.375rem;
|
|
1217
|
+
min-width: 2.375rem;
|
|
1218
|
+
max-width: 2.375rem;
|
|
1219
|
+
height: 2.375rem;
|
|
1220
|
+
min-height: 2.375rem;
|
|
1221
|
+
padding: 0;
|
|
1222
|
+
border-radius: 999px;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
.zippy-app-link--icon-only .zippy-app-link-icon {
|
|
1226
|
+
width: 1rem;
|
|
1227
|
+
height: 1rem;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
.zippy-app-link--icon-only .zippy-app-link-icon--play {
|
|
1231
|
+
width: 0.9375rem;
|
|
1232
|
+
height: 1.0625rem;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
.zippy-app-link:hover {
|
|
1236
|
+
border-color: color-mix(in srgb, var(--zippy-primary) 35%, var(--zippy-border));
|
|
1237
|
+
background: color-mix(in srgb, var(--zippy-primary) 6%, var(--zippy-surface));
|
|
1238
|
+
color: var(--zippy-text);
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
.zippy-app-link:focus-visible {
|
|
1242
|
+
outline: 2px solid color-mix(in srgb, var(--zippy-primary) 45%, transparent);
|
|
1243
|
+
outline-offset: 2px;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
.zippy-app-link-icon {
|
|
1247
|
+
flex-shrink: 0;
|
|
1248
|
+
width: 0.875rem;
|
|
1249
|
+
height: 0.875rem;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
.zippy-app-link-icon--play {
|
|
1253
|
+
width: 0.8125rem;
|
|
1254
|
+
height: 0.9375rem;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
.zippy-app-modal-overlay {
|
|
1258
|
+
position: fixed;
|
|
1259
|
+
inset: 0;
|
|
1260
|
+
z-index: 2147482000;
|
|
1261
|
+
display: flex;
|
|
1262
|
+
align-items: center;
|
|
1263
|
+
justify-content: center;
|
|
1264
|
+
padding: 16px;
|
|
1265
|
+
background: rgba(15, 23, 42, 0.58);
|
|
1266
|
+
animation: zippy-app-modal-fade 0.18s ease-out;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
.zippy-app-modal-panel {
|
|
1270
|
+
position: relative;
|
|
1271
|
+
width: min(100%, 22rem);
|
|
1272
|
+
max-height: calc(100vh - 32px);
|
|
1273
|
+
overflow: auto;
|
|
1274
|
+
padding: 22px 20px 20px;
|
|
1275
|
+
border: 1px solid var(--zippy-border);
|
|
1276
|
+
border-radius: calc(var(--zippy-radius-card) - 2px);
|
|
1277
|
+
background: var(--zippy-background);
|
|
1278
|
+
color: var(--zippy-text);
|
|
1279
|
+
box-shadow:
|
|
1280
|
+
0 1px 2px rgba(15, 23, 42, 0.05),
|
|
1281
|
+
0 24px 56px -24px rgba(15, 23, 42, 0.35);
|
|
1282
|
+
animation: zippy-app-modal-in 0.2s ease-out;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
.zippy-app-modal-close {
|
|
1286
|
+
position: absolute;
|
|
1287
|
+
top: 10px;
|
|
1288
|
+
right: 10px;
|
|
1289
|
+
display: inline-flex;
|
|
1290
|
+
align-items: center;
|
|
1291
|
+
justify-content: center;
|
|
1292
|
+
width: 2rem;
|
|
1293
|
+
height: 2rem;
|
|
1294
|
+
padding: 0;
|
|
1295
|
+
border: 0;
|
|
1296
|
+
border-radius: 999px;
|
|
1297
|
+
background: transparent;
|
|
1298
|
+
color: var(--zippy-text-muted);
|
|
1299
|
+
cursor: pointer;
|
|
1300
|
+
appearance: none;
|
|
1301
|
+
transition:
|
|
1302
|
+
background-color 0.15s ease,
|
|
1303
|
+
color 0.15s ease;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
.zippy-app-modal-close-icon {
|
|
1307
|
+
display: block;
|
|
1308
|
+
width: 1rem;
|
|
1309
|
+
height: 1rem;
|
|
1310
|
+
flex-shrink: 0;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
.zippy-app-modal-close:hover {
|
|
1314
|
+
background: color-mix(in srgb, var(--zippy-text-muted) 16%, transparent);
|
|
1315
|
+
color: var(--zippy-text);
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
.zippy-app-modal-close:focus-visible {
|
|
1319
|
+
outline: 2px solid color-mix(in srgb, var(--zippy-primary) 45%, transparent);
|
|
1320
|
+
outline-offset: 2px;
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
.zippy-app-modal-header {
|
|
1324
|
+
display: flex;
|
|
1325
|
+
align-items: flex-start;
|
|
1326
|
+
gap: 12px;
|
|
1327
|
+
margin-bottom: 16px;
|
|
1328
|
+
padding-right: 1.75rem;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
.zippy-app-modal-platform-icon {
|
|
1332
|
+
flex-shrink: 0;
|
|
1333
|
+
width: 2rem;
|
|
1334
|
+
height: 2rem;
|
|
1335
|
+
margin-top: 2px;
|
|
1336
|
+
color: var(--zippy-text);
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
.zippy-app-modal-platform-icon--play {
|
|
1340
|
+
width: 1.75rem;
|
|
1341
|
+
height: 1.9375rem;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
.zippy-app-modal-heading {
|
|
1345
|
+
min-width: 0;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
.zippy-app-modal-title {
|
|
1349
|
+
margin: 0 0 6px;
|
|
1350
|
+
font-size: 1.0625rem;
|
|
1351
|
+
font-weight: 700;
|
|
1352
|
+
letter-spacing: -0.02em;
|
|
1353
|
+
line-height: 1.25;
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
.zippy-app-modal-lead {
|
|
1357
|
+
margin: 0;
|
|
1358
|
+
font-size: 0.8125rem;
|
|
1359
|
+
line-height: 1.5;
|
|
1360
|
+
color: var(--zippy-text-muted);
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
.zippy-app-modal-qr-wrap {
|
|
1364
|
+
display: flex;
|
|
1365
|
+
flex-direction: column;
|
|
1366
|
+
align-items: center;
|
|
1367
|
+
gap: 8px;
|
|
1368
|
+
margin-bottom: 16px;
|
|
1369
|
+
width: 100%;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
.zippy-app-modal-qr-frame {
|
|
1373
|
+
display: flex;
|
|
1374
|
+
align-items: center;
|
|
1375
|
+
justify-content: center;
|
|
1376
|
+
width: 100%;
|
|
1377
|
+
max-width: 12.5rem;
|
|
1378
|
+
aspect-ratio: 1;
|
|
1379
|
+
padding: 14px;
|
|
1380
|
+
border: 1px solid color-mix(in srgb, var(--zippy-border) 90%, transparent);
|
|
1381
|
+
border-radius: 16px;
|
|
1382
|
+
background: #ffffff;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
.zippy-app-modal-qr-frame .zippy-qr-stack {
|
|
1386
|
+
display: flex;
|
|
1387
|
+
align-items: center;
|
|
1388
|
+
justify-content: center;
|
|
1389
|
+
width: 100%;
|
|
1390
|
+
height: 100%;
|
|
1391
|
+
line-height: 0;
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
.zippy-app-modal-qr-frame .zippy-qr-stack > svg {
|
|
1395
|
+
display: block;
|
|
1396
|
+
width: 100%;
|
|
1397
|
+
height: 100%;
|
|
1398
|
+
max-width: 100%;
|
|
1399
|
+
max-height: 100%;
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
.zippy-app-modal-qr-hint {
|
|
1403
|
+
margin: 0;
|
|
1404
|
+
font-size: 0.75rem;
|
|
1405
|
+
font-weight: 600;
|
|
1406
|
+
color: var(--zippy-text-muted);
|
|
1407
|
+
text-align: center;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
.zippy-app-modal-actions {
|
|
1411
|
+
display: flex;
|
|
1412
|
+
flex-direction: column;
|
|
1413
|
+
gap: 8px;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
.zippy-app-modal-cta {
|
|
1417
|
+
display: inline-flex;
|
|
1418
|
+
align-items: center;
|
|
1419
|
+
justify-content: center;
|
|
1420
|
+
min-height: 2.75rem;
|
|
1421
|
+
padding: 0.625rem 1rem;
|
|
1422
|
+
border-radius: 999px;
|
|
1423
|
+
background: var(--zippy-primary);
|
|
1424
|
+
color: var(--zippy-primary-foreground);
|
|
1425
|
+
font-size: 0.875rem;
|
|
1426
|
+
font-weight: 700;
|
|
1427
|
+
line-height: 1.2;
|
|
1428
|
+
text-decoration: none;
|
|
1429
|
+
transition: background-color 0.15s ease, transform 0.15s ease;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
.zippy-app-modal-cta:hover {
|
|
1433
|
+
background: color-mix(in srgb, var(--zippy-primary) 88%, #000000);
|
|
1434
|
+
transform: translateY(-1px);
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
.zippy-app-modal-cta:focus-visible {
|
|
1438
|
+
outline: 2px solid color-mix(in srgb, var(--zippy-primary) 45%, transparent);
|
|
1439
|
+
outline-offset: 2px;
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
.zippy-app-modal-mobile-note {
|
|
1443
|
+
margin: 0;
|
|
1444
|
+
font-size: 0.75rem;
|
|
1445
|
+
line-height: 1.45;
|
|
1446
|
+
color: var(--zippy-text-muted);
|
|
1447
|
+
text-align: center;
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
.zippy-app-modal-overlay--mobile .zippy-app-modal-qr-wrap {
|
|
1451
|
+
opacity: 0.92;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
@keyframes zippy-app-modal-fade {
|
|
1455
|
+
from { opacity: 0; }
|
|
1456
|
+
to { opacity: 1; }
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
@keyframes zippy-app-modal-in {
|
|
1460
|
+
from {
|
|
1461
|
+
opacity: 0;
|
|
1462
|
+
transform: translateY(8px) scale(0.98);
|
|
1463
|
+
}
|
|
1464
|
+
to {
|
|
1465
|
+
opacity: 1;
|
|
1466
|
+
transform: translateY(0) scale(1);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
|
|
676
1470
|
.zippy-brand-footer-inner {
|
|
677
1471
|
display: inline-flex;
|
|
678
1472
|
align-items: center;
|
|
@@ -825,7 +1619,10 @@ input {
|
|
|
825
1619
|
}
|
|
826
1620
|
|
|
827
1621
|
.zippy-status-icon.loading {
|
|
828
|
-
background:
|
|
1622
|
+
background: transparent;
|
|
1623
|
+
width: auto;
|
|
1624
|
+
height: auto;
|
|
1625
|
+
margin: 0 auto 14px;
|
|
829
1626
|
}
|
|
830
1627
|
|
|
831
1628
|
.zippy-status-icon.success {
|
|
@@ -905,7 +1702,7 @@ input {
|
|
|
905
1702
|
@keyframes zippy-spin {
|
|
906
1703
|
to { transform: rotate(360deg); }
|
|
907
1704
|
}
|
|
908
|
-
`,
|
|
1705
|
+
`,dt=`
|
|
909
1706
|
.zippy-overlay {
|
|
910
1707
|
position: fixed;
|
|
911
1708
|
inset: 0;
|
|
@@ -933,9 +1730,28 @@ input {
|
|
|
933
1730
|
transform: translateY(0) scale(1);
|
|
934
1731
|
}
|
|
935
1732
|
}
|
|
936
|
-
`;function Ie(n){if((n.mode??"inline")==="modal")return Je(n);if(!n.container)throw new Error('Zippy Pay: `container` is required when mode is "inline".');let t=Ce(n.container);t.innerHTML="";let i=document.createElement("div");return i.className="zippy-inline-host",t.appendChild(i),{host:i,overlay:null,escapeHandler:null,destroy:()=>{i.remove();}}}function Je(n){let e=document.createElement("div");e.className="zippy-overlay",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),e.setAttribute("aria-label","Zippy Pay checkout"),e.style.display="none";let t=document.createElement("style");t.textContent=Se,e.appendChild(t);let i=document.createElement("div");i.className="zippy-modal-panel";let r=document.createElement("div");r.className="zippy-modal-host",i.appendChild(r),e.appendChild(i),document.body.appendChild(e),(n.closeOnBackdropClick??false)&&e.addEventListener("click",o=>{o.target===e&&n.onClose?.();});let s={host:r,overlay:e,escapeHandler:null,destroy:()=>{s.escapeHandler&&document.removeEventListener("keydown",s.escapeHandler),e.remove(),document.body.style.overflow="";}};return s}function Le(n,e,t){if(!n.overlay)return;n.overlay.style.display="flex",document.body.style.overflow="hidden",(e.closeOnEscape??false)&&!n.escapeHandler&&(n.escapeHandler=a=>{a.key==="Escape"&&t();},document.addEventListener("keydown",n.escapeHandler)),n.host.querySelector("input, button")?.focus();}function Ne(n){n.overlay&&(n.overlay.style.display="none",document.body.style.overflow="",n.escapeHandler&&(document.removeEventListener("keydown",n.escapeHandler),n.escapeHandler=null));}var Y=class{constructor(e,t){this.fetchSession=e;this.options=t;this.timer=null;this.running=false;this.stopped=false;}start(e){if(!this.running){if(this.running=true,this.stopped=false,e&&(this.options.onUpdate(e),!this.shouldContinue(e))){this.stop();return}this.tick();}}stop(){this.stopped=true,this.running=false,this.timer!==null&&(clearTimeout(this.timer),this.timer=null);}shouldContinue(e){return this.options.shouldPoll?this.options.shouldPoll(e):te.includes(e.status)}intervalMs(){let e=this.options.intervalMs??3e3,t=this.options.hiddenIntervalMs??1e4;return typeof document<"u"&&document.hidden?t:e}scheduleNext(){this.stopped||(this.timer=setTimeout(()=>{this.tick();},this.intervalMs()));}async tick(){if(!this.stopped){try{let e=await this.fetchSession();if(this.options.onUpdate(e),!this.shouldContinue(e)){this.stop();return}}catch(e){this.options.onError?.(e),this.stop();return}this.scheduleNext();}}};function ue(n){return F.includes(n)}function et(n){switch(n){case "CREATED":return "choose-method";case "AWAITING_PAYMENT":return "awaiting";case "COMPLETED":return "success";case "EXPIRED":return "expired";case "CANCELLED":return "cancelled";case "FAILED":return "failed";default:return "error"}}var O=function(n,e){let r=n,a=Q[e],s=null,o=0,l=null,g=[],y={},f=function(c,m){o=r*4+17,s=(function(p){let u=new Array(p);for(let d=0;d<p;d+=1){u[d]=new Array(p);for(let x=0;x<p;x+=1)u[d][x]=null;}return u})(o),h(0,0),h(o-7,0),h(0,o-7),E(),T(),A(c,m),r>=7&&M(c),l==null&&(l=Ve(r,a,g)),I(l,m);},h=function(c,m){for(let p=-1;p<=7;p+=1)if(!(c+p<=-1||o<=c+p))for(let u=-1;u<=7;u+=1)m+u<=-1||o<=m+u||(0<=p&&p<=6&&(u==0||u==6)||0<=u&&u<=6&&(p==0||p==6)||2<=p&&p<=4&&2<=u&&u<=4?s[c+p][m+u]=true:s[c+p][m+u]=false);},w=function(){let c=0,m=0;for(let p=0;p<8;p+=1){f(true,p);let u=D.getLostPoint(y);(p==0||c>u)&&(c=u,m=p);}return m},T=function(){for(let c=8;c<o-8;c+=1)s[c][6]==null&&(s[c][6]=c%2==0);for(let c=8;c<o-8;c+=1)s[6][c]==null&&(s[6][c]=c%2==0);},E=function(){let c=D.getPatternPosition(r);for(let m=0;m<c.length;m+=1)for(let p=0;p<c.length;p+=1){let u=c[m],d=c[p];if(s[u][d]==null)for(let x=-2;x<=2;x+=1)for(let v=-2;v<=2;v+=1)x==-2||x==2||v==-2||v==2||x==0&&v==0?s[u+x][d+v]=true:s[u+x][d+v]=false;}},M=function(c){let m=D.getBCHTypeNumber(r);for(let p=0;p<18;p+=1){let u=!c&&(m>>p&1)==1;s[Math.floor(p/3)][p%3+o-8-3]=u;}for(let p=0;p<18;p+=1){let u=!c&&(m>>p&1)==1;s[p%3+o-8-3][Math.floor(p/3)]=u;}},A=function(c,m){let p=a<<3|m,u=D.getBCHTypeInfo(p);for(let d=0;d<15;d+=1){let x=!c&&(u>>d&1)==1;d<6?s[d][8]=x:d<8?s[d+1][8]=x:s[o-15+d][8]=x;}for(let d=0;d<15;d+=1){let x=!c&&(u>>d&1)==1;d<8?s[8][o-d-1]=x:d<9?s[8][15-d-1+1]=x:s[8][15-d-1]=x;}s[o-8][8]=!c;},I=function(c,m){let p=-1,u=o-1,d=7,x=0,v=D.getMaskFunction(m);for(let P=o-1;P>0;P-=2)for(P==6&&(P-=1);;){for(let z=0;z<2;z+=1)if(s[u][P-z]==null){let k=false;x<c.length&&(k=(c[x]>>>d&1)==1),v(u,P-z)&&(k=!k),s[u][P-z]=k,d-=1,d==-1&&(x+=1,d=7);}if(u+=p,u<0||o<=u){u-=p,p=-p;break}}},je=function(c,m){let p=0,u=0,d=0,x=new Array(m.length),v=new Array(m.length);for(let b=0;b<m.length;b+=1){let C=m[b].dataCount,N=m[b].totalCount-C;u=Math.max(u,C),d=Math.max(d,N),x[b]=new Array(C);for(let _=0;_<x[b].length;_+=1)x[b][_]=255&c.getBuffer()[_+p];p+=C;let ee=D.getErrorCorrectPolynomial(N),ge=j(x[b],ee.getLength()-1).mod(ee);v[b]=new Array(ee.getLength()-1);for(let _=0;_<v[b].length;_+=1){let xe=_+ge.getLength()-v[b].length;v[b][_]=xe>=0?ge.getAt(xe):0;}}let P=0;for(let b=0;b<m.length;b+=1)P+=m[b].totalCount;let z=new Array(P),k=0;for(let b=0;b<u;b+=1)for(let C=0;C<m.length;C+=1)b<x[C].length&&(z[k]=x[C][b],k+=1);for(let b=0;b<d;b+=1)for(let C=0;C<m.length;C+=1)b<v[C].length&&(z[k]=v[C][b],k+=1);return z},Ve=function(c,m,p){let u=_e.getRSBlocks(c,m),d=Re();for(let v=0;v<p.length;v+=1){let P=p[v];d.put(P.getMode(),4),d.put(P.getLength(),D.getLengthInBits(P.getMode(),c)),P.write(d);}let x=0;for(let v=0;v<u.length;v+=1)x+=u[v].dataCount;if(d.getLengthInBits()>x*8)throw "code length overflow. ("+d.getLengthInBits()+">"+x*8+")";for(d.getLengthInBits()+4<=x*8&&d.put(0,4);d.getLengthInBits()%8!=0;)d.putBit(false);for(;!(d.getLengthInBits()>=x*8||(d.put(236,8),d.getLengthInBits()>=x*8));)d.put(17,8);return je(d,u)};y.addData=function(c,m){m=m||"Byte";let p=null;switch(m){case "Numeric":p=tt(c);break;case "Alphanumeric":p=it(c);break;case "Byte":p=nt(c);break;case "Kanji":p=rt(c);break;default:throw "mode:"+m}g.push(p),l=null;},y.isDark=function(c,m){if(c<0||o<=c||m<0||o<=m)throw c+","+m;return s[c][m]},y.getModuleCount=function(){return o},y.make=function(){if(r<1){let c=1;for(;c<40;c++){let m=_e.getRSBlocks(c,a),p=Re();for(let d=0;d<g.length;d++){let x=g[d];p.put(x.getMode(),4),p.put(x.getLength(),D.getLengthInBits(x.getMode(),c)),x.write(p);}let u=0;for(let d=0;d<m.length;d++)u+=m[d].dataCount;if(p.getLengthInBits()<=u*8)break}r=c;}f(false,w());},y.createTableTag=function(c,m){c=c||2,m=typeof m>"u"?c*4:m;let p="";p+='<table style="',p+=" border-width: 0px; border-style: none;",p+=" border-collapse: collapse;",p+=" padding: 0px; margin: "+m+"px;",p+='">',p+="<tbody>";for(let u=0;u<y.getModuleCount();u+=1){p+="<tr>";for(let d=0;d<y.getModuleCount();d+=1)p+='<td style="',p+=" border-width: 0px; border-style: none;",p+=" border-collapse: collapse;",p+=" padding: 0px; margin: 0px;",p+=" width: "+c+"px;",p+=" height: "+c+"px;",p+=" background-color: ",p+=y.isDark(u,d)?"#000000":"#ffffff",p+=";",p+='"/>';p+="</tr>";}return p+="</tbody>",p+="</table>",p},y.createSvgTag=function(c,m,p,u){let d={};typeof arguments[0]=="object"&&(d=arguments[0],c=d.cellSize,m=d.margin,p=d.alt,u=d.title),c=c||2,m=typeof m>"u"?c*4:m,p=typeof p=="string"?{text:p}:p||{},p.text=p.text||null,p.id=p.text?p.id||"qrcode-description":null,u=typeof u=="string"?{text:u}:u||{},u.text=u.text||null,u.id=u.text?u.id||"qrcode-title":null;let x=y.getModuleCount()*c+m*2,v,P,z,k,b="",C;for(C="l"+c+",0 0,"+c+" -"+c+",0 0,-"+c+"z ",b+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',b+=d.scalable?"":' width="'+x+'px" height="'+x+'px"',b+=' viewBox="0 0 '+x+" "+x+'" ',b+=' preserveAspectRatio="xMinYMin meet"',b+=u.text||p.text?' role="img" aria-labelledby="'+Z([u.id,p.id].join(" ").trim())+'"':"",b+=">",b+=u.text?'<title id="'+Z(u.id)+'">'+Z(u.text)+"</title>":"",b+=p.text?'<description id="'+Z(p.id)+'">'+Z(p.text)+"</description>":"",b+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',b+='<path d="',z=0;z<y.getModuleCount();z+=1)for(k=z*c+m,v=0;v<y.getModuleCount();v+=1)y.isDark(z,v)&&(P=v*c+m,b+="M"+P+","+k+C);return b+='" stroke="transparent" fill="black"/>',b+="</svg>",b},y.createDataURL=function(c,m){c=c||2,m=typeof m>"u"?c*4:m;let p=y.getModuleCount()*c+m*2,u=m,d=p-m;return pt(p,p,function(x,v){if(u<=x&&x<d&&u<=v&&v<d){let P=Math.floor((x-u)/c),z=Math.floor((v-u)/c);return y.isDark(z,P)?0:1}else return 1})},y.createImgTag=function(c,m,p){c=c||2,m=typeof m>"u"?c*4:m;let u=y.getModuleCount()*c+m*2,d="";return d+="<img",d+=' src="',d+=y.createDataURL(c,m),d+='"',d+=' width="',d+=u,d+='"',d+=' height="',d+=u,d+='"',p&&(d+=' alt="',d+=Z(p),d+='"'),d+="/>",d};let Z=function(c){let m="";for(let p=0;p<c.length;p+=1){let u=c.charAt(p);switch(u){case "<":m+="<";break;case ">":m+=">";break;case "&":m+="&";break;case '"':m+=""";break;default:m+=u;break}}return m},Ge=function(c){c=typeof c>"u"?2:c;let p=y.getModuleCount()*1+c*2,u=c,d=p-c,x,v,P,z,k,b={"\u2588\u2588":"\u2588","\u2588 ":"\u2580"," \u2588":"\u2584"," ":" "},C={"\u2588\u2588":"\u2580","\u2588 ":"\u2580"," \u2588":" "," ":" "},N="";for(x=0;x<p;x+=2){for(P=Math.floor((x-u)/1),z=Math.floor((x+1-u)/1),v=0;v<p;v+=1)k="\u2588",u<=v&&v<d&&u<=x&&x<d&&y.isDark(P,Math.floor((v-u)/1))&&(k=" "),u<=v&&v<d&&u<=x+1&&x+1<d&&y.isDark(z,Math.floor((v-u)/1))?k+=" ":k+="\u2588",N+=c<1&&x+1>=d?C[k]:b[k];N+=`
|
|
937
|
-
`;}return
|
|
938
|
-
`;}return C.substring(0,C.length-1)},y.renderTo2dContext=function(c,m){m=m||2;let p=y.getModuleCount();for(let u=0;u<p;u++)for(let d=0;d<p;d++)c.fillStyle=y.isDark(u,d)?"black":"white",c.fillRect(d*m,u*m,m,m);},y};O.stringToBytes=function(n){let e=[];for(let t=0;t<n.length;t+=1){let i=n.charCodeAt(t);e.push(i&255);}return e};O.createStringToBytes=function(n,e){let t=(function(){let r=st(n),a=function(){let l=r.read();if(l==-1)throw "eof";return l},s=0,o={};for(;;){let l=r.read();if(l==-1)break;let g=a(),y=a(),f=a(),h=String.fromCharCode(l<<8|g),w=y<<8|f;o[h]=w,s+=1;}if(s!=e)throw s+" != "+e;return o})(),i=63;return function(r){let a=[];for(let s=0;s<r.length;s+=1){let o=r.charCodeAt(s);if(o<128)a.push(o);else {let l=t[r.charAt(s)];typeof l=="number"?(l&255)==l?a.push(l):(a.push(l>>>8),a.push(l&255)):a.push(i);}}return a}};var S={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Q={L:1,M:0,Q:3,H:2},R={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},D=(function(){let n=[[],[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]],e=1335,t=7973,i=21522,r={},a=function(s){let o=0;for(;s!=0;)o+=1,s>>>=1;return o};return r.getBCHTypeInfo=function(s){let o=s<<10;for(;a(o)-a(e)>=0;)o^=e<<a(o)-a(e);return (s<<10|o)^i},r.getBCHTypeNumber=function(s){let o=s<<12;for(;a(o)-a(t)>=0;)o^=t<<a(o)-a(t);return s<<12|o},r.getPatternPosition=function(s){return n[s-1]},r.getMaskFunction=function(s){switch(s){case R.PATTERN000:return function(o,l){return (o+l)%2==0};case R.PATTERN001:return function(o,l){return o%2==0};case R.PATTERN010:return function(o,l){return l%3==0};case R.PATTERN011:return function(o,l){return (o+l)%3==0};case R.PATTERN100:return function(o,l){return (Math.floor(o/2)+Math.floor(l/3))%2==0};case R.PATTERN101:return function(o,l){return o*l%2+o*l%3==0};case R.PATTERN110:return function(o,l){return (o*l%2+o*l%3)%2==0};case R.PATTERN111:return function(o,l){return (o*l%3+(o+l)%2)%2==0};default:throw "bad maskPattern:"+s}},r.getErrorCorrectPolynomial=function(s){let o=j([1],0);for(let l=0;l<s;l+=1)o=o.multiply(j([1,B.gexp(l)],0));return o},r.getLengthInBits=function(s,o){if(1<=o&&o<10)switch(s){case S.MODE_NUMBER:return 10;case S.MODE_ALPHA_NUM:return 9;case S.MODE_8BIT_BYTE:return 8;case S.MODE_KANJI:return 8;default:throw "mode:"+s}else if(o<27)switch(s){case S.MODE_NUMBER:return 12;case S.MODE_ALPHA_NUM:return 11;case S.MODE_8BIT_BYTE:return 16;case S.MODE_KANJI:return 10;default:throw "mode:"+s}else if(o<41)switch(s){case S.MODE_NUMBER:return 14;case S.MODE_ALPHA_NUM:return 13;case S.MODE_8BIT_BYTE:return 16;case S.MODE_KANJI:return 12;default:throw "mode:"+s}else throw "type:"+o},r.getLostPoint=function(s){let o=s.getModuleCount(),l=0;for(let f=0;f<o;f+=1)for(let h=0;h<o;h+=1){let w=0,T=s.isDark(f,h);for(let E=-1;E<=1;E+=1)if(!(f+E<0||o<=f+E))for(let M=-1;M<=1;M+=1)h+M<0||o<=h+M||E==0&&M==0||T==s.isDark(f+E,h+M)&&(w+=1);w>5&&(l+=3+w-5);}for(let f=0;f<o-1;f+=1)for(let h=0;h<o-1;h+=1){let w=0;s.isDark(f,h)&&(w+=1),s.isDark(f+1,h)&&(w+=1),s.isDark(f,h+1)&&(w+=1),s.isDark(f+1,h+1)&&(w+=1),(w==0||w==4)&&(l+=3);}for(let f=0;f<o;f+=1)for(let h=0;h<o-6;h+=1)s.isDark(f,h)&&!s.isDark(f,h+1)&&s.isDark(f,h+2)&&s.isDark(f,h+3)&&s.isDark(f,h+4)&&!s.isDark(f,h+5)&&s.isDark(f,h+6)&&(l+=40);for(let f=0;f<o;f+=1)for(let h=0;h<o-6;h+=1)s.isDark(h,f)&&!s.isDark(h+1,f)&&s.isDark(h+2,f)&&s.isDark(h+3,f)&&s.isDark(h+4,f)&&!s.isDark(h+5,f)&&s.isDark(h+6,f)&&(l+=40);let g=0;for(let f=0;f<o;f+=1)for(let h=0;h<o;h+=1)s.isDark(h,f)&&(g+=1);let y=Math.abs(100*g/o/o-50)/5;return l+=y*10,l},r})(),B=(function(){let n=new Array(256),e=new Array(256);for(let i=0;i<8;i+=1)n[i]=1<<i;for(let i=8;i<256;i+=1)n[i]=n[i-4]^n[i-5]^n[i-6]^n[i-8];for(let i=0;i<255;i+=1)e[n[i]]=i;let t={};return t.glog=function(i){if(i<1)throw "glog("+i+")";return e[i]},t.gexp=function(i){for(;i<0;)i+=255;for(;i>=256;)i-=255;return n[i]},t})(),j=function(n,e){if(typeof n.length>"u")throw n.length+"/"+e;let t=(function(){let r=0;for(;r<n.length&&n[r]==0;)r+=1;let a=new Array(n.length-r+e);for(let s=0;s<n.length-r;s+=1)a[s]=n[s+r];return a})(),i={};return i.getAt=function(r){return t[r]},i.getLength=function(){return t.length},i.multiply=function(r){let a=new Array(i.getLength()+r.getLength()-1);for(let s=0;s<i.getLength();s+=1)for(let o=0;o<r.getLength();o+=1)a[s+o]^=B.gexp(B.glog(i.getAt(s))+B.glog(r.getAt(o)));return j(a,0)},i.mod=function(r){if(i.getLength()-r.getLength()<0)return i;let a=B.glog(i.getAt(0))-B.glog(r.getAt(0)),s=new Array(i.getLength());for(let o=0;o<i.getLength();o+=1)s[o]=i.getAt(o);for(let o=0;o<r.getLength();o+=1)s[o]^=B.gexp(B.glog(r.getAt(o))+a);return j(s,0).mod(r)},i},_e=(function(){let n=[[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]],e=function(r,a){let s={};return s.totalCount=r,s.dataCount=a,s},t={},i=function(r,a){switch(a){case Q.L:return n[(r-1)*4+0];case Q.M:return n[(r-1)*4+1];case Q.Q:return n[(r-1)*4+2];case Q.H:return n[(r-1)*4+3];default:return}};return t.getRSBlocks=function(r,a){let s=i(r,a);if(typeof s>"u")throw "bad rs block @ typeNumber:"+r+"/errorCorrectionLevel:"+a;let o=s.length/3,l=[];for(let g=0;g<o;g+=1){let y=s[g*3+0],f=s[g*3+1],h=s[g*3+2];for(let w=0;w<y;w+=1)l.push(e(f,h));}return l},t})(),Re=function(){let n=[],e=0,t={};return t.getBuffer=function(){return n},t.getAt=function(i){let r=Math.floor(i/8);return (n[r]>>>7-i%8&1)==1},t.put=function(i,r){for(let a=0;a<r;a+=1)t.putBit((i>>>r-a-1&1)==1);},t.getLengthInBits=function(){return e},t.putBit=function(i){let r=Math.floor(e/8);n.length<=r&&n.push(0),i&&(n[r]|=128>>>e%8),e+=1;},t},tt=function(n){let e=S.MODE_NUMBER,t=n,i={};i.getMode=function(){return e},i.getLength=function(s){return t.length},i.write=function(s){let o=t,l=0;for(;l+2<o.length;)s.put(r(o.substring(l,l+3)),10),l+=3;l<o.length&&(o.length-l==1?s.put(r(o.substring(l,l+1)),4):o.length-l==2&&s.put(r(o.substring(l,l+2)),7));};let r=function(s){let o=0;for(let l=0;l<s.length;l+=1)o=o*10+a(s.charAt(l));return o},a=function(s){if("0"<=s&&s<="9")return s.charCodeAt(0)-48;throw "illegal char :"+s};return i},it=function(n){let e=S.MODE_ALPHA_NUM,t=n,i={};i.getMode=function(){return e},i.getLength=function(a){return t.length},i.write=function(a){let s=t,o=0;for(;o+1<s.length;)a.put(r(s.charAt(o))*45+r(s.charAt(o+1)),11),o+=2;o<s.length&&a.put(r(s.charAt(o)),6);};let r=function(a){if("0"<=a&&a<="9")return a.charCodeAt(0)-48;if("A"<=a&&a<="Z")return a.charCodeAt(0)-65+10;switch(a){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 :"+a}};return i},nt=function(n){let e=S.MODE_8BIT_BYTE,i=O.stringToBytes(n),r={};return r.getMode=function(){return e},r.getLength=function(a){return i.length},r.write=function(a){for(let s=0;s<i.length;s+=1)a.put(i[s],8);},r},rt=function(n){let e=S.MODE_KANJI,i=O.stringToBytes;(function(s,o){let l=i(s);if(l.length!=2||(l[0]<<8|l[1])!=o)throw "sjis not supported."})("\u53CB",38726);let r=i(n),a={};return a.getMode=function(){return e},a.getLength=function(s){return ~~(r.length/2)},a.write=function(s){let o=r,l=0;for(;l+1<o.length;){let g=(255&o[l])<<8|255&o[l+1];if(33088<=g&&g<=40956)g-=33088;else if(57408<=g&&g<=60351)g-=49472;else throw "illegal char at "+(l+1)+"/"+g;g=(g>>>8&255)*192+(g&255),s.put(g,13),l+=2;}if(l<o.length)throw "illegal char at "+(l+1)},a},De=function(){let n=[],e={};return e.writeByte=function(t){n.push(t&255);},e.writeShort=function(t){e.writeByte(t),e.writeByte(t>>>8);},e.writeBytes=function(t,i,r){i=i||0,r=r||t.length;for(let a=0;a<r;a+=1)e.writeByte(t[a+i]);},e.writeString=function(t){for(let i=0;i<t.length;i+=1)e.writeByte(t.charCodeAt(i));},e.toByteArray=function(){return n},e.toString=function(){let t="";t+="[";for(let i=0;i<n.length;i+=1)i>0&&(t+=","),t+=n[i];return t+="]",t},e},ot=function(){let n=0,e=0,t=0,i="",r={},a=function(o){i+=String.fromCharCode(s(o&63));},s=function(o){if(o<0)throw "n:"+o;if(o<26)return 65+o;if(o<52)return 97+(o-26);if(o<62)return 48+(o-52);if(o==62)return 43;if(o==63)return 47;throw "n:"+o};return r.writeByte=function(o){for(n=n<<8|o&255,e+=8,t+=1;e>=6;)a(n>>>e-6),e-=6;},r.flush=function(){if(e>0&&(a(n<<6-e),n=0,e=0),t%3!=0){let o=3-t%3;for(let l=0;l<o;l+=1)i+="=";}},r.toString=function(){return i},r},st=function(n){let e=n,t=0,i=0,r=0,a={};a.read=function(){for(;r<8;){if(t>=e.length){if(r==0)return -1;throw "unexpected end of file./"+r}let l=e.charAt(t);if(t+=1,l=="=")return r=0,-1;if(l.match(/^\s$/))continue;i=i<<6|s(l.charCodeAt(0)),r+=6;}let o=i>>>r-8&255;return r-=8,o};let s=function(o){if(65<=o&&o<=90)return o-65;if(97<=o&&o<=122)return o-97+26;if(48<=o&&o<=57)return o-48+52;if(o==43)return 62;if(o==47)return 63;throw "c:"+o};return a},at=function(n,e){let t=n,i=e,r=new Array(n*e),a={};a.setPixel=function(g,y,f){r[y*t+g]=f;},a.write=function(g){g.writeString("GIF87a"),g.writeShort(t),g.writeShort(i),g.writeByte(128),g.writeByte(0),g.writeByte(0),g.writeByte(0),g.writeByte(0),g.writeByte(0),g.writeByte(255),g.writeByte(255),g.writeByte(255),g.writeString(","),g.writeShort(0),g.writeShort(0),g.writeShort(t),g.writeShort(i),g.writeByte(0);let y=2,f=o(y);g.writeByte(y);let h=0;for(;f.length-h>255;)g.writeByte(255),g.writeBytes(f,h,255),h+=255;g.writeByte(f.length-h),g.writeBytes(f,h,f.length-h),g.writeByte(0),g.writeString(";");};let s=function(g){let y=g,f=0,h=0,w={};return w.write=function(T,E){if(T>>>E)throw "length over";for(;f+E>=8;)y.writeByte(255&(T<<f|h)),E-=8-f,T>>>=8-f,h=0,f=0;h=T<<f|h,f=f+E;},w.flush=function(){f>0&&y.writeByte(h);},w},o=function(g){let y=1<<g,f=(1<<g)+1,h=g+1,w=l();for(let I=0;I<y;I+=1)w.add(String.fromCharCode(I));w.add(String.fromCharCode(y)),w.add(String.fromCharCode(f));let T=De(),E=s(T);E.write(y,h);let M=0,A=String.fromCharCode(r[M]);for(M+=1;M<r.length;){let I=String.fromCharCode(r[M]);M+=1,w.contains(A+I)?A=A+I:(E.write(w.indexOf(A),h),w.size()<4095&&(w.size()==1<<h&&(h+=1),w.add(A+I)),A=I);}return E.write(w.indexOf(A),h),E.write(f,h),E.flush(),T.toByteArray()},l=function(){let g={},y=0,f={};return f.add=function(h){if(f.contains(h))throw "dup key:"+h;g[h]=y,y+=1;},f.size=function(){return y},f.indexOf=function(h){return g[h]},f.contains=function(h){return typeof g[h]<"u"},f};return a},pt=function(n,e,t){let i=at(n,e);for(let o=0;o<e;o+=1)for(let l=0;l<n;l+=1)i.setPixel(l,o,t(l,o));let r=De();i.write(r);let a=ot(),s=r.toByteArray();for(let o=0;o<s.length;o+=1)a.writeByte(s[o]);return a.flush(),"data:image/gif;base64,"+a},Be=O;O.stringToBytes;var lt="#476CEB",ct="-1 20.86 60 60",dt="M16.8831 21.5476C16.3856 21.5476 15.9085 21.7452 15.5567 22.097L0.549704 37.104C0.0132083 37.6405 -0.147283 38.4474 0.143066 39.1483C0.433416 39.8493 1.11743 40.3063 1.87615 40.3063H26.5982L2.74743 64.1571C0.0649471 66.8395 -0.737512 70.8738 0.714236 74.3786C2.16598 77.8834 5.58604 80.1686 9.37964 80.1686H41.7385C42.236 80.1686 42.7131 79.971 43.0649 79.6192L58.0719 64.6122C58.6084 64.0757 58.7689 63.2689 58.4785 62.5679C58.1882 61.867 57.5042 61.4099 56.7455 61.4099H32.0234L55.8742 37.5592C58.5567 34.8767 59.3591 30.8425 57.9074 27.3376C56.4556 23.8328 53.0356 21.5476 49.242 21.5476H16.8831ZM5.11632 64.1759L28.3783 40.3812H30.6653L5.11632 64.1759ZM30.1464 61.4059L53.4083 37.6111L27.8594 61.4059H30.1464Z";function ut(n){let e=/viewBox="0 0 ([\d.]+) [\d.]+"/.exec(n);return e?Number(e[1]):null}function mt(n){let e=n*.24,t=(n-e)/2,i=e*1.18,r=(n-i)/2,a=e*.16;return ['<g shape-rendering="geometricPrecision">',`<rect x="${r}" y="${r}" width="${i}" height="${i}" rx="${i*.22}" fill="#ffffff"/>`,`<svg x="${t+a}" y="${t+a}" width="${e-a*2}" height="${e-a*2}" viewBox="${ct}">`,`<path d="${dt}" fill="${lt}"/>`,"</svg>","</g>"].join("")}function He(n){let e=ut(n);return e?n.replace("</svg>",`${mt(e)}</svg>`):n}function Ze(){return '<svg class="zippy-brand-lock" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M7 10V8a5 5 0 0 1 10 0v2" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><rect x="5" y="10" width="14" height="11" rx="2.5" stroke="currentColor" stroke-width="1.75"/><circle cx="12" cy="15.5" r="1.25" fill="currentColor"/></svg>'}var ht="merchant-payment";function Ue(n){return `zippy://${ht}/${n}`}function Oe(n,e=4,t="H",i=2){let r=Be(0,t);return r.addData(n),r.make(),r.createSvgTag(e,i)}function Fe(n,e=4,t="H"){return Oe(Ue(n),e,t)}function $e(n,e=4){return He(Fe(n,e,"H"))}function me(n,e=4){return `<div class="zippy-qr-stack">${$e(n,e)}</div>`}function qe(n){return n.phase==="PAYING"&&n.paymentExpiryAt?n.paymentExpiryAt:null}var yt=["qr-active","awaiting","manual-confirm"],ft=["loading","choose-method","success","expired","cancelled","declined","failed","invalid-session","error"];function he(n,e){return !n?.paymentExpiryAt||ft.includes(e)||F.includes(n.status)||H(n.paymentExpiryAt)<=0?false:qe(n)?true:yt.includes(e)}function V(n){if(!n.paymentExpiryAt)return null;let e=n.paymentExpiryAt,t=new Date(e).getTime(),i=n.paymentStartAt?new Date(n.paymentStartAt).getTime():t-300*1e3,r=t-i;return r<=0?0:Math.min(1,Math.max(0,H(e)/r))}function gt(n){return n.phase==="IDLE"&&n.expiresAt?n.expiresAt:null}function H(n){return Math.max(0,new Date(n).getTime()-Date.now())}var K=class{constructor(e,t,i,r=""){this.expiryTimer=null;this.terminalExitTimer=null;this.callbacks=i,this.state=t,this.shadow=e.attachShadow({mode:"open"});let a=document.createElement("style");a.textContent=Ae+r,this.shadow.appendChild(a),this.root=document.createElement("div"),this.root.className="zippy-root",this.root.setAttribute("role","region"),this.root.setAttribute("aria-label","Zippy Pay checkout"),this.shadow.appendChild(this.root),this.render();}update(e){let t={...this.state,...e};if(this.shouldSkipRender(this.state,t)){this.state=t;return}this.state=t,this.render();}shouldSkipRender(e,t){return this.renderSnapshot(e)===this.renderSnapshot(t)}renderSnapshot(e){let t=e.session;return JSON.stringify({phase:e.phase,sessionId:e.sessionId,committedMethod:e.committedMethod,paymentId:e.paymentId,errorMessage:e.errorMessage,loading:e.loading,mode:e.mode,exitMode:e.exitMode??null,verifiedPayer:e.verifiedPayer,session:t?{status:t.status,phase:t.phase,amount:t.amount,currency:t.currency,businessName:t.businessName,paymentExpiryAt:t.paymentExpiryAt,paymentStartAt:t.paymentStartAt,payer:t.payer,transactionStatus:t.transactionStatus,checkoutMethod:t.checkoutMethod,expiresAt:t.expiresAt,transactionId:t.transactionId}:null})}restoreFocusState(){let e=this.shadow.activeElement;return e instanceof HTMLInputElement&&e.id?{id:e.id,selection:e.selectionStart}:{id:null,selection:null}}applyFocusState(e){if(!e.id)return;let t=this.shadow.getElementById(e.id);t instanceof HTMLInputElement&&(t.focus(),e.selection!==null&&t.setSelectionRange(e.selection,e.selection));}destroy(){this.clearExpiryTimer(),this.clearTerminalExitTimer();}getShadowRoot(){return this.shadow}render(){let e=this.restoreFocusState();this.clearExpiryTimer(),this.clearTerminalExitTimer();let{phase:t,session:i,errorMessage:r,loading:a,verifiedPayer:s,paymentId:o,sessionId:l,committedMethod:g,exitMode:y,mode:f}=this.state,h=t==="success"||t==="expired"||t==="cancelled"||t==="declined"||t==="failed"||t==="invalid-session"||t==="error",w=!h&&he(i,t),T=t==="qr-active"||t==="awaiting"&&g==="qr";this.root.className=w?T?"zippy-root zippy-root--paying zippy-root--qr":"zippy-root zippy-root--paying":h?"zippy-root zippy-root--terminal":"zippy-root",this.root.innerHTML="";let E=h?this.root:document.createElement("div");if(h||(E.className="zippy-root-body",this.root.appendChild(E)),t==="loading"){if(E.appendChild(this.renderLoading()),E.appendChild(this.renderBrandFooter()),w){let A=i?V(i):null;A!==null&&A>0&&this.root.appendChild(this.renderPayProgress());}this.applyFocusState(e);return}switch(i&&!h&&E.appendChild(this.renderPaymentHero(i,this.heroSubtitle(t,i))),w&&t!=="qr-active"&&i?.paymentExpiryAt&&H(i.paymentExpiryAt)>0&&E.appendChild(this.renderPayTimer(i.paymentExpiryAt)),t){case "choose-method":E.appendChild(this.renderChooseMethod());break;case "qr-active":E.appendChild(this.renderQrActive(l,i));break;case "manual-entry":case "manual-confirm":E.appendChild(this.renderManualFlow(o,s,r,a));break;case "awaiting":E.appendChild(this.renderAwaiting(i,g??"qr",s));break;case "success":case "expired":case "cancelled":case "declined":case "failed":case "invalid-session":E.appendChild(this.renderOutcomeScreen(t,i,y,f)),this.mountTerminalExitTimer();break;case "error":E.appendChild(this.renderTerminal("error","Something went wrong",r??"Please try again or contact the merchant."));break;}if(h?this.root.appendChild(this.renderBrandFooter()):E.appendChild(this.renderBrandFooter()),w){let A=i?V(i):null;A!==null&&A>0&&this.root.appendChild(this.renderPayProgress());}this.applyFocusState(e);}heroSubtitle(e,t){switch(e){case "choose-method":return "Choose how to pay";case "qr-active":return t?.status==="AWAITING_PAYMENT"?"Waiting for confirmation":"Scan with the Zippy app";case "manual-entry":return "Pay with your Zippy ID";case "manual-confirm":return "Review and confirm";case "awaiting":return "Waiting for confirmation";default:return ""}}renderPaymentHero(e,t){let i=document.createElement("div");i.className="zippy-payment-hero";let r=document.createElement("p");r.className="zippy-payment-merchant",r.textContent=e.businessName;let a=document.createElement("p");if(a.className="zippy-payment-amount",a.textContent=se(e.amount,e.currency),i.appendChild(r),i.appendChild(a),t){let s=document.createElement("p");s.className="zippy-payment-subtitle",s.textContent=t,i.appendChild(s);}return i}renderBrandFooter(){let e=document.createElement("div");e.className="zippy-brand-footer",e.setAttribute("aria-label","Secured by Zippy");let t=document.createElement("div");t.className="zippy-brand-footer-inner";let i=document.createElement("span");i.className="zippy-brand-secure",i.innerHTML=`${Ze()}<span class="zippy-brand-copy">Secured by</span>`;let r=document.createElement("span");r.className="zippy-brand-divider",r.setAttribute("aria-hidden","true");let a=document.createElement("span");return a.className="zippy-brand-name",a.textContent="Zippy",t.appendChild(i),t.appendChild(r),t.appendChild(a),e.appendChild(t),e}renderLoading(){let e=document.createElement("div");e.className="zippy-status";let t=document.createElement("div");t.className="zippy-status-icon loading";let i=document.createElement("div");i.className="zippy-spinner",t.appendChild(i);let r=document.createElement("p");return r.className="zippy-status-title",r.textContent="Loading checkout\u2026",e.appendChild(t),e.appendChild(r),e}renderChooseMethod(){let e=document.createElement("div");e.className="zippy-choose";let t=document.createElement("div");return t.className="zippy-choose-options",t.appendChild(this.renderMethodCard({method:"qr",title:"QR code",description:"Open Zippy and scan",icon:this.qrIconSvg()})),t.appendChild(this.renderMethodCard({method:"manual",title:"Zippy ID",description:"Enter your handle",icon:this.idIconSvg()})),e.appendChild(t),e}renderMethodCard(e){let t=document.createElement("button");t.type="button",t.className=`zippy-method-card zippy-method-card--${e.method}`,t.setAttribute("aria-label",e.method==="qr"?"Pay by scanning a QR code in the Zippy app":"Pay with your Zippy ID");let i=document.createElement("span");i.className="zippy-method-icon",i.innerHTML=e.icon;let r=document.createElement("span");r.className="zippy-method-copy";let a=document.createElement("span");a.className="zippy-method-title",a.textContent=e.title;let s=document.createElement("span");return s.className="zippy-method-hint",s.textContent=e.description,r.appendChild(a),r.appendChild(s),t.appendChild(i),t.appendChild(r),t.addEventListener("click",()=>this.callbacks.onChooseMethod(e.method)),t}renderQrActive(e,t){let i=document.createElement("div");i.className="zippy-flow";let r=t?.status==="AWAITING_PAYMENT",a=document.createElement("div");a.className="zippy-qr-section";let s=document.createElement("div");return s.className="zippy-qr-frame",s.innerHTML=me(e),a.appendChild(s),t?.paymentExpiryAt&&H(t.paymentExpiryAt)>0&&a.appendChild(this.renderPayTimer(t.paymentExpiryAt)),r&&a.appendChild(this.renderQrAwaitingLoader()),i.appendChild(a),r?(t?.payer&&i.appendChild(this.renderIdentityCard(t.payer)),i.appendChild(this.renderFootnote("Complete the payment in the Zippy app to finish checkout."))):(i.appendChild(this.renderStepGuide(["Open Zippy Pay on your phone","Tap Scan and point at the code","Confirm the amount shown"])),i.appendChild(this.renderFootnote("Keep this page open until payment completes."))),i}renderQrAwaitingLoader(){let e=document.createElement("div");e.className="zippy-qr-awaiting",e.setAttribute("aria-live","polite"),e.setAttribute("aria-label","Waiting for payment confirmation");let t=document.createElement("span");return t.className="zippy-qr-awaiting-spinner",t.setAttribute("aria-hidden","true"),e.appendChild(t),e}renderPayTimer(e){let t=document.createElement("div");t.className="zippy-pay-timer-slot";let i=document.createElement("div");i.className="zippy-pay-timer";let r=document.createElement("span");r.className="zippy-pay-timer-value",r.setAttribute("aria-live","polite"),r.textContent=pe(H(e));let a=document.createElement("span");return a.className="zippy-pay-timer-label",a.textContent="To pay",i.appendChild(r),i.appendChild(a),t.appendChild(i),t}renderManualFlow(e,t,i,r){let a=document.createElement("div");a.className="zippy-flow";let s=document.createElement("form");s.className="zippy-id-form",s.addEventListener("submit",T=>{T.preventDefault();});let o=document.createElement("div");o.className="zippy-input-combo";let l=document.createElement("input");l.id="zippy-payment-id",l.className="zippy-input-combo-field",l.type="text",l.placeholder="your.zippy.id",l.autocomplete="off",l.spellcheck=false,l.inputMode="text",l.value=e,l.disabled=r,l.setAttribute("aria-label","Zippy payment ID");let g=document.createElement("span");g.className="zippy-input-combo-divider",g.setAttribute("aria-hidden","true");let y=document.createElement("button");y.type="button",y.className="zippy-input-combo-action",y.textContent="Verify",y.setAttribute("aria-label","Verify Zippy ID");let f=document.createElement("button");f.type="button",f.className="zippy-btn zippy-btn-primary zippy-btn-block",f.textContent=r&&t?"Processing\u2026":"Proceed";let h=T=>!!(t&&t.paymentId===T.trim().toLowerCase()),w=()=>{let T=l.value.trim(),E=h(l.value),M=r&&!E;o.classList.toggle("zippy-input-combo--verified",E),y.disabled=r||T.length===0||E,y.classList.toggle("zippy-input-combo-action--loading",M);let A=y.querySelector(".zippy-spinner-inline");if(M){if(y.textContent="",!A){let I=document.createElement("span");I.className="zippy-spinner-inline",I.setAttribute("aria-hidden","true"),y.appendChild(I);}y.setAttribute("aria-label","Verifying Zippy ID");}else A?.remove(),y.classList.remove("zippy-input-combo-action--verified"),E?(y.textContent="",y.classList.add("zippy-input-combo-action--verified"),y.innerHTML=xt(),y.setAttribute("aria-label","Zippy ID verified")):(y.textContent="Verify",y.setAttribute("aria-label","Verify Zippy ID"));f.disabled=r||!E;};return y.addEventListener("click",()=>{this.callbacks.onVerify(l.value);}),f.addEventListener("click",()=>{t&&this.callbacks.onPay(e||t.paymentId);}),l.addEventListener("input",()=>{this.state.paymentId=l.value,this.callbacks.onPaymentIdChange?.(l.value),w();}),w(),i&&o.classList.add("zippy-input-combo--error"),o.appendChild(l),o.appendChild(g),o.appendChild(y),s.appendChild(o),i&&s.appendChild(this.renderFieldError(i)),t&&h(e)&&s.appendChild(this.renderIdentityCard(t)),s.appendChild(f),a.appendChild(s),a}renderFieldError(e){let t=document.createElement("p");t.className="zippy-field-error",t.setAttribute("role","alert");let i=document.createElement("span");i.className="zippy-field-error-icon",i.setAttribute("aria-hidden","true"),i.textContent="!";let r=document.createElement("span");return r.textContent=e,t.appendChild(i),t.appendChild(r),t}renderIdentityCard(e){let t=document.createElement("div");t.className="zippy-identity-card";let i=this.renderIdentityAvatar(e),r=document.createElement("div");r.className="zippy-identity-copy";let a=document.createElement("p");a.className="zippy-identity-label",a.textContent="Paying as";let s=document.createElement("p");s.className="zippy-identity-name",s.textContent=e.displayName;let o=document.createElement("p");return o.className="zippy-identity-handle",o.textContent=e.paymentId,r.appendChild(a),r.appendChild(s),r.appendChild(o),t.appendChild(i),t.appendChild(r),t}renderIdentityAvatar(e){let t=document.createElement("div");t.className="zippy-identity-avatar";let i=ze(e.displayName),r=e.profileImage?.trim();if(r){t.classList.add("zippy-identity-avatar--photo");let a=document.createElement("img");a.className="zippy-identity-avatar-image",a.src=r,a.alt="",a.addEventListener("error",()=>{t.classList.remove("zippy-identity-avatar--photo"),a.remove(),t.textContent=i;}),t.appendChild(a);}else t.textContent=i;return t}renderAwaiting(e,t,i){let r=document.createElement("div");r.className="zippy-flow zippy-flow-awaiting";let a=document.createElement("div");a.className="zippy-awaiting-status",a.innerHTML='<div class="zippy-awaiting-ring" aria-hidden="true"><span></span></div>',r.appendChild(a);let s=e?.payer??i??null;s&&r.appendChild(this.renderIdentityCard(s));let o=document.createElement("p");return o.className="zippy-awaiting-message",o.textContent=t==="qr"?"Complete the payment in the Zippy app to finish checkout.":"Tap the notification in Zippy Pay to approve this payment.",r.appendChild(o),r.appendChild(this.renderFootnote("Do not close or refresh this page.")),r}renderStepGuide(e){let t=document.createElement("div");return t.className="zippy-step-guide",e.forEach((i,r)=>{let a=document.createElement("div");a.className="zippy-step-guide-item";let s=document.createElement("span");s.className="zippy-step-guide-num",s.textContent=String(r+1);let o=document.createElement("span");o.className="zippy-step-guide-text",o.textContent=i,a.appendChild(s),a.appendChild(o),t.appendChild(a);}),t}renderPayProgress(){let e=document.createElement("div");e.className="zippy-pay-progress",e.setAttribute("role","progressbar"),e.setAttribute("aria-label","Payment time remaining"),e.setAttribute("aria-valuemin","0"),e.setAttribute("aria-valuemax","100");let t=document.createElement("div");return t.className="zippy-pay-progress-fill",e.appendChild(t),this.mountPayProgress(t,e),e}mountPayProgress(e,t){let i=()=>{let r=this.state.session;if(!r)return;let a=V(r);if(a===null||a<=0){t.style.display="none",t.setAttribute("aria-valuenow","0"),this.clearExpiryTimer();return}t.style.display="";let s=Math.round(a*100);e.style.transform=`scaleX(${a})`,t.setAttribute("aria-valuenow",String(s));let o=this.shadow.querySelector(".zippy-pay-timer-value");o instanceof HTMLElement&&r.paymentExpiryAt&&(o.textContent=pe(H(r.paymentExpiryAt)));};i(),this.expiryTimer=setInterval(i,1e3);}clearExpiryTimer(){this.expiryTimer!==null&&(clearInterval(this.expiryTimer),this.expiryTimer=null);}mountTerminalExitTimer(){this.clearTerminalExitTimer();let e=ae,t=()=>{let i=this.shadow.querySelector(".zippy-status-exit-countdown");i instanceof HTMLElement&&(i.textContent=String(e));};t(),this.terminalExitTimer=setInterval(()=>{if(e-=1,e<=0){this.clearTerminalExitTimer(),this.callbacks.onTerminalExit?.();return}t();},1e3);}clearTerminalExitTimer(){this.terminalExitTimer!==null&&(clearInterval(this.terminalExitTimer),this.terminalExitTimer=null);}renderFootnote(e){let t=document.createElement("p");return t.className="zippy-footnote",t.textContent=e,t}renderOutcomeScreen(e,t,i,r){let a=Pe(e);return this.renderOutcomeStatus(a.kind,a.title,a.detail,a.kind,i,r,t?.transactionId??null)}renderOutcomeStatus(e,t,i,r,a,s,o){let l=this.renderTerminal(e,t,i);o&&l.appendChild(this.renderTransactionReference(o));let g=a??"close",y=document.createElement("p");y.className="zippy-status-exit";let f=document.createElement("span");f.className="zippy-status-exit-lead",f.textContent=Ee(g,s,r);let h=document.createElement("span");h.className="zippy-status-exit-countdown",h.textContent=String(ae);let w=document.createElement("span");return w.className="zippy-status-exit-suffix",w.textContent=" seconds\u2026",y.appendChild(f),y.appendChild(document.createTextNode(" ")),y.appendChild(h),y.appendChild(w),l.appendChild(y),l}renderTransactionReference(e){let t=document.createElement("div");t.className="zippy-transaction-ref";let i=document.createElement("p");i.className="zippy-transaction-ref-label",i.textContent="Transaction ID";let r=document.createElement("p");return r.className="zippy-transaction-ref-value",r.textContent=e,t.appendChild(i),t.appendChild(r),t}renderTerminal(e,t,i){let r=document.createElement("div");r.className="zippy-status";let a=document.createElement("div");a.className=`zippy-status-icon ${e}`,a.innerHTML=e==="success"?'<svg width="28" height="28" viewBox="0 0 28 28" fill="none" aria-hidden="true"><path d="M7 14.5l4.5 4.5L21 9.5" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round"/></svg>':'<svg width="28" height="28" viewBox="0 0 28 28" fill="none" aria-hidden="true"><path d="M10 10l8 8M18 10l-8 8" stroke="currentColor" stroke-width="2.25" stroke-linecap="round"/></svg>';let s=document.createElement("p");s.className="zippy-status-title",s.textContent=t;let o=document.createElement("p");return o.className="zippy-status-detail",o.textContent=i,r.appendChild(a),r.appendChild(s),r.appendChild(o),r}qrIconSvg(){return `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1733
|
+
`;function ut(n){if((n.mode??"inline")==="modal")return Zt(n);if(!n.container)throw new Error('Zippy Pay: `container` is required when mode is "inline".');let t=at(n.container);t.innerHTML="";let i=document.createElement("div");return i.className="zippy-inline-host",t.appendChild(i),{host:i,overlay:null,escapeHandler:null,destroy:()=>{i.remove();}}}function Zt(n){let e=document.createElement("div");e.className="zippy-overlay",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),e.setAttribute("aria-label","Zippy Pay checkout"),e.style.display="none";let t=document.createElement("style");t.textContent=dt,e.appendChild(t);let i=document.createElement("div");i.className="zippy-modal-panel";let r=document.createElement("div");r.className="zippy-modal-host",i.appendChild(r),e.appendChild(i),document.body.appendChild(e),(n.closeOnBackdropClick??false)&&e.addEventListener("click",s=>{s.target===e&&n.onClose?.();});let o={host:r,overlay:e,escapeHandler:null,destroy:()=>{o.escapeHandler&&document.removeEventListener("keydown",o.escapeHandler),e.remove(),document.body.style.overflow="";}};return o}function ht(n,e,t){if(!n.overlay)return;n.overlay.style.display="flex",document.body.style.overflow="hidden",(e.closeOnEscape??false)&&!n.escapeHandler&&(n.escapeHandler=a=>{a.key==="Escape"&&t();},document.addEventListener("keydown",n.escapeHandler)),n.host.querySelector("input, button")?.focus();}function mt(n){n.overlay&&(n.overlay.style.display="none",document.body.style.overflow="",n.escapeHandler&&(document.removeEventListener("keydown",n.escapeHandler),n.escapeHandler=null));}var K=class{constructor(e,t){this.fetchSession=e;this.options=t;this.timer=null;this.running=false;this.stopped=false;}start(e){if(!this.running){if(this.running=true,this.stopped=false,e&&(this.options.onUpdate(e),!this.shouldContinue(e))){this.stop();return}this.tick();}}stop(){this.stopped=true,this.running=false,this.timer!==null&&(clearTimeout(this.timer),this.timer=null);}shouldContinue(e){return this.options.shouldPoll?this.options.shouldPoll(e):xe.includes(e.status)}intervalMs(){let e=this.options.intervalMs??3e3,t=this.options.hiddenIntervalMs??1e4;return typeof document<"u"&&document.hidden?t:e}scheduleNext(){this.stopped||(this.timer=setTimeout(()=>{this.tick();},this.intervalMs()));}async tick(){if(!this.stopped){try{let e=await this.fetchSession();if(this.options.onUpdate(e),!this.shouldContinue(e)){this.stop();return}}catch(e){this.options.onError?.(e);}this.scheduleNext();}}};function ce(n){return Y.includes(n)}function qt(n){switch(n){case "CREATED":return "choose-method";case "AWAITING_PAYMENT":return "awaiting";case "COMPLETED":return "success";case "EXPIRED":return "expired";case "CANCELLED":return "cancelled";case "FAILED":return "failed";default:return "error"}}function yt(n){return n.phase==="PAYING"&&n.paymentExpiryAt?n.paymentExpiryAt:null}var $t=["qr-active","mobile-app-active","awaiting","manual-confirm"],Qt=["loading","choose-method","manual-entry","manual-picker","success","expired","cancelled","declined","failed","invalid-session","error"];function Ne(n,e){return !n?.paymentExpiryAt||Qt.includes(e)||Y.includes(n.status)||_(n.paymentExpiryAt)<=0?false:yt(n)?true:$t.includes(e)}function X(n){if(!n.paymentExpiryAt)return null;let e=n.paymentExpiryAt,t=new Date(e).getTime(),i=n.paymentStartAt?new Date(n.paymentStartAt).getTime():t-300*1e3,r=t-i;return r<=0?0:Math.min(1,Math.max(0,_(e)/r))}function Wt(n){return n.phase==="IDLE"&&n.expiresAt?n.expiresAt:null}function _(n){return Math.max(0,new Date(n).getTime()-Date.now())}function Yt(){return B()==="phone"}function ft(){if(typeof navigator>"u")return "android";let n=navigator.userAgent??"";return /iPad|iPhone|iPod/.test(n)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1?"ios":"android"}function Be(){return typeof navigator>"u"?false:/Android/i.test(navigator.userAgent??"")}function B(){if(typeof window>"u")return "desktop";let n=window.matchMedia("(max-width: 520px)").matches,e=window.matchMedia("(pointer: coarse)").matches;return n&&e?"phone":"desktop"}function Oe(n){if(typeof window>"u")return ()=>{};let e=[window.matchMedia("(max-width: 520px)"),window.matchMedia("(pointer: coarse)")],t=()=>{n(B());};for(let i of e)i.addEventListener("change",t);return window.addEventListener("orientationchange",t),window.addEventListener("resize",t),()=>{for(let i of e)i.removeEventListener("change",t);window.removeEventListener("orientationchange",t),window.removeEventListener("resize",t);}}function q(n){return n.checkoutPolicy!=null||n.mobileAppPolicy!=null}function jt(n){return n==null}function de(n){return n==null||n==="QR"}function _e(n){return n==null||n==="MANUAL"}function ue(n,e){return e==="ENFORCE"&&(n==null||n==="QR"||n==="MANUAL")}function gt(n){return n?.policy==="enforce"?"ENFORCE":n?.policy==="option"?"OPTION":"OFF"}function he(n){let e={};(n.checkoutPolicy==="QR"||n.checkoutPolicy==="MANUAL")&&(e.checkoutPolicy=n.checkoutPolicy);let t=gt(n.mobileApp);return t!=="OFF"&&(e.mobileAppPolicy=t),e}function bt(n){return {qr:de(n),manual:_e(n)}}function vt(n,e,t){if(t==="desktop")return {qr:de(n),manual:_e(n),mobileApp:false};let i=ue(n,e);return {qr:de(n)&&!i,manual:_e(n)&&!i,mobileApp:i||e==="OPTION"&&(n==null||n==="QR"||n==="MANUAL")}}function ee(n,e,t){return t==="desktop"?n==="MANUAL"?"auto-manual":n==="QR"?"auto-qr":"chooser":ue(n,e)?"enforce-mobile-app":n==="MANUAL"&&e==="OFF"?"auto-manual":n==="QR"&&e==="OFF"?"auto-qr":"chooser"}function J(n,e,t,i){return i==="MOBILE_APP"?t==="desktop"||e==="OFF"?false:ue(n,e)?true:e==="OPTION"?n==null||n==="QR"||n==="MANUAL":false:!(!de(n)||t==="phone"&&ue(n,e))}function Re(n,e,t){let i=ee(n,e,t);return i==="enforce-mobile-app"?J(n,e,t,"MOBILE_APP")?"MOBILE_APP":null:i==="auto-qr"&&J(n,e,t,"QR")?"QR":null}function te(n,e,t=B()){return {checkoutPolicy:n,mobileAppPolicy:e,surface:t,methodAvailability:vt(n,e,t),allowManualBack:n==null}}function He(n,e=B()){if(!q(n))throw new Error("Checkout policy is not bound on the payment session.");return te(n.checkoutPolicy,n.mobileAppPolicy??"OFF",e)}function Ue(n,e,t=B()){let i=he({checkoutPolicy:n,mobileApp:e});return te(i.checkoutPolicy??null,i.mobileAppPolicy??"OFF",t)}var ie="com.zippy.pay",xt="https://apps.apple.com/in/app/zippypay/id6806799311",ne={ios:xt,android:`https://play.google.com/store/apps/details?id=${ie}`},wt=`itms-apps://${xt.replace(/^https:\/\//,"")}`,Pt=`market://details?id=${ie}`;function Vt(n){return ne[n]}function De(n){return n==="ios"?wt:Pt}function Fe(n="zippy-app-link-icon"){return `<svg class="${n}" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M16.823 12.345c-.027-2.702 2.208-3.997 2.307-4.059-1.255-1.836-3.211-2.088-3.905-2.118-1.663-.169-3.246.98-4.089.98-.844 0-2.147-.955-3.531-.929-1.818.027-3.493 1.056-4.429 2.683-1.888 3.276-.483 8.131 1.356 10.791.899 1.299 1.968 2.759 3.374 2.707 1.355-.054 1.866-.877 3.504-.877 1.637 0 2.099.877 3.527.85 1.457-.027 2.381-1.32 3.276-2.622.99-1.449 1.396-2.851 1.419-2.922-.031-.014-2.724-1.045-2.751-4.146zM14.303 4.772c.747-.907 1.249-2.164 1.111-3.422-1.075.043-2.375.717-3.147 1.623-.693.802-1.299 2.095-1.136 3.333 1.201.093 2.432-.61 3.172-1.534z"/></svg>`}function Ze(n="zippy-app-link-icon"){return `<svg class="${n} zippy-app-link-icon--play" viewBox="0 0 256 283" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path fill="#EA4335" d="M119.553 134.916 1.06 259.061c2.696 9.556 9.658 17.33 18.861 21.059 9.202 3.73 19.612 2.996 28.201-1.987l133.327-75.935-61.896-67.282z"/><path fill="#FBBC04" d="M239.371 113.814 181.714 80.791 116.816 137.742l65.162 64.279 57.216-32.669c10.332-5.409 16.806-16.107 16.806-27.769 0-11.662-6.474-22.36-16.806-27.769h.177z"/><path fill="#4285F4" d="M1.06 23.487C.344 26.135-.013 28.867 0 31.61v219.327c.008 2.742.364 5.472 1.06 8.124L123.615 138.095 1.06 23.487z"/><path fill="#34A853" d="M120.436 141.274 181.714 80.791 48.563 4.503C43.554 1.569 37.857.016 32.052 0 17.644-.028 4.978 9.534 1.06 23.399l119.376 117.875z"/></svg>`}function kt(){return Fe("zippy-app-link-icon")}function zt(){return Ze("zippy-app-link-icon")}var Q=function(n,e){let r=n,a=re[e],o=null,s=0,p=null,d=[],g={},f=function(c,y){s=r*4+17,o=(function(l){let h=new Array(l);for(let u=0;u<l;u+=1){h[u]=new Array(l);for(let b=0;b<l;b+=1)h[u][b]=null;}return h})(s),m(0,0),m(s-7,0),m(0,s-7),P(),S(),N(c,y),r>=7&&z(c),p==null&&(p=W(r,a,d)),T(p,y);},m=function(c,y){for(let l=-1;l<=7;l+=1)if(!(c+l<=-1||s<=c+l))for(let h=-1;h<=7;h+=1)y+h<=-1||s<=y+h||(0<=l&&l<=6&&(h==0||h==6)||0<=h&&h<=6&&(l==0||l==6)||2<=l&&l<=4&&2<=h&&h<=4?o[c+l][y+h]=true:o[c+l][y+h]=false);},w=function(){let c=0,y=0;for(let l=0;l<8;l+=1){f(true,l);let h=U.getLostPoint(g);(l==0||c>h)&&(c=h,y=l);}return y},S=function(){for(let c=8;c<s-8;c+=1)o[c][6]==null&&(o[c][6]=c%2==0);for(let c=8;c<s-8;c+=1)o[6][c]==null&&(o[6][c]=c%2==0);},P=function(){let c=U.getPatternPosition(r);for(let y=0;y<c.length;y+=1)for(let l=0;l<c.length;l+=1){let h=c[y],u=c[l];if(o[h][u]==null)for(let b=-2;b<=2;b+=1)for(let v=-2;v<=2;v+=1)b==-2||b==2||v==-2||v==2||b==0&&v==0?o[h+b][u+v]=true:o[h+b][u+v]=false;}},z=function(c){let y=U.getBCHTypeNumber(r);for(let l=0;l<18;l+=1){let h=!c&&(y>>l&1)==1;o[Math.floor(l/3)][l%3+s-8-3]=h;}for(let l=0;l<18;l+=1){let h=!c&&(y>>l&1)==1;o[l%3+s-8-3][Math.floor(l/3)]=h;}},N=function(c,y){let l=a<<3|y,h=U.getBCHTypeInfo(l);for(let u=0;u<15;u+=1){let b=!c&&(h>>u&1)==1;u<6?o[u][8]=b:u<8?o[u+1][8]=b:o[s-15+u][8]=b;}for(let u=0;u<15;u+=1){let b=!c&&(h>>u&1)==1;u<8?o[8][s-u-1]=b:u<9?o[8][15-u-1+1]=b:o[8][15-u-1]=b;}o[s-8][8]=!c;},T=function(c,y){let l=-1,h=s-1,u=7,b=0,v=U.getMaskFunction(y);for(let k=s-1;k>0;k-=2)for(k==6&&(k-=1);;){for(let E=0;E<2;E+=1)if(o[h][k-E]==null){let A=false;b<c.length&&(A=(c[b]>>>u&1)==1),v(h,k-E)&&(A=!A),o[h][k-E]=A,u-=1,u==-1&&(b+=1,u=7);}if(h+=l,h<0||s<=h){h-=l,l=-l;break}}},M=function(c,y){let l=0,h=0,u=0,b=new Array(y.length),v=new Array(y.length);for(let x=0;x<y.length;x+=1){let C=y[x].dataCount,O=y[x].totalCount-C;h=Math.max(h,C),u=Math.max(u,O),b[x]=new Array(C);for(let R=0;R<b[x].length;R+=1)b[x][R]=255&c.getBuffer()[R+l];l+=C;let ve=U.getErrorCorrectPolynomial(O),Ke=oe(b[x],ve.getLength()-1).mod(ve);v[x]=new Array(ve.getLength()-1);for(let R=0;R<v[x].length;R+=1){let Xe=R+Ke.getLength()-v[x].length;v[x][R]=Xe>=0?Ke.getAt(Xe):0;}}let k=0;for(let x=0;x<y.length;x+=1)k+=y[x].totalCount;let E=new Array(k),A=0;for(let x=0;x<h;x+=1)for(let C=0;C<y.length;C+=1)x<b[C].length&&(E[A]=b[C][x],A+=1);for(let x=0;x<u;x+=1)for(let C=0;C<y.length;C+=1)x<v[C].length&&(E[A]=v[C][x],A+=1);return E},W=function(c,y,l){let h=Et.getRSBlocks(c,y),u=Ct();for(let v=0;v<l.length;v+=1){let k=l[v];u.put(k.getMode(),4),u.put(k.getLength(),U.getLengthInBits(k.getMode(),c)),k.write(u);}let b=0;for(let v=0;v<h.length;v+=1)b+=h[v].dataCount;if(u.getLengthInBits()>b*8)throw "code length overflow. ("+u.getLengthInBits()+">"+b*8+")";for(u.getLengthInBits()+4<=b*8&&u.put(0,4);u.getLengthInBits()%8!=0;)u.putBit(false);for(;!(u.getLengthInBits()>=b*8||(u.put(236,8),u.getLengthInBits()>=b*8));)u.put(17,8);return M(u,h)};g.addData=function(c,y){y=y||"Byte";let l=null;switch(y){case "Numeric":l=Gt(c);break;case "Alphanumeric":l=Kt(c);break;case "Byte":l=Xt(c);break;case "Kanji":l=Jt(c);break;default:throw "mode:"+y}d.push(l),p=null;},g.isDark=function(c,y){if(c<0||s<=c||y<0||s<=y)throw c+","+y;return o[c][y]},g.getModuleCount=function(){return s},g.make=function(){if(r<1){let c=1;for(;c<40;c++){let y=Et.getRSBlocks(c,a),l=Ct();for(let u=0;u<d.length;u++){let b=d[u];l.put(b.getMode(),4),l.put(b.getLength(),U.getLengthInBits(b.getMode(),c)),b.write(l);}let h=0;for(let u=0;u<y.length;u++)h+=y[u].dataCount;if(l.getLengthInBits()<=h*8)break}r=c;}f(false,w());},g.createTableTag=function(c,y){c=c||2,y=typeof y>"u"?c*4:y;let l="";l+='<table style="',l+=" border-width: 0px; border-style: none;",l+=" border-collapse: collapse;",l+=" padding: 0px; margin: "+y+"px;",l+='">',l+="<tbody>";for(let h=0;h<g.getModuleCount();h+=1){l+="<tr>";for(let u=0;u<g.getModuleCount();u+=1)l+='<td style="',l+=" border-width: 0px; border-style: none;",l+=" border-collapse: collapse;",l+=" padding: 0px; margin: 0px;",l+=" width: "+c+"px;",l+=" height: "+c+"px;",l+=" background-color: ",l+=g.isDark(h,u)?"#000000":"#ffffff",l+=";",l+='"/>';l+="</tr>";}return l+="</tbody>",l+="</table>",l},g.createSvgTag=function(c,y,l,h){let u={};typeof arguments[0]=="object"&&(u=arguments[0],c=u.cellSize,y=u.margin,l=u.alt,h=u.title),c=c||2,y=typeof y>"u"?c*4:y,l=typeof l=="string"?{text:l}:l||{},l.text=l.text||null,l.id=l.text?l.id||"qrcode-description":null,h=typeof h=="string"?{text:h}:h||{},h.text=h.text||null,h.id=h.text?h.id||"qrcode-title":null;let b=g.getModuleCount()*c+y*2,v,k,E,A,x="",C;for(C="l"+c+",0 0,"+c+" -"+c+",0 0,-"+c+"z ",x+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',x+=u.scalable?"":' width="'+b+'px" height="'+b+'px"',x+=' viewBox="0 0 '+b+" "+b+'" ',x+=' preserveAspectRatio="xMinYMin meet"',x+=h.text||l.text?' role="img" aria-labelledby="'+F([h.id,l.id].join(" ").trim())+'"':"",x+=">",x+=h.text?'<title id="'+F(h.id)+'">'+F(h.text)+"</title>":"",x+=l.text?'<description id="'+F(l.id)+'">'+F(l.text)+"</description>":"",x+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',x+='<path d="',E=0;E<g.getModuleCount();E+=1)for(A=E*c+y,v=0;v<g.getModuleCount();v+=1)g.isDark(E,v)&&(k=v*c+y,x+="M"+k+","+A+C);return x+='" stroke="transparent" fill="black"/>',x+="</svg>",x},g.createDataURL=function(c,y){c=c||2,y=typeof y>"u"?c*4:y;let l=g.getModuleCount()*c+y*2,h=y,u=l-y;return ni(l,l,function(b,v){if(h<=b&&b<u&&h<=v&&v<u){let k=Math.floor((b-h)/c),E=Math.floor((v-h)/c);return g.isDark(E,k)?0:1}else return 1})},g.createImgTag=function(c,y,l){c=c||2,y=typeof y>"u"?c*4:y;let h=g.getModuleCount()*c+y*2,u="";return u+="<img",u+=' src="',u+=g.createDataURL(c,y),u+='"',u+=' width="',u+=h,u+='"',u+=' height="',u+=h,u+='"',l&&(u+=' alt="',u+=F(l),u+='"'),u+="/>",u};let F=function(c){let y="";for(let l=0;l<c.length;l+=1){let h=c.charAt(l);switch(h){case "<":y+="<";break;case ">":y+=">";break;case "&":y+="&";break;case '"':y+=""";break;default:y+=h;break}}return y},Z=function(c){c=typeof c>"u"?2:c;let l=g.getModuleCount()*1+c*2,h=c,u=l-c,b,v,k,E,A,x={"\u2588\u2588":"\u2588","\u2588 ":"\u2580"," \u2588":"\u2584"," ":" "},C={"\u2588\u2588":"\u2580","\u2588 ":"\u2580"," \u2588":" "," ":" "},O="";for(b=0;b<l;b+=2){for(k=Math.floor((b-h)/1),E=Math.floor((b+1-h)/1),v=0;v<l;v+=1)A="\u2588",h<=v&&v<u&&h<=b&&b<u&&g.isDark(k,Math.floor((v-h)/1))&&(A=" "),h<=v&&v<u&&h<=b+1&&b+1<u&&g.isDark(E,Math.floor((v-h)/1))?A+=" ":A+="\u2588",O+=c<1&&b+1>=u?C[A]:x[A];O+=`
|
|
1734
|
+
`;}return l%2&&c>0?O.substring(0,O.length-l-1)+Array(l+1).join("\u2580"):O.substring(0,O.length-1)};return g.createASCII=function(c,y){if(c=c||1,c<2)return Z(y);c-=1,y=typeof y>"u"?c*2:y;let l=g.getModuleCount()*c+y*2,h=y,u=l-y,b,v,k,E,A=Array(c+1).join("\u2588\u2588"),x=Array(c+1).join(" "),C="",O="";for(b=0;b<l;b+=1){for(k=Math.floor((b-h)/c),O="",v=0;v<l;v+=1)E=1,h<=v&&v<u&&h<=b&&b<u&&g.isDark(k,Math.floor((v-h)/c))&&(E=0),O+=E?A:x;for(k=0;k<c;k+=1)C+=O+`
|
|
1735
|
+
`;}return C.substring(0,C.length-1)},g.renderTo2dContext=function(c,y){y=y||2;let l=g.getModuleCount();for(let h=0;h<l;h++)for(let u=0;u<l;u++)c.fillStyle=g.isDark(h,u)?"black":"white",c.fillRect(u*y,h*y,y,y);},g};Q.stringToBytes=function(n){let e=[];for(let t=0;t<n.length;t+=1){let i=n.charCodeAt(t);e.push(i&255);}return e};Q.createStringToBytes=function(n,e){let t=(function(){let r=ti(n),a=function(){let p=r.read();if(p==-1)throw "eof";return p},o=0,s={};for(;;){let p=r.read();if(p==-1)break;let d=a(),g=a(),f=a(),m=String.fromCharCode(p<<8|d),w=g<<8|f;s[m]=w,o+=1;}if(o!=e)throw o+" != "+e;return s})(),i=63;return function(r){let a=[];for(let o=0;o<r.length;o+=1){let s=r.charCodeAt(o);if(s<128)a.push(s);else {let p=t[r.charAt(o)];typeof p=="number"?(p&255)==p?a.push(p):(a.push(p>>>8),a.push(p&255)):a.push(i);}}return a}};var L={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},re={L:1,M:0,Q:3,H:2},H={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},U=(function(){let n=[[],[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]],e=1335,t=7973,i=21522,r={},a=function(o){let s=0;for(;o!=0;)s+=1,o>>>=1;return s};return r.getBCHTypeInfo=function(o){let s=o<<10;for(;a(s)-a(e)>=0;)s^=e<<a(s)-a(e);return (o<<10|s)^i},r.getBCHTypeNumber=function(o){let s=o<<12;for(;a(s)-a(t)>=0;)s^=t<<a(s)-a(t);return o<<12|s},r.getPatternPosition=function(o){return n[o-1]},r.getMaskFunction=function(o){switch(o){case H.PATTERN000:return function(s,p){return (s+p)%2==0};case H.PATTERN001:return function(s,p){return s%2==0};case H.PATTERN010:return function(s,p){return p%3==0};case H.PATTERN011:return function(s,p){return (s+p)%3==0};case H.PATTERN100:return function(s,p){return (Math.floor(s/2)+Math.floor(p/3))%2==0};case H.PATTERN101:return function(s,p){return s*p%2+s*p%3==0};case H.PATTERN110:return function(s,p){return (s*p%2+s*p%3)%2==0};case H.PATTERN111:return function(s,p){return (s*p%3+(s+p)%2)%2==0};default:throw "bad maskPattern:"+o}},r.getErrorCorrectPolynomial=function(o){let s=oe([1],0);for(let p=0;p<o;p+=1)s=s.multiply(oe([1,D.gexp(p)],0));return s},r.getLengthInBits=function(o,s){if(1<=s&&s<10)switch(o){case L.MODE_NUMBER:return 10;case L.MODE_ALPHA_NUM:return 9;case L.MODE_8BIT_BYTE:return 8;case L.MODE_KANJI:return 8;default:throw "mode:"+o}else if(s<27)switch(o){case L.MODE_NUMBER:return 12;case L.MODE_ALPHA_NUM:return 11;case L.MODE_8BIT_BYTE:return 16;case L.MODE_KANJI:return 10;default:throw "mode:"+o}else if(s<41)switch(o){case L.MODE_NUMBER:return 14;case L.MODE_ALPHA_NUM:return 13;case L.MODE_8BIT_BYTE:return 16;case L.MODE_KANJI:return 12;default:throw "mode:"+o}else throw "type:"+s},r.getLostPoint=function(o){let s=o.getModuleCount(),p=0;for(let f=0;f<s;f+=1)for(let m=0;m<s;m+=1){let w=0,S=o.isDark(f,m);for(let P=-1;P<=1;P+=1)if(!(f+P<0||s<=f+P))for(let z=-1;z<=1;z+=1)m+z<0||s<=m+z||P==0&&z==0||S==o.isDark(f+P,m+z)&&(w+=1);w>5&&(p+=3+w-5);}for(let f=0;f<s-1;f+=1)for(let m=0;m<s-1;m+=1){let w=0;o.isDark(f,m)&&(w+=1),o.isDark(f+1,m)&&(w+=1),o.isDark(f,m+1)&&(w+=1),o.isDark(f+1,m+1)&&(w+=1),(w==0||w==4)&&(p+=3);}for(let f=0;f<s;f+=1)for(let m=0;m<s-6;m+=1)o.isDark(f,m)&&!o.isDark(f,m+1)&&o.isDark(f,m+2)&&o.isDark(f,m+3)&&o.isDark(f,m+4)&&!o.isDark(f,m+5)&&o.isDark(f,m+6)&&(p+=40);for(let f=0;f<s;f+=1)for(let m=0;m<s-6;m+=1)o.isDark(m,f)&&!o.isDark(m+1,f)&&o.isDark(m+2,f)&&o.isDark(m+3,f)&&o.isDark(m+4,f)&&!o.isDark(m+5,f)&&o.isDark(m+6,f)&&(p+=40);let d=0;for(let f=0;f<s;f+=1)for(let m=0;m<s;m+=1)o.isDark(m,f)&&(d+=1);let g=Math.abs(100*d/s/s-50)/5;return p+=g*10,p},r})(),D=(function(){let n=new Array(256),e=new Array(256);for(let i=0;i<8;i+=1)n[i]=1<<i;for(let i=8;i<256;i+=1)n[i]=n[i-4]^n[i-5]^n[i-6]^n[i-8];for(let i=0;i<255;i+=1)e[n[i]]=i;let t={};return t.glog=function(i){if(i<1)throw "glog("+i+")";return e[i]},t.gexp=function(i){for(;i<0;)i+=255;for(;i>=256;)i-=255;return n[i]},t})(),oe=function(n,e){if(typeof n.length>"u")throw n.length+"/"+e;let t=(function(){let r=0;for(;r<n.length&&n[r]==0;)r+=1;let a=new Array(n.length-r+e);for(let o=0;o<n.length-r;o+=1)a[o]=n[o+r];return a})(),i={};return i.getAt=function(r){return t[r]},i.getLength=function(){return t.length},i.multiply=function(r){let a=new Array(i.getLength()+r.getLength()-1);for(let o=0;o<i.getLength();o+=1)for(let s=0;s<r.getLength();s+=1)a[o+s]^=D.gexp(D.glog(i.getAt(o))+D.glog(r.getAt(s)));return oe(a,0)},i.mod=function(r){if(i.getLength()-r.getLength()<0)return i;let a=D.glog(i.getAt(0))-D.glog(r.getAt(0)),o=new Array(i.getLength());for(let s=0;s<i.getLength();s+=1)o[s]=i.getAt(s);for(let s=0;s<r.getLength();s+=1)o[s]^=D.gexp(D.glog(r.getAt(s))+a);return oe(o,0).mod(r)},i},Et=(function(){let n=[[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]],e=function(r,a){let o={};return o.totalCount=r,o.dataCount=a,o},t={},i=function(r,a){switch(a){case re.L:return n[(r-1)*4+0];case re.M:return n[(r-1)*4+1];case re.Q:return n[(r-1)*4+2];case re.H:return n[(r-1)*4+3];default:return}};return t.getRSBlocks=function(r,a){let o=i(r,a);if(typeof o>"u")throw "bad rs block @ typeNumber:"+r+"/errorCorrectionLevel:"+a;let s=o.length/3,p=[];for(let d=0;d<s;d+=1){let g=o[d*3+0],f=o[d*3+1],m=o[d*3+2];for(let w=0;w<g;w+=1)p.push(e(f,m));}return p},t})(),Ct=function(){let n=[],e=0,t={};return t.getBuffer=function(){return n},t.getAt=function(i){let r=Math.floor(i/8);return (n[r]>>>7-i%8&1)==1},t.put=function(i,r){for(let a=0;a<r;a+=1)t.putBit((i>>>r-a-1&1)==1);},t.getLengthInBits=function(){return e},t.putBit=function(i){let r=Math.floor(e/8);n.length<=r&&n.push(0),i&&(n[r]|=128>>>e%8),e+=1;},t},Gt=function(n){let e=L.MODE_NUMBER,t=n,i={};i.getMode=function(){return e},i.getLength=function(o){return t.length},i.write=function(o){let s=t,p=0;for(;p+2<s.length;)o.put(r(s.substring(p,p+3)),10),p+=3;p<s.length&&(s.length-p==1?o.put(r(s.substring(p,p+1)),4):s.length-p==2&&o.put(r(s.substring(p,p+2)),7));};let r=function(o){let s=0;for(let p=0;p<o.length;p+=1)s=s*10+a(o.charAt(p));return s},a=function(o){if("0"<=o&&o<="9")return o.charCodeAt(0)-48;throw "illegal char :"+o};return i},Kt=function(n){let e=L.MODE_ALPHA_NUM,t=n,i={};i.getMode=function(){return e},i.getLength=function(a){return t.length},i.write=function(a){let o=t,s=0;for(;s+1<o.length;)a.put(r(o.charAt(s))*45+r(o.charAt(s+1)),11),s+=2;s<o.length&&a.put(r(o.charAt(s)),6);};let r=function(a){if("0"<=a&&a<="9")return a.charCodeAt(0)-48;if("A"<=a&&a<="Z")return a.charCodeAt(0)-65+10;switch(a){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 :"+a}};return i},Xt=function(n){let e=L.MODE_8BIT_BYTE,i=Q.stringToBytes(n),r={};return r.getMode=function(){return e},r.getLength=function(a){return i.length},r.write=function(a){for(let o=0;o<i.length;o+=1)a.put(i[o],8);},r},Jt=function(n){let e=L.MODE_KANJI,i=Q.stringToBytes;(function(o,s){let p=i(o);if(p.length!=2||(p[0]<<8|p[1])!=s)throw "sjis not supported."})("\u53CB",38726);let r=i(n),a={};return a.getMode=function(){return e},a.getLength=function(o){return ~~(r.length/2)},a.write=function(o){let s=r,p=0;for(;p+1<s.length;){let d=(255&s[p])<<8|255&s[p+1];if(33088<=d&&d<=40956)d-=33088;else if(57408<=d&&d<=60351)d-=49472;else throw "illegal char at "+(p+1)+"/"+d;d=(d>>>8&255)*192+(d&255),o.put(d,13),p+=2;}if(p<s.length)throw "illegal char at "+(p+1)},a},At=function(){let n=[],e={};return e.writeByte=function(t){n.push(t&255);},e.writeShort=function(t){e.writeByte(t),e.writeByte(t>>>8);},e.writeBytes=function(t,i,r){i=i||0,r=r||t.length;for(let a=0;a<r;a+=1)e.writeByte(t[a+i]);},e.writeString=function(t){for(let i=0;i<t.length;i+=1)e.writeByte(t.charCodeAt(i));},e.toByteArray=function(){return n},e.toString=function(){let t="";t+="[";for(let i=0;i<n.length;i+=1)i>0&&(t+=","),t+=n[i];return t+="]",t},e},ei=function(){let n=0,e=0,t=0,i="",r={},a=function(s){i+=String.fromCharCode(o(s&63));},o=function(s){if(s<0)throw "n:"+s;if(s<26)return 65+s;if(s<52)return 97+(s-26);if(s<62)return 48+(s-52);if(s==62)return 43;if(s==63)return 47;throw "n:"+s};return r.writeByte=function(s){for(n=n<<8|s&255,e+=8,t+=1;e>=6;)a(n>>>e-6),e-=6;},r.flush=function(){if(e>0&&(a(n<<6-e),n=0,e=0),t%3!=0){let s=3-t%3;for(let p=0;p<s;p+=1)i+="=";}},r.toString=function(){return i},r},ti=function(n){let e=n,t=0,i=0,r=0,a={};a.read=function(){for(;r<8;){if(t>=e.length){if(r==0)return -1;throw "unexpected end of file./"+r}let p=e.charAt(t);if(t+=1,p=="=")return r=0,-1;if(p.match(/^\s$/))continue;i=i<<6|o(p.charCodeAt(0)),r+=6;}let s=i>>>r-8&255;return r-=8,s};let o=function(s){if(65<=s&&s<=90)return s-65;if(97<=s&&s<=122)return s-97+26;if(48<=s&&s<=57)return s-48+52;if(s==43)return 62;if(s==47)return 63;throw "c:"+s};return a},ii=function(n,e){let t=n,i=e,r=new Array(n*e),a={};a.setPixel=function(d,g,f){r[g*t+d]=f;},a.write=function(d){d.writeString("GIF87a"),d.writeShort(t),d.writeShort(i),d.writeByte(128),d.writeByte(0),d.writeByte(0),d.writeByte(0),d.writeByte(0),d.writeByte(0),d.writeByte(255),d.writeByte(255),d.writeByte(255),d.writeString(","),d.writeShort(0),d.writeShort(0),d.writeShort(t),d.writeShort(i),d.writeByte(0);let g=2,f=s(g);d.writeByte(g);let m=0;for(;f.length-m>255;)d.writeByte(255),d.writeBytes(f,m,255),m+=255;d.writeByte(f.length-m),d.writeBytes(f,m,f.length-m),d.writeByte(0),d.writeString(";");};let o=function(d){let g=d,f=0,m=0,w={};return w.write=function(S,P){if(S>>>P)throw "length over";for(;f+P>=8;)g.writeByte(255&(S<<f|m)),P-=8-f,S>>>=8-f,m=0,f=0;m=S<<f|m,f=f+P;},w.flush=function(){f>0&&g.writeByte(m);},w},s=function(d){let g=1<<d,f=(1<<d)+1,m=d+1,w=p();for(let T=0;T<g;T+=1)w.add(String.fromCharCode(T));w.add(String.fromCharCode(g)),w.add(String.fromCharCode(f));let S=At(),P=o(S);P.write(g,m);let z=0,N=String.fromCharCode(r[z]);for(z+=1;z<r.length;){let T=String.fromCharCode(r[z]);z+=1,w.contains(N+T)?N=N+T:(P.write(w.indexOf(N),m),w.size()<4095&&(w.size()==1<<m&&(m+=1),w.add(N+T)),N=T);}return P.write(w.indexOf(N),m),P.write(f,m),P.flush(),S.toByteArray()},p=function(){let d={},g=0,f={};return f.add=function(m){if(f.contains(m))throw "dup key:"+m;d[m]=g,g+=1;},f.size=function(){return g},f.indexOf=function(m){return d[m]},f.contains=function(m){return typeof d[m]<"u"},f};return a},ni=function(n,e,t){let i=ii(n,e);for(let s=0;s<e;s+=1)for(let p=0;p<n;p+=1)i.setPixel(p,s,t(p,s));let r=At();i.write(r);let a=ei(),o=r.toByteArray();for(let s=0;s<o.length;s+=1)a.writeByte(o[s]);return a.flush(),"data:image/gif;base64,"+a},Mt=Q;Q.stringToBytes;var ri="#476CEB",oi="-1 20.86 60 60",ai="M16.8831 21.5476C16.3856 21.5476 15.9085 21.7452 15.5567 22.097L0.549704 37.104C0.0132083 37.6405 -0.147283 38.4474 0.143066 39.1483C0.433416 39.8493 1.11743 40.3063 1.87615 40.3063H26.5982L2.74743 64.1571C0.0649471 66.8395 -0.737512 70.8738 0.714236 74.3786C2.16598 77.8834 5.58604 80.1686 9.37964 80.1686H41.7385C42.236 80.1686 42.7131 79.971 43.0649 79.6192L58.0719 64.6122C58.6084 64.0757 58.7689 63.2689 58.4785 62.5679C58.1882 61.867 57.5042 61.4099 56.7455 61.4099H32.0234L55.8742 37.5592C58.5567 34.8767 59.3591 30.8425 57.9074 27.3376C56.4556 23.8328 53.0356 21.5476 49.242 21.5476H16.8831ZM5.11632 64.1759L28.3783 40.3812H30.6653L5.11632 64.1759ZM30.1464 61.4059L53.4083 37.6111L27.8594 61.4059H30.1464Z";function si(n){let e=/viewBox="0 0 ([\d.]+) [\d.]+"/.exec(n);return e?Number(e[1]):null}function pi(n){let e=n*.24,t=(n-e)/2,i=e*1.18,r=(n-i)/2,a=e*.16;return ['<g shape-rendering="geometricPrecision">',`<rect x="${r}" y="${r}" width="${i}" height="${i}" rx="${i*.22}" fill="#ffffff"/>`,`<svg x="${t+a}" y="${t+a}" width="${e-a*2}" height="${e-a*2}" viewBox="${oi}">`,`<path d="${ai}" fill="${ri}"/>`,"</svg>","</g>"].join("")}function St(n){let e=si(n);return e?n.replace("</svg>",`${pi(e)}</svg>`):n}function Tt(){return '<svg class="zippy-brand-lock" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M7 10V8a5 5 0 0 1 10 0v2" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><rect x="5" y="10" width="14" height="11" rx="2.5" stroke="currentColor" stroke-width="1.75"/><circle cx="12" cy="15.5" r="1.25" fill="currentColor"/></svg>'}var qe="merchant-payment";function me(n){return `zippy://${qe}/${n}`}function $e(n,e=4,t="H",i=2){let r=Mt(0,t);return r.addData(n),r.make(),r.createSvgTag(e,i)}function Lt(n,e=4,t="H"){return $e(me(n),e,t)}function It(n,e=4){return St(Lt(n,e,"H"))}function Qe(n,e=4){return `<div class="zippy-qr-stack">${It(n,e)}</div>`}function We(n,e=4){return `<div class="zippy-qr-stack zippy-qr-stack--plain">${$e(n,e,"M")}</div>`}function Nt(n){return `intent://${qe}/${n}#Intent;scheme=zippy;package=${ie};end`}function Bt(n,e){return e==="android"||e==null&&Be()?Nt(n):me(n)}function ae(n){if(typeof window>"u")return;let e=n??ft();window.location.assign(De(e));}function Ye(n){typeof window>"u"||typeof document>"u"||li(Bt(n));}function li(n){let e=document.createElement("a");e.href=n,e.style.display="none",e.setAttribute("aria-hidden","true"),document.body.appendChild(e),e.click(),e.remove();}var ci={ios:{title:"Download Zippy for iPhone",lead:"Scan the code with your iPhone camera, or open the App Store directly on this device.",qrHint:"Scan to open the App Store",ctaLabel:"Open App Store",dialogLabel:"Download Zippy on the App Store",icon:Fe("zippy-app-modal-platform-icon")},android:{title:"Download Zippy for Android",lead:"Scan the code with your Android phone, or open Google Play directly on this device.",qrHint:"Scan to open Google Play",ctaLabel:"Open Google Play",dialogLabel:"Get Zippy on Google Play",icon:Ze("zippy-app-modal-platform-icon zippy-app-modal-platform-icon--play")}};function di(){return typeof window>"u"?false:window.matchMedia("(max-width: 520px), (pointer: coarse)").matches}var ye=class{constructor(e){this.shadow=e;this.overlay=null;this.escapeHandler=null;this.focusTrapHandler=null;this.trigger=null;}open(e,t,i){this.close(),this.trigger=i;let r=ci[e],a=di(),o=document.createElement("div");o.className=`zippy-app-modal-overlay${a?" zippy-app-modal-overlay--mobile":""}`,o.setAttribute("role","dialog"),o.setAttribute("aria-modal","true"),o.setAttribute("aria-label",r.dialogLabel),o.innerHTML=`
|
|
1736
|
+
<div class="zippy-app-modal-panel">
|
|
1737
|
+
<button type="button" class="zippy-app-modal-close" aria-label="Close download dialog"><svg class="zippy-app-modal-close-icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M7 7l10 10M17 7 7 17" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
|
1738
|
+
<div class="zippy-app-modal-header">
|
|
1739
|
+
${r.icon}
|
|
1740
|
+
<div class="zippy-app-modal-heading">
|
|
1741
|
+
<h2 class="zippy-app-modal-title">${r.title}</h2>
|
|
1742
|
+
<p class="zippy-app-modal-lead">${r.lead}</p>
|
|
1743
|
+
</div>
|
|
1744
|
+
</div>
|
|
1745
|
+
<div class="zippy-app-modal-qr-wrap">
|
|
1746
|
+
<div class="zippy-app-modal-qr-frame" aria-label="${r.qrHint}">${We(t,5)}</div>
|
|
1747
|
+
<p class="zippy-app-modal-qr-hint">${r.qrHint}</p>
|
|
1748
|
+
</div>
|
|
1749
|
+
<div class="zippy-app-modal-actions">
|
|
1750
|
+
<a class="zippy-app-modal-cta zippy-app-modal-cta--${e}" href="${ui(t)}" target="_blank" rel="noopener noreferrer">${r.ctaLabel}</a>
|
|
1751
|
+
${a?'<p class="zippy-app-modal-mobile-note">On this device, use the button above to install the app.</p>':""}
|
|
1752
|
+
</div>
|
|
1753
|
+
</div>
|
|
1754
|
+
`,o.addEventListener("click",p=>{p.target===o&&this.close();}),o.querySelector(".zippy-app-modal-panel")?.addEventListener("click",p=>{p.stopPropagation();}),o.querySelector(".zippy-app-modal-close")?.addEventListener("click",()=>{this.close();});let s=o.querySelector(".zippy-app-modal-cta");a&&s&&s.addEventListener("click",p=>{p.preventDefault(),ae(e);}),this.shadow.appendChild(o),this.overlay=o,this.escapeHandler=p=>{p.key==="Escape"&&(p.preventDefault(),this.close());},document.addEventListener("keydown",this.escapeHandler),this.focusTrapHandler=p=>{if(p.key!=="Tab"||!this.overlay)return;let d=Array.from(this.overlay.querySelectorAll('button:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])')).filter(m=>m.offsetParent!==null);if(d.length===0)return;let g=d[0],f=d[d.length-1];p.shiftKey&&document.activeElement===g?(p.preventDefault(),f.focus()):!p.shiftKey&&document.activeElement===f&&(p.preventDefault(),g.focus());},document.addEventListener("keydown",this.focusTrapHandler),o.querySelector(".zippy-app-modal-close")?.focus();}close(){this.escapeHandler&&(document.removeEventListener("keydown",this.escapeHandler),this.escapeHandler=null),this.focusTrapHandler&&(document.removeEventListener("keydown",this.focusTrapHandler),this.focusTrapHandler=null),this.overlay?.remove(),this.overlay=null,this.trigger?.isConnected&&this.trigger.focus(),this.trigger=null;}destroy(){this.close();}};function ui(n){return n.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}var fe=class{constructor(e,t,i,r,a=""){this.expiryTimer=null;this.terminalExitTimer=null;this.callbacks=i,this.uiOptions=r,this.state=t,this.shadow=e.attachShadow({mode:"open"}),this.appStoreModal=new ye(this.shadow);let o=document.createElement("style");o.textContent=ct+a,this.shadow.appendChild(o),this.root=document.createElement("div"),this.root.className="zippy-root",this.root.setAttribute("role","region"),this.root.setAttribute("aria-label","Zippy Pay checkout"),this.shadow.appendChild(this.root),this.render();}update(e){let t={...this.state,...e};if(this.shouldSkipRender(this.state,t)){this.state=t;return}this.state=t,this.render();}updateUiOptions(e){this.uiOptions=e,this.render();}shouldSkipRender(e,t){return this.renderSnapshot(e)===this.renderSnapshot(t)}renderSnapshot(e){let t=e.session;return JSON.stringify({phase:e.phase,sessionId:e.sessionId,committedMethod:e.committedMethod,paymentId:e.paymentId,errorMessage:e.errorMessage,loading:e.loading,mode:e.mode,exitMode:e.exitMode??null,appHandoffStatus:e.appHandoffStatus??"idle",mobileAppManualFallback:e.mobileAppManualFallback??false,verifiedPayer:e.verifiedPayer,verifyMatches:e.verifyMatches,session:t?{status:t.status,phase:t.phase,amount:t.amount,currency:t.currency,businessName:t.businessName,paymentExpiryAt:t.paymentExpiryAt,paymentStartAt:t.paymentStartAt,payer:t.payer,transactionStatus:t.transactionStatus,checkoutMethod:t.checkoutMethod,expiresAt:t.expiresAt,transactionId:t.transactionId}:null})}restoreFocusState(){let e=this.shadow.activeElement;return e instanceof HTMLInputElement&&e.id?{id:e.id,selection:e.selectionStart}:{id:null,selection:null}}applyFocusState(e){if(!e.id)return;let t=this.shadow.getElementById(e.id);t instanceof HTMLInputElement&&(t.focus(),e.selection!==null&&t.setSelectionRange(e.selection,e.selection));}destroy(){this.clearExpiryTimer(),this.clearTerminalExitTimer(),this.appStoreModal.destroy();}getShadowRoot(){return this.shadow}render(){let e=this.restoreFocusState();this.clearExpiryTimer(),this.clearTerminalExitTimer();let{phase:t,session:i,errorMessage:r,loading:a,verifiedPayer:o,verifyMatches:s,paymentId:p,sessionId:d,committedMethod:g,exitMode:f,mode:m,appHandoffStatus:w="idle",mobileAppManualFallback:S=false}=this.state,P=t==="success"||t==="expired"||t==="cancelled"||t==="declined"||t==="failed"||t==="invalid-session"||t==="error",z=!P&&Ne(i,t),N=t==="qr-active"||t==="awaiting"&&g==="qr",T=t==="mobile-app-active"||t==="awaiting"&&g==="mobileApp";this.root.className=z?N?"zippy-root zippy-root--paying zippy-root--qr":T?"zippy-root zippy-root--paying zippy-root--mobile-app":"zippy-root zippy-root--paying":P?"zippy-root zippy-root--terminal":"zippy-root",this.root.innerHTML="";let M=P?this.root:document.createElement("div");if(P||(M.className="zippy-root-body",this.root.appendChild(M)),t==="loading"){if(M.appendChild(this.renderLoading()),M.appendChild(this.renderBrandFooter()),z){let Z=i?X(i):null;Z!==null&&Z>0&&this.root.appendChild(this.renderPayProgress());}this.applyFocusState(e);return}i&&!P&&M.appendChild(this.renderPaymentHero(i,this.heroSubtitle(t,i)));let W=i?.paymentExpiryAt;switch(z&&t!=="qr-active"&&t!=="mobile-app-active"&&W!=null&&_(W)>0&&M.appendChild(this.renderPayTimer(W)),t){case "choose-method":M.appendChild(this.renderChooseMethod());break;case "qr-active":M.appendChild(this.renderQrActive(d,i));break;case "mobile-app-active":M.appendChild(this.renderMobileAppActive(i,w,a));break;case "manual-entry":M.appendChild(this.renderManualEntry(p,r,a,S));break;case "manual-picker":M.appendChild(this.renderPayerPicker(s??[],a));break;case "manual-confirm":M.appendChild(this.renderManualConfirm(o,r,a));break;case "awaiting":M.appendChild(this.renderAwaiting(i,g??"qr",o));break;case "success":case "expired":case "cancelled":case "declined":case "failed":case "invalid-session":M.appendChild(this.renderOutcomeScreen(t,i,f,m)),this.mountTerminalExitTimer();break;case "error":M.appendChild(this.renderTerminal("error","Something went wrong",r??"Please try again or contact the merchant."));break;}if(P?this.root.appendChild(this.renderBrandFooter()):M.appendChild(this.renderBrandFooter()),z){let Z=i?X(i):null;Z!==null&&Z>0&&this.root.appendChild(this.renderPayProgress());}this.applyFocusState(e);}heroSubtitle(e,t){switch(e){case "choose-method":return "Choose how to pay";case "qr-active":return t?.status==="AWAITING_PAYMENT"?"Waiting for confirmation":"Scan with the Zippy app";case "mobile-app-active":return this.state.appHandoffStatus==="failed"?"Install or choose another way":t?.status==="AWAITING_PAYMENT"?"Waiting for confirmation":"Pay in the Zippy app";case "manual-entry":return "Find your Zippy account";case "manual-picker":return "Select your account";case "manual-confirm":return "Review and confirm";case "awaiting":return "Waiting for confirmation";default:return ""}}renderPaymentHero(e,t){let i=document.createElement("div");i.className="zippy-payment-hero";let r=document.createElement("p");r.className="zippy-payment-merchant",r.textContent=e.businessName;let a=document.createElement("p");if(a.className="zippy-payment-amount",a.textContent=Ce(e.amount,e.currency),i.appendChild(r),i.appendChild(a),t){let o=document.createElement("p");o.className="zippy-payment-subtitle",o.textContent=t,i.appendChild(o);}return i}renderBrandFooter(){let e=document.createElement("div");if(e.className="zippy-brand-footer",e.setAttribute("aria-label","Zippy checkout footer"),this.uiOptions.surface!=="phone"){let o=document.createElement("div");o.className="zippy-app-links";let s=document.createElement("p");s.className="zippy-app-links-label",s.textContent="Get the Zippy Pay app";let p=document.createElement("div");p.className="zippy-app-links-badges",p.appendChild(this.renderStoreBadgeButton("ios",ne.ios,"Show App Store download options",kt())),p.appendChild(this.renderStoreBadgeButton("android",ne.android,"Show Google Play download options",zt())),o.appendChild(s),o.appendChild(p),e.appendChild(o);}let t=document.createElement("div");t.className="zippy-brand-footer-inner";let i=document.createElement("span");i.className="zippy-brand-secure",i.innerHTML=`${Tt()}<span class="zippy-brand-copy">Secured by</span>`;let r=document.createElement("span");r.className="zippy-brand-divider",r.setAttribute("aria-hidden","true");let a=document.createElement("span");return a.className="zippy-brand-name",a.textContent="Zippy",t.appendChild(i),t.appendChild(r),t.appendChild(a),e.appendChild(t),e}renderStoreBadgeButton(e,t,i,r){let a=document.createElement("button");return a.type="button",a.className=`zippy-app-link zippy-app-link--icon-only zippy-app-link--${e}`,a.setAttribute("aria-label",i),a.setAttribute("aria-haspopup","dialog"),a.innerHTML=r,a.addEventListener("click",()=>{this.appStoreModal.open(e,t,a);}),a}renderLoading(){let e=document.createElement("div");e.className="zippy-status";let t=document.createElement("div");t.className="zippy-status-icon loading";let i=document.createElement("div");i.className="zippy-spinner",t.appendChild(i);let r=document.createElement("p");return r.className="zippy-status-title",r.textContent="Loading checkout\u2026",e.appendChild(t),e.appendChild(r),e}renderChooseMethod(){let e=document.createElement("div");e.className="zippy-choose";let{appHandoffStatus:t="idle"}=this.state,i=document.createElement("div");i.className="zippy-choose-options";let{methodAvailability:r}=this.uiOptions;if(r.qr&&i.appendChild(this.renderMethodCard({method:"qr",title:"QR code",description:"Open Zippy and scan",icon:this.qrIconSvg()})),r.manual&&i.appendChild(this.renderMethodCard({method:"manual",title:"Zippy account",description:"ID, email, or phone",icon:this.idIconSvg()})),(r.qr||r.manual)&&e.appendChild(i),r.mobileApp){let a=document.createElement("div");a.className="zippy-choose-mobile-app",a.appendChild(this.renderPayWithZippyButton({opening:t==="opening",action:"choose"})),e.appendChild(a);}return e}renderMethodCard(e){let t=document.createElement("button");t.type="button",t.className=`zippy-method-card zippy-method-card--${e.method}`,t.setAttribute("aria-label",e.method==="qr"?"Pay by scanning a QR code in the Zippy app":e.method==="mobileApp"?"Pay with the Zippy app on this phone":"Pay with your Zippy ID, email, or phone");let i=document.createElement("span");i.className="zippy-method-icon",i.innerHTML=e.icon;let r=document.createElement("span");r.className="zippy-method-copy";let a=document.createElement("span");a.className="zippy-method-title",a.textContent=e.title;let o=document.createElement("span");return o.className="zippy-method-hint",o.textContent=e.description,r.appendChild(a),r.appendChild(o),t.appendChild(i),t.appendChild(r),t.addEventListener("click",()=>this.callbacks.onChooseMethod(e.method)),t}renderQrActive(e,t){let i=document.createElement("div");i.className="zippy-flow zippy-flow--centered";let r=t?.status==="AWAITING_PAYMENT",a=document.createElement("div");a.className="zippy-qr-section";let o=document.createElement("div");return o.className="zippy-qr-frame",o.innerHTML=Qe(e),a.appendChild(o),t?.paymentExpiryAt&&_(t.paymentExpiryAt)>0&&a.appendChild(this.renderPayTimer(t.paymentExpiryAt)),r&&a.appendChild(this.renderQrAwaitingLoader()),i.appendChild(a),r?(t?.payer&&i.appendChild(this.renderIdentityCard(t.payer)),i.appendChild(this.renderFootnote("Complete the payment in the Zippy app to finish checkout."))):(i.appendChild(this.renderFlowHint("Open Zippy Pay, scan the code, and complete your payment.")),i.appendChild(this.renderFootnote("Keep this page open until payment completes."))),i}renderMobileAppActive(e,t,i){let r=document.createElement("div");r.className="zippy-flow zippy-flow--centered";let a=e?.status==="AWAITING_PAYMENT",o=document.createElement("div");o.className="zippy-mobile-app-section";let s=e?.paymentExpiryAt;return s!=null&&_(s)>0&&t!=="idle"&&t!=="opening"&&o.appendChild(this.renderPayTimer(s)),t==="opening"?o.appendChild(this.renderPayWithZippyButton({opening:true})):t==="failed"?i?o.appendChild(this.renderMobileAppMethodSwitching()):o.appendChild(this.renderMobileAppHandoffFailed()):t==="opened"||a?a?o.appendChild(this.renderQrAwaitingLoader()):o.appendChild(this.renderMobileAppOpenedHint()):o.appendChild(this.renderPayWithZippyButton({disabled:a})),r.appendChild(o),a?(e?.payer&&r.appendChild(this.renderIdentityCard(e.payer)),r.appendChild(this.renderFootnote("Complete the payment in the Zippy app to finish checkout."))):t==="failed"?r.appendChild(this.renderFootnote(i?"Switching payment method\u2026":"Install Zippy or choose another payment method below.")):r.appendChild(this.renderFootnote("Keep this page open until payment completes.")),r}renderMobileAppMethodSwitching(){let e=document.createElement("div");e.className="zippy-mobile-app-method-switching",e.setAttribute("aria-live","polite"),e.setAttribute("aria-busy","true");let t=document.createElement("span");t.className="zippy-qr-awaiting-spinner",t.setAttribute("aria-hidden","true");let i=document.createElement("p");return i.className="zippy-mobile-app-method-switching-title",i.textContent="Switching payment method\u2026",e.appendChild(t),e.appendChild(i),e}renderPayWithZippyButton(e={}){let{disabled:t=false,opening:i=false,action:r="open"}=e,a=document.createElement("button");if(a.type="button",a.className="zippy-mobile-app-pay-btn",a.disabled=t||i,i){a.classList.add("zippy-mobile-app-pay-btn--opening"),a.setAttribute("aria-busy","true"),a.setAttribute("aria-live","polite"),a.setAttribute("aria-label","Opening Zippy Pay");let o=document.createElement("span");o.className="zippy-qr-awaiting-spinner zippy-mobile-app-pay-btn-spinner",o.setAttribute("aria-hidden","true");let s=document.createElement("span");s.textContent="Opening Zippy\u2026",a.appendChild(o),a.appendChild(s);}else a.textContent="Pay with Zippy",a.setAttribute("aria-label","Open Zippy Pay to complete this payment");return a.addEventListener("click",()=>{a.disabled||(r==="choose"?this.callbacks.onChooseMethod("mobileApp"):this.callbacks.onOpenMobileApp?.());}),a}renderMobileAppOpenedHint(){let e=document.createElement("p");return e.className="zippy-mobile-app-opened-hint",e.textContent="Complete your payment in the Zippy app.",e}renderMobileAppHandoffFailed(){let e=document.createElement("div");e.className="zippy-mobile-app-handoff-failed";let t=document.createElement("p");t.className="zippy-mobile-app-handoff-message",t.textContent="We couldn't open the Zippy app on this device.";let i=document.createElement("button");return i.type="button",i.className="zippy-install-zippy-btn",i.textContent="Install Zippy",i.setAttribute("aria-label","Install Zippy Pay from your app store"),i.addEventListener("click",()=>{this.callbacks.onInstallZippy?.();}),e.appendChild(t),e.appendChild(this.renderRetryMobileAppLink()),e.appendChild(this.renderMobileAppFallbackOptions()),e.appendChild(i),e}renderMobileAppFallbackOptions(){let{checkoutPolicy:e}=this.uiOptions,t=bt(e);if(!t.qr&&!t.manual)return document.createDocumentFragment();let i=document.createElement("div");i.className="zippy-mobile-app-fallback";let r=document.createElement("p");r.className="zippy-mobile-app-fallback-label",r.textContent="Or pay another way";let a=document.createElement("div");return a.className="zippy-choose-options zippy-choose-options--compact",t.qr&&a.appendChild(this.renderMethodCard({method:"qr",title:"QR code",description:"Open Zippy and scan",icon:this.qrIconSvg()})),t.manual&&a.appendChild(this.renderMethodCard({method:"manual",title:"Zippy account",description:"ID, email, or phone",icon:this.idIconSvg()})),i.appendChild(r),i.appendChild(a),i}renderRetryMobileAppLink(){let e=document.createElement("button");return e.type="button",e.className="zippy-mobile-app-retry",e.textContent="Try again",e.setAttribute("aria-label","Try opening the Zippy app again"),e.addEventListener("click",()=>{this.callbacks.onRetryMobileApp?.();}),e}renderQrAwaitingLoader(){let e=document.createElement("div");e.className="zippy-qr-awaiting",e.setAttribute("aria-live","polite"),e.setAttribute("aria-label","Waiting for payment confirmation");let t=document.createElement("span");return t.className="zippy-qr-awaiting-spinner",t.setAttribute("aria-hidden","true"),e.appendChild(t),e}renderPayTimer(e){let t=document.createElement("div");t.className="zippy-pay-timer-slot";let i=_(e),r=document.createElement("div");r.className="zippy-pay-timer",r.setAttribute("role","timer"),r.setAttribute("aria-live","polite"),r.setAttribute("aria-label",`${Se(i)} remaining to complete payment`);let a=document.createElement("span");a.className="zippy-pay-timer-label",a.textContent="Time remaining";let o=document.createElement("span");return o.className="zippy-pay-timer-value",o.setAttribute("aria-hidden","true"),o.textContent=Me(i),r.appendChild(a),r.appendChild(o),t.appendChild(r),t}renderManualEntry(e,t,i,r){let a=document.createElement("div");a.className="zippy-flow",r&&this.callbacks.onBackToMobileAppFallback?a.appendChild(this.renderBackButton(i,{label:"Back",onClick:()=>this.callbacks.onBackToMobileAppFallback?.()})):this.uiOptions.allowManualBack&&this.callbacks.onBackToChooseMethod&&a.appendChild(this.renderBackButton(i,{label:"Back"}));let o=document.createElement("form");o.className="zippy-id-form",o.addEventListener("submit",S=>{S.preventDefault(),!i&&d.value.trim()&&this.callbacks.onVerify(d.value);});let s=document.createElement("div");s.className="zippy-input-combo";let p=document.createElement("div");p.className="zippy-input-combo-input-wrap";let d=document.createElement("input");d.id="zippy-payer-query",d.className="zippy-input-combo-field",d.type="text",d.placeholder="Zippy ID, email, or +15551234567",d.autocomplete="off",d.spellcheck=false,d.inputMode="text",d.value=e,d.disabled=i,d.setAttribute("aria-label","Zippy ID, email, or phone number");let g=document.createElement("button");g.type="button",g.className="zippy-input-combo-clear",g.setAttribute("aria-label","Clear input"),g.innerHTML='<svg class="zippy-input-combo-clear-icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M7 7l10 10M17 7 7 17" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>';let f=document.createElement("span");f.className="zippy-input-combo-divider",f.setAttribute("aria-hidden","true");let m=document.createElement("button");m.type="button",m.className="zippy-input-combo-action",m.textContent="Find",m.setAttribute("aria-label","Find Zippy account");let w=()=>{let S=d.value.trim(),P=i,z=d.value.length>0&&!i;p.classList.toggle("zippy-input-combo-input-wrap--has-value",z),g.disabled=!z,g.tabIndex=z?0:-1,g.setAttribute("aria-hidden",z?"false":"true"),m.disabled=i||S.length===0,m.classList.toggle("zippy-input-combo-action--loading",P);let N=m.querySelector(".zippy-spinner-inline");if(P){if(m.textContent="",!N){let T=document.createElement("span");T.className="zippy-spinner-inline",T.setAttribute("aria-hidden","true"),m.appendChild(T);}m.setAttribute("aria-label","Finding account");}else N?.remove(),m.textContent="Find",m.setAttribute("aria-label","Find Zippy account");};return m.addEventListener("click",()=>{this.callbacks.onVerify(d.value);}),g.addEventListener("click",()=>{d.value="",this.state.paymentId="",this.callbacks.onPaymentIdChange?.(""),d.focus(),w();}),d.addEventListener("input",()=>{this.state.paymentId=d.value,this.callbacks.onPaymentIdChange?.(d.value),w();}),w(),t&&s.classList.add("zippy-input-combo--error"),s.appendChild(p),p.appendChild(d),p.appendChild(g),s.appendChild(f),s.appendChild(m),o.appendChild(s),t&&o.appendChild(this.renderFieldError(t)),o.appendChild(this.renderPayerQueryHint()),a.appendChild(o),a}renderPayerQueryHint(){let e=document.createElement("div");e.className="zippy-query-hint";let t=document.createElement("p");t.className="zippy-query-hint-lead",t.textContent="Find your account using any of:";let i=document.createElement("ul");i.className="zippy-query-hint-list";for(let r of [{label:"Zippy ID",example:"john.doe12"},{label:"Email",example:"you@example.com"},{label:"Phone",example:"+15551234567",note:"E.164 \u2014 include + and country code"}])i.appendChild(this.renderPayerQueryHintItem(r));return e.appendChild(t),e.appendChild(i),e}renderPayerQueryHintItem(e){let t=document.createElement("li");t.className="zippy-query-hint-item";let i=document.createElement("span");i.className="zippy-query-hint-label",i.textContent=e.label;let r=document.createElement("span");r.className="zippy-query-hint-example-wrap";let a=document.createElement("code");if(a.className="zippy-query-hint-example",a.textContent=e.example,r.appendChild(a),e.note){let o=document.createElement("span");o.className="zippy-query-hint-note",o.textContent=e.note,r.appendChild(o);}return t.appendChild(i),t.appendChild(r),t}renderPayerPicker(e,t){let i=document.createElement("div");i.className="zippy-flow",this.callbacks.onBackToManualEntry&&i.appendChild(this.renderBackButton(t,{label:"Back",onClick:()=>this.callbacks.onBackToManualEntry?.()}));let r=document.createElement("p");r.className="zippy-picker-lead",r.textContent="Multiple accounts match. Select the one paying for this checkout.",i.appendChild(r);let a=document.createElement("div");a.className="zippy-picker-list",a.setAttribute("role","listbox"),a.setAttribute("aria-label","Matching Zippy accounts");for(let o of e)a.appendChild(this.renderPayerPickerOption(o,t));return i.appendChild(a),i}renderPayerPickerOption(e,t){let i=document.createElement("button");return i.type="button",i.className="zippy-picker-option",i.disabled=t,i.setAttribute("role","option"),i.setAttribute("aria-label",`Pay as ${e.displayName}`),i.appendChild(this.renderIdentityCard(e)),i.addEventListener("click",()=>{this.callbacks.onSelectPayer?.(e);}),i}renderManualConfirm(e,t,i){let r=document.createElement("div");r.className="zippy-flow";let a=i&&!!e;e&&r.appendChild(this.renderIdentityCard(e,{dismissible:true,dismissDisabled:a,onDismiss:()=>this.callbacks.onBackToManualEntry?.()})),t&&r.appendChild(this.renderFieldError(t));let o=document.createElement("button");return o.type="button",o.className="zippy-btn zippy-btn-primary zippy-btn-block",o.textContent=a?"Processing\u2026":"Proceed",o.disabled=i||!e,o.addEventListener("click",()=>{e&&this.callbacks.onPay(e.paymentId);}),r.appendChild(o),r}renderBackButton(e,t){let i=document.createElement("button");return i.type="button",i.className="zippy-back-btn",i.disabled=e,i.setAttribute("aria-label",t?.label??"Back to payment options"),i.innerHTML=`<svg class="zippy-back-btn-icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M14.5 6.5 9 12l5.5 5.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg><span>${t?.label??"Back"}</span>`,i.addEventListener("click",()=>{t?.onClick?t.onClick():this.callbacks.onBackToChooseMethod?.();}),i}renderFieldError(e){let t=document.createElement("p");t.className="zippy-field-error",t.setAttribute("role","alert");let i=document.createElement("span");i.className="zippy-field-error-icon",i.setAttribute("aria-hidden","true"),i.textContent="!";let r=document.createElement("span");return r.textContent=e,t.appendChild(i),t.appendChild(r),t}renderIdentityCard(e,t){let i=document.createElement("div");i.className=`zippy-identity-card${t?.dismissible?" zippy-identity-card--dismissible":""}`;let r=this.renderIdentityAvatar(e),a=document.createElement("div");a.className="zippy-identity-copy";let o=document.createElement("p");o.className="zippy-identity-label",o.textContent="Paying as";let s=document.createElement("p");s.className="zippy-identity-name",s.textContent=e.displayName;let p=document.createElement("p");return p.className="zippy-identity-handle",p.textContent=e.paymentId,a.appendChild(o),a.appendChild(s),a.appendChild(p),i.appendChild(r),i.appendChild(a),t?.dismissible&&i.appendChild(this.renderCardDismissButton(t.dismissDisabled??false,t.onDismiss)),i}renderCardDismissButton(e,t){let i=document.createElement("button");return i.type="button",i.className="zippy-identity-card-dismiss",i.disabled=e,i.setAttribute("aria-label","Change account"),i.innerHTML='<svg class="zippy-identity-card-dismiss-icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M7 7l10 10M17 7 7 17" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>',i.addEventListener("click",()=>{t?.();}),i}renderIdentityAvatar(e){let t=document.createElement("div");t.className="zippy-identity-avatar";let i=ot(e.displayName),r=e.profileImage?.trim();if(r){t.classList.add("zippy-identity-avatar--photo");let a=document.createElement("img");a.className="zippy-identity-avatar-image",a.src=r,a.alt="",a.addEventListener("error",()=>{t.classList.remove("zippy-identity-avatar--photo"),a.remove(),t.textContent=i;}),t.appendChild(a);}else t.textContent=i;return t}renderAwaiting(e,t,i){let r=document.createElement("div");r.className="zippy-flow zippy-flow-awaiting";let a=document.createElement("div");a.className="zippy-awaiting-status",a.innerHTML='<div class="zippy-awaiting-ring" aria-hidden="true"><span></span></div>',r.appendChild(a);let o=e?.payer??i??null;o&&r.appendChild(this.renderIdentityCard(o));let s=document.createElement("p");return s.className="zippy-awaiting-message",s.textContent=t==="qr"||t==="mobileApp"?"Complete the payment in the Zippy app to finish checkout.":"Tap the notification in Zippy Pay to approve this payment.",r.appendChild(s),r.appendChild(this.renderFootnote("Do not close or refresh this page.")),r}renderFlowHint(e){let t=document.createElement("p");return t.className="zippy-flow-hint",t.textContent=e,t}renderPayProgress(){let e=document.createElement("div");e.className="zippy-pay-progress",e.setAttribute("role","progressbar"),e.setAttribute("aria-label","Payment time remaining"),e.setAttribute("aria-valuemin","0"),e.setAttribute("aria-valuemax","100");let t=document.createElement("div");return t.className="zippy-pay-progress-fill",e.appendChild(t),this.mountPayProgress(t,e),e}mountPayProgress(e,t){let i=()=>{let r=this.state.session;if(!r)return;let a=X(r);if(a===null||a<=0){t.style.display="none",t.setAttribute("aria-valuenow","0"),this.clearExpiryTimer();return}t.style.display="";let o=Math.round(a*100);e.style.transform=`scaleX(${a})`,t.setAttribute("aria-valuenow",String(o));let s=this.shadow.querySelector(".zippy-pay-timer-value"),p=this.shadow.querySelector(".zippy-pay-timer");if(s instanceof HTMLElement&&r.paymentExpiryAt){let d=_(r.paymentExpiryAt);s.textContent=Me(d),p instanceof HTMLElement&&p.setAttribute("aria-label",`${Se(d)} remaining to complete payment`);}};i(),this.expiryTimer=setInterval(i,1e3);}clearExpiryTimer(){this.expiryTimer!==null&&(clearInterval(this.expiryTimer),this.expiryTimer=null);}mountTerminalExitTimer(){this.clearTerminalExitTimer();let e=Ae,t=()=>{let i=this.shadow.querySelector(".zippy-status-exit-countdown");i instanceof HTMLElement&&(i.textContent=String(e));};t(),this.terminalExitTimer=setInterval(()=>{if(e-=1,e<=0){this.clearTerminalExitTimer(),this.callbacks.onTerminalExit?.();return}t();},1e3);}clearTerminalExitTimer(){this.terminalExitTimer!==null&&(clearInterval(this.terminalExitTimer),this.terminalExitTimer=null);}renderFootnote(e){let t=document.createElement("p");return t.className="zippy-footnote",t.textContent=e,t}renderOutcomeScreen(e,t,i,r){let a=rt(e);return this.renderOutcomeStatus(a.kind,a.title,a.detail,a.kind,i,r,t?.transactionId??null)}renderOutcomeStatus(e,t,i,r,a,o,s){let p=this.renderTerminal(e,t,i);s&&p.appendChild(this.renderTransactionReference(s));let d=a??"close",g=document.createElement("p");g.className="zippy-status-exit";let f=document.createElement("span");f.className="zippy-status-exit-lead",f.textContent=nt(d,o,r);let m=document.createElement("span");m.className="zippy-status-exit-countdown",m.textContent=String(Ae);let w=document.createElement("span");return w.className="zippy-status-exit-suffix",w.textContent=" seconds\u2026",g.appendChild(f),g.appendChild(document.createTextNode(" ")),g.appendChild(m),g.appendChild(w),p.appendChild(g),p}renderTransactionReference(e){let t=document.createElement("div");t.className="zippy-transaction-ref";let i=document.createElement("p");i.className="zippy-transaction-ref-label",i.textContent="Transaction ID";let r=document.createElement("p");return r.className="zippy-transaction-ref-value",r.textContent=e,t.appendChild(i),t.appendChild(r),t}renderTerminal(e,t,i){let r=document.createElement("div");r.className="zippy-status";let a=document.createElement("div");a.className=`zippy-status-icon ${e}`,a.innerHTML=e==="success"?'<svg width="28" height="28" viewBox="0 0 28 28" fill="none" aria-hidden="true"><path d="M7 14.5l4.5 4.5L21 9.5" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round"/></svg>':'<svg width="28" height="28" viewBox="0 0 28 28" fill="none" aria-hidden="true"><path d="M10 10l8 8M18 10l-8 8" stroke="currentColor" stroke-width="2.25" stroke-linecap="round"/></svg>';let o=document.createElement("p");o.className="zippy-status-title",o.textContent=t;let s=document.createElement("p");return s.className="zippy-status-detail",s.textContent=i,r.appendChild(a),r.appendChild(o),r.appendChild(s),r}qrIconSvg(){return `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
939
1755
|
<rect x="3" y="3" width="7" height="7" rx="1.25" stroke="currentColor" stroke-width="1.6"/>
|
|
940
1756
|
<rect x="14" y="3" width="7" height="7" rx="1.25" stroke="currentColor" stroke-width="1.6"/>
|
|
941
1757
|
<rect x="3" y="14" width="7" height="7" rx="1.25" stroke="currentColor" stroke-width="1.6"/>
|
|
@@ -946,6 +1762,5 @@ input {
|
|
|
946
1762
|
</svg>`}idIconSvg(){return `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
947
1763
|
<circle cx="12" cy="9" r="3.5" stroke="currentColor" stroke-width="1.6"/>
|
|
948
1764
|
<path d="M5 20c0-3.87 3.13-7 7-7s7 3.13 7 7" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>
|
|
949
|
-
</svg>`}};function xt(){return '<svg class="zippy-input-combo-check" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M6.5 12.5 10 16l7.5-7.5" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round"/></svg>'}var X=class{constructor(e){this.ui=null;this.session=null;this.paymentId="";this.verifiedPayer=null;this.committedMethod=null;this.phase="loading";this.errorMessage=null;this.loading=true;this.destroyed=false;this.modalOpen=false;this.exitMode=null;this.terminalFailureReason=null;if(this.config={mode:"inline",closeOnBackdropClick:false,closeOnEscape:false,...e},!we(this.config.sessionId))throw new Error("Zippy Pay: sessionId must be a UUID v4.");$(this.config.environment),this.client=new q({baseUrl:ne(this.config.environment),sessionId:this.config.sessionId,clientToken:this.config.clientToken}),this.embed=Ie(this.config),de(this.embed.host,this.config.theme),this.poller=new Y(()=>this.client.getSession(),{onUpdate:t=>this.handleSessionUpdate(t),onError:t=>this.handleError(t)}),this.ui=new K(this.embed.host,this.snapshotUiState(),{onChooseMethod:t=>{this.chooseMethod(t);},onVerify:t=>this.verify(t),onPay:t=>this.attach(t),onPaymentIdChange:t=>{let i=t.trim().toLowerCase(),r=false;this.verifiedPayer&&i!==this.verifiedPayer.paymentId.toLowerCase()&&(this.verifiedPayer=null,this.phase==="manual-confirm"&&(this.phase="manual-entry"),r=true),this.errorMessage&&(this.errorMessage=null,r=true),this.paymentId=t,r&&this.syncUi();},onTerminalExit:()=>this.executeTerminalExit()}),this.bootstrap(),this.config.mode==="inline"&&(this.modalOpen=true);}open(){this.config.mode!=="modal"||this.modalOpen||(this.modalOpen=true,Le(this.embed,this.config,()=>this.close()));}close(){this.config.mode==="modal"&&(this.modalOpen=false,Ne(this.embed),this.config.onClose?.());}destroy(){this.destroyed||(this.destroyed=true,this.poller.stop(),this.ui?.destroy(),this.embed.destroy(),this.ui=null);}snapshotUiState(){return {phase:this.phase,session:this.session,sessionId:this.config.sessionId,committedMethod:this.committedMethod,paymentId:this.paymentId,verifiedPayer:this.verifiedPayer,errorMessage:this.errorMessage,loading:this.loading,mode:this.config.mode??"inline",exitMode:this.exitMode}}syncUi(e){this.destroyed||(e&&"errorMessage"in e&&(this.errorMessage=e.errorMessage??null),e&&"loading"in e&&(this.loading=e.loading??false),e&&"exitMode"in e&&(this.exitMode=e.exitMode??null),this.ui?.update({phase:this.phase,session:this.session,sessionId:this.config.sessionId,committedMethod:this.committedMethod,paymentId:this.paymentId,verifiedPayer:this.verifiedPayer,errorMessage:this.errorMessage,loading:this.loading,mode:this.config.mode??"inline",exitMode:this.exitMode}));}async bootstrap(){try{let e=await this.client.getSession();if(this.applySession(e),this.destroyed)return;this.config.onReady?.(e),ue(e.status)||this.poller.start(e);}catch(e){this.handleBootstrapError(e);}}applySession(e){if(this.session=e,this.config.onSessionUpdate?.(e),this.committedMethod=bt(e.checkoutMethod)??this.committedMethod,e.transactionStatus==="DECLINED"&&e.status!=="COMPLETED"){this.handleFailure({reason:"declined",session:e});return}if(e.status==="COMPLETED"){this.handleSuccess(e);return}if(e.status==="EXPIRED"){this.handleFailure({reason:"expired",session:e});return}if(e.status==="FAILED"){this.handleFailure({reason:"failed",session:e});return}if(e.status==="CANCELLED"){this.handleFailure({reason:"cancelled",session:e});return}this.phase=this.resolveActivePhase(e),this.syncUi();}resolveActivePhase(e){return e.status==="AWAITING_PAYMENT"?e.checkoutMethod==="QR"||this.committedMethod==="qr"?"qr-active":"awaiting":e.phase==="PAYING"&&e.checkoutMethod==="QR"?"qr-active":e.phase==="PAYING"&&e.checkoutMethod==="MANUAL"?this.phase==="manual-confirm"&&this.verifiedPayer?"manual-confirm":"manual-entry":e.phase==="IDLE"?this.phase==="manual-confirm"&&this.verifiedPayer&&this.committedMethod==="manual"?"manual-confirm":this.phase==="manual-entry"&&this.committedMethod==="manual"?"manual-entry":this.phase==="qr-active"&&this.committedMethod==="qr"?"qr-active":"choose-method":this.phase==="loading"?"choose-method":this.phase}handleSessionUpdate(e){this.destroyed||this.applySession(e);}handleFailure(e){if(this.destroyed)return;this.poller.stop(),this.loading=false;let t=e.session??this.session;if(e.reason==="expired")t&&this.config.onExpired?.(t);else {let i=e.error??(e.reason==="failed"||e.reason==="cancelled"||e.reason==="declined"?vt(e.reason):void 0);i&&this.config.onError?.(i);}this.terminalFailureReason=e.reason,this.phase=this.failurePhaseFromReason(e.reason),this.exitMode=this.resolveExitMode("failure",t),this.syncUi();}handleSuccess(e){this.destroyed||(this.poller.stop(),this.loading=false,this.config.onComplete?.(e),this.terminalFailureReason=null,this.phase="success",this.exitMode=this.resolveExitMode("success",e),this.syncUi());}executeTerminalExit(){if(this.destroyed)return;let e=this.session;if(this.phase==="success"&&e){if(this.config.redirectOnComplete&&e.successUrl){window.location.assign(le(e.successUrl,{sessionId:e.sessionId,status:e.status,transactionId:e.transactionId}));return}}else if(this.phase==="expired"||this.phase==="failed"||this.phase==="cancelled"||this.phase==="declined"||this.phase==="invalid-session"){let t=e?.failureUrl??null;if(this.config.redirectOnFailure&&t){let i=this.terminalFailureReason==="expired"?le(t,{sessionId:e?.sessionId??this.config.sessionId,status:e?.status??"EXPIRED"}):t;window.location.assign(i);return}}this.teardownView();}resolveExitMode(e,t){return e==="success"?this.config.redirectOnComplete&&t?.successUrl?"redirect":"close":this.config.redirectOnFailure&&t?.failureUrl?"redirect":"close"}failurePhaseFromReason(e){switch(e){case "expired":return "expired";case "failed":return "failed";case "cancelled":return "cancelled";case "declined":return "declined";case "invalid-session":return "invalid-session"}}teardownView(){this.config.mode==="modal"&&this.modalOpen&&this.close(),this.destroy();}handleBootstrapError(e){if(e instanceof L&&e.status===401){this.handleFailure({reason:"invalid-session",error:e,session:this.session});return}this.handleError(e);}handleError(e){let t=Ye(e);if(t.status===401){this.handleFailure({reason:"invalid-session",error:t,session:this.session});return}if(t.code==="payment-session.not-attachable"){this.handleFailure({reason:"expired",session:this.session});return}(this.phase==="loading"||this.phase==="choose-method")&&(this.phase="error"),this.syncUi({errorMessage:t.detail,loading:false}),this.config.onError?.(t),this.poller.stop();}async chooseMethod(e){if(!this.committedMethod){this.committedMethod=e,this.verifiedPayer=null,this.syncUi({errorMessage:null,loading:true});try{if(e==="qr"){let t=await this.client.startQrCheckout();if(this.applySession(t),this.destroyed)return;this.syncUi({loading:!1});}else this.phase="manual-entry",this.syncUi({loading:!1});}catch(t){this.committedMethod=null,this.handleFlowError(t,"choose-method");}}}async verify(e){if(this.paymentId=e,!re(e)){this.syncUi({errorMessage:oe(),loading:false});return}this.syncUi({errorMessage:null,loading:true});try{let t=await this.client.verifyPayer(e);this.verifiedPayer=t,this.phase="manual-confirm",this.syncUi({loading:!1});}catch(t){this.handleFlowError(t,"manual-entry");}}async attach(e){if(!this.verifiedPayer||wt(e)!==this.verifiedPayer.paymentId){this.syncUi({errorMessage:"Verify your Zippy ID before proceeding to pay.",loading:false});return}this.syncUi({errorMessage:null,loading:true});try{let t=await ce(this.client,e);if(this.committedMethod="manual",this.applySession(t),this.destroyed)return;t.status==="AWAITING_PAYMENT"&&this.poller.start(t),this.syncUi({loading:!1});}catch(t){this.handleFlowError(t,"manual-confirm");}}handleFlowError(e,t){let i=Ye(e),r=Et(i,t);if(i.code==="payment-session.not-attachable"){this.handleFailure({reason:"expired",session:this.session});return}else if(i.code==="payment-session.checkout-method-conflict"){this.refreshAfterConflict(),this.syncUi({errorMessage:r,loading:false}),this.config.onError?.(i);return}else this.phase=t;this.syncUi({errorMessage:r,loading:false}),this.config.onError?.(i);}async refreshAfterConflict(){try{let e=await this.client.getSession();this.applySession(e);}catch{}}};function vt(n){return n==="failed"?new L({code:"payment-session.failed",status:400,title:"Payment failed",detail:"Something went wrong with this payment."}):n==="declined"?new L({code:"payment-session.declined",status:400,title:"Payment declined",detail:"Your payment was declined."}):new L({code:"payment-session.cancelled",status:400,title:"Payment cancelled",detail:"This payment was cancelled."})}function bt(n){return n==="QR"?"qr":n==="MANUAL"?"manual":null}function wt(n){return n.trim().toLowerCase()}function Et(n,e){return e==="manual-entry"&&(n.status===404||n.code.includes("not-found")||n.code.includes("payer-not-found")||n.code==="payer.not-found")?"Zippy ID not found":n.detail?.trim()||"Something went wrong. Please try again."}function Ye(n){return n instanceof L?n:new L({code:"unknown",status:500,title:"Unexpected error",detail:n instanceof Error?n.message:"An unexpected error occurred"})}function G(n){return new X(n)}var ye="zippy-pay-checkout",Qe={"theme-primary":"primary","theme-primary-foreground":"primaryForeground","theme-background":"background","theme-surface":"surface","theme-text":"text","theme-text-muted":"textMuted","theme-border":"border","theme-error":"error","theme-success":"success","theme-border-radius":"borderRadius","theme-font-family":"fontFamily","theme-mode":"mode"},J=class extends HTMLElement{constructor(){super(...arguments);this.instance=null;}static get observedAttributes(){return ["mode","session-id","environment",...Object.keys(Qe)]}connectedCallback(){this.mount();}disconnectedCallback(){this.unmount();}attributeChangedCallback(){this.isConnected&&(this.unmount(),this.mount());}set clientToken(t){this.dataset.clientToken=t,this.isConnected&&(this.unmount(),this.mount());}get clientToken(){return this.dataset.clientToken??this.getAttribute("client-token")??""}mount(){let t=this.readConfig();if(!t)return;this.innerHTML="";let i=t.mode??"inline",r;if(i==="inline"){let a=document.createElement("div");this.appendChild(a),r=a;}this.instance=G({...t,container:r,mode:i,onReady:a=>this.dispatch("zippy-ready",a),onSessionUpdate:a=>this.dispatch("zippy-session-update",a),onComplete:a=>this.dispatch("zippy-complete",a),onExpired:a=>this.dispatch("zippy-expired",a),onError:a=>this.dispatch("zippy-error",a),onClose:()=>this.dispatch("zippy-close",null)}),t.mode==="modal"&&this.instance.open();}unmount(){this.instance?.destroy(),this.instance=null,this.innerHTML="";}readConfig(){let t=this.getAttribute("environment")??"production",i=this.getAttribute("session-id")??"",r=this.clientToken,a=this.getAttribute("mode")??"inline";if(!i||!r)return null;let s;try{s=$(t);}catch{return null}let o={};for(let[l,g]of Object.entries(Qe)){let y=this.getAttribute(l);y&&(g==="mode"?o.mode=y:o[g]=y);}return {environment:s,sessionId:i,clientToken:r,mode:a,theme:o}}dispatch(t,i){this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:true,composed:true}));}open(){this.instance?.open();}close(){this.instance?.close();}destroy(){this.instance?.destroy(),this.instance=null;}};function fe(){typeof customElements>"u"||customElements.get(ye)||customElements.define(ye,J);}var Pt={create(n){let e=G(n);return (n.mode??"inline")==="modal"&&e.open(),e}};fe();var ui=Pt;
|
|
950
|
-
exports.CheckoutController=X;exports.DEFAULT_THEME=Te;exports.ELEMENT_TAG=ye;exports.PAYMENT_ID_PATTERN=be;exports.POLLABLE_STATUSES=te;exports.PaymentSessionClient=q;exports.SessionPoller=Y;exports.TERMINAL_STATUSES=F;exports.ZIPPY_API_BASE_URLS=W;exports.ZIPPY_API_PATH_PREFIX=ie;exports.ZippyPay=Pt;exports.ZippyPayCheckoutElement=J;exports.ZippyPayError=L;exports.applyThemeToHost=de;exports.attachPayerWithRetry=ce;exports.buildPaymentQrPayload=Ue;exports.createCheckout=G;exports.default=ui;exports.defineZippyPayCheckoutElement=fe;exports.formatAmount=se;exports.getCountdownTarget=qe;exports.getPayWindowRemainingRatio=V;exports.getSoftIdleHint=gt;exports.isTerminalStatus=ue;exports.isValidPaymentId=re;exports.isZippyEnvironment=ve;exports.msUntil=H;exports.normalizePaymentId=U;exports.parseZippyEnvironment=$;exports.paymentIdValidationMessage=oe;exports.phaseFromSession=et;exports.renderBrandedPaymentQrSvg=$e;exports.renderPaymentQrMarkup=me;exports.renderPaymentQrSvg=Fe;exports.renderQrSvg=Oe;exports.resolveApiBaseUrl=ne;exports.resolveTheme=Me;exports.shouldShowPayProgress=he;//# sourceMappingURL=index.cjs.map
|
|
1765
|
+
</svg>`}};function Ot(n){let e=n.timeoutMs??8e3,t=false,i=[],r=()=>{for(let p of i)p();i.length=0;},a=p=>{t||(t=true,r(),p==="opened"?n.onOpened():n.onFailed());},o=()=>{document.hidden&&a("opened");};document.addEventListener("visibilitychange",o),i.push(()=>{document.removeEventListener("visibilitychange",o);});let s=setTimeout(()=>{document.hidden?a("opened"):a("failed");},e);return i.push(()=>{clearTimeout(s);}),r}var se=class se{constructor(e){this.ui=null;this.session=null;this.paymentId="";this.verifiedPayer=null;this.verifyMatches=null;this.lastVerifiedQuery=null;this.committedMethod=null;this.phase="loading";this.errorMessage=null;this.loading=true;this.destroyed=false;this.modalOpen=false;this.exitMode=null;this.terminalFailureReason=null;this.appHandoffStatus="idle";this.clearAppHandoffWatch=null;this.methodSwitchInProgress=false;this.entryRoutingDone=false;this.payWindowExpiryTimer=null;this.unsubscribeSurface=null;if(this.config={mode:"inline",closeOnBackdropClick:false,closeOnEscape:false,...e},!it(this.config.sessionId))throw new Error("Zippy Pay: sessionId must be a UUID v4.");j(this.config.environment),this.uiOptions=Ue(this.config.checkoutPolicy,this.config.mobileApp,B()),this.client=new G({baseUrl:Pe(this.config.environment),sessionId:this.config.sessionId,clientToken:this.config.clientToken}),this.embed=ut(this.config),Ie(this.embed.host,this.config.theme),this.poller=new K(()=>this.client.getSession(),{onUpdate:t=>this.handleSessionUpdate(t),onError:t=>this.handlePollError(t)}),this.ui=new fe(this.embed.host,this.snapshotUiState(),{onChooseMethod:t=>{this.chooseMethod(t);},onVerify:t=>this.verify(t),onPay:t=>this.attach(t),onSelectPayer:t=>this.selectPayer(t),onBackToChooseMethod:()=>this.backToChooseMethod(),onBackToManualEntry:()=>this.backToManualEntry(),onBackToMobileAppFallback:()=>this.backToMobileAppFallback(),onOpenMobileApp:()=>this.beginMobileAppHandoff(),onInstallZippy:()=>this.installZippy(),onRetryMobileApp:()=>this.beginMobileAppHandoff(),onPaymentIdChange:t=>{let i=$(t),r=false;(this.verifiedPayer||this.verifyMatches)&&this.lastVerifiedQuery!==null&&i!==this.lastVerifiedQuery&&(this.verifiedPayer=null,this.verifyMatches=null,this.lastVerifiedQuery=null,(this.phase==="manual-confirm"||this.phase==="manual-picker")&&(this.phase="manual-entry"),r=true),this.errorMessage&&(this.errorMessage=null,r=true),this.paymentId=t,r&&this.syncUi();},onTerminalExit:()=>this.executeTerminalExit()},this.uiOptions),this.bootstrap(),this.unsubscribeSurface=Oe(t=>{this.handleSurfaceChange(t);}),this.config.mode==="inline"&&(this.modalOpen=true);}open(){this.config.mode!=="modal"||this.modalOpen||(this.modalOpen=true,ht(this.embed,this.config,()=>this.close()));}close(){this.config.mode==="modal"&&(this.modalOpen=false,mt(this.embed),this.config.onClose?.());}destroy(){this.destroyed||(this.destroyed=true,this.unsubscribeSurface?.(),this.unsubscribeSurface=null,this.poller.stop(),this.clearAppHandoffWatch?.(),this.clearAppHandoffWatch=null,this.clearPayWindowExpiryWatch(),this.ui?.destroy(),this.embed.destroy(),this.ui=null);}snapshotUiState(){return {phase:this.phase,session:this.session,sessionId:this.config.sessionId,committedMethod:this.committedMethod,paymentId:this.paymentId,verifiedPayer:this.verifiedPayer,verifyMatches:this.verifyMatches,errorMessage:this.errorMessage,loading:this.loading,mode:this.config.mode??"inline",exitMode:this.exitMode,appHandoffStatus:this.appHandoffStatus,mobileAppManualFallback:this.isMobileAppManualFallbackActive()}}syncUi(e){this.destroyed||(e&&"errorMessage"in e&&(this.errorMessage=e.errorMessage??null),e&&"loading"in e&&(this.loading=e.loading??false),e&&"exitMode"in e&&(this.exitMode=e.exitMode??null),this.ui?.update(this.snapshotUiState()));}async bootstrap(){try{let e=await this.bindPolicy();if(this.destroyed||(this.applyBoundUiOptions(e),this.applySession(e),this.destroyed))return;this.config.onReady?.(e),ce(e.status)?this.destroyed||this.syncUi({loading:!1}):(await this.routeIdleEntry(),this.destroyed||(this.syncUi({loading:!1}),this.poller.start(e)));}catch(e){this.handleBootstrapError(e);}}async bindPolicy(){let e=he({checkoutPolicy:this.config.checkoutPolicy,mobileApp:this.config.mobileApp});try{return await this.client.bindCheckoutPolicy(e)}catch(t){if(t instanceof I&&t.code==="payment-session.checkout-policy-conflict"){let i=await this.client.getSession();if(q(i))return i}throw t}}applyBoundUiOptions(e,t=B()){this.uiOptions=He(e,t),this.ui?.updateUiOptions(this.uiOptions);}handleSurfaceChange(e){if(this.destroyed||this.committedMethod)return;let t=this.session;!t||!q(t)||this.uiOptions.surface!==e&&(this.uiOptions=te(t.checkoutPolicy,t.mobileAppPolicy??"OFF",e),this.ui?.updateUiOptions(this.uiOptions),(this.phase==="choose-method"||this.phase==="loading")&&this.syncUi());}applySession(e,t){if(this.session=e,this.config.onSessionUpdate?.(e),e.transactionStatus==="DECLINED"&&e.status!=="COMPLETED"){this.methodSwitchInProgress=false,this.handleFailure({reason:"declined",session:e});return}if(e.status==="COMPLETED"){this.methodSwitchInProgress=false,this.handleSuccess(e);return}if(e.status==="EXPIRED"){this.methodSwitchInProgress=false,this.handleFailure({reason:"expired",session:e});return}if(e.status==="FAILED"){this.methodSwitchInProgress=false,this.handleFailure({reason:"failed",session:e});return}if(e.status==="CANCELLED"){this.methodSwitchInProgress=false,this.handleFailure({reason:"cancelled",session:e});return}if(this.isMobileAppManualFallbackActive()&&!t?.fromMethodSwitch){this.schedulePayWindowExpiryWatch(),this.syncUi();return}this.committedMethod=mi(e.checkoutMethod)??this.committedMethod,this.phase=this.resolveActivePhase(e),this.schedulePayWindowExpiryWatch(),this.syncUi();}schedulePayWindowExpiryWatch(){this.clearPayWindowExpiryWatch();let e=this.session;if(!e?.paymentExpiryAt||!se.PAY_WINDOW_PHASES.includes(this.phase))return;let t=_(e.paymentExpiryAt);if(t<=0){this.handlePayWindowExpired();return}this.payWindowExpiryTimer=setTimeout(()=>{this.handlePayWindowExpired();},t+250);}clearPayWindowExpiryWatch(){this.payWindowExpiryTimer!==null&&(clearTimeout(this.payWindowExpiryTimer),this.payWindowExpiryTimer=null);}async handlePayWindowExpired(){if(!(this.destroyed||!this.session?.paymentExpiryAt)){if(_(this.session.paymentExpiryAt)>0){this.schedulePayWindowExpiryWatch();return}if(se.PAY_WINDOW_PHASES.includes(this.phase))try{let e=await this.client.getSession();if(this.destroyed)return;this.applySession(e);}catch{this.destroyed||this.handleFailure({reason:"expired",session:this.session});}}}resolveActivePhase(e){return e.status==="AWAITING_PAYMENT"?e.checkoutMethod==="MOBILE_APP"||this.committedMethod==="mobileApp"?"mobile-app-active":e.checkoutMethod==="QR"||this.committedMethod==="qr"?"qr-active":"awaiting":e.phase==="PAYING"&&e.checkoutMethod==="MOBILE_APP"?"mobile-app-active":e.phase==="PAYING"&&e.checkoutMethod==="QR"?"qr-active":e.phase==="PAYING"&&e.checkoutMethod==="MANUAL"?this.phase==="manual-confirm"&&this.verifiedPayer?"manual-confirm":"manual-entry":e.phase==="IDLE"?this.phase==="manual-confirm"&&this.verifiedPayer?"manual-confirm":this.phase==="manual-picker"&&this.verifyMatches?"manual-picker":this.phase==="manual-entry"?"manual-entry":this.phase==="choose-method"?"choose-method":this.phase==="qr-active"&&this.committedMethod==="qr"?"qr-active":this.phase==="mobile-app-active"&&this.committedMethod==="mobileApp"?"mobile-app-active":!e.checkoutMethod&&ee(this.uiOptions.checkoutPolicy,this.uiOptions.mobileAppPolicy,this.uiOptions.surface)!=="chooser"?"loading":"choose-method":this.phase}handleSessionUpdate(e){this.destroyed||this.applySession(e);}handleFailure(e){if(this.destroyed)return;this.poller.stop(),this.clearPayWindowExpiryWatch(),this.loading=false;let t=e.session??this.session;if(e.reason==="expired")t&&this.config.onExpired?.(t);else {let i=e.error??(e.reason==="failed"||e.reason==="cancelled"||e.reason==="declined"?hi(e.reason):void 0);i&&this.config.onError?.(i);}this.terminalFailureReason=e.reason,this.phase=this.failurePhaseFromReason(e.reason),this.exitMode=this.resolveExitMode("failure",t),this.syncUi();}handleSuccess(e){this.destroyed||(this.poller.stop(),this.clearPayWindowExpiryWatch(),this.loading=false,this.config.onComplete?.(e),this.terminalFailureReason=null,this.phase="success",this.exitMode=this.resolveExitMode("success",e),this.syncUi());}executeTerminalExit(){if(this.destroyed)return;let e=this.session;if(this.phase==="success"&&e){if(this.config.redirectOnComplete&&e.successUrl){window.location.assign(Te(e.successUrl,{sessionId:e.sessionId,status:e.status,transactionId:e.transactionId}));return}}else if(this.phase==="expired"||this.phase==="failed"||this.phase==="cancelled"||this.phase==="declined"||this.phase==="invalid-session"){let t=e?.failureUrl??null;if(this.config.redirectOnFailure&&t){let i=this.terminalFailureReason==="expired"?Te(t,{sessionId:e?.sessionId??this.config.sessionId,status:e?.status??"EXPIRED"}):t;window.location.assign(i);return}}this.teardownView();}resolveExitMode(e,t){return e==="success"?this.config.redirectOnComplete&&t?.successUrl?"redirect":"close":this.config.redirectOnFailure&&t?.failureUrl?"redirect":"close"}failurePhaseFromReason(e){switch(e){case "expired":return "expired";case "failed":return "failed";case "cancelled":return "cancelled";case "declined":return "declined";case "invalid-session":return "invalid-session"}}teardownView(){this.config.mode==="modal"&&this.modalOpen&&this.close(),this.destroy();}handleBootstrapError(e){if(e instanceof I&&e.status===401){this.handleFailure({reason:"invalid-session",error:e,session:this.session});return}this.handleError(e);}handlePollError(e){let t=je(e);if(t.status===401){this.poller.stop(),this.handleFailure({reason:"invalid-session",error:t,session:this.session});return}if(t.code==="payment-session.not-attachable"){this.poller.stop(),this.handleFailure({reason:"expired",session:this.session});return}}handleError(e){let t=je(e);if(t.status===401){this.handleFailure({reason:"invalid-session",error:t,session:this.session});return}if(t.code==="payment-session.not-attachable"){this.handleFailure({reason:"expired",session:this.session});return}if(t.code==="payment-session.checkout-policy-not-bound"){(this.phase==="loading"||this.phase==="choose-method")&&(this.phase="error"),this.syncUi({errorMessage:t.detail||"Checkout is not ready yet. Please refresh and try again.",loading:false}),this.config.onError?.(t),this.poller.stop();return}(this.phase==="loading"||this.phase==="choose-method")&&(this.phase="error"),this.syncUi({errorMessage:t.detail,loading:false}),this.config.onError?.(t),this.poller.stop();}async routeIdleEntry(){if(this.destroyed||this.entryRoutingDone)return;let e=this.session;if(!e||ce(e.status))return;if(e.checkoutMethod){this.entryRoutingDone=true;return}if(e.phase!=="IDLE")return;let t=B(),{checkoutPolicy:i,mobileAppPolicy:r}=this.uiOptions,a=Re(i,r,t);a==="MOBILE_APP"?await this.startMobileAppFlow(false):a==="QR"?await this.chooseMethod("qr"):ee(i,r,t)==="auto-manual"?(this.phase="manual-entry",this.syncUi({loading:false})):(this.phase="choose-method",this.syncUi({loading:false})),this.entryRoutingDone=true;}openMobileApp(){Ye(this.config.sessionId);}beginMobileAppHandoff(){this.destroyed||(this.clearAppHandoffWatch?.(),this.clearAppHandoffWatch=null,this.appHandoffStatus="opening",this.syncUi(),this.openMobileApp(),this.clearAppHandoffWatch=Ot({onOpened:()=>{this.destroyed||(this.appHandoffStatus="opened",this.syncUi());},onFailed:()=>{this.destroyed||(this.appHandoffStatus="failed",this.syncUi());}}));}installZippy(){ae();}async startMobileAppFlow(e){if(this.session?.checkoutMethod==="MOBILE_APP"){this.committedMethod="mobileApp",this.phase="mobile-app-active",e&&this.beginMobileAppHandoff(),this.syncUi({loading:false});return}if(this.committedMethod&&this.committedMethod!=="mobileApp")return;let t=B();if(this.canStartAppClaim("MOBILE_APP",t)){e?(this.committedMethod="mobileApp",this.phase="mobile-app-active",this.beginMobileAppHandoff()):this.syncUi({errorMessage:null,loading:true});try{let i=await this.client.startMobileAppCheckout(t);if(this.committedMethod="mobileApp",this.applySession(i),this.destroyed)return;this.phase="mobile-app-active",this.syncUi({loading:!1});}catch(i){this.handleFlowError(i,"choose-method");}}}canStartAppClaim(e,t){if(!this.session||!q(this.session))return this.syncUi({errorMessage:"Checkout is not ready yet. Please refresh and try again.",loading:false}),false;let i=this.session.checkoutPolicy,r=this.session.mobileAppPolicy??"OFF";return J(i,r,t,e)?true:(this.syncUi({errorMessage:"This payment option is not available on your device.",loading:false}),false)}async chooseMethod(e){if(!this.methodSwitchInProgress&&!(this.committedMethod&&!(this.appHandoffStatus==="failed"&&this.committedMethod==="mobileApp"&&e!=="mobileApp"))){if(this.appHandoffStatus==="failed"&&this.committedMethod==="mobileApp"&&(e==="qr"||e==="manual")){await this.chooseFallbackMethod(e);return}if(e==="mobileApp"){await this.startMobileAppFlow(true);return}this.verifiedPayer=null,this.syncUi({errorMessage:null,loading:e==="qr"});try{if(e==="qr"){let t=B();if(!this.canStartAppClaim("QR",t))return;let i=await this.client.startQrCheckout(t);if(this.committedMethod="qr",this.applySession(i),this.destroyed)return;this.syncUi({loading:!1});}else this.phase="manual-entry",this.syncUi({loading:!1});}catch(t){this.handleFlowError(t,"choose-method");}}}async chooseFallbackMethod(e){if(!(this.appHandoffStatus!=="failed"||this.committedMethod!=="mobileApp"||this.methodSwitchInProgress)){if(this.clearAppHandoffWatch?.(),this.clearAppHandoffWatch=null,e==="manual"){this.methodSwitchInProgress=true,this.appHandoffStatus="idle",this.verifiedPayer=null,this.verifyMatches=null,this.lastVerifiedQuery=null,this.paymentId="",this.phase="manual-entry",this.syncUi({errorMessage:null,loading:false});return}this.methodSwitchInProgress=true,this.verifiedPayer=null,this.syncUi({errorMessage:null,loading:true});try{let t=B(),i=await this.client.startQrCheckout(t);if(this.destroyed)return;this.methodSwitchInProgress=!1,this.appHandoffStatus="idle",this.loading=!1,this.applySession(i,{fromMethodSwitch:!0});}catch(t){this.methodSwitchInProgress=false,this.handleFlowError(t,"mobile-app-active");}}}backToChooseMethod(){this.uiOptions.allowManualBack&&(this.committedMethod||this.loading&&this.verifiedPayer||(this.phase="choose-method",this.paymentId="",this.verifiedPayer=null,this.verifyMatches=null,this.lastVerifiedQuery=null,this.errorMessage=null,this.loading=false,this.syncUi({errorMessage:null,loading:false})));}backToManualEntry(){this.loading&&this.verifiedPayer||(this.phase="manual-entry",this.verifiedPayer=null,this.verifyMatches=null,this.lastVerifiedQuery=null,this.errorMessage=null,this.loading=false,this.syncUi({errorMessage:null,loading:false}));}backToMobileAppFallback(){this.loading&&this.verifiedPayer||this.isMobileAppManualFallbackActive()&&(this.methodSwitchInProgress=false,this.appHandoffStatus="failed",this.phase="mobile-app-active",this.paymentId="",this.verifiedPayer=null,this.verifyMatches=null,this.lastVerifiedQuery=null,this.errorMessage=null,this.loading=false,this.syncUi({errorMessage:null,loading:false}));}isMobileAppManualFallbackActive(){return this.committedMethod!=="mobileApp"?false:this.methodSwitchInProgress?true:this.session?.checkoutMethod==="MOBILE_APP"&&(this.phase==="manual-entry"||this.phase==="manual-picker"||this.phase==="manual-confirm")}selectPayer(e){this.loading||this.phase!=="manual-picker"||(this.verifiedPayer=e,this.phase="manual-confirm",this.errorMessage=null,this.syncUi({errorMessage:null,loading:false}));}async verify(e){if(this.paymentId=e,!ze(e)){this.syncUi({errorMessage:Ee(),loading:false});return}let t=$(e);this.syncUi({errorMessage:null,loading:true});try{let{items:i}=await this.client.verifyPayer(e);if(this.phase!=="manual-entry")return;this.lastVerifiedQuery=t,this.verifyMatches=null,i.length===1?(this.verifiedPayer=i[0],this.phase="manual-confirm"):(this.verifiedPayer=null,this.verifyMatches=i,this.phase="manual-picker"),this.syncUi({loading:!1});}catch(i){this.handleFlowError(i,"manual-entry");}}async attach(e){if(!this.verifiedPayer){this.syncUi({errorMessage:"Find your account before proceeding to pay.",loading:false});return}this.syncUi({errorMessage:null,loading:true});try{let t=await Le(this.client,this.verifiedPayer.paymentId);if(this.methodSwitchInProgress=!1,this.committedMethod="manual",this.applySession(t),this.destroyed)return;t.status==="AWAITING_PAYMENT"&&this.poller.start(t),this.syncUi({loading:!1});}catch(t){this.handleFlowError(t,"manual-confirm");}}handleFlowError(e,t){let i=je(e),r=yi(i,t);if(i.code==="payment-session.not-attachable"){this.handleFailure({reason:"expired",session:this.session});return}else if(i.code==="payment-session.checkout-method-conflict"){this.refreshAfterConflict(),this.syncUi({errorMessage:r,loading:false}),this.config.onError?.(i);return}else if(i.code==="payment-session.checkout-policy-not-bound"){this.syncUi({errorMessage:r,loading:false}),this.config.onError?.(i);return}else if(i.code==="payment-session.checkout-policy-denied"||i.code==="payment-session.checkout-policy-conflict"){this.refreshAfterConflict(),this.syncUi({errorMessage:r,loading:false}),this.config.onError?.(i);return}else this.phase=t;this.syncUi({errorMessage:r,loading:false}),this.config.onError?.(i);}async refreshAfterConflict(){try{let e=await this.client.getSession();q(e)&&this.applyBoundUiOptions(e),this.applySession(e);}catch{}}};se.PAY_WINDOW_PHASES=["qr-active","mobile-app-active","awaiting","manual-confirm"];var ge=se;function hi(n){return n==="failed"?new I({code:"payment-session.failed",status:400,title:"Payment failed",detail:"Something went wrong with this payment."}):n==="declined"?new I({code:"payment-session.declined",status:400,title:"Payment declined",detail:"Your payment was declined."}):new I({code:"payment-session.cancelled",status:400,title:"Payment cancelled",detail:"This payment was cancelled."})}function mi(n){return n==="QR"?"qr":n==="MANUAL"?"manual":n==="MOBILE_APP"?"mobileApp":null}function yi(n,e){return e==="manual-entry"&&(n.status===404||n.code.includes("not-found")||n.code.includes("payer-not-found")||n.code==="payer.not-found")?"No Zippy account found":n.detail?.trim()||"Something went wrong. Please try again."}function je(n){return n instanceof I?n:new I({code:"unknown",status:500,title:"Unexpected error",detail:n instanceof Error?n.message:"An unexpected error occurred"})}function pe(n){return new ge(n)}var Ve="zippy-pay-checkout",_t={"theme-primary":"primary","theme-primary-foreground":"primaryForeground","theme-background":"background","theme-surface":"surface","theme-text":"text","theme-text-muted":"textMuted","theme-border":"border","theme-error":"error","theme-success":"success","theme-border-radius":"borderRadius","theme-font-family":"fontFamily","theme-mode":"mode"},be=class extends HTMLElement{constructor(){super(...arguments);this.instance=null;}static get observedAttributes(){return ["mode","session-id","environment","checkout-policy","mobile-app-policy",...Object.keys(_t)]}connectedCallback(){this.mount();}disconnectedCallback(){this.unmount();}attributeChangedCallback(){this.isConnected&&(this.unmount(),this.mount());}set clientToken(t){this.dataset.clientToken=t,this.isConnected&&(this.unmount(),this.mount());}get clientToken(){return this.dataset.clientToken??this.getAttribute("client-token")??""}mount(){let t=this.readConfig();if(!t)return;this.innerHTML="";let i=t.mode??"inline",r;if(i==="inline"){let a=document.createElement("div");this.appendChild(a),r=a;}this.instance=pe({...t,container:r,mode:i,onReady:a=>this.dispatch("zippy-ready",a),onSessionUpdate:a=>this.dispatch("zippy-session-update",a),onComplete:a=>this.dispatch("zippy-complete",a),onExpired:a=>this.dispatch("zippy-expired",a),onError:a=>this.dispatch("zippy-error",a),onClose:()=>this.dispatch("zippy-close",null)}),t.mode==="modal"&&this.instance.open();}unmount(){this.instance?.destroy(),this.instance=null,this.innerHTML="";}readConfig(){let t=this.getAttribute("environment")??"production",i=this.getAttribute("session-id")??"",r=this.clientToken,a=this.getAttribute("mode")??"inline";if(!i||!r)return null;let o;try{o=j(t);}catch{return null}let s={};for(let[p,d]of Object.entries(_t)){let g=this.getAttribute(p);g&&(d==="mode"?s.mode=g:s[d]=g);}return {environment:o,sessionId:i,clientToken:r,mode:a,theme:s,checkoutPolicy:fi(this.getAttribute("checkout-policy")),mobileApp:gi(this.getAttribute("mobile-app-policy"))}}dispatch(t,i){this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:true,composed:true}));}open(){this.instance?.open();}close(){this.instance?.close();}destroy(){this.instance?.destroy(),this.instance=null;}};function fi(n){if(n==="QR"||n==="MANUAL")return n}function gi(n){if(n==="option"||n==="enforce")return {policy:n}}function Ge(){typeof customElements>"u"||customElements.get(Ve)||customElements.define(Ve,be);}var bi={create(n){let e=pe(n);return (n.mode??"inline")==="modal"&&e.open(),e}};Ge();var Ln=bi;exports.ANDROID_APP_PACKAGE=ie;exports.ANDROID_PLAY_STORE_NATIVE_URL=Pt;exports.APP_STORE_LINKS=ne;exports.CheckoutController=ge;exports.DEFAULT_THEME=pt;exports.E164_PHONE_PATTERN=et;exports.ELEMENT_TAG=Ve;exports.EMAIL_PATTERN=tt;exports.IOS_APP_STORE_NATIVE_URL=wt;exports.PAYMENT_ID_PATTERN=ke;exports.POLLABLE_STATUSES=xe;exports.PaymentSessionClient=G;exports.SessionPoller=K;exports.TERMINAL_STATUSES=Y;exports.ZIPPY_API_BASE_URLS=le;exports.ZIPPY_API_PATH_PREFIX=we;exports.ZippyPay=bi;exports.ZippyPayCheckoutElement=be;exports.ZippyPayError=I;exports.applyThemeToHost=Ie;exports.attachPayerWithRetry=Le;exports.buildAndroidPaymentIntentUrl=Nt;exports.buildBindPolicyRequest=he;exports.buildPaymentDeepLinkOpenUrl=Bt;exports.buildPaymentQrPayload=me;exports.createCheckout=pe;exports.default=Ln;exports.defineZippyPayCheckoutElement=Ge;exports.detectCheckoutSurface=B;exports.formatAmount=Ce;exports.getCountdownTarget=yt;exports.getPayWindowRemainingRatio=X;exports.getSoftIdleHint=Wt;exports.isAndroidDevice=Be;exports.isCheckoutPolicyBound=q;exports.isCheckoutStartAllowed=J;exports.isFullChooserPolicy=jt;exports.isPhoneDevice=Yt;exports.isTerminalStatus=ce;exports.isValidPayerQuery=ze;exports.isValidPaymentId=Rt;exports.isZippyEnvironment=Je;exports.msUntil=_;exports.normalizePayerQuery=$;exports.normalizePaymentId=V;exports.openAppStore=ae;exports.openPaymentDeepLink=Ye;exports.parseZippyEnvironment=j;exports.payerQueryValidationMessage=Ee;exports.paymentIdValidationMessage=Ht;exports.phaseFromSession=qt;exports.renderBrandedPaymentQrSvg=It;exports.renderPaymentQrMarkup=Qe;exports.renderPaymentQrSvg=Lt;exports.renderQrSvg=$e;exports.renderUrlQrMarkup=We;exports.resolveApiBaseUrl=Pe;exports.resolveAppStoreOpenUrl=De;exports.resolveAppStoreUrl=Vt;exports.resolveAutoStartMethod=Re;exports.resolveCheckoutUiOptions=Ue;exports.resolveCheckoutUiOptionsFromBound=te;exports.resolveCheckoutUiOptionsFromSession=He;exports.resolveEntryRouting=ee;exports.resolveMethodAvailability=vt;exports.resolveMobileAppPolicy=gt;exports.resolveTheme=lt;exports.shouldShowPayProgress=Ne;exports.subscribeCheckoutSurface=Oe;//# sourceMappingURL=index.cjs.map
|
|
951
1766
|
//# sourceMappingURL=index.cjs.map
|