@pelican-identity/vanilla 1.0.4

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 ADDED
@@ -0,0 +1,319 @@
1
+ # Pelican Identity React SDK
2
+
3
+ React SDK for Pelican authentication and identity verification on the web.
4
+ 👉 **Pelican Dashboard:** https://dash.pelicanidentity.com
5
+
6
+ ---
7
+
8
+ ## Installation
9
+
10
+ ### Using npm
11
+
12
+ ```bash
13
+ npm install @pelican-identity/react
14
+ ```
15
+
16
+ ### Using yarn
17
+
18
+ ```bash
19
+ yarn add @pelican-identity/react
20
+ ```
21
+
22
+ ### Using pnpm
23
+
24
+ ```bash
25
+ pnpm add @pelican-identity/react
26
+ ```
27
+
28
+ ---
29
+
30
+ ## Requirements
31
+
32
+ - React **17, 18, or 19**
33
+ - A modern browser environment
34
+ - A Pelican project configured in the Pelican dashboard
35
+
36
+ > This SDK is **browser-only** and must be used in client-side React components.
37
+
38
+ ---
39
+
40
+ ## Required Setup
41
+
42
+ ### 1. Whitelist your domain in Pelican Dashboard
43
+
44
+ You must add your website’s domain (e.g. `example.com`, `app.example.com`, or `localhost`) to your project’s whitelist in the Pelican dashboard.
45
+
46
+ Pelican validates **explicit domain ownership** on every authentication attempt.
47
+ 👉 **Pelican Dashboard:** https://dash.pelicanidentity.com
48
+
49
+ ---
50
+
51
+ ### 2. Client-side usage only (important)
52
+
53
+ If you are using **Next.js, Remix, or similar frameworks**, ensure the SDK is only initialized on the client.
54
+
55
+ For Next.js App Router:
56
+
57
+ ```tsx
58
+ "use client";
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Usage
64
+
65
+ ### Basic Usage
66
+
67
+ ```tsx
68
+ import { PelicanAuth } from "@pelican-identity/react";
69
+
70
+ export default function LoginPage() {
71
+ return (
72
+ <PelicanAuth
73
+ publicKey="your-business-public-key"
74
+ projectId="your-project-id"
75
+ authType="login"
76
+ onSuccess={(data) => {
77
+ console.log("Authentication successful:", data);
78
+ }}
79
+ onError={(error) => {
80
+ console.error("Authentication failed:", error);
81
+ }}
82
+ />
83
+ );
84
+ }
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Complete Example
90
+
91
+ ```tsx
92
+ "use client";
93
+
94
+ import { useState } from "react";
95
+ import { PelicanAuth } from "@pelican-identity/react";
96
+
97
+ export default function Login() {
98
+ const [user, setUser] = useState(null);
99
+ const [error, setError] = useState<string | null>(null);
100
+
101
+ return (
102
+ <div style={{ maxWidth: 400, margin: "auto" }}>
103
+ <h2>Login to MyApp</h2>
104
+
105
+ <PelicanAuth
106
+ publicKey="your-business-public-key"
107
+ projectId="your-project-id"
108
+ authType="login"
109
+ onSuccess={(data) => {
110
+ setUser(data);
111
+ setError(null);
112
+ }}
113
+ onError={(err) => {
114
+ setError(err.message);
115
+ setUser(null);
116
+ }}
117
+ />
118
+
119
+ {user && <p>Authenticated successfully</p>}
120
+ {error && <p style={{ color: "red" }}>{error}</p>}
121
+ </div>
122
+ );
123
+ }
124
+ ```
125
+
126
+ ---
127
+
128
+ ## API Reference
129
+
130
+ ### `PelicanAuth`
131
+
132
+ Main authentication component.
133
+
134
+ #### Props
135
+
136
+ | Prop | Type | Required | Description |
137
+ | ----------------- | ------------------------------------------ | -------- | --------------------------------------------------- |
138
+ | `publicKey` | `string` | ✅ | Business public key from Pelican dashboard |
139
+ | `projectId` | `string` | ✅ | Project ID from Pelican dashboard |
140
+ | `authType` | `"signup" \| "login" \| "id-verification"` | ✅ | Authentication flow |
141
+ | `onSuccess` | `(data: IdentityResult) => void` | ✅ | Success callback containing authenticated user data |
142
+ | `onError` | `(error: Error) => void` | Optional | Error callback |
143
+ | `buttonComponent` | `ReactNode` | Optional | Custom trigger UI |
144
+ | `forceQRCode` | `boolean` | Optional | Always show QR code instead of deep link |
145
+ | `continuousMode` | `boolean` | Optional | Automatically restart auth after completion |
146
+
147
+ > If `publicKey` or `projectId` is invalid, Pelican will fail immediately.
148
+
149
+ ## 👉 **Pelican Dashboard:** https://dash.pelicanidentity.com
150
+
151
+ ## Authentication Flow
152
+
153
+ Pelican Web authentication works using:
154
+
155
+ - **QR codes** (desktop → mobile)
156
+ - **Deep links** (mobile browsers)
157
+
158
+ The SDK automatically chooses the best option based on the user’s device.
159
+
160
+ ---
161
+
162
+ ## Authentication Response
163
+
164
+ When authentication completes successfully, Pelican returns a structured **identity result** to your application via the `onSuccess` callback.
165
+
166
+ ---
167
+
168
+ ## Success Callback
169
+
170
+ ```ts
171
+ onSuccess: (result: IdentityResult) => void;
172
+ ```
173
+
174
+ ---
175
+
176
+ ## IdentityResult
177
+
178
+ ```ts
179
+ interface IdentityResult {
180
+ /** Deterministic unique user identifier specific to your business */
181
+ user_id: string;
182
+
183
+ /** Basic user profile and contact information (if available) */
184
+ user_data?: IUserData;
185
+
186
+ /** Identity document and liveness verification data */
187
+ id_verification: IKycData;
188
+
189
+ /** Download URLs for verified identity documents */
190
+ id_downloadurls?: {
191
+ front_of_card?: string;
192
+ back_of_card?: string;
193
+ };
194
+ }
195
+ ```
196
+
197
+ ---
198
+
199
+ ## `user_id`
200
+
201
+ - A **stable, deterministic identifier** generated by Pelican.
202
+ - Unique **per business**, not global.
203
+ - Safe to store and use as your internal user reference.
204
+ - Does **not** expose personally identifiable information (PII).
205
+
206
+ ---
207
+
208
+ ## User Data (`user_data`)
209
+
210
+ Returned when available and permitted by the authentication flow.
211
+
212
+ ```ts
213
+ interface IUserData {
214
+ first_name?: string;
215
+ last_name?: string;
216
+ other_names?: string;
217
+ email?: IEmail;
218
+ phone?: IPhone;
219
+ dob?: string | Date;
220
+ gender?: "male" | "female" | "other";
221
+ country?: string;
222
+ state?: string;
223
+ city?: string;
224
+ address?: string;
225
+ occupation?: string;
226
+ company?: string;
227
+ website?: string;
228
+ }
229
+ ```
230
+
231
+ All contact data returned by Pelican is **verified**.
232
+
233
+ ---
234
+
235
+ ## Identity Verification (`id_verification`)
236
+
237
+ Returned for flows involving identity verification or KYC.
238
+
239
+ ```ts
240
+ interface IKycData {
241
+ id: number;
242
+ status?: "Approved" | "Declined" | "In Review";
243
+ document_type?:
244
+ | "national id card"
245
+ | "passport"
246
+ | "driver's license"
247
+ | "residence permit";
248
+ document_number?: string;
249
+ nationality?: string;
250
+ age?: number;
251
+ verified_at?: string | Date;
252
+ }
253
+ ```
254
+
255
+ ---
256
+
257
+ ## Authentication Flow Differences
258
+
259
+ | Auth Type | Returned Data |
260
+ | ----------------- | ------------------------------------------- |
261
+ | `signup` | `user_id`, basic `user_data` |
262
+ | `login` | `user_id` |
263
+ | `id-verification` | `user_id`, `id_verification`, document URLs |
264
+
265
+ Returned fields depend on:
266
+
267
+ - User consent
268
+ - Project configuration
269
+ - Regulatory requirements
270
+
271
+ ---
272
+
273
+ ## Troubleshooting
274
+
275
+ ### Blank page or no QR code
276
+
277
+ - Ensure the SDK is running client-side
278
+ - Confirm your domain is whitelisted
279
+
280
+ ### Authentication never completes
281
+
282
+ - Ensure the browser tab regains focus after mobile authentication
283
+
284
+ ### Unsupported authentication type
285
+
286
+ - Ensure `authType` is valid
287
+
288
+ ### Billing issues, please contact this site owner
289
+
290
+ - Ensure your business wallet has sufficient balance
291
+ - Low balance alerts can be configured in the Pelican dashboard
292
+ 👉 **Pelican Dashboard:** https://dash.pelicanidentity.com
293
+
294
+ ---
295
+
296
+ ## Security Notes
297
+
298
+ - All identity data is transmitted **encrypted**.
299
+ - Pelican never exposes raw credentials.
300
+ - Identifiers are scoped per business.
301
+ - Domains are validated on every authentication request.
302
+
303
+ ---
304
+
305
+ ### Final note
306
+
307
+ Pelican deliberately separates:
308
+
309
+ - **Identity** (who the user is)
310
+ - **Authentication** (this session)
311
+ - **Verification** (confidence level)
312
+
313
+ This ensures your web application remains secure, flexible, and compliant.
314
+
315
+ ---
316
+
317
+ ## License
318
+
319
+ MIT
@@ -0,0 +1,5 @@
1
+ import { PelicanWebAuthProps } from '@pelican-identity/auth-core';
2
+
3
+ declare function createPelicanAuth(containerId: string, config: PelicanWebAuthProps): () => void;
4
+
5
+ export { createPelicanAuth };
@@ -0,0 +1,5 @@
1
+ import { PelicanWebAuthProps } from '@pelican-identity/auth-core';
2
+
3
+ declare function createPelicanAuth(containerId: string, config: PelicanWebAuthProps): () => void;
4
+
5
+ export { createPelicanAuth };
@@ -0,0 +1,103 @@
1
+ var Pelican=(function(exports){'use strict';var li=Object.create;var Or=Object.defineProperty;var ui=Object.getOwnPropertyDescriptor;var hi=Object.getOwnPropertyNames;var di=Object.getPrototypeOf,xi=Object.prototype.hasOwnProperty;var Fr=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var et=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var gi=(n,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of hi(e))!xi.call(n,l)&&l!==i&&Or(n,l,{get:()=>e[l],enumerable:!(a=ui(e,l))||a.enumerable});return n};var pi=(n,e,i)=>(i=n!=null?li(di(n)):{},gi(!n||!n.__esModule?Or(i,"default",{value:n,enumerable:true}):i,n));var Kr=et(()=>{});var Hr=et((_f,Ee)=>{(function(n){var e=function(r){var o,f=new Float64Array(16);if(r)for(o=0;o<r.length;o++)f[o]=r[o];return f},i=function(){throw new Error("no PRNG")},a=new Uint8Array(16),l=new Uint8Array(32);l[0]=9;var h=e(),p=e([1]),m=e([56129,1]),C=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),J=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),V=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),rt=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),it=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function ot(r,o,f,t){r[o]=f>>24&255,r[o+1]=f>>16&255,r[o+2]=f>>8&255,r[o+3]=f&255,r[o+4]=t>>24&255,r[o+5]=t>>16&255,r[o+6]=t>>8&255,r[o+7]=t&255;}function bt(r,o,f,t,s){var u,d=0;for(u=0;u<s;u++)d|=r[o+u]^f[t+u];return (1&d-1>>>8)-1}function wt(r,o,f,t){return bt(r,o,f,t,16)}function Mt(r,o,f,t){return bt(r,o,f,t,32)}function Bt(r,o,f,t){for(var s=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,u=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,d=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,b=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,A=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,L=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,B=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,W=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,M=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,N=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,j=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,O=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,Y=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,z=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,q=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,D=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,T=s,R=u,S=d,I=b,U=A,_=L,x=B,g=W,v=M,y=N,w=j,E=O,P=Y,F=z,H=q,K=D,c,Z=0;Z<20;Z+=2)c=T+P|0,U^=c<<7|c>>>25,c=U+T|0,v^=c<<9|c>>>23,c=v+U|0,P^=c<<13|c>>>19,c=P+v|0,T^=c<<18|c>>>14,c=_+R|0,y^=c<<7|c>>>25,c=y+_|0,F^=c<<9|c>>>23,c=F+y|0,R^=c<<13|c>>>19,c=R+F|0,_^=c<<18|c>>>14,c=w+x|0,H^=c<<7|c>>>25,c=H+w|0,S^=c<<9|c>>>23,c=S+H|0,x^=c<<13|c>>>19,c=x+S|0,w^=c<<18|c>>>14,c=K+E|0,I^=c<<7|c>>>25,c=I+K|0,g^=c<<9|c>>>23,c=g+I|0,E^=c<<13|c>>>19,c=E+g|0,K^=c<<18|c>>>14,c=T+I|0,R^=c<<7|c>>>25,c=R+T|0,S^=c<<9|c>>>23,c=S+R|0,I^=c<<13|c>>>19,c=I+S|0,T^=c<<18|c>>>14,c=_+U|0,x^=c<<7|c>>>25,c=x+_|0,g^=c<<9|c>>>23,c=g+x|0,U^=c<<13|c>>>19,c=U+g|0,_^=c<<18|c>>>14,c=w+y|0,E^=c<<7|c>>>25,c=E+w|0,v^=c<<9|c>>>23,c=v+E|0,y^=c<<13|c>>>19,c=y+v|0,w^=c<<18|c>>>14,c=K+H|0,P^=c<<7|c>>>25,c=P+K|0,F^=c<<9|c>>>23,c=F+P|0,H^=c<<13|c>>>19,c=H+F|0,K^=c<<18|c>>>14;T=T+s|0,R=R+u|0,S=S+d|0,I=I+b|0,U=U+A|0,_=_+L|0,x=x+B|0,g=g+W|0,v=v+M|0,y=y+N|0,w=w+j|0,E=E+O|0,P=P+Y|0,F=F+z|0,H=H+q|0,K=K+D|0,r[0]=T>>>0&255,r[1]=T>>>8&255,r[2]=T>>>16&255,r[3]=T>>>24&255,r[4]=R>>>0&255,r[5]=R>>>8&255,r[6]=R>>>16&255,r[7]=R>>>24&255,r[8]=S>>>0&255,r[9]=S>>>8&255,r[10]=S>>>16&255,r[11]=S>>>24&255,r[12]=I>>>0&255,r[13]=I>>>8&255,r[14]=I>>>16&255,r[15]=I>>>24&255,r[16]=U>>>0&255,r[17]=U>>>8&255,r[18]=U>>>16&255,r[19]=U>>>24&255,r[20]=_>>>0&255,r[21]=_>>>8&255,r[22]=_>>>16&255,r[23]=_>>>24&255,r[24]=x>>>0&255,r[25]=x>>>8&255,r[26]=x>>>16&255,r[27]=x>>>24&255,r[28]=g>>>0&255,r[29]=g>>>8&255,r[30]=g>>>16&255,r[31]=g>>>24&255,r[32]=v>>>0&255,r[33]=v>>>8&255,r[34]=v>>>16&255,r[35]=v>>>24&255,r[36]=y>>>0&255,r[37]=y>>>8&255,r[38]=y>>>16&255,r[39]=y>>>24&255,r[40]=w>>>0&255,r[41]=w>>>8&255,r[42]=w>>>16&255,r[43]=w>>>24&255,r[44]=E>>>0&255,r[45]=E>>>8&255,r[46]=E>>>16&255,r[47]=E>>>24&255,r[48]=P>>>0&255,r[49]=P>>>8&255,r[50]=P>>>16&255,r[51]=P>>>24&255,r[52]=F>>>0&255,r[53]=F>>>8&255,r[54]=F>>>16&255,r[55]=F>>>24&255,r[56]=H>>>0&255,r[57]=H>>>8&255,r[58]=H>>>16&255,r[59]=H>>>24&255,r[60]=K>>>0&255,r[61]=K>>>8&255,r[62]=K>>>16&255,r[63]=K>>>24&255;}function De(r,o,f,t){for(var s=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,u=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,d=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,b=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,A=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,L=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,B=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,W=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,M=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,N=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,j=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,O=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,Y=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,z=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,q=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,D=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,T=s,R=u,S=d,I=b,U=A,_=L,x=B,g=W,v=M,y=N,w=j,E=O,P=Y,F=z,H=q,K=D,c,Z=0;Z<20;Z+=2)c=T+P|0,U^=c<<7|c>>>25,c=U+T|0,v^=c<<9|c>>>23,c=v+U|0,P^=c<<13|c>>>19,c=P+v|0,T^=c<<18|c>>>14,c=_+R|0,y^=c<<7|c>>>25,c=y+_|0,F^=c<<9|c>>>23,c=F+y|0,R^=c<<13|c>>>19,c=R+F|0,_^=c<<18|c>>>14,c=w+x|0,H^=c<<7|c>>>25,c=H+w|0,S^=c<<9|c>>>23,c=S+H|0,x^=c<<13|c>>>19,c=x+S|0,w^=c<<18|c>>>14,c=K+E|0,I^=c<<7|c>>>25,c=I+K|0,g^=c<<9|c>>>23,c=g+I|0,E^=c<<13|c>>>19,c=E+g|0,K^=c<<18|c>>>14,c=T+I|0,R^=c<<7|c>>>25,c=R+T|0,S^=c<<9|c>>>23,c=S+R|0,I^=c<<13|c>>>19,c=I+S|0,T^=c<<18|c>>>14,c=_+U|0,x^=c<<7|c>>>25,c=x+_|0,g^=c<<9|c>>>23,c=g+x|0,U^=c<<13|c>>>19,c=U+g|0,_^=c<<18|c>>>14,c=w+y|0,E^=c<<7|c>>>25,c=E+w|0,v^=c<<9|c>>>23,c=v+E|0,y^=c<<13|c>>>19,c=y+v|0,w^=c<<18|c>>>14,c=K+H|0,P^=c<<7|c>>>25,c=P+K|0,F^=c<<9|c>>>23,c=F+P|0,H^=c<<13|c>>>19,c=H+F|0,K^=c<<18|c>>>14;r[0]=T>>>0&255,r[1]=T>>>8&255,r[2]=T>>>16&255,r[3]=T>>>24&255,r[4]=_>>>0&255,r[5]=_>>>8&255,r[6]=_>>>16&255,r[7]=_>>>24&255,r[8]=w>>>0&255,r[9]=w>>>8&255,r[10]=w>>>16&255,r[11]=w>>>24&255,r[12]=K>>>0&255,r[13]=K>>>8&255,r[14]=K>>>16&255,r[15]=K>>>24&255,r[16]=x>>>0&255,r[17]=x>>>8&255,r[18]=x>>>16&255,r[19]=x>>>24&255,r[20]=g>>>0&255,r[21]=g>>>8&255,r[22]=g>>>16&255,r[23]=g>>>24&255,r[24]=v>>>0&255,r[25]=v>>>8&255,r[26]=v>>>16&255,r[27]=v>>>24&255,r[28]=y>>>0&255,r[29]=y>>>8&255,r[30]=y>>>16&255,r[31]=y>>>24&255;}function Rt(r,o,f,t){Bt(r,o,f,t);}function Dt(r,o,f,t){De(r,o,f,t);}var xt=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function vt(r,o,f,t,s,u,d){var b=new Uint8Array(16),A=new Uint8Array(64),L,B;for(B=0;B<16;B++)b[B]=0;for(B=0;B<8;B++)b[B]=u[B];for(;s>=64;){for(Rt(A,b,d,xt),B=0;B<64;B++)r[o+B]=f[t+B]^A[B];for(L=1,B=8;B<16;B++)L=L+(b[B]&255)|0,b[B]=L&255,L>>>=8;s-=64,o+=64,t+=64;}if(s>0)for(Rt(A,b,d,xt),B=0;B<s;B++)r[o+B]=f[t+B]^A[B];return 0}function Tt(r,o,f,t,s){var u=new Uint8Array(16),d=new Uint8Array(64),b,A;for(A=0;A<16;A++)u[A]=0;for(A=0;A<8;A++)u[A]=t[A];for(;f>=64;){for(Rt(d,u,s,xt),A=0;A<64;A++)r[o+A]=d[A];for(b=1,A=8;A<16;A++)b=b+(u[A]&255)|0,u[A]=b&255,b>>>=8;f-=64,o+=64;}if(f>0)for(Rt(d,u,s,xt),A=0;A<f;A++)r[o+A]=d[A];return 0}function $t(r,o,f,t,s){var u=new Uint8Array(32);Dt(u,t,s,xt);for(var d=new Uint8Array(8),b=0;b<8;b++)d[b]=t[b+16];return Tt(r,o,f,d,u)}function qe(r,o,f,t,s,u,d){var b=new Uint8Array(32);Dt(b,u,d,xt);for(var A=new Uint8Array(8),L=0;L<8;L++)A[L]=u[L+16];return vt(r,o,f,t,s,A,b)}var xe=function(r){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var o,f,t,s,u,d,b,A;o=r[0]&255|(r[1]&255)<<8,this.r[0]=o&8191,f=r[2]&255|(r[3]&255)<<8,this.r[1]=(o>>>13|f<<3)&8191,t=r[4]&255|(r[5]&255)<<8,this.r[2]=(f>>>10|t<<6)&7939,s=r[6]&255|(r[7]&255)<<8,this.r[3]=(t>>>7|s<<9)&8191,u=r[8]&255|(r[9]&255)<<8,this.r[4]=(s>>>4|u<<12)&255,this.r[5]=u>>>1&8190,d=r[10]&255|(r[11]&255)<<8,this.r[6]=(u>>>14|d<<2)&8191,b=r[12]&255|(r[13]&255)<<8,this.r[7]=(d>>>11|b<<5)&8065,A=r[14]&255|(r[15]&255)<<8,this.r[8]=(b>>>8|A<<8)&8191,this.r[9]=A>>>5&127,this.pad[0]=r[16]&255|(r[17]&255)<<8,this.pad[1]=r[18]&255|(r[19]&255)<<8,this.pad[2]=r[20]&255|(r[21]&255)<<8,this.pad[3]=r[22]&255|(r[23]&255)<<8,this.pad[4]=r[24]&255|(r[25]&255)<<8,this.pad[5]=r[26]&255|(r[27]&255)<<8,this.pad[6]=r[28]&255|(r[29]&255)<<8,this.pad[7]=r[30]&255|(r[31]&255)<<8;};xe.prototype.blocks=function(r,o,f){for(var t=this.fin?0:2048,s,u,d,b,A,L,B,W,M,N,j,O,Y,z,q,D,T,R,S,I=this.h[0],U=this.h[1],_=this.h[2],x=this.h[3],g=this.h[4],v=this.h[5],y=this.h[6],w=this.h[7],E=this.h[8],P=this.h[9],F=this.r[0],H=this.r[1],K=this.r[2],c=this.r[3],Z=this.r[4],X=this.r[5],tt=this.r[6],$=this.r[7],Q=this.r[8],G=this.r[9];f>=16;)s=r[o+0]&255|(r[o+1]&255)<<8,I+=s&8191,u=r[o+2]&255|(r[o+3]&255)<<8,U+=(s>>>13|u<<3)&8191,d=r[o+4]&255|(r[o+5]&255)<<8,_+=(u>>>10|d<<6)&8191,b=r[o+6]&255|(r[o+7]&255)<<8,x+=(d>>>7|b<<9)&8191,A=r[o+8]&255|(r[o+9]&255)<<8,g+=(b>>>4|A<<12)&8191,v+=A>>>1&8191,L=r[o+10]&255|(r[o+11]&255)<<8,y+=(A>>>14|L<<2)&8191,B=r[o+12]&255|(r[o+13]&255)<<8,w+=(L>>>11|B<<5)&8191,W=r[o+14]&255|(r[o+15]&255)<<8,E+=(B>>>8|W<<8)&8191,P+=W>>>5|t,M=0,N=M,N+=I*F,N+=U*(5*G),N+=_*(5*Q),N+=x*(5*$),N+=g*(5*tt),M=N>>>13,N&=8191,N+=v*(5*X),N+=y*(5*Z),N+=w*(5*c),N+=E*(5*K),N+=P*(5*H),M+=N>>>13,N&=8191,j=M,j+=I*H,j+=U*F,j+=_*(5*G),j+=x*(5*Q),j+=g*(5*$),M=j>>>13,j&=8191,j+=v*(5*tt),j+=y*(5*X),j+=w*(5*Z),j+=E*(5*c),j+=P*(5*K),M+=j>>>13,j&=8191,O=M,O+=I*K,O+=U*H,O+=_*F,O+=x*(5*G),O+=g*(5*Q),M=O>>>13,O&=8191,O+=v*(5*$),O+=y*(5*tt),O+=w*(5*X),O+=E*(5*Z),O+=P*(5*c),M+=O>>>13,O&=8191,Y=M,Y+=I*c,Y+=U*K,Y+=_*H,Y+=x*F,Y+=g*(5*G),M=Y>>>13,Y&=8191,Y+=v*(5*Q),Y+=y*(5*$),Y+=w*(5*tt),Y+=E*(5*X),Y+=P*(5*Z),M+=Y>>>13,Y&=8191,z=M,z+=I*Z,z+=U*c,z+=_*K,z+=x*H,z+=g*F,M=z>>>13,z&=8191,z+=v*(5*G),z+=y*(5*Q),z+=w*(5*$),z+=E*(5*tt),z+=P*(5*X),M+=z>>>13,z&=8191,q=M,q+=I*X,q+=U*Z,q+=_*c,q+=x*K,q+=g*H,M=q>>>13,q&=8191,q+=v*F,q+=y*(5*G),q+=w*(5*Q),q+=E*(5*$),q+=P*(5*tt),M+=q>>>13,q&=8191,D=M,D+=I*tt,D+=U*X,D+=_*Z,D+=x*c,D+=g*K,M=D>>>13,D&=8191,D+=v*H,D+=y*F,D+=w*(5*G),D+=E*(5*Q),D+=P*(5*$),M+=D>>>13,D&=8191,T=M,T+=I*$,T+=U*tt,T+=_*X,T+=x*Z,T+=g*c,M=T>>>13,T&=8191,T+=v*K,T+=y*H,T+=w*F,T+=E*(5*G),T+=P*(5*Q),M+=T>>>13,T&=8191,R=M,R+=I*Q,R+=U*$,R+=_*tt,R+=x*X,R+=g*Z,M=R>>>13,R&=8191,R+=v*c,R+=y*K,R+=w*H,R+=E*F,R+=P*(5*G),M+=R>>>13,R&=8191,S=M,S+=I*G,S+=U*Q,S+=_*$,S+=x*tt,S+=g*X,M=S>>>13,S&=8191,S+=v*Z,S+=y*c,S+=w*K,S+=E*H,S+=P*F,M+=S>>>13,S&=8191,M=(M<<2)+M|0,M=M+N|0,N=M&8191,M=M>>>13,j+=M,I=N,U=j,_=O,x=Y,g=z,v=q,y=D,w=T,E=R,P=S,o+=16,f-=16;this.h[0]=I,this.h[1]=U,this.h[2]=_,this.h[3]=x,this.h[4]=g,this.h[5]=v,this.h[6]=y,this.h[7]=w,this.h[8]=E,this.h[9]=P;},xe.prototype.finish=function(r,o){var f=new Uint16Array(10),t,s,u,d;if(this.leftover){for(d=this.leftover,this.buffer[d++]=1;d<16;d++)this.buffer[d]=0;this.fin=1,this.blocks(this.buffer,0,16);}for(t=this.h[1]>>>13,this.h[1]&=8191,d=2;d<10;d++)this.h[d]+=t,t=this.h[d]>>>13,this.h[d]&=8191;for(this.h[0]+=t*5,t=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=t,t=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=t,f[0]=this.h[0]+5,t=f[0]>>>13,f[0]&=8191,d=1;d<10;d++)f[d]=this.h[d]+t,t=f[d]>>>13,f[d]&=8191;for(f[9]-=8192,s=(t^1)-1,d=0;d<10;d++)f[d]&=s;for(s=~s,d=0;d<10;d++)this.h[d]=this.h[d]&s|f[d];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,u=this.h[0]+this.pad[0],this.h[0]=u&65535,d=1;d<8;d++)u=(this.h[d]+this.pad[d]|0)+(u>>>16)|0,this.h[d]=u&65535;r[o+0]=this.h[0]>>>0&255,r[o+1]=this.h[0]>>>8&255,r[o+2]=this.h[1]>>>0&255,r[o+3]=this.h[1]>>>8&255,r[o+4]=this.h[2]>>>0&255,r[o+5]=this.h[2]>>>8&255,r[o+6]=this.h[3]>>>0&255,r[o+7]=this.h[3]>>>8&255,r[o+8]=this.h[4]>>>0&255,r[o+9]=this.h[4]>>>8&255,r[o+10]=this.h[5]>>>0&255,r[o+11]=this.h[5]>>>8&255,r[o+12]=this.h[6]>>>0&255,r[o+13]=this.h[6]>>>8&255,r[o+14]=this.h[7]>>>0&255,r[o+15]=this.h[7]>>>8&255;},xe.prototype.update=function(r,o,f){var t,s;if(this.leftover){for(s=16-this.leftover,s>f&&(s=f),t=0;t<s;t++)this.buffer[this.leftover+t]=r[o+t];if(f-=s,o+=s,this.leftover+=s,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0;}if(f>=16&&(s=f-f%16,this.blocks(r,o,s),o+=s,f-=s),f){for(t=0;t<f;t++)this.buffer[this.leftover+t]=r[o+t];this.leftover+=f;}};function Ye(r,o,f,t,s,u){var d=new xe(u);return d.update(f,t,s),d.finish(r,o),0}function Sr(r,o,f,t,s,u){var d=new Uint8Array(16);return Ye(d,0,f,t,s,u),wt(r,o,d,0)}function Oe(r,o,f,t,s){var u;if(f<32)return -1;for(qe(r,0,o,0,f,t,s),Ye(r,16,r,32,f-32,r),u=0;u<16;u++)r[u]=0;return 0}function Fe(r,o,f,t,s){var u,d=new Uint8Array(32);if(f<32||($t(d,0,32,t,s),Sr(o,16,o,32,f-32,d)!==0))return -1;for(qe(r,0,o,0,f,t,s),u=0;u<32;u++)r[u]=0;return 0}function It(r,o){var f;for(f=0;f<16;f++)r[f]=o[f]|0;}function Ke(r){var o,f,t=1;for(o=0;o<16;o++)f=r[o]+t+65535,t=Math.floor(f/65536),r[o]=f-t*65536;r[0]+=t-1+37*(t-1);}function Jt(r,o,f){for(var t,s=~(f-1),u=0;u<16;u++)t=s&(r[u]^o[u]),r[u]^=t,o[u]^=t;}function Zt(r,o){var f,t,s,u=e(),d=e();for(f=0;f<16;f++)d[f]=o[f];for(Ke(d),Ke(d),Ke(d),t=0;t<2;t++){for(u[0]=d[0]-65517,f=1;f<15;f++)u[f]=d[f]-65535-(u[f-1]>>16&1),u[f-1]&=65535;u[15]=d[15]-32767-(u[14]>>16&1),s=u[15]>>16&1,u[14]&=65535,Jt(d,u,1-s);}for(f=0;f<16;f++)r[2*f]=d[f]&255,r[2*f+1]=d[f]>>8;}function Mr(r,o){var f=new Uint8Array(32),t=new Uint8Array(32);return Zt(f,r),Zt(t,o),Mt(f,0,t,0)}function Tr(r){var o=new Uint8Array(32);return Zt(o,r),o[0]&1}function He(r,o){var f;for(f=0;f<16;f++)r[f]=o[2*f]+(o[2*f+1]<<8);r[15]&=32767;}function At(r,o,f){for(var t=0;t<16;t++)r[t]=o[t]+f[t];}function _t(r,o,f){for(var t=0;t<16;t++)r[t]=o[t]-f[t];}function k(r,o,f){var t,s,u=0,d=0,b=0,A=0,L=0,B=0,W=0,M=0,N=0,j=0,O=0,Y=0,z=0,q=0,D=0,T=0,R=0,S=0,I=0,U=0,_=0,x=0,g=0,v=0,y=0,w=0,E=0,P=0,F=0,H=0,K=0,c=f[0],Z=f[1],X=f[2],tt=f[3],$=f[4],Q=f[5],G=f[6],ut=f[7],ft=f[8],at=f[9],ct=f[10],lt=f[11],dt=f[12],gt=f[13],pt=f[14],yt=f[15];t=o[0],u+=t*c,d+=t*Z,b+=t*X,A+=t*tt,L+=t*$,B+=t*Q,W+=t*G,M+=t*ut,N+=t*ft,j+=t*at,O+=t*ct,Y+=t*lt,z+=t*dt,q+=t*gt,D+=t*pt,T+=t*yt,t=o[1],d+=t*c,b+=t*Z,A+=t*X,L+=t*tt,B+=t*$,W+=t*Q,M+=t*G,N+=t*ut,j+=t*ft,O+=t*at,Y+=t*ct,z+=t*lt,q+=t*dt,D+=t*gt,T+=t*pt,R+=t*yt,t=o[2],b+=t*c,A+=t*Z,L+=t*X,B+=t*tt,W+=t*$,M+=t*Q,N+=t*G,j+=t*ut,O+=t*ft,Y+=t*at,z+=t*ct,q+=t*lt,D+=t*dt,T+=t*gt,R+=t*pt,S+=t*yt,t=o[3],A+=t*c,L+=t*Z,B+=t*X,W+=t*tt,M+=t*$,N+=t*Q,j+=t*G,O+=t*ut,Y+=t*ft,z+=t*at,q+=t*ct,D+=t*lt,T+=t*dt,R+=t*gt,S+=t*pt,I+=t*yt,t=o[4],L+=t*c,B+=t*Z,W+=t*X,M+=t*tt,N+=t*$,j+=t*Q,O+=t*G,Y+=t*ut,z+=t*ft,q+=t*at,D+=t*ct,T+=t*lt,R+=t*dt,S+=t*gt,I+=t*pt,U+=t*yt,t=o[5],B+=t*c,W+=t*Z,M+=t*X,N+=t*tt,j+=t*$,O+=t*Q,Y+=t*G,z+=t*ut,q+=t*ft,D+=t*at,T+=t*ct,R+=t*lt,S+=t*dt,I+=t*gt,U+=t*pt,_+=t*yt,t=o[6],W+=t*c,M+=t*Z,N+=t*X,j+=t*tt,O+=t*$,Y+=t*Q,z+=t*G,q+=t*ut,D+=t*ft,T+=t*at,R+=t*ct,S+=t*lt,I+=t*dt,U+=t*gt,_+=t*pt,x+=t*yt,t=o[7],M+=t*c,N+=t*Z,j+=t*X,O+=t*tt,Y+=t*$,z+=t*Q,q+=t*G,D+=t*ut,T+=t*ft,R+=t*at,S+=t*ct,I+=t*lt,U+=t*dt,_+=t*gt,x+=t*pt,g+=t*yt,t=o[8],N+=t*c,j+=t*Z,O+=t*X,Y+=t*tt,z+=t*$,q+=t*Q,D+=t*G,T+=t*ut,R+=t*ft,S+=t*at,I+=t*ct,U+=t*lt,_+=t*dt,x+=t*gt,g+=t*pt,v+=t*yt,t=o[9],j+=t*c,O+=t*Z,Y+=t*X,z+=t*tt,q+=t*$,D+=t*Q,T+=t*G,R+=t*ut,S+=t*ft,I+=t*at,U+=t*ct,_+=t*lt,x+=t*dt,g+=t*gt,v+=t*pt,y+=t*yt,t=o[10],O+=t*c,Y+=t*Z,z+=t*X,q+=t*tt,D+=t*$,T+=t*Q,R+=t*G,S+=t*ut,I+=t*ft,U+=t*at,_+=t*ct,x+=t*lt,g+=t*dt,v+=t*gt,y+=t*pt,w+=t*yt,t=o[11],Y+=t*c,z+=t*Z,q+=t*X,D+=t*tt,T+=t*$,R+=t*Q,S+=t*G,I+=t*ut,U+=t*ft,_+=t*at,x+=t*ct,g+=t*lt,v+=t*dt,y+=t*gt,w+=t*pt,E+=t*yt,t=o[12],z+=t*c,q+=t*Z,D+=t*X,T+=t*tt,R+=t*$,S+=t*Q,I+=t*G,U+=t*ut,_+=t*ft,x+=t*at,g+=t*ct,v+=t*lt,y+=t*dt,w+=t*gt,E+=t*pt,P+=t*yt,t=o[13],q+=t*c,D+=t*Z,T+=t*X,R+=t*tt,S+=t*$,I+=t*Q,U+=t*G,_+=t*ut,x+=t*ft,g+=t*at,v+=t*ct,y+=t*lt,w+=t*dt,E+=t*gt,P+=t*pt,F+=t*yt,t=o[14],D+=t*c,T+=t*Z,R+=t*X,S+=t*tt,I+=t*$,U+=t*Q,_+=t*G,x+=t*ut,g+=t*ft,v+=t*at,y+=t*ct,w+=t*lt,E+=t*dt,P+=t*gt,F+=t*pt,H+=t*yt,t=o[15],T+=t*c,R+=t*Z,S+=t*X,I+=t*tt,U+=t*$,_+=t*Q,x+=t*G,g+=t*ut,v+=t*ft,y+=t*at,w+=t*ct,E+=t*lt,P+=t*dt,F+=t*gt,H+=t*pt,K+=t*yt,u+=38*R,d+=38*S,b+=38*I,A+=38*U,L+=38*_,B+=38*x,W+=38*g,M+=38*v,N+=38*y,j+=38*w,O+=38*E,Y+=38*P,z+=38*F,q+=38*H,D+=38*K,s=1,t=u+s+65535,s=Math.floor(t/65536),u=t-s*65536,t=d+s+65535,s=Math.floor(t/65536),d=t-s*65536,t=b+s+65535,s=Math.floor(t/65536),b=t-s*65536,t=A+s+65535,s=Math.floor(t/65536),A=t-s*65536,t=L+s+65535,s=Math.floor(t/65536),L=t-s*65536,t=B+s+65535,s=Math.floor(t/65536),B=t-s*65536,t=W+s+65535,s=Math.floor(t/65536),W=t-s*65536,t=M+s+65535,s=Math.floor(t/65536),M=t-s*65536,t=N+s+65535,s=Math.floor(t/65536),N=t-s*65536,t=j+s+65535,s=Math.floor(t/65536),j=t-s*65536,t=O+s+65535,s=Math.floor(t/65536),O=t-s*65536,t=Y+s+65535,s=Math.floor(t/65536),Y=t-s*65536,t=z+s+65535,s=Math.floor(t/65536),z=t-s*65536,t=q+s+65535,s=Math.floor(t/65536),q=t-s*65536,t=D+s+65535,s=Math.floor(t/65536),D=t-s*65536,t=T+s+65535,s=Math.floor(t/65536),T=t-s*65536,u+=s-1+37*(s-1),s=1,t=u+s+65535,s=Math.floor(t/65536),u=t-s*65536,t=d+s+65535,s=Math.floor(t/65536),d=t-s*65536,t=b+s+65535,s=Math.floor(t/65536),b=t-s*65536,t=A+s+65535,s=Math.floor(t/65536),A=t-s*65536,t=L+s+65535,s=Math.floor(t/65536),L=t-s*65536,t=B+s+65535,s=Math.floor(t/65536),B=t-s*65536,t=W+s+65535,s=Math.floor(t/65536),W=t-s*65536,t=M+s+65535,s=Math.floor(t/65536),M=t-s*65536,t=N+s+65535,s=Math.floor(t/65536),N=t-s*65536,t=j+s+65535,s=Math.floor(t/65536),j=t-s*65536,t=O+s+65535,s=Math.floor(t/65536),O=t-s*65536,t=Y+s+65535,s=Math.floor(t/65536),Y=t-s*65536,t=z+s+65535,s=Math.floor(t/65536),z=t-s*65536,t=q+s+65535,s=Math.floor(t/65536),q=t-s*65536,t=D+s+65535,s=Math.floor(t/65536),D=t-s*65536,t=T+s+65535,s=Math.floor(t/65536),T=t-s*65536,u+=s-1+37*(s-1),r[0]=u,r[1]=d,r[2]=b,r[3]=A,r[4]=L,r[5]=B,r[6]=W,r[7]=M,r[8]=N,r[9]=j,r[10]=O,r[11]=Y,r[12]=z,r[13]=q,r[14]=D,r[15]=T;}function Ct(r,o){k(r,o,o);}function Ir(r,o){var f=e(),t;for(t=0;t<16;t++)f[t]=o[t];for(t=253;t>=0;t--)Ct(f,f),t!==2&&t!==4&&k(f,f,o);for(t=0;t<16;t++)r[t]=f[t];}function Ur(r,o){var f=e(),t;for(t=0;t<16;t++)f[t]=o[t];for(t=250;t>=0;t--)Ct(f,f),t!==1&&k(f,f,o);for(t=0;t<16;t++)r[t]=f[t];}function ge(r,o,f){var t=new Uint8Array(32),s=new Float64Array(80),u,d,b=e(),A=e(),L=e(),B=e(),W=e(),M=e();for(d=0;d<31;d++)t[d]=o[d];for(t[31]=o[31]&127|64,t[0]&=248,He(s,f),d=0;d<16;d++)A[d]=s[d],B[d]=b[d]=L[d]=0;for(b[0]=B[0]=1,d=254;d>=0;--d)u=t[d>>>3]>>>(d&7)&1,Jt(b,A,u),Jt(L,B,u),At(W,b,L),_t(b,b,L),At(L,A,B),_t(A,A,B),Ct(B,W),Ct(M,b),k(b,L,b),k(L,A,W),At(W,b,L),_t(b,b,L),Ct(A,b),_t(L,B,M),k(b,L,m),At(b,b,B),k(L,L,b),k(b,B,M),k(B,A,s),Ct(A,W),Jt(b,A,u),Jt(L,B,u);for(d=0;d<16;d++)s[d+16]=b[d],s[d+32]=L[d],s[d+48]=A[d],s[d+64]=B[d];var N=s.subarray(32),j=s.subarray(16);return Ir(N,N),k(j,j,N),Zt(r,j),0}function pe(r,o){return ge(r,o,l)}function Lr(r,o){return i(o,32),pe(r,o)}function ye(r,o,f){var t=new Uint8Array(32);return ge(t,f,o),Dt(r,a,t,xt)}var Rr=Oe,ni=Fe;function ii(r,o,f,t,s,u){var d=new Uint8Array(32);return ye(d,s,u),Rr(r,o,f,t,d)}function fi(r,o,f,t,s,u){var d=new Uint8Array(32);return ye(d,s,u),ni(r,o,f,t,d)}var Pr=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Nr(r,o,f,t){for(var s=new Int32Array(16),u=new Int32Array(16),d,b,A,L,B,W,M,N,j,O,Y,z,q,D,T,R,S,I,U,_,x,g,v,y,w,E,P=r[0],F=r[1],H=r[2],K=r[3],c=r[4],Z=r[5],X=r[6],tt=r[7],$=o[0],Q=o[1],G=o[2],ut=o[3],ft=o[4],at=o[5],ct=o[6],lt=o[7],dt=0;t>=128;){for(U=0;U<16;U++)_=8*U+dt,s[U]=f[_+0]<<24|f[_+1]<<16|f[_+2]<<8|f[_+3],u[U]=f[_+4]<<24|f[_+5]<<16|f[_+6]<<8|f[_+7];for(U=0;U<80;U++)if(d=P,b=F,A=H,L=K,B=c,W=Z,M=X,N=tt,j=$,O=Q,Y=G,z=ut,q=ft,D=at,T=ct,R=lt,x=tt,g=lt,v=g&65535,y=g>>>16,w=x&65535,E=x>>>16,x=(c>>>14|ft<<18)^(c>>>18|ft<<14)^(ft>>>9|c<<23),g=(ft>>>14|c<<18)^(ft>>>18|c<<14)^(c>>>9|ft<<23),v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,x=c&Z^~c&X,g=ft&at^~ft&ct,v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,x=Pr[U*2],g=Pr[U*2+1],v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,x=s[U%16],g=u[U%16],v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,y+=v>>>16,w+=y>>>16,E+=w>>>16,S=w&65535|E<<16,I=v&65535|y<<16,x=S,g=I,v=g&65535,y=g>>>16,w=x&65535,E=x>>>16,x=(P>>>28|$<<4)^($>>>2|P<<30)^($>>>7|P<<25),g=($>>>28|P<<4)^(P>>>2|$<<30)^(P>>>7|$<<25),v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,x=P&F^P&H^F&H,g=$&Q^$&G^Q&G,v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,y+=v>>>16,w+=y>>>16,E+=w>>>16,N=w&65535|E<<16,R=v&65535|y<<16,x=L,g=z,v=g&65535,y=g>>>16,w=x&65535,E=x>>>16,x=S,g=I,v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,y+=v>>>16,w+=y>>>16,E+=w>>>16,L=w&65535|E<<16,z=v&65535|y<<16,F=d,H=b,K=A,c=L,Z=B,X=W,tt=M,P=N,Q=j,G=O,ut=Y,ft=z,at=q,ct=D,lt=T,$=R,U%16===15)for(_=0;_<16;_++)x=s[_],g=u[_],v=g&65535,y=g>>>16,w=x&65535,E=x>>>16,x=s[(_+9)%16],g=u[(_+9)%16],v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,S=s[(_+1)%16],I=u[(_+1)%16],x=(S>>>1|I<<31)^(S>>>8|I<<24)^S>>>7,g=(I>>>1|S<<31)^(I>>>8|S<<24)^(I>>>7|S<<25),v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,S=s[(_+14)%16],I=u[(_+14)%16],x=(S>>>19|I<<13)^(I>>>29|S<<3)^S>>>6,g=(I>>>19|S<<13)^(S>>>29|I<<3)^(I>>>6|S<<26),v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,y+=v>>>16,w+=y>>>16,E+=w>>>16,s[_]=w&65535|E<<16,u[_]=v&65535|y<<16;x=P,g=$,v=g&65535,y=g>>>16,w=x&65535,E=x>>>16,x=r[0],g=o[0],v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,y+=v>>>16,w+=y>>>16,E+=w>>>16,r[0]=P=w&65535|E<<16,o[0]=$=v&65535|y<<16,x=F,g=Q,v=g&65535,y=g>>>16,w=x&65535,E=x>>>16,x=r[1],g=o[1],v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,y+=v>>>16,w+=y>>>16,E+=w>>>16,r[1]=F=w&65535|E<<16,o[1]=Q=v&65535|y<<16,x=H,g=G,v=g&65535,y=g>>>16,w=x&65535,E=x>>>16,x=r[2],g=o[2],v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,y+=v>>>16,w+=y>>>16,E+=w>>>16,r[2]=H=w&65535|E<<16,o[2]=G=v&65535|y<<16,x=K,g=ut,v=g&65535,y=g>>>16,w=x&65535,E=x>>>16,x=r[3],g=o[3],v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,y+=v>>>16,w+=y>>>16,E+=w>>>16,r[3]=K=w&65535|E<<16,o[3]=ut=v&65535|y<<16,x=c,g=ft,v=g&65535,y=g>>>16,w=x&65535,E=x>>>16,x=r[4],g=o[4],v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,y+=v>>>16,w+=y>>>16,E+=w>>>16,r[4]=c=w&65535|E<<16,o[4]=ft=v&65535|y<<16,x=Z,g=at,v=g&65535,y=g>>>16,w=x&65535,E=x>>>16,x=r[5],g=o[5],v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,y+=v>>>16,w+=y>>>16,E+=w>>>16,r[5]=Z=w&65535|E<<16,o[5]=at=v&65535|y<<16,x=X,g=ct,v=g&65535,y=g>>>16,w=x&65535,E=x>>>16,x=r[6],g=o[6],v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,y+=v>>>16,w+=y>>>16,E+=w>>>16,r[6]=X=w&65535|E<<16,o[6]=ct=v&65535|y<<16,x=tt,g=lt,v=g&65535,y=g>>>16,w=x&65535,E=x>>>16,x=r[7],g=o[7],v+=g&65535,y+=g>>>16,w+=x&65535,E+=x>>>16,y+=v>>>16,w+=y>>>16,E+=w>>>16,r[7]=tt=w&65535|E<<16,o[7]=lt=v&65535|y<<16,dt+=128,t-=128;}return t}function qt(r,o,f){var t=new Int32Array(8),s=new Int32Array(8),u=new Uint8Array(256),d,b=f;for(t[0]=1779033703,t[1]=3144134277,t[2]=1013904242,t[3]=2773480762,t[4]=1359893119,t[5]=2600822924,t[6]=528734635,t[7]=1541459225,s[0]=4089235720,s[1]=2227873595,s[2]=4271175723,s[3]=1595750129,s[4]=2917565137,s[5]=725511199,s[6]=4215389547,s[7]=327033209,Nr(t,s,o,f),f%=128,d=0;d<f;d++)u[d]=o[b-f+d];for(u[f]=128,f=256-128*(f<112?1:0),u[f-9]=0,ot(u,f-8,b/536870912|0,b<<3),Nr(t,s,u,f),d=0;d<8;d++)ot(r,8*d,t[d],s[d]);return 0}function be(r,o){var f=e(),t=e(),s=e(),u=e(),d=e(),b=e(),A=e(),L=e(),B=e();_t(f,r[1],r[0]),_t(B,o[1],o[0]),k(f,f,B),At(t,r[0],r[1]),At(B,o[0],o[1]),k(t,t,B),k(s,r[3],o[3]),k(s,s,J),k(u,r[2],o[2]),At(u,u,u),_t(d,t,f),_t(b,u,s),At(A,u,s),At(L,t,f),k(r[0],d,b),k(r[1],L,A),k(r[2],A,b),k(r[3],d,L);}function jr(r,o,f){var t;for(t=0;t<4;t++)Jt(r[t],o[t],f);}function Ve(r,o){var f=e(),t=e(),s=e();Ir(s,o[2]),k(f,o[0],s),k(t,o[1],s),Zt(r,t),r[31]^=Tr(f)<<7;}function $e(r,o,f){var t,s;for(It(r[0],h),It(r[1],p),It(r[2],p),It(r[3],h),s=255;s>=0;--s)t=f[s/8|0]>>(s&7)&1,jr(r,o,t),be(o,r),be(r,r),jr(r,o,t);}function we(r,o){var f=[e(),e(),e(),e()];It(f[0],V),It(f[1],rt),It(f[2],p),k(f[3],V,rt),$e(r,f,o);}function Je(r,o,f){var t=new Uint8Array(64),s=[e(),e(),e(),e()],u;for(f||i(o,32),qt(t,o,32),t[0]&=248,t[31]&=127,t[31]|=64,we(s,t),Ve(r,s),u=0;u<32;u++)o[u+32]=r[u];return 0}var me=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ze(r,o){var f,t,s,u;for(t=63;t>=32;--t){for(f=0,s=t-32,u=t-12;s<u;++s)o[s]+=f-16*o[t]*me[s-(t-32)],f=Math.floor((o[s]+128)/256),o[s]-=f*256;o[s]+=f,o[t]=0;}for(f=0,s=0;s<32;s++)o[s]+=f-(o[31]>>4)*me[s],f=o[s]>>8,o[s]&=255;for(s=0;s<32;s++)o[s]-=f*me[s];for(t=0;t<32;t++)o[t+1]+=o[t]>>8,r[t]=o[t]&255;}function ke(r){var o=new Float64Array(64),f;for(f=0;f<64;f++)o[f]=r[f];for(f=0;f<64;f++)r[f]=0;Ze(r,o);}function zr(r,o,f,t){var s=new Uint8Array(64),u=new Uint8Array(64),d=new Uint8Array(64),b,A,L=new Float64Array(64),B=[e(),e(),e(),e()];qt(s,t,32),s[0]&=248,s[31]&=127,s[31]|=64;var W=f+64;for(b=0;b<f;b++)r[64+b]=o[b];for(b=0;b<32;b++)r[32+b]=s[32+b];for(qt(d,r.subarray(32),f+32),ke(d),we(B,d),Ve(r,B),b=32;b<64;b++)r[b]=t[b];for(qt(u,r,f+64),ke(u),b=0;b<64;b++)L[b]=0;for(b=0;b<32;b++)L[b]=d[b];for(b=0;b<32;b++)for(A=0;A<32;A++)L[b+A]+=u[b]*s[A];return Ze(r.subarray(32),L),W}function oi(r,o){var f=e(),t=e(),s=e(),u=e(),d=e(),b=e(),A=e();return It(r[2],p),He(r[1],o),Ct(s,r[1]),k(u,s,C),_t(s,s,r[2]),At(u,r[2],u),Ct(d,u),Ct(b,d),k(A,b,d),k(f,A,s),k(f,f,u),Ur(f,f),k(f,f,s),k(f,f,u),k(f,f,u),k(r[0],f,u),Ct(t,r[0]),k(t,t,u),Mr(t,s)&&k(r[0],r[0],it),Ct(t,r[0]),k(t,t,u),Mr(t,s)?-1:(Tr(r[0])===o[31]>>7&&_t(r[0],h,r[0]),k(r[3],r[0],r[1]),0)}function Qe(r,o,f,t){var s,u=new Uint8Array(32),d=new Uint8Array(64),b=[e(),e(),e(),e()],A=[e(),e(),e(),e()];if(f<64||oi(A,t))return -1;for(s=0;s<f;s++)r[s]=o[s];for(s=0;s<32;s++)r[s+32]=t[s];if(qt(d,r,f),ke(d),$e(b,A,d),we(A,o.subarray(32)),be(b,A),Ve(u,b),f-=64,Mt(o,0,u,0)){for(s=0;s<f;s++)r[s]=0;return -1}for(s=0;s<f;s++)r[s]=o[s+64];return f}var Ge=32,ve=24,re=32,kt=16,ne=32,Ce=32,ie=32,fe=32,We=32,Dr=ve,si=re,ai=kt,Ut=64,Yt=32,Qt=64,Xe=32,tr=64;n.lowlevel={crypto_core_hsalsa20:Dt,crypto_stream_xor:qe,crypto_stream:$t,crypto_stream_salsa20_xor:vt,crypto_stream_salsa20:Tt,crypto_onetimeauth:Ye,crypto_onetimeauth_verify:Sr,crypto_verify_16:wt,crypto_verify_32:Mt,crypto_secretbox:Oe,crypto_secretbox_open:Fe,crypto_scalarmult:ge,crypto_scalarmult_base:pe,crypto_box_beforenm:ye,crypto_box_afternm:Rr,crypto_box:ii,crypto_box_open:fi,crypto_box_keypair:Lr,crypto_hash:qt,crypto_sign:zr,crypto_sign_keypair:Je,crypto_sign_open:Qe,crypto_secretbox_KEYBYTES:Ge,crypto_secretbox_NONCEBYTES:ve,crypto_secretbox_ZEROBYTES:re,crypto_secretbox_BOXZEROBYTES:kt,crypto_scalarmult_BYTES:ne,crypto_scalarmult_SCALARBYTES:Ce,crypto_box_PUBLICKEYBYTES:ie,crypto_box_SECRETKEYBYTES:fe,crypto_box_BEFORENMBYTES:We,crypto_box_NONCEBYTES:Dr,crypto_box_ZEROBYTES:si,crypto_box_BOXZEROBYTES:ai,crypto_sign_BYTES:Ut,crypto_sign_PUBLICKEYBYTES:Yt,crypto_sign_SECRETKEYBYTES:Qt,crypto_sign_SEEDBYTES:Xe,crypto_hash_BYTES:tr,gf:e,D:C,L:me,pack25519:Zt,unpack25519:He,M:k,A:At,S:Ct,Z:_t,pow2523:Ur,add:be,set25519:It,modL:Ze,scalarmult:$e,scalarbase:we};function qr(r,o){if(r.length!==Ge)throw new Error("bad key size");if(o.length!==ve)throw new Error("bad nonce size")}function ci(r,o){if(r.length!==ie)throw new Error("bad public key size");if(o.length!==fe)throw new Error("bad secret key size")}function mt(){for(var r=0;r<arguments.length;r++)if(!(arguments[r]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Yr(r){for(var o=0;o<r.length;o++)r[o]=0;}n.randomBytes=function(r){var o=new Uint8Array(r);return i(o,r),o},n.secretbox=function(r,o,f){mt(r,o,f),qr(f,o);for(var t=new Uint8Array(re+r.length),s=new Uint8Array(t.length),u=0;u<r.length;u++)t[u+re]=r[u];return Oe(s,t,t.length,o,f),s.subarray(kt)},n.secretbox.open=function(r,o,f){mt(r,o,f),qr(f,o);for(var t=new Uint8Array(kt+r.length),s=new Uint8Array(t.length),u=0;u<r.length;u++)t[u+kt]=r[u];return t.length<32||Fe(s,t,t.length,o,f)!==0?null:s.subarray(re)},n.secretbox.keyLength=Ge,n.secretbox.nonceLength=ve,n.secretbox.overheadLength=kt,n.scalarMult=function(r,o){if(mt(r,o),r.length!==Ce)throw new Error("bad n size");if(o.length!==ne)throw new Error("bad p size");var f=new Uint8Array(ne);return ge(f,r,o),f},n.scalarMult.base=function(r){if(mt(r),r.length!==Ce)throw new Error("bad n size");var o=new Uint8Array(ne);return pe(o,r),o},n.scalarMult.scalarLength=Ce,n.scalarMult.groupElementLength=ne,n.box=function(r,o,f,t){var s=n.box.before(f,t);return n.secretbox(r,o,s)},n.box.before=function(r,o){mt(r,o),ci(r,o);var f=new Uint8Array(We);return ye(f,r,o),f},n.box.after=n.secretbox,n.box.open=function(r,o,f,t){var s=n.box.before(f,t);return n.secretbox.open(r,o,s)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var r=new Uint8Array(ie),o=new Uint8Array(fe);return Lr(r,o),{publicKey:r,secretKey:o}},n.box.keyPair.fromSecretKey=function(r){if(mt(r),r.length!==fe)throw new Error("bad secret key size");var o=new Uint8Array(ie);return pe(o,r),{publicKey:o,secretKey:new Uint8Array(r)}},n.box.publicKeyLength=ie,n.box.secretKeyLength=fe,n.box.sharedKeyLength=We,n.box.nonceLength=Dr,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(r,o){if(mt(r,o),o.length!==Qt)throw new Error("bad secret key size");var f=new Uint8Array(Ut+r.length);return zr(f,r,r.length,o),f},n.sign.open=function(r,o){if(mt(r,o),o.length!==Yt)throw new Error("bad public key size");var f=new Uint8Array(r.length),t=Qe(f,r,r.length,o);if(t<0)return null;for(var s=new Uint8Array(t),u=0;u<s.length;u++)s[u]=f[u];return s},n.sign.detached=function(r,o){for(var f=n.sign(r,o),t=new Uint8Array(Ut),s=0;s<t.length;s++)t[s]=f[s];return t},n.sign.detached.verify=function(r,o,f){if(mt(r,o,f),o.length!==Ut)throw new Error("bad signature size");if(f.length!==Yt)throw new Error("bad public key size");var t=new Uint8Array(Ut+r.length),s=new Uint8Array(Ut+r.length),u;for(u=0;u<Ut;u++)t[u]=o[u];for(u=0;u<r.length;u++)t[u+Ut]=r[u];return Qe(s,t,t.length,f)>=0},n.sign.keyPair=function(){var r=new Uint8Array(Yt),o=new Uint8Array(Qt);return Je(r,o),{publicKey:r,secretKey:o}},n.sign.keyPair.fromSecretKey=function(r){if(mt(r),r.length!==Qt)throw new Error("bad secret key size");for(var o=new Uint8Array(Yt),f=0;f<o.length;f++)o[f]=r[32+f];return {publicKey:o,secretKey:new Uint8Array(r)}},n.sign.keyPair.fromSeed=function(r){if(mt(r),r.length!==Xe)throw new Error("bad seed size");for(var o=new Uint8Array(Yt),f=new Uint8Array(Qt),t=0;t<32;t++)f[t]=r[t];return Je(o,f,true),{publicKey:o,secretKey:f}},n.sign.publicKeyLength=Yt,n.sign.secretKeyLength=Qt,n.sign.seedLength=Xe,n.sign.signatureLength=Ut,n.hash=function(r){mt(r);var o=new Uint8Array(tr);return qt(o,r,r.length),o},n.hash.hashLength=tr,n.verify=function(r,o){return mt(r,o),r.length===0||o.length===0||r.length!==o.length?false:bt(r,0,o,0,r.length)===0},n.setPRNG=function(r){i=r;},(function(){var r=typeof self<"u"?self.crypto||self.msCrypto:null;if(r&&r.getRandomValues){var o=65536;n.setPRNG(function(f,t){var s,u=new Uint8Array(t);for(s=0;s<t;s+=o)r.getRandomValues(u.subarray(s,s+Math.min(t-s,o)));for(s=0;s<t;s++)f[s]=u[s];Yr(u);});}else typeof Fr<"u"&&(r=Kr(),r&&r.randomBytes&&n.setPRNG(function(f,t){var s,u=r.randomBytes(t);for(s=0;s<t;s++)f[s]=u[s];Yr(u);}));})();})(typeof Ee<"u"&&Ee.exports?Ee.exports:self.nacl=self.nacl||{});});var $r=et((Vr,Ae)=>{(function(n,e){typeof Ae<"u"&&Ae.exports?Ae.exports=e():(n.nacl||(n.nacl={}),n.nacl.util=e());})(Vr,function(){var n={};function e(i){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(i))throw new TypeError("invalid encoding")}return n.decodeUTF8=function(i){if(typeof i!="string")throw new TypeError("expected string");var a,l=unescape(encodeURIComponent(i)),h=new Uint8Array(l.length);for(a=0;a<l.length;a++)h[a]=l.charCodeAt(a);return h},n.encodeUTF8=function(i){var a,l=[];for(a=0;a<i.length;a++)l.push(String.fromCharCode(i[a]));return decodeURIComponent(escape(l.join("")))},typeof atob>"u"?typeof Buffer.from<"u"?(n.encodeBase64=function(i){return Buffer.from(i).toString("base64")},n.decodeBase64=function(i){return e(i),new Uint8Array(Array.prototype.slice.call(Buffer.from(i,"base64"),0))}):(n.encodeBase64=function(i){return new Buffer(i).toString("base64")},n.decodeBase64=function(i){return e(i),new Uint8Array(Array.prototype.slice.call(new Buffer(i,"base64"),0))}):(n.encodeBase64=function(i){var a,l=[],h=i.length;for(a=0;a<h;a++)l.push(String.fromCharCode(i[a]));return btoa(l.join(""))},n.decodeBase64=function(i){e(i);var a,l=atob(i),h=new Uint8Array(l.length);for(a=0;a<l.length;a++)h[a]=l.charCodeAt(a);return h}),n});});var Zr=et((Sf,Jr)=>{Jr.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then};});var Pt=et(Ot=>{var rr,yi=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Ot.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};Ot.getSymbolTotalCodewords=function(e){return yi[e]};Ot.getBCHDigit=function(n){let e=0;for(;n!==0;)e++,n>>>=1;return e};Ot.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');rr=e;};Ot.isKanjiModeEnabled=function(){return typeof rr<"u"};Ot.toSJIS=function(e){return rr(e)};});var _e=et(Et=>{Et.L={bit:1};Et.M={bit:0};Et.Q={bit:3};Et.H={bit:2};function bi(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case "l":case "low":return Et.L;case "m":case "medium":return Et.M;case "q":case "quartile":return Et.Q;case "h":case "high":return Et.H;default:throw new Error("Unknown EC Level: "+n)}}Et.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Et.from=function(e,i){if(Et.isValid(e))return e;try{return bi(e)}catch{return i}};});var Gr=et((If,Qr)=>{function kr(){this.buffer=[],this.length=0;}kr.prototype={get:function(n){let e=Math.floor(n/8);return (this.buffer[e]>>>7-n%8&1)===1},put:function(n,e){for(let i=0;i<e;i++)this.putBit((n>>>e-i-1&1)===1);},getLengthInBits:function(){return this.length},putBit:function(n){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),n&&(this.buffer[e]|=128>>>this.length%8),this.length++;}};Qr.exports=kr;});var Xr=et((Uf,Wr)=>{function oe(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n);}oe.prototype.set=function(n,e,i,a){let l=n*this.size+e;this.data[l]=i,a&&(this.reservedBit[l]=true);};oe.prototype.get=function(n,e){return this.data[n*this.size+e]};oe.prototype.xor=function(n,e,i){this.data[n*this.size+e]^=i;};oe.prototype.isReserved=function(n,e){return this.reservedBit[n*this.size+e]};Wr.exports=oe;});var tn=et(Be=>{var wi=Pt().getSymbolSize;Be.getRowColCoords=function(e){if(e===1)return [];let i=Math.floor(e/7)+2,a=wi(e),l=a===145?26:Math.ceil((a-13)/(2*i-2))*2,h=[a-7];for(let p=1;p<i-1;p++)h[p]=h[p-1]-l;return h.push(6),h.reverse()};Be.getPositions=function(e){let i=[],a=Be.getRowColCoords(e),l=a.length;for(let h=0;h<l;h++)for(let p=0;p<l;p++)h===0&&p===0||h===0&&p===l-1||h===l-1&&p===0||i.push([a[h],a[p]]);return i};});var nn=et(rn=>{var mi=Pt().getSymbolSize,en=7;rn.getPositions=function(e){let i=mi(e);return [[0,0],[i-en,0],[0,i-en]]};});var fn=et(st=>{st.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Ft={N1:3,N2:3,N3:40,N4:10};st.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};st.from=function(e){return st.isValid(e)?parseInt(e,10):void 0};st.getPenaltyN1=function(e){let i=e.size,a=0,l=0,h=0,p=null,m=null;for(let C=0;C<i;C++){l=h=0,p=m=null;for(let J=0;J<i;J++){let V=e.get(C,J);V===p?l++:(l>=5&&(a+=Ft.N1+(l-5)),p=V,l=1),V=e.get(J,C),V===m?h++:(h>=5&&(a+=Ft.N1+(h-5)),m=V,h=1);}l>=5&&(a+=Ft.N1+(l-5)),h>=5&&(a+=Ft.N1+(h-5));}return a};st.getPenaltyN2=function(e){let i=e.size,a=0;for(let l=0;l<i-1;l++)for(let h=0;h<i-1;h++){let p=e.get(l,h)+e.get(l,h+1)+e.get(l+1,h)+e.get(l+1,h+1);(p===4||p===0)&&a++;}return a*Ft.N2};st.getPenaltyN3=function(e){let i=e.size,a=0,l=0,h=0;for(let p=0;p<i;p++){l=h=0;for(let m=0;m<i;m++)l=l<<1&2047|e.get(p,m),m>=10&&(l===1488||l===93)&&a++,h=h<<1&2047|e.get(m,p),m>=10&&(h===1488||h===93)&&a++;}return a*Ft.N3};st.getPenaltyN4=function(e){let i=0,a=e.data.length;for(let h=0;h<a;h++)i+=e.data[h];return Math.abs(Math.ceil(i*100/a/5)-10)*Ft.N4};function vi(n,e,i){switch(n){case st.Patterns.PATTERN000:return (e+i)%2===0;case st.Patterns.PATTERN001:return e%2===0;case st.Patterns.PATTERN010:return i%3===0;case st.Patterns.PATTERN011:return (e+i)%3===0;case st.Patterns.PATTERN100:return (Math.floor(e/2)+Math.floor(i/3))%2===0;case st.Patterns.PATTERN101:return e*i%2+e*i%3===0;case st.Patterns.PATTERN110:return (e*i%2+e*i%3)%2===0;case st.Patterns.PATTERN111:return (e*i%3+(e+i)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}st.applyMask=function(e,i){let a=i.size;for(let l=0;l<a;l++)for(let h=0;h<a;h++)i.isReserved(h,l)||i.xor(h,l,vi(e,h,l));};st.getBestMask=function(e,i){let a=Object.keys(st.Patterns).length,l=0,h=1/0;for(let p=0;p<a;p++){i(p),st.applyMask(p,e);let m=st.getPenaltyN1(e)+st.getPenaltyN2(e)+st.getPenaltyN3(e)+st.getPenaltyN4(e);st.applyMask(p,e),m<h&&(h=m,l=p);}return l};});var ir=et(nr=>{var Nt=_e(),Se=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Me=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];nr.getBlocksCount=function(e,i){switch(i){case Nt.L:return Se[(e-1)*4+0];case Nt.M:return Se[(e-1)*4+1];case Nt.Q:return Se[(e-1)*4+2];case Nt.H:return Se[(e-1)*4+3];default:return}};nr.getTotalCodewordsCount=function(e,i){switch(i){case Nt.L:return Me[(e-1)*4+0];case Nt.M:return Me[(e-1)*4+1];case Nt.Q:return Me[(e-1)*4+2];case Nt.H:return Me[(e-1)*4+3];default:return}};});var on=et(Ie=>{var se=new Uint8Array(512),Te=new Uint8Array(256);(function(){let e=1;for(let i=0;i<255;i++)se[i]=e,Te[e]=i,e<<=1,e&256&&(e^=285);for(let i=255;i<512;i++)se[i]=se[i-255];})();Ie.log=function(e){if(e<1)throw new Error("log("+e+")");return Te[e]};Ie.exp=function(e){return se[e]};Ie.mul=function(e,i){return e===0||i===0?0:se[Te[e]+Te[i]]};});var sn=et(ae=>{var fr=on();ae.mul=function(e,i){let a=new Uint8Array(e.length+i.length-1);for(let l=0;l<e.length;l++)for(let h=0;h<i.length;h++)a[l+h]^=fr.mul(e[l],i[h]);return a};ae.mod=function(e,i){let a=new Uint8Array(e);for(;a.length-i.length>=0;){let l=a[0];for(let p=0;p<i.length;p++)a[p]^=fr.mul(i[p],l);let h=0;for(;h<a.length&&a[h]===0;)h++;a=a.slice(h);}return a};ae.generateECPolynomial=function(e){let i=new Uint8Array([1]);for(let a=0;a<e;a++)i=ae.mul(i,new Uint8Array([1,fr.exp(a)]));return i};});var ln=et((Df,cn)=>{var an=sn();function or(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree);}or.prototype.initialize=function(e){this.degree=e,this.genPoly=an.generateECPolynomial(this.degree);};or.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let i=new Uint8Array(e.length+this.degree);i.set(e);let a=an.mod(i,this.genPoly),l=this.degree-a.length;if(l>0){let h=new Uint8Array(this.degree);return h.set(a,l),h}return a};cn.exports=or;});var sr=et(un=>{un.isValid=function(e){return !isNaN(e)&&e>=1&&e<=40};});var ar=et(Lt=>{var hn="[0-9]+",Ci="[A-Z $%*+\\-./:]+",ce="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";ce=ce.replace(/u/g,"\\u");var Ei="(?:(?![A-Z0-9 $%*+\\-./:]|"+ce+`)(?:.|[\r
2
+ ]))+`;Lt.KANJI=new RegExp(ce,"g");Lt.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");Lt.BYTE=new RegExp(Ei,"g");Lt.NUMERIC=new RegExp(hn,"g");Lt.ALPHANUMERIC=new RegExp(Ci,"g");var Ai=new RegExp("^"+ce+"$"),_i=new RegExp("^"+hn+"$"),Bi=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Lt.testKanji=function(e){return Ai.test(e)};Lt.testNumeric=function(e){return _i.test(e)};Lt.testAlphanumeric=function(e){return Bi.test(e)};});var jt=et(ht=>{var Si=sr(),cr=ar();ht.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};ht.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};ht.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};ht.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};ht.MIXED={bit:-1};ht.getCharCountIndicator=function(e,i){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!Si.isValid(i))throw new Error("Invalid version: "+i);return i>=1&&i<10?e.ccBits[0]:i<27?e.ccBits[1]:e.ccBits[2]};ht.getBestModeForData=function(e){return cr.testNumeric(e)?ht.NUMERIC:cr.testAlphanumeric(e)?ht.ALPHANUMERIC:cr.testKanji(e)?ht.KANJI:ht.BYTE};ht.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};ht.isValid=function(e){return e&&e.bit&&e.ccBits};function Mi(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case "numeric":return ht.NUMERIC;case "alphanumeric":return ht.ALPHANUMERIC;case "kanji":return ht.KANJI;case "byte":return ht.BYTE;default:throw new Error("Unknown mode: "+n)}}ht.from=function(e,i){if(ht.isValid(e))return e;try{return Mi(e)}catch{return i}};});var yn=et(Kt=>{var Ue=Pt(),Ti=ir(),dn=_e(),zt=jt(),lr=sr(),gn=7973,xn=Ue.getBCHDigit(gn);function Ii(n,e,i){for(let a=1;a<=40;a++)if(e<=Kt.getCapacity(a,i,n))return a}function pn(n,e){return zt.getCharCountIndicator(n,e)+4}function Ui(n,e){let i=0;return n.forEach(function(a){let l=pn(a.mode,e);i+=l+a.getBitsLength();}),i}function Li(n,e){for(let i=1;i<=40;i++)if(Ui(n,i)<=Kt.getCapacity(i,e,zt.MIXED))return i}Kt.from=function(e,i){return lr.isValid(e)?parseInt(e,10):i};Kt.getCapacity=function(e,i,a){if(!lr.isValid(e))throw new Error("Invalid QR Code version");typeof a>"u"&&(a=zt.BYTE);let l=Ue.getSymbolTotalCodewords(e),h=Ti.getTotalCodewordsCount(e,i),p=(l-h)*8;if(a===zt.MIXED)return p;let m=p-pn(a,e);switch(a){case zt.NUMERIC:return Math.floor(m/10*3);case zt.ALPHANUMERIC:return Math.floor(m/11*2);case zt.KANJI:return Math.floor(m/13);case zt.BYTE:default:return Math.floor(m/8)}};Kt.getBestVersionForData=function(e,i){let a,l=dn.from(i,dn.M);if(Array.isArray(e)){if(e.length>1)return Li(e,l);if(e.length===0)return 1;a=e[0];}else a=e;return Ii(a.mode,a.getLength(),l)};Kt.getEncodedBits=function(e){if(!lr.isValid(e)||e<7)throw new Error("Invalid QR Code version");let i=e<<12;for(;Ue.getBCHDigit(i)-xn>=0;)i^=gn<<Ue.getBCHDigit(i)-xn;return e<<12|i};});var vn=et(mn=>{var ur=Pt(),wn=1335,Ri=21522,bn=ur.getBCHDigit(wn);mn.getEncodedBits=function(e,i){let a=e.bit<<3|i,l=a<<10;for(;ur.getBCHDigit(l)-bn>=0;)l^=wn<<ur.getBCHDigit(l)-bn;return (a<<10|l)^Ri};});var En=et((Hf,Cn)=>{var Pi=jt();function Gt(n){this.mode=Pi.NUMERIC,this.data=n.toString();}Gt.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Gt.prototype.getLength=function(){return this.data.length};Gt.prototype.getBitsLength=function(){return Gt.getBitsLength(this.data.length)};Gt.prototype.write=function(e){let i,a,l;for(i=0;i+3<=this.data.length;i+=3)a=this.data.substr(i,3),l=parseInt(a,10),e.put(l,10);let h=this.data.length-i;h>0&&(a=this.data.substr(i),l=parseInt(a,10),e.put(l,h*3+1));};Cn.exports=Gt;});var _n=et((Vf,An)=>{var Ni=jt(),hr=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Wt(n){this.mode=Ni.ALPHANUMERIC,this.data=n;}Wt.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Wt.prototype.getLength=function(){return this.data.length};Wt.prototype.getBitsLength=function(){return Wt.getBitsLength(this.data.length)};Wt.prototype.write=function(e){let i;for(i=0;i+2<=this.data.length;i+=2){let a=hr.indexOf(this.data[i])*45;a+=hr.indexOf(this.data[i+1]),e.put(a,11);}this.data.length%2&&e.put(hr.indexOf(this.data[i]),6);};An.exports=Wt;});var Sn=et(($f,Bn)=>{var ji=jt();function Xt(n){this.mode=ji.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n);}Xt.getBitsLength=function(e){return e*8};Xt.prototype.getLength=function(){return this.data.length};Xt.prototype.getBitsLength=function(){return Xt.getBitsLength(this.data.length)};Xt.prototype.write=function(n){for(let e=0,i=this.data.length;e<i;e++)n.put(this.data[e],8);};Bn.exports=Xt;});var Tn=et((Jf,Mn)=>{var zi=jt(),Di=Pt();function te(n){this.mode=zi.KANJI,this.data=n;}te.getBitsLength=function(e){return e*13};te.prototype.getLength=function(){return this.data.length};te.prototype.getBitsLength=function(){return te.getBitsLength(this.data.length)};te.prototype.write=function(n){let e;for(e=0;e<this.data.length;e++){let i=Di.toSJIS(this.data[e]);if(i>=33088&&i<=40956)i-=33088;else if(i>=57408&&i<=60351)i-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
3
+ Make sure your charset is UTF-8`);i=(i>>>8&255)*192+(i&255),n.put(i,13);}};Mn.exports=te;});var In=et((Zf,dr)=>{var le={single_source_shortest_paths:function(n,e,i){var a={},l={};l[e]=0;var h=le.PriorityQueue.make();h.push(e,0);for(var p,m,C,J,V,rt,it,ot,bt;!h.empty();){p=h.pop(),m=p.value,J=p.cost,V=n[m]||{};for(C in V)V.hasOwnProperty(C)&&(rt=V[C],it=J+rt,ot=l[C],bt=typeof l[C]>"u",(bt||ot>it)&&(l[C]=it,h.push(C,it),a[C]=m));}if(typeof i<"u"&&typeof l[i]>"u"){var wt=["Could not find a path from ",e," to ",i,"."].join("");throw new Error(wt)}return a},extract_shortest_path_from_predecessor_list:function(n,e){for(var i=[],a=e,l;a;)i.push(a),l=n[a],a=n[a];return i.reverse(),i},find_path:function(n,e,i){var a=le.single_source_shortest_paths(n,e,i);return le.extract_shortest_path_from_predecessor_list(a,i)},PriorityQueue:{make:function(n){var e=le.PriorityQueue,i={},a;n=n||{};for(a in e)e.hasOwnProperty(a)&&(i[a]=e[a]);return i.queue=[],i.sorter=n.sorter||e.default_sorter,i},default_sorter:function(n,e){return n.cost-e.cost},push:function(n,e){var i={value:n,cost:e};this.queue.push(i),this.queue.sort(this.sorter);},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof dr<"u"&&(dr.exports=le);});var Dn=et(ee=>{var nt=jt(),Rn=En(),Pn=_n(),Nn=Sn(),jn=Tn(),ue=ar(),Le=Pt(),qi=In();function Un(n){return unescape(encodeURIComponent(n)).length}function he(n,e,i){let a=[],l;for(;(l=n.exec(i))!==null;)a.push({data:l[0],index:l.index,mode:e,length:l[0].length});return a}function zn(n){let e=he(ue.NUMERIC,nt.NUMERIC,n),i=he(ue.ALPHANUMERIC,nt.ALPHANUMERIC,n),a,l;return Le.isKanjiModeEnabled()?(a=he(ue.BYTE,nt.BYTE,n),l=he(ue.KANJI,nt.KANJI,n)):(a=he(ue.BYTE_KANJI,nt.BYTE,n),l=[]),e.concat(i,a,l).sort(function(p,m){return p.index-m.index}).map(function(p){return {data:p.data,mode:p.mode,length:p.length}})}function xr(n,e){switch(e){case nt.NUMERIC:return Rn.getBitsLength(n);case nt.ALPHANUMERIC:return Pn.getBitsLength(n);case nt.KANJI:return jn.getBitsLength(n);case nt.BYTE:return Nn.getBitsLength(n)}}function Yi(n){return n.reduce(function(e,i){let a=e.length-1>=0?e[e.length-1]:null;return a&&a.mode===i.mode?(e[e.length-1].data+=i.data,e):(e.push(i),e)},[])}function Oi(n){let e=[];for(let i=0;i<n.length;i++){let a=n[i];switch(a.mode){case nt.NUMERIC:e.push([a,{data:a.data,mode:nt.ALPHANUMERIC,length:a.length},{data:a.data,mode:nt.BYTE,length:a.length}]);break;case nt.ALPHANUMERIC:e.push([a,{data:a.data,mode:nt.BYTE,length:a.length}]);break;case nt.KANJI:e.push([a,{data:a.data,mode:nt.BYTE,length:Un(a.data)}]);break;case nt.BYTE:e.push([{data:a.data,mode:nt.BYTE,length:Un(a.data)}]);}}return e}function Fi(n,e){let i={},a={start:{}},l=["start"];for(let h=0;h<n.length;h++){let p=n[h],m=[];for(let C=0;C<p.length;C++){let J=p[C],V=""+h+C;m.push(V),i[V]={node:J,lastCount:0},a[V]={};for(let rt=0;rt<l.length;rt++){let it=l[rt];i[it]&&i[it].node.mode===J.mode?(a[it][V]=xr(i[it].lastCount+J.length,J.mode)-xr(i[it].lastCount,J.mode),i[it].lastCount+=J.length):(i[it]&&(i[it].lastCount=J.length),a[it][V]=xr(J.length,J.mode)+4+nt.getCharCountIndicator(J.mode,e));}}l=m;}for(let h=0;h<l.length;h++)a[l[h]].end=0;return {map:a,table:i}}function Ln(n,e){let i,a=nt.getBestModeForData(n);if(i=nt.from(e,a),i!==nt.BYTE&&i.bit<a.bit)throw new Error('"'+n+'" cannot be encoded with mode '+nt.toString(i)+`.
4
+ Suggested mode is: `+nt.toString(a));switch(i===nt.KANJI&&!Le.isKanjiModeEnabled()&&(i=nt.BYTE),i){case nt.NUMERIC:return new Rn(n);case nt.ALPHANUMERIC:return new Pn(n);case nt.KANJI:return new jn(n);case nt.BYTE:return new Nn(n)}}ee.fromArray=function(e){return e.reduce(function(i,a){return typeof a=="string"?i.push(Ln(a,null)):a.data&&i.push(Ln(a.data,a.mode)),i},[])};ee.fromString=function(e,i){let a=zn(e,Le.isKanjiModeEnabled()),l=Oi(a),h=Fi(l,i),p=qi.find_path(h.map,"start","end"),m=[];for(let C=1;C<p.length-1;C++)m.push(h.table[p[C]].node);return ee.fromArray(Yi(m))};ee.rawSplit=function(e){return ee.fromArray(zn(e,Le.isKanjiModeEnabled()))};});var Yn=et(qn=>{var Pe=Pt(),gr=_e(),Ki=Gr(),Hi=Xr(),Vi=tn(),$i=nn(),br=fn(),wr=ir(),Ji=ln(),Re=yn(),Zi=vn(),ki=jt(),pr=Dn();function Qi(n,e){let i=n.size,a=$i.getPositions(e);for(let l=0;l<a.length;l++){let h=a[l][0],p=a[l][1];for(let m=-1;m<=7;m++)if(!(h+m<=-1||i<=h+m))for(let C=-1;C<=7;C++)p+C<=-1||i<=p+C||(m>=0&&m<=6&&(C===0||C===6)||C>=0&&C<=6&&(m===0||m===6)||m>=2&&m<=4&&C>=2&&C<=4?n.set(h+m,p+C,true,true):n.set(h+m,p+C,false,true));}}function Gi(n){let e=n.size;for(let i=8;i<e-8;i++){let a=i%2===0;n.set(i,6,a,true),n.set(6,i,a,true);}}function Wi(n,e){let i=Vi.getPositions(e);for(let a=0;a<i.length;a++){let l=i[a][0],h=i[a][1];for(let p=-2;p<=2;p++)for(let m=-2;m<=2;m++)p===-2||p===2||m===-2||m===2||p===0&&m===0?n.set(l+p,h+m,true,true):n.set(l+p,h+m,false,true);}}function Xi(n,e){let i=n.size,a=Re.getEncodedBits(e),l,h,p;for(let m=0;m<18;m++)l=Math.floor(m/3),h=m%3+i-8-3,p=(a>>m&1)===1,n.set(l,h,p,true),n.set(h,l,p,true);}function yr(n,e,i){let a=n.size,l=Zi.getEncodedBits(e,i),h,p;for(h=0;h<15;h++)p=(l>>h&1)===1,h<6?n.set(h,8,p,true):h<8?n.set(h+1,8,p,true):n.set(a-15+h,8,p,true),h<8?n.set(8,a-h-1,p,true):h<9?n.set(8,15-h-1+1,p,true):n.set(8,15-h-1,p,true);n.set(a-8,8,1,true);}function tf(n,e){let i=n.size,a=-1,l=i-1,h=7,p=0;for(let m=i-1;m>0;m-=2)for(m===6&&m--;;){for(let C=0;C<2;C++)if(!n.isReserved(l,m-C)){let J=false;p<e.length&&(J=(e[p]>>>h&1)===1),n.set(l,m-C,J),h--,h===-1&&(p++,h=7);}if(l+=a,l<0||i<=l){l-=a,a=-a;break}}}function ef(n,e,i){let a=new Ki;i.forEach(function(C){a.put(C.mode.bit,4),a.put(C.getLength(),ki.getCharCountIndicator(C.mode,n)),C.write(a);});let l=Pe.getSymbolTotalCodewords(n),h=wr.getTotalCodewordsCount(n,e),p=(l-h)*8;for(a.getLengthInBits()+4<=p&&a.put(0,4);a.getLengthInBits()%8!==0;)a.putBit(0);let m=(p-a.getLengthInBits())/8;for(let C=0;C<m;C++)a.put(C%2?17:236,8);return rf(a,n,e)}function rf(n,e,i){let a=Pe.getSymbolTotalCodewords(e),l=wr.getTotalCodewordsCount(e,i),h=a-l,p=wr.getBlocksCount(e,i),m=a%p,C=p-m,J=Math.floor(a/p),V=Math.floor(h/p),rt=V+1,it=J-V,ot=new Ji(it),bt=0,wt=new Array(p),Mt=new Array(p),Bt=0,De=new Uint8Array(n.buffer);for(let Tt=0;Tt<p;Tt++){let $t=Tt<C?V:rt;wt[Tt]=De.slice(bt,bt+$t),Mt[Tt]=ot.encode(wt[Tt]),bt+=$t,Bt=Math.max(Bt,$t);}let Rt=new Uint8Array(a),Dt=0,xt,vt;for(xt=0;xt<Bt;xt++)for(vt=0;vt<p;vt++)xt<wt[vt].length&&(Rt[Dt++]=wt[vt][xt]);for(xt=0;xt<it;xt++)for(vt=0;vt<p;vt++)Rt[Dt++]=Mt[vt][xt];return Rt}function nf(n,e,i,a){let l;if(Array.isArray(n))l=pr.fromArray(n);else if(typeof n=="string"){let J=e;if(!J){let V=pr.rawSplit(n);J=Re.getBestVersionForData(V,i);}l=pr.fromString(n,J||40);}else throw new Error("Invalid data");let h=Re.getBestVersionForData(l,i);if(!h)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=h;else if(e<h)throw new Error(`
5
+ The chosen QR Code version cannot contain this amount of data.
6
+ Minimum version required to store current data is: `+h+`.
7
+ `);let p=ef(e,i,l),m=Pe.getSymbolSize(e),C=new Hi(m);return Qi(C,e),Gi(C),Wi(C,e),yr(C,i,0),e>=7&&Xi(C,e),tf(C,p),isNaN(a)&&(a=br.getBestMask(C,yr.bind(null,C,i))),br.applyMask(a,C),yr(C,i,a),{modules:C,version:e,errorCorrectionLevel:i,maskPattern:a,segments:l}}qn.create=function(e,i){if(typeof e>"u"||e==="")throw new Error("No input text");let a=gr.M,l,h;return typeof i<"u"&&(a=gr.from(i.errorCorrectionLevel,gr.M),l=Re.from(i.version),h=br.from(i.maskPattern),i.toSJISFunc&&Pe.setToSJISFunction(i.toSJISFunc)),nf(e,l,a,h)};});var mr=et(Ht=>{function On(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let e=n.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+n);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(a){return [a,a]}))),e.length===6&&e.push("F","F");let i=parseInt(e.join(""),16);return {r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+e.slice(0,6).join("")}}Ht.getOptions=function(e){e||(e={}),e.color||(e.color={});let i=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,a=e.width&&e.width>=21?e.width:void 0,l=e.scale||4;return {width:a,scale:a?4:l,margin:i,color:{dark:On(e.color.dark||"#000000ff"),light:On(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Ht.getScale=function(e,i){return i.width&&i.width>=e+i.margin*2?i.width/(e+i.margin*2):i.scale};Ht.getImageWidth=function(e,i){let a=Ht.getScale(e,i);return Math.floor((e+i.margin*2)*a)};Ht.qrToImageData=function(e,i,a){let l=i.modules.size,h=i.modules.data,p=Ht.getScale(l,a),m=Math.floor((l+a.margin*2)*p),C=a.margin*p,J=[a.color.light,a.color.dark];for(let V=0;V<m;V++)for(let rt=0;rt<m;rt++){let it=(V*m+rt)*4,ot=a.color.light;if(V>=C&&rt>=C&&V<m-C&&rt<m-C){let bt=Math.floor((V-C)/p),wt=Math.floor((rt-C)/p);ot=J[h[bt*l+wt]?1:0];}e[it++]=ot.r,e[it++]=ot.g,e[it++]=ot.b,e[it]=ot.a;}};});var Fn=et(Ne=>{var vr=mr();function ff(n,e,i){n.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=i,e.width=i,e.style.height=i+"px",e.style.width=i+"px";}function of(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Ne.render=function(e,i,a){let l=a,h=i;typeof l>"u"&&(!i||!i.getContext)&&(l=i,i=void 0),i||(h=of()),l=vr.getOptions(l);let p=vr.getImageWidth(e.modules.size,l),m=h.getContext("2d"),C=m.createImageData(p,p);return vr.qrToImageData(C.data,e,l),ff(m,h,p),m.putImageData(C,0,0),h};Ne.renderToDataURL=function(e,i,a){let l=a;typeof l>"u"&&(!i||!i.getContext)&&(l=i,i=void 0),l||(l={});let h=Ne.render(e,i,l),p=l.type||"image/png",m=l.rendererOpts||{};return h.toDataURL(p,m.quality)};});var Vn=et(Hn=>{var sf=mr();function Kn(n,e){let i=n.a/255,a=e+'="'+n.hex+'"';return i<1?a+" "+e+'-opacity="'+i.toFixed(2).slice(1)+'"':a}function Cr(n,e,i){let a=n+e;return typeof i<"u"&&(a+=" "+i),a}function af(n,e,i){let a="",l=0,h=false,p=0;for(let m=0;m<n.length;m++){let C=Math.floor(m%e),J=Math.floor(m/e);!C&&!h&&(h=true),n[m]?(p++,m>0&&C>0&&n[m-1]||(a+=h?Cr("M",C+i,.5+J+i):Cr("m",l,0),l=0,h=false),C+1<e&&n[m+1]||(a+=Cr("h",p),p=0)):l++;}return a}Hn.render=function(e,i,a){let l=sf.getOptions(i),h=e.modules.size,p=e.modules.data,m=h+l.margin*2,C=l.color.light.a?"<path "+Kn(l.color.light,"fill")+' d="M0 0h'+m+"v"+m+'H0z"/>':"",J="<path "+Kn(l.color.dark,"stroke")+' d="'+af(p,h,l.margin)+'"/>',V='viewBox="0 0 '+m+" "+m+'"',it='<svg xmlns="http://www.w3.org/2000/svg" '+(l.width?'width="'+l.width+'" height="'+l.width+'" ':"")+V+' shape-rendering="crispEdges">'+C+J+`</svg>
8
+ `;return typeof a=="function"&&a(null,it),it};});var Jn=et(de=>{var cf=Zr(),Er=Yn(),$n=Fn(),lf=Vn();function Ar(n,e,i,a,l){let h=[].slice.call(arguments,1),p=h.length,m=typeof h[p-1]=="function";if(!m&&!cf())throw new Error("Callback required as last argument");if(m){if(p<2)throw new Error("Too few arguments provided");p===2?(l=i,i=e,e=a=void 0):p===3&&(e.getContext&&typeof l>"u"?(l=a,a=void 0):(l=a,a=i,i=e,e=void 0));}else {if(p<1)throw new Error("Too few arguments provided");return p===1?(i=e,e=a=void 0):p===2&&!e.getContext&&(a=i,i=e,e=void 0),new Promise(function(C,J){try{let V=Er.create(i,a);C(n(V,e,a));}catch(V){J(V);}})}try{let C=Er.create(i,a);l(null,n(C,e,a));}catch(C){l(C);}}de.create=Er.create;de.toCanvas=Ar.bind(null,$n.render);de.toDataURL=Ar.bind(null,$n.renderToDataURL);de.toString=Ar.bind(null,function(n,e,i){return lf.render(n,i)});});var ti=et(St=>{var uf=Hr(),Vt=$r(),hf=Jn();function Zn(n){return n&&n.__esModule?n:{default:n}}var je=Zn(uf),df=Zn(hf),kn=class{generateSymmetricKey(){let n=je.default.randomBytes(32);return Vt.encodeBase64(n)}encryptSymmetric({plaintext:n,keyString:e}){let i=Vt.decodeBase64(e),a=je.default.randomBytes(24),l=new TextEncoder().encode(n),h=je.default.secretbox(l,a,i);return {cipher:Vt.encodeBase64(h),nonce:Vt.encodeBase64(a)}}decryptSymmetric({encrypted:n,keyString:e}){try{let i=Vt.decodeBase64(e),a=Vt.decodeBase64(n.cipher),l=Vt.decodeBase64(n.nonce),h=je.default.secretbox.open(a,l,i);if(!h)throw new Error("Decryption failed - invalid key or corrupted data");return new TextDecoder().decode(h)}catch(i){return console.error("Decryption failed",i),null}}},xf=kn,gf=class{constructor(){this.prefix="pelican_auth_",this.defaultTTL=300*1e3,this.memoryCache=new Map;}set(n,e,i={}){let{ttlMs:a=this.defaultTTL,useSessionStorage:l=true}=i,h=Date.now()+a,p={value:e,expiresAt:h};if(l)try{sessionStorage.setItem(`${this.prefix}${n}`,JSON.stringify(p));}catch(m){console.warn("SessionStorage unavailable, using memory:",m),this.setMemory(n,p);}else this.setMemory(n,p);}get(n){try{let e=sessionStorage.getItem(`${this.prefix}${n}`);if(e){let i=JSON.parse(e);return Date.now()>i.expiresAt?(this.remove(n),null):i.value}}catch{}return this.getMemory(n)}remove(n){try{sessionStorage.removeItem(`${this.prefix}${n}`);}catch{}this.memoryCache.delete(n);}clear(){try{Object.keys(sessionStorage).forEach(n=>{n.startsWith(this.prefix)&&sessionStorage.removeItem(n);});}catch{}this.memoryCache.clear();}setMemory(n,e){this.memoryCache.set(n,e);let i=e.expiresAt-Date.now();setTimeout(()=>{this.memoryCache.delete(n);},i);}getMemory(n){let e=this.memoryCache.get(n);return e?Date.now()>e.expiresAt?(this.memoryCache.delete(n),null):e.value:null}},ze=new gf,Qn=(n,e,i)=>{ze.set("session",{sessionId:n,sessionKey:e},{ttlMs:i});},Gn=()=>ze.get("session"),_r=()=>{ze.remove("session");},pf=()=>{ze.clear();},Wn=class{constructor(){this.state="idle",this.listeners=new Set;}get current(){return this.state}transition(n){this.state=n,this.listeners.forEach(e=>e(n));}subscribe(n){return this.listeners.add(n),()=>this.listeners.delete(n)}},Xn=class{constructor(n){this.reconnectAttempts=0,this.maxReconnectAttempts=5,this.isExplicitlyClosed=false,this.handlers=n;}connect(n){this.url=n,this.isExplicitlyClosed=false,this.socket=new WebSocket(n),this.socket.onopen=()=>{this.reconnectAttempts=0,this.handlers.onOpen?.();},this.socket.onmessage=e=>{try{let i=JSON.parse(e.data);this.handlers.onMessage?.(i);}catch(i){console.error("Failed to parse message",i);}},this.socket.onerror=e=>{this.handlers.onError?.(e);},this.socket.onclose=e=>{this.handlers.onClose?.(e),this.isExplicitlyClosed||this.attemptReconnect();};}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts){console.error("\u274C Max reconnect attempts reached");return}this.reconnectAttempts++;let n=Math.pow(2,this.reconnectAttempts)*500;setTimeout(()=>{this.url&&this.connect(this.url);},n);}send(n){this.socket?.readyState===WebSocket.OPEN&&this.socket.send(JSON.stringify(n));}close(){this.isExplicitlyClosed=true,this.socket?.close();}},Br="http://192.168.1.2:8080",yf=class{constructor(n){if(this.crypto=new xf,this.stateMachine=new Wn,this.sessionId="",this.sessionKey=null,this.listeners={},!n.publicKey)throw new Error("Missing publicKey");if(!n.projectId)throw new Error("Missing projectId");if(!n.authType)throw new Error("Missing authType");this.config={continuousMode:false,forceQRCode:false,...n},this.stateMachine.subscribe(e=>this.emit("state",e)),this.attachVisibilityRecovery();}on(n,e){var i;return (i=this.listeners)[n]??(i[n]=new Set),this.listeners[n].add(e),()=>this.listeners[n].delete(e)}async start(){if(this.stateMachine.current==="idle"){this.resetSession(),this.stateMachine.transition("initializing");try{let n=await this.fetchRelayUrl();this.sessionKey=this.crypto.generateSymmetricKey(),this.sessionId=crypto.randomUUID()+crypto.randomUUID(),this.transport=new Xn({onOpen:()=>{this.transport.send({type:"register",sessionID:this.sessionId,...this.config}),this.stateMachine.transition("awaiting-pair");},onMessage:e=>this.handleMessage(e),onError:()=>this.fail(new Error("WebSocket connection failed"))}),this.transport.connect(n),await this.emitEntryPoint();}catch(n){this.fail(n instanceof Error?n:new Error("Start failed"));}}}stop(){this.terminate(false);}async fetchRelayUrl(){let{publicKey:n,projectId:e,authType:i}=this.config,a=await fetch(`${Br}/relay?public_key=${n}&auth_type=${i}&project_id=${e}`);if(!a.ok)throw new Error("Failed to fetch relay URL");return (await a.json()).relay_url}async emitEntryPoint(){let n={sessionID:this.sessionId,sessionKey:this.sessionKey,publicKey:this.config.publicKey,authType:this.config.authType,projectId:this.config.projectId,url:window.location.href};if(!(this.config.forceQRCode||!/Android|iPhone|iPad/i.test(navigator.userAgent))&&this.sessionKey)Qn(this.sessionId,this.sessionKey,5*6e4),this.emit("deeplink",`pelicanvault://auth/deep-link?sessionID=${encodeURIComponent(this.sessionId)}&sessionKey=${encodeURIComponent(this.sessionKey)}&publicKey=${encodeURIComponent(this.config.publicKey)}&authType=${this.config.authType}&projectId=${encodeURIComponent(this.config.projectId)}&url=${encodeURIComponent(window.location.href)}`);else {let i=await df.default.toDataURL(JSON.stringify(n),{type:"image/png",scale:3,color:{light:"#FFFFF5",dark:"#121212"}});this.emit("qr",i);}}handleMessage(n){switch(n.type){case "paired":this.stateMachine.transition("paired"),this.transport.send({type:"authenticate",sessionID:this.sessionId,...this.config,url:window.location.href});return;case "phone-auth-success":this.handleAuthSuccess(n);return;case "phone-terminated":this.fail(new Error("Authenticating device terminated the connection")),this.restartIfContinuous();return;case "confirmed":this.terminate(true),this.restartIfContinuous();return}}handleAuthSuccess(n){if(!this.sessionKey||!n.cipher||!n.nonce){this.fail(new Error("Invalid authentication payload")),this.restartIfContinuous();return}try{let e=this.crypto.decryptSymmetric({encrypted:{cipher:n.cipher,nonce:n.nonce},keyString:this.sessionKey});if(!e){this.fail(new Error("Invalid authentication data")),this.restartIfContinuous();return}let i=JSON.parse(e);this.emit("success",i),this.stateMachine.transition("authenticated"),this.transport?.send({type:"confirm",sessionID:this.sessionId});}catch{this.fail(new Error("Failed to decrypt authentication data")),this.restartIfContinuous();}}async getCachedEntry(n){try{let e=await fetch(`${Br}/session?session_id=${n.sessionId}`);if(!e.ok)throw new Error("Invalid session");let i=await e.json(),a=this.crypto.decryptSymmetric({encrypted:{cipher:i.cipher,nonce:i.nonce},keyString:n.sessionKey});if(!a){this.fail(new Error("Invalid session data")),this.restartIfContinuous();return}let l=JSON.parse(a);this.emit("success",l),_r();}catch{this.fail(new Error("Session recovery failed")),this.restartIfContinuous();}}attachVisibilityRecovery(){this.visibilityHandler=async()=>{if(document.visibilityState!=="visible")return;let n=Gn();n&&await this.getCachedEntry(n);},document.addEventListener("visibilitychange",this.visibilityHandler);}detachVisibilityRecovery(){this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0);}terminate(n){this.transport&&(n||this.transport?.send({type:"client-terminated",sessionID:this.sessionId,projectId:this.config.projectId,publicKey:this.config.publicKey,authType:this.config.authType}),this.transport?.close(),_r(),this.resetSession(),this.config.continuousMode||this.detachVisibilityRecovery(),this.stateMachine.transition(n?"confirmed":"idle"));}restartIfContinuous(){this.stateMachine.transition("idle"),this.config.continuousMode&&setTimeout(()=>{this.start();},150);}resetSession(){this.sessionId="",this.sessionKey=null;}destroy(){this.detachVisibilityRecovery(),this.transport?.close(),this.listeners={};}emit(n,e){this.listeners[n]?.forEach(i=>i(e));}fail(n){this.emit("error",n),this.stateMachine.transition("error");}};St.BASEURL=Br;St.CryptoService=kn;St.PelicanAuthentication=yf;St.StateMachine=Wn;St.Transport=Xn;St.clearAllAuthData=pf;St.clearAuthSession=_r;St.getAuthSession=Gn;St.storeAuthSession=Qn;});function er(n,{insertAt:e}={}){if(typeof document>"u")return;let i=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css",e==="top"&&i.firstChild?i.insertBefore(a,i.firstChild):i.appendChild(a),a.styleSheet?a.styleSheet.cssText=n:a.appendChild(document.createTextNode(n));}er(`@keyframes fadeUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes spin{to{transform:rotate(360deg)}}@keyframes successPulse{0%,to{transform:scale(1);opacity:1}50%{transform:scale(1.05);opacity:.9}}.auth-container{width:300px;max-width:fit-content;padding:1rem;margin-top:.3rem;position:relative;animation:fadeUp .5s ease-out;background-color:#fdfdfd;border-radius:2.5rem;display:flex;flex-direction:column;justify-content:space-between;align-items:center;gap:1rem;height:400px}.close-button{background:none;border:none;cursor:pointer;transition:opacity .2s}.close-button:hover{opacity:.6}.close-icon{width:1.5rem;height:1.5rem;fill:#000}.retry-container{text-align:center;padding:3rem 0}.retry-container>div:first-child{margin-bottom:1rem}.retry-text{font-size:1.125rem;font-family:Onest,system-ui,Avenir,Helvetica,Arial,sans-serif}.content-wrapper{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:2rem}.unpaired-container{text-align:center;display:flex;flex-direction:column}.main-heading{font-size:.75rem;font-weight:700;color:#121212;font-family:Onest,system-ui,Avenir,Helvetica,Arial,sans-serif}@media(min-width:768px){.main-heading{font-size:1rem;font-family:Onest,system-ui,Avenir,Helvetica,Arial,sans-serif}}@media(min-width:1024px){.main-heading{font-size:1rem;font-family:Onest,system-ui,Avenir,Helvetica,Arial,sans-serif}}.mobile-auth-container{display:flex;flex-direction:column;gap:1rem;width:300px}.logo-container{display:flex;justify-content:center;padding:2rem 0}.open-app-link{display:inline-block;padding:.75rem 2rem;background-color:#000;width:fit-content;align-self:center;border-radius:18px;color:#d9eb1b;font-weight:600;font-size:1rem;text-decoration:none;transition:background-color .2s;font-family:Onest,system-ui,Avenir,Helvetica,Arial,sans-serif}.open-app-link:hover{background-color:#d9eb1be6;color:#000}.helper-text{font-size:.75rem;color:#6b7280;font-family:Onest,system-ui,Avenir,Helvetica,Arial,sans-serif}.qr-container{display:flex;justify-content:center}.qr-wrapper{display:flex;justify-content:center;align-items:center;overflow:hidden;border-radius:2rem;border:1px solid #d9eb1b;background-color:#fffff5;padding:.2rem;height:244px;width:244px}.error-text{font-weight:500;color:red;font-family:Onest,system-ui,Avenir,Helvetica,Arial,sans-serif}.qr-image{height:100%;width:100%}.loader-container{display:flex;justify-content:center}.instruction-text{font-size:.875rem;color:#9ca3af;font-family:Onest,system-ui,Avenir,Helvetica,Arial,sans-serif}.paired-container{text-align:center;display:flex;flex-direction:column;gap:1rem;max-width:250px}.paired-heading{font-size:1rem;font-weight:800;font-family:Onest,system-ui,Avenir,Helvetica,Arial,sans-serif}@media(min-width:768px){.paired-heading{font-size:1rem;font-family:Onest,system-ui,Avenir,Helvetica,Arial,sans-serif}}.success-message{background-color:#121212;color:#d9eb1b;padding:.5rem 1rem;border-radius:1.3rem;font-weight:700;font-size:1rem;animation:successPulse .2s ease-in-out;margin:.5rem 0;font-family:system-ui,Avenir,Helvetica,Arial,sans-serif;width:300px;max-width:fit-content}.auto-renew-badge{display:inline-block;background-color:#d9eb1b33;border:1px solid #d9eb1b;color:#d9eb1b;padding:.25rem .75rem;border-radius:9999px;font-size:.75rem;font-weight:600;margin-top:.5rem}.loader{width:48px;height:48px;position:relative}.loader:before,.loader:after{content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:48em;height:48em;background-image:radial-gradient(circle 10px,#d9eb1b 100%,transparent 0),radial-gradient(circle 10px,#d9eb1b 100%,transparent 0),radial-gradient(circle 10px,#d9eb1b 100%,transparent 0),radial-gradient(circle 10px,#d9eb1b 100%,transparent 0),radial-gradient(circle 10px,#d9eb1b 100%,transparent 0),radial-gradient(circle 10px,#d9eb1b 100%,transparent 0),radial-gradient(circle 10px,#d9eb1b 100%,transparent 0),radial-gradient(circle 10px,#d9eb1b 100%,transparent 0);background-position:0em -18em,0em 18em,18em 0em,-18em 0em,13em -13em,-13em -13em,13em 13em,-13em 13em;background-repeat:no-repeat;font-size:.5px;border-radius:50%;animation:blast 1s ease-in infinite}.loader:after{font-size:1px;background:#d9eb1b;animation:bounce 1s ease-in infinite}@keyframes bounce{0%,to{font-size:.75px}50%{font-size:1.5px}}@keyframes blast{0%,40%{font-size:.5px}70%{opacity:1;font-size:4px}to{font-size:6px;opacity:0}}
9
+ `);var ei=pi(ti());function ri(n,e){let i=document.getElementById(n),a=new ei.PelicanAuthentication(e),l=e.continuousMode||false,h=null,p=null,m=null,C="idle",J=()=>["initializing","paired","awaiting-auth"].includes(C),V=[a.on("qr",ot=>{p=ot,rt();}),a.on("deeplink",ot=>{m=ot,rt();}),a.on("state",ot=>{C=ot,rt();}),a.on("success",ot=>{e.onSuccess(ot),e.continuousMode?(h="Authentication complete!",rt(),setTimeout(()=>{h=null,rt();},2e3)):(l=false,rt());}),a.on("error",ot=>{e.onError?.(ot),rt();})];function rt(){if(!i)return;let ot=J(),bt=!e.forceQRCode&&m,wt=e.forceQRCode&&p&&C==="awaiting-pair"||!e.forceQRCode&&p&&C==="awaiting-pair",Mt=`
10
+ <div style="max-width: 290px; width: 100%; margin: 0 auto;">
11
+ ${e.continuousMode?"":`
12
+ <div style="width: 100%; display: flex; justify-content: space-between; align-items: center;">
13
+ <button type="button" id="pelican-start-btn" style="border: none; background: transparent; cursor: pointer;" ${l?"disabled":""}>
14
+ ${e.buttonComponent?e.buttonComponent:wf(e.authType,e.buttonText)}
15
+ </button>
16
+
17
+ ${l?`
18
+ <button id="pelican-stop-btn" class="close-button" type="button">
19
+ <svg class="close-icon" fill="#fff" stroke="#fff" viewBox="0 0 24 24">
20
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M6 18L18 6M6 6l12 12" />
21
+ </svg>
22
+ </button>
23
+ `:""}
24
+ </div>
25
+ `}
26
+ </div>
27
+ `,Bt=i.querySelector(".auth-container");if(l){if(Bt||(i.innerHTML=Mt+'<div class="auth-container"></div>',Bt=i.querySelector(".auth-container")),!Bt)return;Bt.innerHTML=` ${h?`
28
+ <div class="success-message" style="text-align: center;">
29
+ ${h}
30
+ ${e.continuousMode?'<p style="font-size: 0.8rem; margin-top: 0.5rem; color: #f3f3f3;">Preparing next session...</p>':""}
31
+ </div>
32
+ `:""} ${ot?`
33
+ <div class="content-wrapper">
34
+ <h2 class="main-heading">one sec...</h2>
35
+ <span class="loader" style="margin: 1rem auto; width: 252px;"></span>
36
+ </div>
37
+ `:`
38
+ <div class="content-wrapper">
39
+ ${C==="awaiting-pair"&&!h?`
40
+ <div class="unpaired-container">
41
+ <h2 class="main-heading">Open Pelican Vault</h2>
42
+
43
+ ${bt?`
44
+ <div class="mobile-auth-container">
45
+ <div class="logo-container">
46
+ <img src="https://res.cloudinary.com/de0jr8mcm/image/upload/v1765904735/pelican/pelican_icon_r9ghqw.png" alt="Pelican Logo" class="logo" style="width: 120px; height: 120px;">
47
+ </div>
48
+ <a href="${m}" class="open-app-link">Open Pelican App</a>
49
+ <p class="helper-text">Tap the button to open the app and authenticate</p>
50
+ </div>
51
+ `:wt?`
52
+ <div class="qr-container">
53
+ <div class="qr-wrapper">
54
+ <img src="${p}" alt="QR Code" class="qr-image" />
55
+ </div>
56
+ </div>
57
+ `:`
58
+ <div class="loader-container">
59
+ <span class="loader"></span>
60
+ </div>
61
+ `}
62
+ </div>
63
+ `:""}
64
+ </div>
65
+ `}
66
+ ${bf()}
67
+ </div>`;}else i.innerHTML=Mt;it();}function it(){document.getElementById("pelican-start-btn")?.addEventListener("click",()=>{a.start(),l=true,rt();}),document.getElementById("pelican-stop-btn")?.addEventListener("click",()=>{a.stop(),e.onClose?.(),l=false,rt();});}return rt(),e.continuousMode&&a.start(),()=>{V.forEach(ot=>ot()),a.destroy();}}var bf=()=>`
68
+ <div style="display: flex; justify-content: center; align-items: center; margin-top: 1rem;">
69
+ <div style="display: flex; justify-content: center; align-items: center; background-color: #000000; border-radius: 1.2rem; gap: 0.5rem; padding: 0.7rem 1rem; height: 1.4rem;">
70
+ <div>
71
+ <p style="font-size: 14px; font-weight: 500; color: #fff; font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif; margin: 0;">
72
+ Available on
73
+ </p>
74
+ </div>
75
+ <div style="display: flex; align-items: center; gap: 0.6rem;">
76
+ <svg width="20" height="20" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
77
+ <g clip-path="url(#clip_apple)">
78
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M22.0213 7.30124C24.1265 7.30124 26.358 8.45986 27.947 10.4637C22.7386 13.3501 23.5854 20.8709 28.8483 22.881C28.1232 24.5027 27.777 25.2278 26.8445 26.664C25.5424 28.6663 23.7101 31.1613 21.435 31.1831C19.4156 31.2018 18.8963 29.8529 16.155 29.8685C13.4136 29.8841 12.8413 31.2065 10.8219 31.1878C8.54832 31.1659 6.80962 28.9142 5.50754 26.9104C1.86795 21.3091 1.48746 14.7363 3.73297 11.2433C5.32821 8.7577 7.84348 7.3028 10.2106 7.3028C12.6199 7.3028 14.134 8.63919 16.1269 8.63919C18.0605 8.63919 19.2363 7.30124 22.0213 7.30124ZM21.4101 0.000244141C21.6907 1.89489 20.9204 3.75054 19.9084 5.06354C18.8246 6.4701 16.958 7.5601 15.1523 7.50396C14.8248 5.69041 15.67 3.82383 16.6961 2.56542C17.8235 1.17757 19.7571 0.115638 21.4101 0.000244141Z" fill="white"/>
79
+ </g>
80
+ <defs><clipPath id="clip_apple"><rect width="31.1875" height="31.1875" fill="white"/></clipPath></defs>
81
+ </svg>
82
+ <svg width="18" height="18" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
83
+ <path d="M0.015625 2.02546V24.3372C0.0157895 24.3856 0.0316774 24.4329 0.0612964 24.4731C0.0909154 24.4134 0.132947 24.5448 0.182121 24.5634C0.231294 24.582 0.285421 24.587 0.337713 24.5778C0.390006 24.5685 0.438136 24.5455 0.476069 24.5115L13.2604 13.1819L0.476069 1.85116C0.438136 1.81718 0.390006 1.79412 0.337713 1.7849C0.285421 1.77567 0.231294 1.78067 0.182121 1.79929C0.132947 1.8179 0.0909154 1.84929 0.0612964 1.88953C0.0316774 1.92976 0.0157895 1.97705 0.015625 2.02546ZM18.6208 8.52652L2.59086 0.501104L2.58086 0.495994C2.30472 0.359739 2.04233 0.699241 2.26849 0.896811L14.8342 11.8154L18.6208 8.52652ZM2.26974 25.467C2.04233 25.6645 2.30472 26.004 2.58211 25.8678L2.59211 25.8627L18.6208 17.8373L14.8342 14.5473L2.26974 25.467ZM25.092 11.7626L20.6156 9.52231L16.4067 13.1819L20.6156 16.8398L25.092 14.6012C26.3096 13.9898 26.3096 12.374 25.092 11.7626Z" fill="white"/>
84
+ </svg>
85
+ </div>
86
+ </div>
87
+ </div>
88
+ `,wf=(n,e)=>`
89
+ <div class="pelican-btn-wrapper" style="display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 0.35rem; padding: 0.35rem 0.7rem; border-radius: 20px; cursor: pointer; border: 1px solid #d9eb1b;">
90
+ <div>
91
+ <svg width="28" height="28" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Pelican logo">
92
+ <rect width="100" height="100" rx="32" fill="#121212" />
93
+ <path d="M56.5511 56.8089C56.5705 55.5878 57.5734 54.0696 58.7917 53.4254C60.0572 52.7596 61.0322 53.2324 61.0193 54.5099C60.9978 55.744 59.9754 57.2947 58.7572 57.9346C57.539 58.5744 56.5296 58.0777 56.5511 56.8089ZM70.0957 49.6364C70.2081 49.5555 70.2954 49.4442 70.3475 49.3154C70.369 48.6278 70.3626 47.9555 70.3626 47.2354C68.4083 48.5172 66.5142 49.7665 64.6202 51.0158V53.2389L65.1174 52.9114C66.7725 51.8183 68.4341 50.7338 70.0957 49.6364ZM69.7147 58.5592C68.4463 60.5076 66.7916 62.1705 64.8548 63.4436C63.1329 64.6039 61.4778 65.222 59.9389 65.1787C58.359 65.1375 57.2893 64.3957 56.6695 62.9686C57.2678 62.448 57.8059 61.9665 58.344 61.4937C58.5418 61.8163 58.7688 62.1198 59.022 62.4003C60.0572 63.3828 61.5488 63.3134 63.3546 62.4762C63.5698 62.3743 63.77 62.2593 63.9809 62.1401C64.8419 61.6607 65.2874 61.1033 65.5069 60.123C65.6834 59.3053 65.7932 58.5158 65.9374 57.7068C66.1135 56.6524 66.4412 55.6295 66.9102 54.6704C67.4634 53.5512 68.2382 52.7184 69.2412 52.3085C70.1323 51.9528 70.7048 52.2065 70.9911 52.8854C71.6432 54.4687 71.0965 56.425 69.7147 58.5592ZM69.3273 54.5923C69.2714 54.434 69.1013 54.2691 68.9528 54.3168C68.8043 54.3646 68.5632 54.6877 68.4341 54.9068C68.2881 55.1536 68.1759 55.4192 68.1005 55.6963C67.8293 56.8913 67.5775 58.082 67.3106 59.2641C67.356 59.263 67.4013 59.2586 67.4462 59.2511C68.1303 58.4928 68.6892 57.6287 69.1013 56.6918C69.4349 55.8741 69.5038 55.1757 69.3273 54.5923ZM80.7949 39.7072V60.2726C80.7942 62.6299 80.1786 64.9455 79.0098 66.9874C77.841 69.0293 76.1601 70.7257 74.1356 71.9066L56.4607 82.1785C54.4328 83.3608 52.1313 83.9834 49.7885 83.9834C47.4456 83.9834 45.1441 83.3608 43.1162 82.1785L25.4671 71.9001C23.4402 70.7208 21.7567 69.0251 20.5856 66.9831C19.4145 64.9411 18.7969 62.6246 18.7949 60.2661V39.7007C18.7969 37.3422 19.4145 35.0257 20.5856 32.9837C21.7567 30.9417 23.4402 29.246 25.4671 28.0667L43.1378 17.7883C45.1657 16.606 47.4671 15.9834 49.81 15.9834C52.1529 15.9834 54.4543 16.606 56.4822 17.7883L74.1356 28.0667C76.1601 29.2476 77.841 30.944 79.0098 32.9859C80.1786 35.0278 80.7942 37.3434 80.7949 39.7007V39.7072ZM77.8333 47.6887C77.8333 42.3077 73.5007 40.2624 68.1629 43.134L52.9287 51.2956C51.6739 51.9679 50.6602 53.5382 50.6602 54.8005V77.5956C50.6602 78.8644 51.6739 79.3307 52.9287 78.6649L58.5936 75.6284C59.1636 75.3055 59.6456 74.8458 59.997 74.2902C60.3517 73.7796 60.5547 73.1777 60.5824 72.5551C60.5824 71.9435 61.0731 71.1887 61.6779 70.8655L64.4975 69.3473C65.0291 69.0653 65.5414 68.7769 66.0299 68.4797L68.1629 67.3411C73.5007 64.4716 77.8333 57.7979 77.8333 52.4082V47.6887Z" fill="#D9EB1B" />
94
+ </svg>
95
+ </div>
96
+ <div>
97
+ <p style="font-size: 14px; font-weight: 500; color: #fff; font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif; margin: 0;">
98
+ ${(()=>{if(e)return e;switch(n){case "login":return "Login with Pelican";case "signup":return "Signup with Pelican";case "id-verification":return "Verify with Pelican";default:return "Authenticate with Pelican"}})()}
99
+ </p>
100
+ </div>
101
+ </div>
102
+ `;typeof window<"u"&&(window.Pelican={createPelicanAuth:ri});exports.createPelicanAuth=ri;return exports;})({});//# sourceMappingURL=index.min.js.map
103
+ //# sourceMappingURL=index.min.js.map