@zkpassport/sdk 0.5.6 → 0.5.7-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3169 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ ASEAN_COUNTRIES: () => import_utils4.ASEAN_COUNTRIES,
34
+ EEA_COUNTRIES: () => import_utils4.EEA_COUNTRIES,
35
+ EU_COUNTRIES: () => import_utils4.EU_COUNTRIES,
36
+ MERCOSUR_COUNTRIES: () => import_utils4.MERCOSUR_COUNTRIES,
37
+ SANCTIONED_COUNTRIES: () => import_utils4.SANCTIONED_COUNTRIES,
38
+ SCHENGEN_COUNTRIES: () => import_utils4.SCHENGEN_COUNTRIES,
39
+ ZKPassport: () => ZKPassport
40
+ });
41
+ module.exports = __toCommonJS(index_exports);
42
+ var import_i18n_iso_countries = require("i18n-iso-countries");
43
+ var import_utils = require("@zkpassport/utils");
44
+ var import_utils2 = require("@noble/ciphers/utils");
45
+
46
+ // src/logger.ts
47
+ var noLogger = {
48
+ debug: (..._) => {
49
+ },
50
+ info: (..._) => {
51
+ },
52
+ warn: (..._) => {
53
+ },
54
+ error: (..._) => {
55
+ }
56
+ };
57
+
58
+ // src/index.ts
59
+ var import_en = __toESM(require("i18n-iso-countries/langs/en.json"), 1);
60
+ var import_buffer = require("buffer/");
61
+ var import_sha2 = require("@noble/hashes/sha2");
62
+ var import_utils3 = require("@noble/hashes/utils");
63
+
64
+ // src/assets/abi/ZKPassportVerifier.json
65
+ var ZKPassportVerifier_default = {
66
+ abi: [
67
+ {
68
+ type: "constructor",
69
+ inputs: [{ name: "_rootRegistry", type: "address", internalType: "address" }],
70
+ stateMutability: "nonpayable"
71
+ },
72
+ {
73
+ type: "function",
74
+ name: "CERTIFICATE_REGISTRY_ID",
75
+ inputs: [],
76
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
77
+ stateMutability: "view"
78
+ },
79
+ {
80
+ type: "function",
81
+ name: "CIRCUIT_REGISTRY_ID",
82
+ inputs: [],
83
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
84
+ stateMutability: "view"
85
+ },
86
+ {
87
+ type: "function",
88
+ name: "addCertificateRegistryRoot",
89
+ inputs: [
90
+ { name: "certificateRegistryRoot", type: "bytes32", internalType: "bytes32" }
91
+ ],
92
+ outputs: [],
93
+ stateMutability: "nonpayable"
94
+ },
95
+ {
96
+ type: "function",
97
+ name: "addVerifiers",
98
+ inputs: [
99
+ { name: "vkeyHashes", type: "bytes32[]", internalType: "bytes32[]" },
100
+ { name: "verifiers", type: "address[]", internalType: "address[]" }
101
+ ],
102
+ outputs: [],
103
+ stateMutability: "nonpayable"
104
+ },
105
+ {
106
+ type: "function",
107
+ name: "admin",
108
+ inputs: [],
109
+ outputs: [{ name: "", type: "address", internalType: "address" }],
110
+ stateMutability: "view"
111
+ },
112
+ {
113
+ type: "function",
114
+ name: "getAgeProofInputs",
115
+ inputs: [
116
+ { name: "committedInputs", type: "bytes", internalType: "bytes" },
117
+ { name: "committedInputCounts", type: "uint256[]", internalType: "uint256[]" }
118
+ ],
119
+ outputs: [
120
+ { name: "currentDate", type: "uint256", internalType: "uint256" },
121
+ { name: "minAge", type: "uint8", internalType: "uint8" },
122
+ { name: "maxAge", type: "uint8", internalType: "uint8" }
123
+ ],
124
+ stateMutability: "pure"
125
+ },
126
+ {
127
+ type: "function",
128
+ name: "getBindProofInputs",
129
+ inputs: [
130
+ { name: "committedInputs", type: "bytes", internalType: "bytes" },
131
+ { name: "committedInputCounts", type: "uint256[]", internalType: "uint256[]" }
132
+ ],
133
+ outputs: [{ name: "data", type: "bytes", internalType: "bytes" }],
134
+ stateMutability: "pure"
135
+ },
136
+ {
137
+ type: "function",
138
+ name: "getBoundData",
139
+ inputs: [{ name: "data", type: "bytes", internalType: "bytes" }],
140
+ outputs: [
141
+ { name: "senderAddress", type: "address", internalType: "address" },
142
+ { name: "customData", type: "string", internalType: "string" }
143
+ ],
144
+ stateMutability: "pure"
145
+ },
146
+ {
147
+ type: "function",
148
+ name: "getCountryProofInputs",
149
+ inputs: [
150
+ { name: "committedInputs", type: "bytes", internalType: "bytes" },
151
+ { name: "committedInputCounts", type: "uint256[]", internalType: "uint256[]" },
152
+ { name: "proofType", type: "uint8", internalType: "enum ProofType" }
153
+ ],
154
+ outputs: [{ name: "countryList", type: "string[]", internalType: "string[]" }],
155
+ stateMutability: "pure"
156
+ },
157
+ {
158
+ type: "function",
159
+ name: "getDateProofInputs",
160
+ inputs: [
161
+ { name: "committedInputs", type: "bytes", internalType: "bytes" },
162
+ { name: "committedInputCounts", type: "uint256[]", internalType: "uint256[]" },
163
+ { name: "proofType", type: "uint8", internalType: "enum ProofType" }
164
+ ],
165
+ outputs: [
166
+ { name: "currentDate", type: "uint256", internalType: "uint256" },
167
+ { name: "minDate", type: "uint256", internalType: "uint256" },
168
+ { name: "maxDate", type: "uint256", internalType: "uint256" }
169
+ ],
170
+ stateMutability: "pure"
171
+ },
172
+ {
173
+ type: "function",
174
+ name: "getDiscloseProofInputs",
175
+ inputs: [
176
+ { name: "committedInputs", type: "bytes", internalType: "bytes" },
177
+ { name: "committedInputCounts", type: "uint256[]", internalType: "uint256[]" }
178
+ ],
179
+ outputs: [
180
+ { name: "discloseMask", type: "bytes", internalType: "bytes" },
181
+ { name: "discloseBytes", type: "bytes", internalType: "bytes" }
182
+ ],
183
+ stateMutability: "pure"
184
+ },
185
+ {
186
+ type: "function",
187
+ name: "getDisclosedData",
188
+ inputs: [
189
+ { name: "discloseBytes", type: "bytes", internalType: "bytes" },
190
+ { name: "isIDCard", type: "bool", internalType: "bool" }
191
+ ],
192
+ outputs: [
193
+ { name: "name", type: "string", internalType: "string" },
194
+ { name: "issuingCountry", type: "string", internalType: "string" },
195
+ { name: "nationality", type: "string", internalType: "string" },
196
+ { name: "gender", type: "string", internalType: "string" },
197
+ { name: "birthDate", type: "string", internalType: "string" },
198
+ { name: "expiryDate", type: "string", internalType: "string" },
199
+ { name: "documentNumber", type: "string", internalType: "string" },
200
+ { name: "documentType", type: "string", internalType: "string" }
201
+ ],
202
+ stateMutability: "pure"
203
+ },
204
+ {
205
+ type: "function",
206
+ name: "isValidCertificateRegistryRoot",
207
+ inputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
208
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
209
+ stateMutability: "view"
210
+ },
211
+ {
212
+ type: "function",
213
+ name: "paused",
214
+ inputs: [],
215
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
216
+ stateMutability: "view"
217
+ },
218
+ {
219
+ type: "function",
220
+ name: "removeCertificateRegistryRoot",
221
+ inputs: [
222
+ { name: "certificateRegistryRoot", type: "bytes32", internalType: "bytes32" }
223
+ ],
224
+ outputs: [],
225
+ stateMutability: "nonpayable"
226
+ },
227
+ {
228
+ type: "function",
229
+ name: "removeVerifiers",
230
+ inputs: [{ name: "vkeyHashes", type: "bytes32[]", internalType: "bytes32[]" }],
231
+ outputs: [],
232
+ stateMutability: "nonpayable"
233
+ },
234
+ {
235
+ type: "function",
236
+ name: "rootRegistry",
237
+ inputs: [],
238
+ outputs: [{ name: "", type: "address", internalType: "contract IRootRegistry" }],
239
+ stateMutability: "view"
240
+ },
241
+ {
242
+ type: "function",
243
+ name: "setPaused",
244
+ inputs: [{ name: "_paused", type: "bool", internalType: "bool" }],
245
+ outputs: [],
246
+ stateMutability: "nonpayable"
247
+ },
248
+ {
249
+ type: "function",
250
+ name: "transferAdmin",
251
+ inputs: [{ name: "newAdmin", type: "address", internalType: "address" }],
252
+ outputs: [],
253
+ stateMutability: "nonpayable"
254
+ },
255
+ {
256
+ type: "function",
257
+ name: "updateRootRegistry",
258
+ inputs: [{ name: "_rootRegistry", type: "address", internalType: "address" }],
259
+ outputs: [],
260
+ stateMutability: "nonpayable"
261
+ },
262
+ {
263
+ type: "function",
264
+ name: "verifyProof",
265
+ inputs: [
266
+ {
267
+ name: "params",
268
+ type: "tuple",
269
+ internalType: "struct ProofVerificationParams",
270
+ components: [
271
+ { name: "vkeyHash", type: "bytes32", internalType: "bytes32" },
272
+ { name: "proof", type: "bytes", internalType: "bytes" },
273
+ { name: "publicInputs", type: "bytes32[]", internalType: "bytes32[]" },
274
+ { name: "committedInputs", type: "bytes", internalType: "bytes" },
275
+ { name: "committedInputCounts", type: "uint256[]", internalType: "uint256[]" },
276
+ { name: "validityPeriodInDays", type: "uint256", internalType: "uint256" },
277
+ { name: "domain", type: "string", internalType: "string" },
278
+ { name: "scope", type: "string", internalType: "string" },
279
+ { name: "devMode", type: "bool", internalType: "bool" }
280
+ ]
281
+ }
282
+ ],
283
+ outputs: [
284
+ { name: "", type: "bool", internalType: "bool" },
285
+ { name: "", type: "bytes32", internalType: "bytes32" }
286
+ ],
287
+ stateMutability: "view"
288
+ },
289
+ {
290
+ type: "function",
291
+ name: "verifyScopes",
292
+ inputs: [
293
+ { name: "publicInputs", type: "bytes32[]", internalType: "bytes32[]" },
294
+ { name: "domain", type: "string", internalType: "string" },
295
+ { name: "scope", type: "string", internalType: "string" }
296
+ ],
297
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
298
+ stateMutability: "view"
299
+ },
300
+ {
301
+ type: "function",
302
+ name: "vkeyHashToVerifier",
303
+ inputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
304
+ outputs: [{ name: "", type: "address", internalType: "address" }],
305
+ stateMutability: "view"
306
+ },
307
+ {
308
+ type: "event",
309
+ name: "AdminUpdated",
310
+ inputs: [
311
+ { name: "oldAdmin", type: "address", indexed: true, internalType: "address" },
312
+ { name: "newAdmin", type: "address", indexed: true, internalType: "address" }
313
+ ],
314
+ anonymous: false
315
+ },
316
+ {
317
+ type: "event",
318
+ name: "CertificateRegistryRootAdded",
319
+ inputs: [
320
+ {
321
+ name: "certificateRegistryRoot",
322
+ type: "bytes32",
323
+ indexed: true,
324
+ internalType: "bytes32"
325
+ }
326
+ ],
327
+ anonymous: false
328
+ },
329
+ {
330
+ type: "event",
331
+ name: "CertificateRegistryRootRemoved",
332
+ inputs: [
333
+ {
334
+ name: "certificateRegistryRoot",
335
+ type: "bytes32",
336
+ indexed: true,
337
+ internalType: "bytes32"
338
+ }
339
+ ],
340
+ anonymous: false
341
+ },
342
+ {
343
+ type: "event",
344
+ name: "PausedStatusChanged",
345
+ inputs: [{ name: "paused", type: "bool", indexed: false, internalType: "bool" }],
346
+ anonymous: false
347
+ },
348
+ {
349
+ type: "event",
350
+ name: "VerifierAdded",
351
+ inputs: [
352
+ { name: "vkeyHash", type: "bytes32", indexed: true, internalType: "bytes32" },
353
+ { name: "verifier", type: "address", indexed: true, internalType: "address" }
354
+ ],
355
+ anonymous: false
356
+ },
357
+ {
358
+ type: "event",
359
+ name: "VerifierRemoved",
360
+ inputs: [
361
+ { name: "vkeyHash", type: "bytes32", indexed: true, internalType: "bytes32" }
362
+ ],
363
+ anonymous: false
364
+ },
365
+ {
366
+ type: "event",
367
+ name: "ZKPassportVerifierDeployed",
368
+ inputs: [
369
+ { name: "admin", type: "address", indexed: true, internalType: "address" },
370
+ { name: "timestamp", type: "uint256", indexed: false, internalType: "uint256" }
371
+ ],
372
+ anonymous: false
373
+ }
374
+ ],
375
+ bytecode: {
376
+ object: "0x608060405234801561000f575f5ffd5b506040516133bb3803806133bb83398101604081905261002e916100f6565b6001600160a01b0381166100945760405162461bcd60e51b8152602060048201526024808201527f526f6f742072656769737472792063616e6e6f74206265207a65726f206164646044820152637265737360e01b606482015260840160405180910390fd5b5f8054336001600160a01b03199182168117909255600380549091166001600160a01b0384161790556040514281527ff29b53747ae7121d0958d490ad3d5cf6767119b0fdbd8389d918de3a12cf5a299060200160405180910390a250610123565b5f60208284031215610106575f5ffd5b81516001600160a01b038116811461011c575f5ffd5b9392505050565b61328b806101305f395ff3fe608060405234801561000f575f5ffd5b5060043610610148575f3560e01c806375829def116100bf578063b2b37a4c11610079578063b2b37a4c1461031a578063b96b161c1461034c578063d7bf616a1461035f578063ddf3eec914610389578063ec1374cd146103aa578063f851a440146103d8575f5ffd5b806375829def1461027b5780638163f2311461028e578063847755e3146102ce578063886c3533146102e15780638d6937b8146102f4578063a6df2c0114610307575f5ffd5b80633a316e62116101105780633a316e62146101e557806341a0e2c2146101f857806345e21c901461020e5780634601173c146102405780635c975abb146102605780636c40d5d614610273575f5ffd5b806303d37eae1461014c5780630af18ba61461017c578063126f75591461019d57806316c38b3c146101bd57806318677f2a146101d2575b5f5ffd5b61015f61015a3660046129bb565b6103ea565b604051610173989796959493929190612a3b565b60405180910390f35b61018f61018a366004612ae8565b610955565b604051610173929190612b26565b6101b06101ab366004612b89565b610b1e565b6040516101739190612c0d565b6101d06101cb366004612c70565b610d62565b005b6101d06101e0366004612c92565b610de2565b6101d06101f3366004612cb8565b610e8f565b610200600181565b604051908152602001610173565b61023061021c366004612cb8565b60026020525f908152604090205460ff1681565b6040519015158152602001610173565b61025361024e366004612ccf565b610efa565b6040516101739190612d39565b5f5461023090600160a01b900460ff1681565b610200600281565b6101d0610289366004612c92565b61126a565b6102b661029c366004612cb8565b60016020525f90815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610173565b6102306102dc366004612d4b565b611338565b6101d06102ef366004612cb8565b61150f565b6101d0610302366004612de7565b611577565b6101d0610315366004612e19565b611637565b61032d610328366004612ccf565b611761565b6040805193845260ff9283166020850152911690820152606001610173565b6003546102b6906001600160a01b031681565b61037261036d366004612e4d565b611918565b604080519215158352602083019190915201610173565b61039c610397366004612ccf565b611cfc565b604051610173929190612e84565b6103bd6103b8366004612b89565b611eb6565b60408051938452602084019290925290820152606001610173565b5f546102b6906001600160a01b031681565b606080606080606080606080886106a4578a60058b61040a826027612ebc565b9261041793929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250929a508d9250600291508c905061045f826003612ebc565b9261046c93929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509299508d9250603691508c90506104b4826003612ebc565b926104c193929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509298508d9250604091508c9050610509826001612ebc565b9261051693929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509297508d9250603991508c905061055e826006612ebc565b9261056b93929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509296508d9250604191508c90506105b3826006612ebc565b926105c093929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509295508d9250602c91508c9050610608826009612ebc565b9261061593929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201829052509395508e9392508d915061065b9050826002612ebc565b9261066893929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525092935061094892505050565b8a603c8b6106b382601e612ebc565b926106c093929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250929a508d9250600291508c9050610708826003612ebc565b9261071593929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509299508d9250602d91508c905061075d826003612ebc565b9261076a93929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509298508d9250602591508c90506107b2826001612ebc565b926107bf93929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509297508d9250601e91508c9050610807826006612ebc565b9261081493929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509296508d9250602691508c905061085c826006612ebc565b9261086993929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509295508d9250600591508c90506108b1826009612ebc565b926108be93929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201829052509395508e9392508d91506109049050826002612ebc565b9261091193929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509293505050505b9397509397509397509397565b5f6060815b6101f4811015610b1657600160f81b85858381811061097b5761097b612f0a565b9050013560f81c60f81b6001600160f81b03191603610a38575f85856109a2846001612ebc565b906109ae856003612ebc565b926109bb93929190612ecf565b6109c491612f1e565b60f01c905085856109d6846003612ebc565b9061ffff84166109e7866003612ebc565b6109f19190612ebc565b926109fe93929190612ecf565b610a0791612f56565b60601c9350610a17816002612f96565b610a22906001612f96565b610a309061ffff1683612ebc565b91505061095a565b600160f91b858583818110610a4f57610a4f612f0a565b9050013560f81c60f81b6001600160f81b03191603610b16575f8585610a76846001612ebc565b90610a82856003612ebc565b92610a8f93929190612ecf565b610a9891612f1e565b60f01c90508585610aaa846003612ebc565b9061ffff8416610abb866003612ebc565b610ac59190612ebc565b92610ad293929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250929550610a17925083915060029050612f96565b509250929050565b60605f80805b85811015610d0457868682818110610b3e57610b3e612f0a565b90506020020135610259148015610b975750846008811115610b6257610b62612ef6565b60f81b6001600160f81b031916898985818110610b8157610b81612f0a565b9050013560f81c60f81b6001600160f81b031916145b15610cd6576040805160c8808252611920820190925290816020015b6060815260200190600190039081610bb35790505093505f5b60c8811015610cd0578989610be2836003612fc4565b610bec9087612ebc565b610bf7906001612ebc565b818110610c0657610c06612f0a565b909101356001600160f81b031916159050610cd0578989610c28836003612fc4565b610c329087612ebc565b610c3d906001612ebc565b90610c49846003612fc4565b610c539088612ebc565b610c5e906003612ebc565b610c69906001612ebc565b92610c7693929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152505087518892508491508110610cbd57610cbd612f0a565b6020908102919091010152600101610bcc565b50600191505b868682818110610ce857610ce8612f0a565b9050602002013583610cfa9190612ebc565b9250600101610b24565b5080610d575760405162461bcd60e51b815260206004820152601e60248201527f436f756e7472792070726f6f6620696e70757473206e6f7420666f756e64000060448201526064015b60405180910390fd5b505095945050505050565b5f546001600160a01b03163314610d8b5760405162461bcd60e51b8152600401610d4e90612fdb565b5f8054821515600160a01b0260ff60a01b199091161790556040517f9a506b30e47f3823b09f67e4c0dfa5c3d8023b71825b7ceaa97677129128c9c590610dd790831515815260200190565b60405180910390a150565b5f546001600160a01b03163314610e0b5760405162461bcd60e51b8152600401610d4e90612fdb565b6001600160a01b038116610e6d5760405162461bcd60e51b8152602060048201526024808201527f526f6f742072656769737472792063616e6e6f74206265207a65726f206164646044820152637265737360e01b6064820152608401610d4e565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b5f546001600160a01b03163314610eb85760405162461bcd60e51b8152600401610d4e90612fdb565b5f81815260026020526040808220805460ff191660011790555182917f28b645e250fa5c9d240590b408225ec310e29b861312e75a76b0d55f7d927a2f91a250565b60605f80805b8481101561121257858582818110610f1a57610f1a612f0a565b905060200201356101f5036111e457600160fb1b888885818110610f4057610f40612f0a565b9050013560f81c60f81b6001600160f81b03191614610f715760405162461bcd60e51b8152600401610d4e90613012565b5f5b6101f48110156110a357600160f81b898983610f90886001612ebc565b610f9a9190612ebc565b818110610fa957610fa9612f0a565b9050013560f81c60f81b6001600160f81b0319160361104f575f898983610fd1886001612ebc565b610fdb9190612ebc565b610fe6906001612ebc565b9084610ff3896001612ebc565b610ffd9190612ebc565b611008906003612ebc565b9261101593929190612ecf565b61101e91612f1e565b60f01c905061102e816002612f96565b611039906001612f96565b6110479061ffff1683612ebc565b915050610f73565b600160f91b898983611062886001612ebc565b61106c9190612ebc565b81811061107b5761107b612f0a565b9050013560f81c60f81b6001600160f81b031916036110a3575f898983610fd1886001612ebc565b5f811180156110b457506101f48111155b6110f65760405162461bcd60e51b8152602060048201526013602482015272092dcecc2d8d2c840c8c2e8c240d8cadccee8d606b1b6044820152606401610d4e565b805b6101f481101561118057898982611110886001612ebc565b61111a9190612ebc565b81811061112957611129612f0a565b909101356001600160f81b0319161590506111785760405162461bcd60e51b815260206004820152600f60248201526e496e76616c69642070616464696e6760881b6044820152606401610d4e565b6001016110f8565b50888861118e866001612ebc565b9061119b876101f5612ebc565b926111a893929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525092975060019550505050505b8585828181106111f6576111f6612f0a565b90506020020135836112089190612ebc565b9250600101610f00565b50806112605760405162461bcd60e51b815260206004820181905260248201527f42696e6420646174612070726f6f6620696e70757473206e6f7420666f756e646044820152606401610d4e565b5050949350505050565b5f546001600160a01b031633146112935760405162461bcd60e51b8152600401610d4e90612fdb565b6001600160a01b0381166112e95760405162461bcd60e51b815260206004820152601c60248201527f41646d696e2063616e6e6f74206265207a65726f2061646472657373000000006044820152606401610d4e565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f101b8081ff3b56bbf45deb824d86a3b0fd38b7e3dd42421105cf8abe9106db0b9190a35050565b5f5f61134346612010565b90505f61138487878080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061211492505050565b61140057600860028888856040516020016113a193929190613055565b60408051601f19818403018152908290526113bb91613077565b602060405180830381855afa1580156113d6573d5f5f3e3d5ffd5b5050506040513d601f19601f820116820180604052508101906113f99190613082565b901c611402565b5f5b90505f61144386868080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061211492505050565b6114bd5760086002878760405160200161145e929190613099565b60408051601f198184030181529082905261147891613077565b602060405180830381855afa158015611493573d5f5f3e3d5ffd5b5050506040513d601f19601f820116820180604052508101906114b69190613082565b901c6114bf565b5f5b9050818a8a600a8181106114d5576114d5612f0a565b905060200201351480156115015750808a8a600b8181106114f8576114f8612f0a565b90506020020135145b9a9950505050505050505050565b5f546001600160a01b031633146115385760405162461bcd60e51b8152600401610d4e90612fdb565b5f81815260026020526040808220805460ff191690555182917fc4da3a189adfa305afb4c073f96be9bd96f1ebea4e42a5e7e2e98818509a682791a250565b5f546001600160a01b031633146115a05760405162461bcd60e51b8152600401610d4e90612fdb565b5f5b818110156116325760015f8484848181106115bf576115bf612f0a565b602090810292909201358352508101919091526040015f2080546001600160a01b03191690558282828181106115f7576115f7612f0a565b905060200201357f6fdcbcf8f91bc23f2c9dcfe8fe01d80d1b1afbbf207298e94c0171ccc587424c60405160405180910390a26001016115a2565b505050565b5f546001600160a01b031633146116605760405162461bcd60e51b8152600401610d4e90612fdb565b5f5b8381101561175a5782828281811061167c5761167c612f0a565b90506020020160208101906116919190612c92565b60015f8787858181106116a6576116a6612f0a565b9050602002013581526020019081526020015f205f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508282828181106116ef576116ef612f0a565b90506020020160208101906117049190612c92565b6001600160a01b031685858381811061171f5761171f612f0a565b905060200201357f636107338a3eb46f1f60562462f3ec11393d35fbc965991aaade3b9e7d89c3f560405160405180910390a3600101611662565b5050505050565b5f80808080805b868110156118be5787878281811061178257611782612f0a565b90506020020135600b0361189057600160f81b8a8a858181106117a7576117a7612f0a565b9050013560f81c60f81b6001600160f81b031916146117d85760405162461bcd60e51b8152600401610d4e90613012565b61183a8a8a6117e8866001612ebc565b906117f4876009612ebc565b9261180193929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061211992505050565b95508989611849856009612ebc565b81811061185857611858612f0a565b919091013560f81c95508a90508961187185600a612ebc565b81811061188057611880612f0a565b919091013560f81c945060019250505b8787828181106118a2576118a2612f0a565b90506020020135836118b49190612ebc565b9250600101611768565b508061190c5760405162461bcd60e51b815260206004820152601a60248201527f4167652070726f6f6620696e70757473206e6f7420666f756e640000000000006044820152606401610d4e565b50509450945094915050565b5f80548190600160a01b900460ff16156119695760405162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b6044820152606401610d4e565b5f6119748435612428565b90505f601061198660408701876130a8565b6119919291506130ed565b90506119bf6119a360408701876130a8565b5f8181106119b3576119b3612f0a565b90506020020135612487565b6119ec6119cf60408701876130a8565b60018181106119e0576119e0612f0a565b90506020020135612569565b611a366119fc60408701876130a8565b808060200260200160405190810160405280939291908181526020018383602002808284375f9201919091525050505060a0870135612627565b611a825760405162461bcd60e51b815260206004820181905260248201527f50726f6f662065787069726564206f72206461746520697320696e76616c69646044820152606401610d4e565b611aac611a9260408701876130a8565b611a9f60c0890189613100565b6102dc60e08b018b613100565b611ae95760405162461bcd60e51b815260206004820152600e60248201526d496e76616c69642073636f70657360901b6044820152606401610d4e565b611b95611af960408701876130a8565b600c90611b076001866130ed565b92611b1493929190613142565b808060200260200160405190810160405280939291908181526020018383602002808284375f92019190915250611b52925050506060880188613100565b611b5f60808a018a6130a8565b808060200260200160405190810160405280939291908181526020018383602002808284375f920191909152506126bb92505050565b6001611ba460408701876130a8565b611baf6001856130ed565b818110611bbe57611bbe612f0a565b90506020020135141580611bdf5750611bdf61012086016101008701612c70565b611c3c5760405162461bcd60e51b815260206004820152602860248201527f4d6f636b2070726f6f667320617265206f6e6c7920616c6c6f77656420696e20604482015267646576206d6f646560c01b6064820152608401610d4e565b6001600160a01b03821663ea50d0e4611c586020880188613100565b611c6560408a018a6130a8565b6040518563ffffffff1660e01b8152600401611c84949392919061316d565b602060405180830381865afa158015611c9f573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611cc391906131cf565b611cd060408701876130a8565b611cdb6001856130ed565b818110611cea57611cea612f0a565b90506020020135935093505050915091565b6060805f80805b85811015611e5d57868682818110611d1d57611d1d612f0a565b9050602002013560b503611e2f575f898985818110611d3e57611d3e612f0a565b9050013560f81c60f81b6001600160f81b03191614611d6f5760405162461bcd60e51b8152600401610d4e90613012565b8888611d7c856001612ebc565b90611d8886605b612ebc565b92611d9593929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509297508b92508a9150611ddb905085605b612ebc565b90611de78660b5612ebc565b92611df493929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250929650600194505050505b868682818110611e4157611e41612f0a565b9050602002013583611e539190612ebc565b9250600101611d03565b5080611eab5760405162461bcd60e51b815260206004820152601f60248201527f446973636c6f73652070726f6f6620696e70757473206e6f7420666f756e64006044820152606401610d4e565b505094509492505050565b5f80808080805b87811015611fb557888882818110611ed757611ed7612f0a565b905060200201356019148015611f2f5750866008811115611efa57611efa612ef6565b60f81b6001600160f81b0319168b8b85818110611f1957611f19612f0a565b9050013560f81c60f81b6001600160f81b031916145b15611f8757611f448b8b6117e8866001612ebc565b9550611f628b8b611f56866009612ebc565b906117f4876011612ebc565b9450611f808b8b611f74866011612ebc565b906117f4876019612ebc565b9350600191505b888882818110611f9957611f99612f0a565b9050602002013583611fab9190612ebc565b9250600101611ebd565b50806120035760405162461bcd60e51b815260206004820152601b60248201527f446174652070726f6f6620696e70757473206e6f7420666f756e6400000000006044820152606401610d4e565b5050955095509592505050565b6060815f036120365750506040805180820190915260018152600360fc1b602082015290565b815f5b811561205f5780612049816131ea565b91506120589050600a83613216565b9150612039565b5f816001600160401b0381111561207857612078612fb0565b6040519080825280601f01601f1916602001820160405280156120a2576020820181803683370190505b5090505b841561210c576120b76001836130ed565b91506120c4600a86613229565b6120cf906030612ebc565b60f81b8183815181106120e4576120e4612f0a565b60200101906001600160f81b03191690815f1a905350612105600a86613216565b94506120a6565b949350505050565b511590565b604080518082019091526008815267313131313131313160c01b6020918201528151908201205f907fc21a5c94d030b6b0ea6834442967d237d4cc49a2b74bbb3846572bb3c8021a300161216e57505f919050565b5f6121998360038151811061218557612185612f0a565b01602001516001600160f81b031916612804565b6121af8460028151811061218557612185612f0a565b6121ba90600a612fc4565b6121d08560018151811061218557612185612f0a565b6121db906064612fc4565b6121f0865f8151811061218557612185612f0a565b6121fc906103e8612fc4565b6122069190612ebc565b6122109190612ebc565b61221a9190612ebc565b90505f6122338460058151811061218557612185612f0a565b6122498560048151811061218557612185612f0a565b61225490600a612fc4565b61225e9190612ebc565b90505f6122778560078151811061218557612185612f0a565b61228d8660068151811061218557612185612f0a565b61229890600a612fc4565b6122a29190612ebc565b90506107b28310156122ef5760405162461bcd60e51b81526020600482015260166024820152750b2cac2e440c4caccdee4ca40aa9c92b040cae0dec6d60531b6044820152606401610d4e565b600182101580156123015750600c8211155b61233d5760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840dadedce8d609b1b6044820152606401610d4e565b600181101580156123575750612353828461281d565b8111155b6123915760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642064617960a81b6044820152606401610d4e565b5f6107b25b848110156123cf576123a7816128d0565b6123b35761016d6123b7565b61016e5b6123c59061ffff1683612ebc565b9150600101612396565b5060015b838110156123f9576123e5818661281d565b6123ef9083612ebc565b91506001016123d3565b506124056001836130ed565b61240f9082612ebc565b905061241e6201518082612fc4565b9695505050505050565b5f818152600160205260408120546001600160a01b0316806124815760405162461bcd60e51b815260206004820152601260248201527115995c9a599a595c881b9bdd08199bdd5b9960721b6044820152606401610d4e565b92915050565b5f8181526002602052604090205460ff168061251057506003546040516383578c1160e01b815260016004820152602481018390526001600160a01b03909116906383578c1190604401602060405180830381865afa1580156124ec573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061251091906131cf565b6125665760405162461bcd60e51b815260206004820152602160248201527f496e76616c696420636572746966696361746520726567697374727920726f6f6044820152601d60fa1b6064820152608401610d4e565b50565b6003546040516383578c1160e01b815260026004820152602481018390526001600160a01b03909116906383578c1190604401602060405180830381865afa1580156125b7573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125db91906131cf565b6125665760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964206369726375697420726567697374727920726f6f740000006044820152606401610d4e565b6040805160088082528183019092525f9182919060208201818036833701905050905060025b600a8110156126b05760f885828151811061266a5761266a612f0a565b6020026020010151901b8260028361268291906130ed565b8151811061269257612692612f0a565b60200101906001600160f81b03191690815f1a90535060010161264d565b5061210c8184612920565b5f805b82518110156127fc575f60086002878786908887815181106126e2576126e2612f0a565b6020026020010151886126f59190612ebc565b9261270293929190612ecf565b604051602001612713929190613099565b60408051601f198184030181529082905261272d91613077565b602060405180830381855afa158015612748573d5f5f3e3d5ffd5b5050506040513d601f19601f8201168201806040525081019061276b9190613082565b901c905086828151811061278157612781612f0a565b602002602001015181146127cc5760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a590818dbdb5b5a5d1b595b9d60721b6044820152606401610d4e565b8382815181106127de576127de612f0a565b6020026020010151836127f19190612ebc565b9250506001016126be565b505050505050565b5f612814603060f884901c61323c565b60ff1692915050565b5f600183101580156128305750600c8311155b61286c5760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840dadedce8d609b1b6044820152606401610d4e565b826002036128955761287d826128d0565b61288857601c61288b565b601d5b60ff169050612481565b82600414806128a45750826006145b806128af5750826009145b806128ba575082600b145b156128c75750601e612481565b50601f92915050565b5f6128dc600483613229565b156128e857505f919050565b6128f3606483613229565b1561290057506001919050565b61290c61019083613229565b1561291857505f919050565b506001919050565b5f5f61292b84612119565b90505f61293b6201518085612fc4565b6129459083612ebc565b905081421015801561295657508181115b801561296157504281115b95945050505050565b5f5f83601f84011261297a575f5ffd5b5081356001600160401b03811115612990575f5ffd5b6020830191508360208285010111156129a7575f5ffd5b9250929050565b8015158114612566575f5ffd5b5f5f5f604084860312156129cd575f5ffd5b83356001600160401b038111156129e2575f5ffd5b6129ee8682870161296a565b9094509250506020840135612a02816129ae565b809150509250925092565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b61010081525f612a4f61010083018b612a0d565b8281036020840152612a61818b612a0d565b90508281036040840152612a75818a612a0d565b90508281036060840152612a898189612a0d565b90508281036080840152612a9d8188612a0d565b905082810360a0840152612ab18187612a0d565b905082810360c0840152612ac58186612a0d565b905082810360e0840152612ad98185612a0d565b9b9a5050505050505050505050565b5f5f60208385031215612af9575f5ffd5b82356001600160401b03811115612b0e575f5ffd5b612b1a8582860161296a565b90969095509350505050565b6001600160a01b03831681526040602082018190525f9061210c90830184612a0d565b5f5f83601f840112612b59575f5ffd5b5081356001600160401b03811115612b6f575f5ffd5b6020830191508360208260051b85010111156129a7575f5ffd5b5f5f5f5f5f60608688031215612b9d575f5ffd5b85356001600160401b03811115612bb2575f5ffd5b612bbe8882890161296a565b90965094505060208601356001600160401b03811115612bdc575f5ffd5b612be888828901612b49565b909450925050604086013560098110612bff575f5ffd5b809150509295509295909350565b5f602082016020835280845180835260408501915060408160051b8601019250602086015f5b82811015612c6457603f19878603018452612c4f858351612a0d565b94506020938401939190910190600101612c33565b50929695505050505050565b5f60208284031215612c80575f5ffd5b8135612c8b816129ae565b9392505050565b5f60208284031215612ca2575f5ffd5b81356001600160a01b0381168114612c8b575f5ffd5b5f60208284031215612cc8575f5ffd5b5035919050565b5f5f5f5f60408587031215612ce2575f5ffd5b84356001600160401b03811115612cf7575f5ffd5b612d038782880161296a565b90955093505060208501356001600160401b03811115612d21575f5ffd5b612d2d87828801612b49565b95989497509550505050565b602081525f612c8b6020830184612a0d565b5f5f5f5f5f5f60608789031215612d60575f5ffd5b86356001600160401b03811115612d75575f5ffd5b612d8189828a01612b49565b90975095505060208701356001600160401b03811115612d9f575f5ffd5b612dab89828a0161296a565b90955093505060408701356001600160401b03811115612dc9575f5ffd5b612dd589828a0161296a565b979a9699509497509295939492505050565b5f5f60208385031215612df8575f5ffd5b82356001600160401b03811115612e0d575f5ffd5b612b1a85828601612b49565b5f5f5f5f60408587031215612e2c575f5ffd5b84356001600160401b03811115612e41575f5ffd5b612d0387828801612b49565b5f60208284031215612e5d575f5ffd5b81356001600160401b03811115612e72575f5ffd5b82016101208185031215612c8b575f5ffd5b604081525f612e966040830185612a0d565b82810360208401526129618185612a0d565b634e487b7160e01b5f52601160045260245ffd5b8082018082111561248157612481612ea8565b5f5f85851115612edd575f5ffd5b83861115612ee9575f5ffd5b5050820193919092039150565b634e487b7160e01b5f52602160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b80356001600160f01b03198116906002841015612f4f576001600160f01b0319600285900360031b81901b82161691505b5092915050565b80356bffffffffffffffffffffffff198116906014841015612f4f576bffffffffffffffffffffffff1960149490940360031b84901b1690921692915050565b61ffff818116838216019081111561248157612481612ea8565b634e487b7160e01b5f52604160045260245ffd5b808202811582820484141761248157612481612ea8565b6020808252601a908201527f4e6f7420617574686f72697a65643a2061646d696e206f6e6c79000000000000604082015260600190565b602080825260129082015271496e76616c69642070726f6f66207479706560701b604082015260600190565b5f81518060208401855e5f93019283525090919050565b828482375f838201663a636861696e2d60c81b815261241e600782018561303e565b5f612c8b828461303e565b5f60208284031215613092575f5ffd5b5051919050565b818382375f9101908152919050565b5f5f8335601e198436030181126130bd575f5ffd5b8301803591506001600160401b038211156130d6575f5ffd5b6020019150600581901b36038213156129a7575f5ffd5b8181038181111561248157612481612ea8565b5f5f8335601e19843603018112613115575f5ffd5b8301803591506001600160401b0382111561312e575f5ffd5b6020019150368190038213156129a7575f5ffd5b5f5f85851115613150575f5ffd5b8386111561315c575f5ffd5b5050600583901b0193919092039150565b60408152836040820152838560608301375f60608583018101829052601f19601f8701168301838103820160208501529081018490526001600160fb1b038411156131b6575f5ffd5b8360051b80866080840137016080019695505050505050565b5f602082840312156131df575f5ffd5b8151612c8b816129ae565b5f600182016131fb576131fb612ea8565b5060010190565b634e487b7160e01b5f52601260045260245ffd5b5f8261322457613224613202565b500490565b5f8261323757613237613202565b500690565b60ff828116828216039081111561248157612481612ea856fea26469706673582212201a497e289cb2afef87e360aef70529cf50f5118d091365c3a48d37bb3c55e49a64736f6c634300081d0033",
377
+ sourceMap: "878:18823:27:-:0;;;4273:256;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;4322:27:27;;4314:76;;;;-1:-1:-1;;;4314:76:27;;511:2:31;4314:76:27;;;493:21:31;550:2;530:18;;;523:30;589:34;569:18;;;562:62;-1:-1:-1;;;640:18:31;;;633:34;684:19;;4314:76:27;;;;;;;;4396:5;:18;;4404:10;-1:-1:-1;;;;;;4396:18:27;;;;;;;;4420:12;:43;;;;;-1:-1:-1;;;;;4420:43:27;;;;;4474:50;;4508:15;860:25:31;;4474:50:27;;848:2:31;833:18;4474:50:27;;;;;;;4273:256;878:18823;;14:290:31;84:6;137:2;125:9;116:7;112:23;108:32;105:52;;;153:1;150;143:12;105:52;179:16;;-1:-1:-1;;;;;224:31:31;;214:42;;204:70;;270:1;267;260:12;204:70;293:5;14:290;-1:-1:-1;;;14:290:31:o;714:177::-;878:18823:27;;;;;;",
378
+ linkReferences: {}
379
+ },
380
+ deployedBytecode: {
381
+ object: "0x608060405234801561000f575f5ffd5b5060043610610148575f3560e01c806375829def116100bf578063b2b37a4c11610079578063b2b37a4c1461031a578063b96b161c1461034c578063d7bf616a1461035f578063ddf3eec914610389578063ec1374cd146103aa578063f851a440146103d8575f5ffd5b806375829def1461027b5780638163f2311461028e578063847755e3146102ce578063886c3533146102e15780638d6937b8146102f4578063a6df2c0114610307575f5ffd5b80633a316e62116101105780633a316e62146101e557806341a0e2c2146101f857806345e21c901461020e5780634601173c146102405780635c975abb146102605780636c40d5d614610273575f5ffd5b806303d37eae1461014c5780630af18ba61461017c578063126f75591461019d57806316c38b3c146101bd57806318677f2a146101d2575b5f5ffd5b61015f61015a3660046129bb565b6103ea565b604051610173989796959493929190612a3b565b60405180910390f35b61018f61018a366004612ae8565b610955565b604051610173929190612b26565b6101b06101ab366004612b89565b610b1e565b6040516101739190612c0d565b6101d06101cb366004612c70565b610d62565b005b6101d06101e0366004612c92565b610de2565b6101d06101f3366004612cb8565b610e8f565b610200600181565b604051908152602001610173565b61023061021c366004612cb8565b60026020525f908152604090205460ff1681565b6040519015158152602001610173565b61025361024e366004612ccf565b610efa565b6040516101739190612d39565b5f5461023090600160a01b900460ff1681565b610200600281565b6101d0610289366004612c92565b61126a565b6102b661029c366004612cb8565b60016020525f90815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610173565b6102306102dc366004612d4b565b611338565b6101d06102ef366004612cb8565b61150f565b6101d0610302366004612de7565b611577565b6101d0610315366004612e19565b611637565b61032d610328366004612ccf565b611761565b6040805193845260ff9283166020850152911690820152606001610173565b6003546102b6906001600160a01b031681565b61037261036d366004612e4d565b611918565b604080519215158352602083019190915201610173565b61039c610397366004612ccf565b611cfc565b604051610173929190612e84565b6103bd6103b8366004612b89565b611eb6565b60408051938452602084019290925290820152606001610173565b5f546102b6906001600160a01b031681565b606080606080606080606080886106a4578a60058b61040a826027612ebc565b9261041793929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250929a508d9250600291508c905061045f826003612ebc565b9261046c93929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509299508d9250603691508c90506104b4826003612ebc565b926104c193929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509298508d9250604091508c9050610509826001612ebc565b9261051693929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509297508d9250603991508c905061055e826006612ebc565b9261056b93929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509296508d9250604191508c90506105b3826006612ebc565b926105c093929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509295508d9250602c91508c9050610608826009612ebc565b9261061593929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201829052509395508e9392508d915061065b9050826002612ebc565b9261066893929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525092935061094892505050565b8a603c8b6106b382601e612ebc565b926106c093929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250929a508d9250600291508c9050610708826003612ebc565b9261071593929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509299508d9250602d91508c905061075d826003612ebc565b9261076a93929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509298508d9250602591508c90506107b2826001612ebc565b926107bf93929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509297508d9250601e91508c9050610807826006612ebc565b9261081493929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509296508d9250602691508c905061085c826006612ebc565b9261086993929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509295508d9250600591508c90506108b1826009612ebc565b926108be93929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201829052509395508e9392508d91506109049050826002612ebc565b9261091193929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509293505050505b9397509397509397509397565b5f6060815b6101f4811015610b1657600160f81b85858381811061097b5761097b612f0a565b9050013560f81c60f81b6001600160f81b03191603610a38575f85856109a2846001612ebc565b906109ae856003612ebc565b926109bb93929190612ecf565b6109c491612f1e565b60f01c905085856109d6846003612ebc565b9061ffff84166109e7866003612ebc565b6109f19190612ebc565b926109fe93929190612ecf565b610a0791612f56565b60601c9350610a17816002612f96565b610a22906001612f96565b610a309061ffff1683612ebc565b91505061095a565b600160f91b858583818110610a4f57610a4f612f0a565b9050013560f81c60f81b6001600160f81b03191603610b16575f8585610a76846001612ebc565b90610a82856003612ebc565b92610a8f93929190612ecf565b610a9891612f1e565b60f01c90508585610aaa846003612ebc565b9061ffff8416610abb866003612ebc565b610ac59190612ebc565b92610ad293929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250929550610a17925083915060029050612f96565b509250929050565b60605f80805b85811015610d0457868682818110610b3e57610b3e612f0a565b90506020020135610259148015610b975750846008811115610b6257610b62612ef6565b60f81b6001600160f81b031916898985818110610b8157610b81612f0a565b9050013560f81c60f81b6001600160f81b031916145b15610cd6576040805160c8808252611920820190925290816020015b6060815260200190600190039081610bb35790505093505f5b60c8811015610cd0578989610be2836003612fc4565b610bec9087612ebc565b610bf7906001612ebc565b818110610c0657610c06612f0a565b909101356001600160f81b031916159050610cd0578989610c28836003612fc4565b610c329087612ebc565b610c3d906001612ebc565b90610c49846003612fc4565b610c539088612ebc565b610c5e906003612ebc565b610c69906001612ebc565b92610c7693929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152505087518892508491508110610cbd57610cbd612f0a565b6020908102919091010152600101610bcc565b50600191505b868682818110610ce857610ce8612f0a565b9050602002013583610cfa9190612ebc565b9250600101610b24565b5080610d575760405162461bcd60e51b815260206004820152601e60248201527f436f756e7472792070726f6f6620696e70757473206e6f7420666f756e64000060448201526064015b60405180910390fd5b505095945050505050565b5f546001600160a01b03163314610d8b5760405162461bcd60e51b8152600401610d4e90612fdb565b5f8054821515600160a01b0260ff60a01b199091161790556040517f9a506b30e47f3823b09f67e4c0dfa5c3d8023b71825b7ceaa97677129128c9c590610dd790831515815260200190565b60405180910390a150565b5f546001600160a01b03163314610e0b5760405162461bcd60e51b8152600401610d4e90612fdb565b6001600160a01b038116610e6d5760405162461bcd60e51b8152602060048201526024808201527f526f6f742072656769737472792063616e6e6f74206265207a65726f206164646044820152637265737360e01b6064820152608401610d4e565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b5f546001600160a01b03163314610eb85760405162461bcd60e51b8152600401610d4e90612fdb565b5f81815260026020526040808220805460ff191660011790555182917f28b645e250fa5c9d240590b408225ec310e29b861312e75a76b0d55f7d927a2f91a250565b60605f80805b8481101561121257858582818110610f1a57610f1a612f0a565b905060200201356101f5036111e457600160fb1b888885818110610f4057610f40612f0a565b9050013560f81c60f81b6001600160f81b03191614610f715760405162461bcd60e51b8152600401610d4e90613012565b5f5b6101f48110156110a357600160f81b898983610f90886001612ebc565b610f9a9190612ebc565b818110610fa957610fa9612f0a565b9050013560f81c60f81b6001600160f81b0319160361104f575f898983610fd1886001612ebc565b610fdb9190612ebc565b610fe6906001612ebc565b9084610ff3896001612ebc565b610ffd9190612ebc565b611008906003612ebc565b9261101593929190612ecf565b61101e91612f1e565b60f01c905061102e816002612f96565b611039906001612f96565b6110479061ffff1683612ebc565b915050610f73565b600160f91b898983611062886001612ebc565b61106c9190612ebc565b81811061107b5761107b612f0a565b9050013560f81c60f81b6001600160f81b031916036110a3575f898983610fd1886001612ebc565b5f811180156110b457506101f48111155b6110f65760405162461bcd60e51b8152602060048201526013602482015272092dcecc2d8d2c840c8c2e8c240d8cadccee8d606b1b6044820152606401610d4e565b805b6101f481101561118057898982611110886001612ebc565b61111a9190612ebc565b81811061112957611129612f0a565b909101356001600160f81b0319161590506111785760405162461bcd60e51b815260206004820152600f60248201526e496e76616c69642070616464696e6760881b6044820152606401610d4e565b6001016110f8565b50888861118e866001612ebc565b9061119b876101f5612ebc565b926111a893929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525092975060019550505050505b8585828181106111f6576111f6612f0a565b90506020020135836112089190612ebc565b9250600101610f00565b50806112605760405162461bcd60e51b815260206004820181905260248201527f42696e6420646174612070726f6f6620696e70757473206e6f7420666f756e646044820152606401610d4e565b5050949350505050565b5f546001600160a01b031633146112935760405162461bcd60e51b8152600401610d4e90612fdb565b6001600160a01b0381166112e95760405162461bcd60e51b815260206004820152601c60248201527f41646d696e2063616e6e6f74206265207a65726f2061646472657373000000006044820152606401610d4e565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f101b8081ff3b56bbf45deb824d86a3b0fd38b7e3dd42421105cf8abe9106db0b9190a35050565b5f5f61134346612010565b90505f61138487878080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061211492505050565b61140057600860028888856040516020016113a193929190613055565b60408051601f19818403018152908290526113bb91613077565b602060405180830381855afa1580156113d6573d5f5f3e3d5ffd5b5050506040513d601f19601f820116820180604052508101906113f99190613082565b901c611402565b5f5b90505f61144386868080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061211492505050565b6114bd5760086002878760405160200161145e929190613099565b60408051601f198184030181529082905261147891613077565b602060405180830381855afa158015611493573d5f5f3e3d5ffd5b5050506040513d601f19601f820116820180604052508101906114b69190613082565b901c6114bf565b5f5b9050818a8a600a8181106114d5576114d5612f0a565b905060200201351480156115015750808a8a600b8181106114f8576114f8612f0a565b90506020020135145b9a9950505050505050505050565b5f546001600160a01b031633146115385760405162461bcd60e51b8152600401610d4e90612fdb565b5f81815260026020526040808220805460ff191690555182917fc4da3a189adfa305afb4c073f96be9bd96f1ebea4e42a5e7e2e98818509a682791a250565b5f546001600160a01b031633146115a05760405162461bcd60e51b8152600401610d4e90612fdb565b5f5b818110156116325760015f8484848181106115bf576115bf612f0a565b602090810292909201358352508101919091526040015f2080546001600160a01b03191690558282828181106115f7576115f7612f0a565b905060200201357f6fdcbcf8f91bc23f2c9dcfe8fe01d80d1b1afbbf207298e94c0171ccc587424c60405160405180910390a26001016115a2565b505050565b5f546001600160a01b031633146116605760405162461bcd60e51b8152600401610d4e90612fdb565b5f5b8381101561175a5782828281811061167c5761167c612f0a565b90506020020160208101906116919190612c92565b60015f8787858181106116a6576116a6612f0a565b9050602002013581526020019081526020015f205f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508282828181106116ef576116ef612f0a565b90506020020160208101906117049190612c92565b6001600160a01b031685858381811061171f5761171f612f0a565b905060200201357f636107338a3eb46f1f60562462f3ec11393d35fbc965991aaade3b9e7d89c3f560405160405180910390a3600101611662565b5050505050565b5f80808080805b868110156118be5787878281811061178257611782612f0a565b90506020020135600b0361189057600160f81b8a8a858181106117a7576117a7612f0a565b9050013560f81c60f81b6001600160f81b031916146117d85760405162461bcd60e51b8152600401610d4e90613012565b61183a8a8a6117e8866001612ebc565b906117f4876009612ebc565b9261180193929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061211992505050565b95508989611849856009612ebc565b81811061185857611858612f0a565b919091013560f81c95508a90508961187185600a612ebc565b81811061188057611880612f0a565b919091013560f81c945060019250505b8787828181106118a2576118a2612f0a565b90506020020135836118b49190612ebc565b9250600101611768565b508061190c5760405162461bcd60e51b815260206004820152601a60248201527f4167652070726f6f6620696e70757473206e6f7420666f756e640000000000006044820152606401610d4e565b50509450945094915050565b5f80548190600160a01b900460ff16156119695760405162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b6044820152606401610d4e565b5f6119748435612428565b90505f601061198660408701876130a8565b6119919291506130ed565b90506119bf6119a360408701876130a8565b5f8181106119b3576119b3612f0a565b90506020020135612487565b6119ec6119cf60408701876130a8565b60018181106119e0576119e0612f0a565b90506020020135612569565b611a366119fc60408701876130a8565b808060200260200160405190810160405280939291908181526020018383602002808284375f9201919091525050505060a0870135612627565b611a825760405162461bcd60e51b815260206004820181905260248201527f50726f6f662065787069726564206f72206461746520697320696e76616c69646044820152606401610d4e565b611aac611a9260408701876130a8565b611a9f60c0890189613100565b6102dc60e08b018b613100565b611ae95760405162461bcd60e51b815260206004820152600e60248201526d496e76616c69642073636f70657360901b6044820152606401610d4e565b611b95611af960408701876130a8565b600c90611b076001866130ed565b92611b1493929190613142565b808060200260200160405190810160405280939291908181526020018383602002808284375f92019190915250611b52925050506060880188613100565b611b5f60808a018a6130a8565b808060200260200160405190810160405280939291908181526020018383602002808284375f920191909152506126bb92505050565b6001611ba460408701876130a8565b611baf6001856130ed565b818110611bbe57611bbe612f0a565b90506020020135141580611bdf5750611bdf61012086016101008701612c70565b611c3c5760405162461bcd60e51b815260206004820152602860248201527f4d6f636b2070726f6f667320617265206f6e6c7920616c6c6f77656420696e20604482015267646576206d6f646560c01b6064820152608401610d4e565b6001600160a01b03821663ea50d0e4611c586020880188613100565b611c6560408a018a6130a8565b6040518563ffffffff1660e01b8152600401611c84949392919061316d565b602060405180830381865afa158015611c9f573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611cc391906131cf565b611cd060408701876130a8565b611cdb6001856130ed565b818110611cea57611cea612f0a565b90506020020135935093505050915091565b6060805f80805b85811015611e5d57868682818110611d1d57611d1d612f0a565b9050602002013560b503611e2f575f898985818110611d3e57611d3e612f0a565b9050013560f81c60f81b6001600160f81b03191614611d6f5760405162461bcd60e51b8152600401610d4e90613012565b8888611d7c856001612ebc565b90611d8886605b612ebc565b92611d9593929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152509297508b92508a9150611ddb905085605b612ebc565b90611de78660b5612ebc565b92611df493929190612ecf565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250929650600194505050505b868682818110611e4157611e41612f0a565b9050602002013583611e539190612ebc565b9250600101611d03565b5080611eab5760405162461bcd60e51b815260206004820152601f60248201527f446973636c6f73652070726f6f6620696e70757473206e6f7420666f756e64006044820152606401610d4e565b505094509492505050565b5f80808080805b87811015611fb557888882818110611ed757611ed7612f0a565b905060200201356019148015611f2f5750866008811115611efa57611efa612ef6565b60f81b6001600160f81b0319168b8b85818110611f1957611f19612f0a565b9050013560f81c60f81b6001600160f81b031916145b15611f8757611f448b8b6117e8866001612ebc565b9550611f628b8b611f56866009612ebc565b906117f4876011612ebc565b9450611f808b8b611f74866011612ebc565b906117f4876019612ebc565b9350600191505b888882818110611f9957611f99612f0a565b9050602002013583611fab9190612ebc565b9250600101611ebd565b50806120035760405162461bcd60e51b815260206004820152601b60248201527f446174652070726f6f6620696e70757473206e6f7420666f756e6400000000006044820152606401610d4e565b5050955095509592505050565b6060815f036120365750506040805180820190915260018152600360fc1b602082015290565b815f5b811561205f5780612049816131ea565b91506120589050600a83613216565b9150612039565b5f816001600160401b0381111561207857612078612fb0565b6040519080825280601f01601f1916602001820160405280156120a2576020820181803683370190505b5090505b841561210c576120b76001836130ed565b91506120c4600a86613229565b6120cf906030612ebc565b60f81b8183815181106120e4576120e4612f0a565b60200101906001600160f81b03191690815f1a905350612105600a86613216565b94506120a6565b949350505050565b511590565b604080518082019091526008815267313131313131313160c01b6020918201528151908201205f907fc21a5c94d030b6b0ea6834442967d237d4cc49a2b74bbb3846572bb3c8021a300161216e57505f919050565b5f6121998360038151811061218557612185612f0a565b01602001516001600160f81b031916612804565b6121af8460028151811061218557612185612f0a565b6121ba90600a612fc4565b6121d08560018151811061218557612185612f0a565b6121db906064612fc4565b6121f0865f8151811061218557612185612f0a565b6121fc906103e8612fc4565b6122069190612ebc565b6122109190612ebc565b61221a9190612ebc565b90505f6122338460058151811061218557612185612f0a565b6122498560048151811061218557612185612f0a565b61225490600a612fc4565b61225e9190612ebc565b90505f6122778560078151811061218557612185612f0a565b61228d8660068151811061218557612185612f0a565b61229890600a612fc4565b6122a29190612ebc565b90506107b28310156122ef5760405162461bcd60e51b81526020600482015260166024820152750b2cac2e440c4caccdee4ca40aa9c92b040cae0dec6d60531b6044820152606401610d4e565b600182101580156123015750600c8211155b61233d5760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840dadedce8d609b1b6044820152606401610d4e565b600181101580156123575750612353828461281d565b8111155b6123915760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642064617960a81b6044820152606401610d4e565b5f6107b25b848110156123cf576123a7816128d0565b6123b35761016d6123b7565b61016e5b6123c59061ffff1683612ebc565b9150600101612396565b5060015b838110156123f9576123e5818661281d565b6123ef9083612ebc565b91506001016123d3565b506124056001836130ed565b61240f9082612ebc565b905061241e6201518082612fc4565b9695505050505050565b5f818152600160205260408120546001600160a01b0316806124815760405162461bcd60e51b815260206004820152601260248201527115995c9a599a595c881b9bdd08199bdd5b9960721b6044820152606401610d4e565b92915050565b5f8181526002602052604090205460ff168061251057506003546040516383578c1160e01b815260016004820152602481018390526001600160a01b03909116906383578c1190604401602060405180830381865afa1580156124ec573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061251091906131cf565b6125665760405162461bcd60e51b815260206004820152602160248201527f496e76616c696420636572746966696361746520726567697374727920726f6f6044820152601d60fa1b6064820152608401610d4e565b50565b6003546040516383578c1160e01b815260026004820152602481018390526001600160a01b03909116906383578c1190604401602060405180830381865afa1580156125b7573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125db91906131cf565b6125665760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964206369726375697420726567697374727920726f6f740000006044820152606401610d4e565b6040805160088082528183019092525f9182919060208201818036833701905050905060025b600a8110156126b05760f885828151811061266a5761266a612f0a565b6020026020010151901b8260028361268291906130ed565b8151811061269257612692612f0a565b60200101906001600160f81b03191690815f1a90535060010161264d565b5061210c8184612920565b5f805b82518110156127fc575f60086002878786908887815181106126e2576126e2612f0a565b6020026020010151886126f59190612ebc565b9261270293929190612ecf565b604051602001612713929190613099565b60408051601f198184030181529082905261272d91613077565b602060405180830381855afa158015612748573d5f5f3e3d5ffd5b5050506040513d601f19601f8201168201806040525081019061276b9190613082565b901c905086828151811061278157612781612f0a565b602002602001015181146127cc5760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a590818dbdb5b5a5d1b595b9d60721b6044820152606401610d4e565b8382815181106127de576127de612f0a565b6020026020010151836127f19190612ebc565b9250506001016126be565b505050505050565b5f612814603060f884901c61323c565b60ff1692915050565b5f600183101580156128305750600c8311155b61286c5760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840dadedce8d609b1b6044820152606401610d4e565b826002036128955761287d826128d0565b61288857601c61288b565b601d5b60ff169050612481565b82600414806128a45750826006145b806128af5750826009145b806128ba575082600b145b156128c75750601e612481565b50601f92915050565b5f6128dc600483613229565b156128e857505f919050565b6128f3606483613229565b1561290057506001919050565b61290c61019083613229565b1561291857505f919050565b506001919050565b5f5f61292b84612119565b90505f61293b6201518085612fc4565b6129459083612ebc565b905081421015801561295657508181115b801561296157504281115b95945050505050565b5f5f83601f84011261297a575f5ffd5b5081356001600160401b03811115612990575f5ffd5b6020830191508360208285010111156129a7575f5ffd5b9250929050565b8015158114612566575f5ffd5b5f5f5f604084860312156129cd575f5ffd5b83356001600160401b038111156129e2575f5ffd5b6129ee8682870161296a565b9094509250506020840135612a02816129ae565b809150509250925092565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b61010081525f612a4f61010083018b612a0d565b8281036020840152612a61818b612a0d565b90508281036040840152612a75818a612a0d565b90508281036060840152612a898189612a0d565b90508281036080840152612a9d8188612a0d565b905082810360a0840152612ab18187612a0d565b905082810360c0840152612ac58186612a0d565b905082810360e0840152612ad98185612a0d565b9b9a5050505050505050505050565b5f5f60208385031215612af9575f5ffd5b82356001600160401b03811115612b0e575f5ffd5b612b1a8582860161296a565b90969095509350505050565b6001600160a01b03831681526040602082018190525f9061210c90830184612a0d565b5f5f83601f840112612b59575f5ffd5b5081356001600160401b03811115612b6f575f5ffd5b6020830191508360208260051b85010111156129a7575f5ffd5b5f5f5f5f5f60608688031215612b9d575f5ffd5b85356001600160401b03811115612bb2575f5ffd5b612bbe8882890161296a565b90965094505060208601356001600160401b03811115612bdc575f5ffd5b612be888828901612b49565b909450925050604086013560098110612bff575f5ffd5b809150509295509295909350565b5f602082016020835280845180835260408501915060408160051b8601019250602086015f5b82811015612c6457603f19878603018452612c4f858351612a0d565b94506020938401939190910190600101612c33565b50929695505050505050565b5f60208284031215612c80575f5ffd5b8135612c8b816129ae565b9392505050565b5f60208284031215612ca2575f5ffd5b81356001600160a01b0381168114612c8b575f5ffd5b5f60208284031215612cc8575f5ffd5b5035919050565b5f5f5f5f60408587031215612ce2575f5ffd5b84356001600160401b03811115612cf7575f5ffd5b612d038782880161296a565b90955093505060208501356001600160401b03811115612d21575f5ffd5b612d2d87828801612b49565b95989497509550505050565b602081525f612c8b6020830184612a0d565b5f5f5f5f5f5f60608789031215612d60575f5ffd5b86356001600160401b03811115612d75575f5ffd5b612d8189828a01612b49565b90975095505060208701356001600160401b03811115612d9f575f5ffd5b612dab89828a0161296a565b90955093505060408701356001600160401b03811115612dc9575f5ffd5b612dd589828a0161296a565b979a9699509497509295939492505050565b5f5f60208385031215612df8575f5ffd5b82356001600160401b03811115612e0d575f5ffd5b612b1a85828601612b49565b5f5f5f5f60408587031215612e2c575f5ffd5b84356001600160401b03811115612e41575f5ffd5b612d0387828801612b49565b5f60208284031215612e5d575f5ffd5b81356001600160401b03811115612e72575f5ffd5b82016101208185031215612c8b575f5ffd5b604081525f612e966040830185612a0d565b82810360208401526129618185612a0d565b634e487b7160e01b5f52601160045260245ffd5b8082018082111561248157612481612ea8565b5f5f85851115612edd575f5ffd5b83861115612ee9575f5ffd5b5050820193919092039150565b634e487b7160e01b5f52602160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b80356001600160f01b03198116906002841015612f4f576001600160f01b0319600285900360031b81901b82161691505b5092915050565b80356bffffffffffffffffffffffff198116906014841015612f4f576bffffffffffffffffffffffff1960149490940360031b84901b1690921692915050565b61ffff818116838216019081111561248157612481612ea8565b634e487b7160e01b5f52604160045260245ffd5b808202811582820484141761248157612481612ea8565b6020808252601a908201527f4e6f7420617574686f72697a65643a2061646d696e206f6e6c79000000000000604082015260600190565b602080825260129082015271496e76616c69642070726f6f66207479706560701b604082015260600190565b5f81518060208401855e5f93019283525090919050565b828482375f838201663a636861696e2d60c81b815261241e600782018561303e565b5f612c8b828461303e565b5f60208284031215613092575f5ffd5b5051919050565b818382375f9101908152919050565b5f5f8335601e198436030181126130bd575f5ffd5b8301803591506001600160401b038211156130d6575f5ffd5b6020019150600581901b36038213156129a7575f5ffd5b8181038181111561248157612481612ea8565b5f5f8335601e19843603018112613115575f5ffd5b8301803591506001600160401b0382111561312e575f5ffd5b6020019150368190038213156129a7575f5ffd5b5f5f85851115613150575f5ffd5b8386111561315c575f5ffd5b5050600583901b0193919092039150565b60408152836040820152838560608301375f60608583018101829052601f19601f8701168301838103820160208501529081018490526001600160fb1b038411156131b6575f5ffd5b8360051b80866080840137016080019695505050505050565b5f602082840312156131df575f5ffd5b8151612c8b816129ae565b5f600182016131fb576131fb612ea8565b5060010190565b634e487b7160e01b5f52601260045260245ffd5b5f8261322457613224613202565b500490565b5f8261323757613237613202565b500690565b60ff828116828216039081111561248157612481612ea856fea26469706673582212201a497e289cb2afef87e360aef70529cf50f5118d091365c3a48d37bb3c55e49a64736f6c634300081d0033",
382
+ sourceMap: "878:18823:27:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6785:2299;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;;;;;;;;14814:785;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;:::i;11721:1004::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;4952:118::-;;;;;;:::i;:::-;;:::i;:::-;;5603:206;;;;;;:::i;:::-;;:::i;5893:225::-;;;;;;:::i;:::-;;:::i;3244:69::-;;3310:1;3244:69;;;;;6486:25:31;;;6474:2;6459:18;3244:69:27;6340:177:31;3571:62:27;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;6687:14:31;;6680:22;6662:41;;6650:2;6635:18;3571:62:27;6522:187:31;12729:2081:27;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;3411:18::-;;;;;-1:-1:-1;;;3411:18:27;;;;;;3317:65;;3379:1;3317:65;;4719:229;;;;;;:::i;:::-;;:::i;3434:53::-;;;;;;:::i;:::-;;;;;;;;;;;;-1:-1:-1;;;;;3434:53:27;;;;;;-1:-1:-1;;;;;7857:32:31;;;7839:51;;7827:2;7812:18;3434:53:27;7693:203:31;15603:791:27;;;;;;:::i;:::-;;:::i;6202:231::-;;;;;;:::i;:::-;;:::i;5368:::-;;;;;;:::i;:::-;;:::i;5074:290::-;;;;;;:::i;:::-;;:::i;10851:866::-;;;;;;:::i;:::-;;:::i;:::-;;;;10360:25:31;;;10433:4;10421:17;;;10416:2;10401:18;;10394:45;10475:17;;10455:18;;;10448:45;10348:2;10333:18;10851:866:27;10166:333:31;3708:33:27;;;;;-1:-1:-1;;;;;3708:33:27;;;18112:1587;;;;;;:::i;:::-;;:::i;:::-;;;;11337:14:31;;11330:22;11312:41;;11384:2;11369:18;;11362:34;;;;11285:18;18112:1587:27;11144:258:31;9088:822:27;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;:::i;9914:933::-;;;;;;:::i;:::-;;:::i;:::-;;;;12015:25:31;;;12071:2;12056:18;;12049:34;;;;12099:18;;;12092:34;12003:2;11988:18;9914:933:27;11813:319:31;3387:20:27;;;;;-1:-1:-1;;;;;3387:20:27;;;6785:2299;6908:18;6934:28;6970:25;7003:20;7031:23;7062:24;7094:28;7130:26;7176:8;7171:1909;;7208:13;2035:1;7208:13;7246:28;2035:1;7272:2;7246:28;:::i;:::-;7208:67;;;;;;;:::i;:::-;7194:82;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7194:82:27;;-1:-1:-1;7317:13:27;;-1:-1:-1;1026:1:27;;-1:-1:-1;7317:13:27;;-1:-1:-1;7358:30:27;1026:1;7387;7358:30;:::i;:::-;7317:72;;;;;;;:::i;:::-;7284:113;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7284:113:27;;-1:-1:-1;7435:13:27;;-1:-1:-1;1383:2:27;;-1:-1:-1;7435:13:27;;-1:-1:-1;7480:34:27;1383:2;7513:1;7480:34;:::i;:::-;7435:80;;;;;;;:::i;:::-;7405:118;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7405:118:27;;-1:-1:-1;7547:13:27;;-1:-1:-1;1510:2:27;;-1:-1:-1;7547:13:27;;-1:-1:-1;7587:29:27;1510:2;7615:1;7587:29;:::i;:::-;7547:70;;;;;;;:::i;:::-;7531:87;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7531:87:27;;-1:-1:-1;7654:13:27;;-1:-1:-1;1732:2:27;;-1:-1:-1;7654:13:27;;-1:-1:-1;7697:32:27;1732:2;7728:1;7697:32;:::i;:::-;7654:76;;;;;;;:::i;:::-;7626:112;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7626:112:27;;-1:-1:-1;7775:13:27;;-1:-1:-1;1609:2:27;;-1:-1:-1;7775:13:27;;-1:-1:-1;7820:34:27;1609:2;7853:1;7820:34;:::i;:::-;7775:80;;;;;;;:::i;:::-;7746:117;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7746:117:27;;-1:-1:-1;7904:13:27;;-1:-1:-1;1838:2:27;;-1:-1:-1;7904:13:27;;-1:-1:-1;7953:38:27;1838:2;7990:1;7953:38;:::i;:::-;7904:88;;;;;;;:::i;:::-;7871:129;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7871:129:27;;-1:-1:-1;8039:13:27;;7871:129;-1:-1:-1;8039:13:27;;-1:-1:-1;8086:36:27;;-1:-1:-1;7871:129:27;8121:1;8086:36;:::i;:::-;8039:84;;;;;;;:::i;:::-;8008:123;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8008:123:27;;-1:-1:-1;7171:1909:27;;-1:-1:-1;;;7171:1909:27;;8166:13;3156:2;8166:13;8203:27;3156:2;8228;8203:27;:::i;:::-;8166:65;;;;;;;:::i;:::-;8152:80;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8152:80:27;;-1:-1:-1;8273:13:27;;-1:-1:-1;2222:1:27;;-1:-1:-1;8273:13:27;;-1:-1:-1;8313:29:27;2222:1;8341;8313:29;:::i;:::-;8273:70;;;;;;;:::i;:::-;8240:111;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8240:111:27;;-1:-1:-1;8389:13:27;;-1:-1:-1;2511:2:27;;-1:-1:-1;8389:13:27;;-1:-1:-1;8433:33:27;2511:2;8465:1;8433:33;:::i;:::-;8389:78;;;;;;;:::i;:::-;8359:116;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8359:116:27;;-1:-1:-1;8499:13:27;;-1:-1:-1;2637:2:27;;-1:-1:-1;8499:13:27;;-1:-1:-1;8538:28:27;2637:2;8565:1;8538:28;:::i;:::-;8499:68;;;;;;;:::i;:::-;8483:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8483:85:27;;-1:-1:-1;8604:13:27;;-1:-1:-1;2857:2:27;;-1:-1:-1;8604:13:27;;-1:-1:-1;8646:31:27;2857:2;8676:1;8646:31;:::i;:::-;8604:74;;;;;;;:::i;:::-;8576:110;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8576:110:27;;-1:-1:-1;8723:13:27;;-1:-1:-1;2735:2:27;;-1:-1:-1;8723:13:27;;-1:-1:-1;8767:33:27;2735:2;8799:1;8767:33;:::i;:::-;8723:78;;;;;;;:::i;:::-;8694:115;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8694:115:27;;-1:-1:-1;8850:13:27;;-1:-1:-1;2962:1:27;;-1:-1:-1;8850:13:27;;-1:-1:-1;8898:37:27;2962:1;8934;8898:37;:::i;:::-;8850:86;;;;;;;:::i;:::-;8817:127;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8817:127:27;;-1:-1:-1;8983:13:27;;8817:127;-1:-1:-1;8983:13:27;;-1:-1:-1;9029:35:27;;-1:-1:-1;8817:127:27;9063:1;9029:35;:::i;:::-;8983:82;;;;;;;:::i;:::-;8952:121;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8952:121:27;;-1:-1:-1;;;;7171:1909:27;6785:2299;;;;;;;;;;;:::o;14814:785::-;14886:21;14909:24;14886:21;14965:630;14981:3;14972:6;:12;14965:630;;;-1:-1:-1;;;14998:4:27;;15003:6;14998:12;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;;;;;14998:63:27;;;14994:595;;15073:20;15110:4;;15115:10;:6;15124:1;15115:10;:::i;:::-;15110:27;15126:10;:6;15135:1;15126:10;:::i;:::-;15110:27;;;;;;;:::i;:::-;15103:35;;;:::i;:::-;15096:43;;;-1:-1:-1;15181:4:27;;15186:10;:6;15195:1;15186:10;:::i;:::-;15181:43;15197:26;;;:10;:6;15206:1;15197:10;:::i;:::-;:26;;;;:::i;:::-;15181:43;;;;;;;:::i;:::-;15173:52;;;:::i;:::-;15165:61;;;-1:-1:-1;15246:17:27;15250:13;15246:1;:17;:::i;:::-;:21;;15266:1;15246:21;:::i;:::-;15236:31;;;;;;:::i;:::-;;;15063:213;14965:630;;14994:595;-1:-1:-1;;;15286:4:27;;15291:6;15286:12;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;;;;;15286:62:27;;;15282:307;;15360:23;15400:4;;15405:10;:6;15414:1;15405:10;:::i;:::-;15400:27;15416:10;:6;15425:1;15416:10;:::i;:::-;15400:27;;;;;;;:::i;:::-;15393:35;;;:::i;:::-;15386:43;;;-1:-1:-1;15459:4:27;;15464:10;:6;15473:1;15464:10;:::i;:::-;15459:46;15475:29;;;:10;:6;15484:1;15475:10;:::i;:::-;:29;;;;:::i;:::-;15459:46;;;;;;;:::i;:::-;15439:67;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;15439:67:27;;-1:-1:-1;15526:20:27;;-1:-1:-1;15530:16:27;;-1:-1:-1;15526:1:27;;-1:-1:-1;15526:20:27;:::i;15282:307::-;14935:664;14814:785;;;;;:::o;11721:1004::-;11883:27;11918:14;;;11966:701;11986:31;;;11966:701;;;12165:20;;12186:1;12165:23;;;;;;;:::i;:::-;;;;;;;12192:3;12165:30;:85;;;;;12239:9;12233:16;;;;;;;;:::i;:::-;12226:24;;-1:-1:-1;;;;;12199:51:27;;:15;;12215:6;12199:23;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;;;;;12199:51:27;;;12165:85;12161:459;;;12276:17;;;12289:3;12276:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;12262:31:27;-1:-1:-1;12308:9:27;12303:287;12327:3;12323:1;:7;12303:287;;;12353:15;;12378:5;:1;12382;12378:5;:::i;:::-;12369:14;;:6;:14;:::i;:::-;:18;;12386:1;12369:18;:::i;:::-;12353:35;;;;;;;:::i;:::-;;;;;-1:-1:-1;;;;;;12353:35:27;12349:136;;-1:-1:-1;12467:5:27;12349:136;12520:15;;12545:5;:1;12549;12545:5;:::i;:::-;12536:14;;:6;:14;:::i;:::-;:18;;12553:1;12536:18;:::i;:::-;12520:58;12564:5;:1;12568;12564:5;:::i;:::-;12555:14;;:6;:14;:::i;:::-;:18;;12572:1;12555:18;:::i;:::-;:22;;12576:1;12555:22;:::i;:::-;12520:58;;;;;;;:::i;:::-;12496:83;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;12496:14:27;;:11;;-1:-1:-1;12508:1:27;;-1:-1:-1;12496:14:27;;;;;;:::i;:::-;;;;;;;;;;:83;12332:3;;12303:287;;;;12607:4;12599:12;;12161:459;12637:20;;12658:1;12637:23;;;;;;;:::i;:::-;;;;;;;12627:33;;;;;:::i;:::-;;-1:-1:-1;12019:3:27;;11966:701;;;;12680:5;12672:48;;;;-1:-1:-1;;;12672:48:27;;14373:2:31;12672:48:27;;;14355:21:31;14412:2;14392:18;;;14385:30;14451:32;14431:18;;;14424:60;14501:18;;12672:48:27;;;;;;;;;11912:813;;11721:1004;;;;;;;:::o;4952:118::-;4582:5;;-1:-1:-1;;;;;4582:5:27;4568:10;:19;4560:58;;;;-1:-1:-1;;;4560:58:27;;;;;;;:::i;:::-;5010:6:::1;:16:::0;;;::::1;;-1:-1:-1::0;;;5010:16:27::1;-1:-1:-1::0;;;;5010:16:27;;::::1;;::::0;;5037:28:::1;::::0;::::1;::::0;::::1;::::0;5019:7;6687:14:31;6680:22;6662:41;;6650:2;6635:18;;6522:187;5037:28:27::1;;;;;;;;4952:118:::0;:::o;5603:206::-;4582:5;;-1:-1:-1;;;;;4582:5:27;4568:10;:19;4560:58;;;;-1:-1:-1;;;4560:58:27;;;;;;;:::i;:::-;-1:-1:-1;;;;;5687:27:27;::::1;5679:76;;;::::0;-1:-1:-1;;;5679:76:27;;15087:2:31;5679:76:27::1;::::0;::::1;15069:21:31::0;15126:2;15106:18;;;15099:30;15165:34;15145:18;;;15138:62;-1:-1:-1;;;15216:18:31;;;15209:34;15260:19;;5679:76:27::1;14885:400:31::0;5679:76:27::1;5761:12;:43:::0;;-1:-1:-1;;;;;;5761:43:27::1;-1:-1:-1::0;;;;;5761:43:27;;;::::1;::::0;;;::::1;::::0;;5603:206::o;5893:225::-;4582:5;;-1:-1:-1;;;;;4582:5:27;4568:10;:19;4560:58;;;;-1:-1:-1;;;4560:58:27;;;;;;;:::i;:::-;5987:55:::1;::::0;;;:30:::1;:55;::::0;;;;;:62;;-1:-1:-1;;5987:62:27::1;6045:4;5987:62;::::0;;6060:53;6018:23;;6060:53:::1;::::0;::::1;5893:225:::0;:::o;12729:2081::-;12863:17;12888:14;;;12936:1814;12956:31;;;12936:1814;;;13113:20;;13134:1;13113:23;;;;;;;:::i;:::-;;;;;;;13140:3;13113:30;13109:1594;;-1:-1:-1;;;13163:15:27;;13179:6;13163:23;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;;;;;13163:56:27;;;13155:87;;;;-1:-1:-1;;;13155:87:27;;;;;;;:::i;:::-;13528:18;13560:792;13580:3;13567:10;:16;13560:792;;;-1:-1:-1;;;13614:15:27;;13643:10;13630;:6;13683:32;13630:10;:::i;:::-;:23;;;;:::i;:::-;13614:40;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;;;;;13614:103:27;;;13597:745;;13744:20;13796:15;;13825:10;13812;:6;13821:1;13812:10;:::i;:::-;:23;;;;:::i;:::-;:27;;13838:1;13812:27;:::i;:::-;13796:72;13853:10;13840;:6;13849:1;13840:10;:::i;:::-;:23;;;;:::i;:::-;:27;;13866:1;13840:27;:::i;:::-;13796:72;;;;;;;:::i;:::-;13789:80;;;:::i;:::-;13767:116;;;-1:-1:-1;13911:17:27;13767:116;13911:1;:17;:::i;:::-;:21;;13931:1;13911:21;:::i;:::-;13897:35;;;;;;:::i;:::-;;;13730:215;13560:792;;13597:745;-1:-1:-1;;;13968:15:27;;13997:10;13984;:6;13993:1;13984:10;:::i;:::-;:23;;;;:::i;:::-;13968:40;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;;;;;13968:102:27;;;13951:391;;14097:23;14152:15;;14181:10;14168;:6;14177:1;14168:10;:::i;13951:391::-;14382:1;14369:10;:14;:35;;;;;14401:3;14387:10;:17;;14369:35;14361:67;;;;-1:-1:-1;;;14361:67:27;;15839:2:31;14361:67:27;;;15821:21:31;15878:2;15858:18;;;15851:30;-1:-1:-1;;;15897:18:31;;;15890:49;15956:18;;14361:67:27;15637:343:31;14361:67:27;14502:10;14485:130;14518:3;14514:1;:7;14485:130;;;14548:15;;14577:1;14564:10;:6;14573:1;14564:10;:::i;:::-;:14;;;;:::i;:::-;14548:31;;;;;;;:::i;:::-;;;;;-1:-1:-1;;;;;;14548:31:27;:36;;-1:-1:-1;14540:64:27;;;;-1:-1:-1;;;14540:64:27;;16187:2:31;14540:64:27;;;16169:21:31;16226:2;16206:18;;;16199:30;-1:-1:-1;;;16245:18:31;;;16238:45;16300:18;;14540:64:27;15985:339:31;14540:64:27;14523:3;;14485:130;;;-1:-1:-1;14632:15:27;;14648:10;:6;14657:1;14648:10;:::i;:::-;14632:40;14659:12;:6;14668:3;14659:12;:::i;:::-;14632:40;;;;;;;:::i;:::-;14625:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;14625:47:27;;-1:-1:-1;14690:4:27;;-1:-1:-1;;;;;13109:1594:27;14720:20;;14741:1;14720:23;;;;;;;:::i;:::-;;;;;;;14710:33;;;;;:::i;:::-;;-1:-1:-1;12989:3:27;;12936:1814;;;;14763:5;14755:50;;;;-1:-1:-1;;;14755:50:27;;16531:2:31;14755:50:27;;;16513:21:31;;;16550:18;;;16543:30;16609:34;16589:18;;;16582:62;16661:18;;14755:50:27;16329:356:31;14755:50:27;12882:1928;;12729:2081;;;;;;:::o;4719:229::-;4582:5;;-1:-1:-1;;;;;4582:5:27;4568:10;:19;4560:58;;;;-1:-1:-1;;;4560:58:27;;;;;;;:::i;:::-;-1:-1:-1;;;;;4793:22:27;::::1;4785:63;;;::::0;-1:-1:-1;;;4785:63:27;;16892:2:31;4785:63:27::1;::::0;::::1;16874:21:31::0;16931:2;16911:18;;;16904:30;16970;16950:18;;;16943:58;17018:18;;4785:63:27::1;16690:352:31::0;4785:63:27::1;4854:16;4873:5:::0;;-1:-1:-1;;;;;4884:16:27;;::::1;-1:-1:-1::0;;;;;;4884:16:27;::::1;::::0;::::1;::::0;;4911:32:::1;::::0;4873:5;;;::::1;::::0;;;4911:32:::1;::::0;4854:16;4911:32:::1;4779:169;4719:229:::0;:::o;15603:791::-;15742:4;15792:21;15816:35;15837:13;15816:20;:35::i;:::-;15792:59;;15966:17;15986:27;16006:6;;15986:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;15986:19:27;;-1:-1:-1;;;15986:27:27:i;:::-;:112;;16097:1;16041:52;16065:6;;16084:7;16048:44;;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;16048:44:27;;;;;;;;;;16041:52;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:57;;15986:112;;;16030:1;15986:112;15966:132;;16198:20;16221:26;16241:5;;16221:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;16221:19:27;;-1:-1:-1;;;16221:26:27:i;:::-;:90;;16310:1;16275:31;16299:5;;16282:23;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;16282:23:27;;;;;;;;;;16275:31;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:36;;16221:90;;;16264:1;16221:90;16198:113;;16344:9;16324:12;;16337:2;16324:16;;;;;;;:::i;:::-;;;;;;;:29;:65;;;;;16377:12;16357;;16370:2;16357:16;;;;;;;:::i;:::-;;;;;;;:32;16324:65;16317:72;15603:791;-1:-1:-1;;;;;;;;;;15603:791:27:o;6202:231::-;4582:5;;-1:-1:-1;;;;;4582:5:27;4568:10;:19;4560:58;;;;-1:-1:-1;;;4560:58:27;;;;;;;:::i;:::-;6357:5:::1;6299:55:::0;;;:30:::1;:55;::::0;;;;;:63;;-1:-1:-1;;6299:63:27::1;::::0;;6373:55;6330:23;;6373:55:::1;::::0;::::1;6202:231:::0;:::o;5368:::-;4582:5;;-1:-1:-1;;;;;4582:5:27;4568:10;:19;4560:58;;;;-1:-1:-1;;;4560:58:27;;;;;;;:::i;:::-;5454:9:::1;5449:146;5469:21:::0;;::::1;5449:146;;;5512:18;:33;5531:10;;5542:1;5531:13;;;;;;;:::i;:::-;;::::0;;::::1;::::0;;;::::1;;5512:33:::0;;-1:-1:-1;5512:33:27;::::1;::::0;;;;;;-1:-1:-1;5512:33:27;5505:40;;-1:-1:-1;;;;;;5505:40:27::1;::::0;;5574:10;;5585:1;5574:13;;::::1;;;;;:::i;:::-;;;;;;;5558:30;;;;;;;;;;5492:3;;5449:146;;;;5368:231:::0;;:::o;5074:290::-;4582:5;;-1:-1:-1;;;;;4582:5:27;4568:10;:19;4560:58;;;;-1:-1:-1;;;4560:58:27;;;;;;;:::i;:::-;5199:9:::1;5194:166;5214:21:::0;;::::1;5194:166;;;5286:9;;5296:1;5286:12;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;5250:18;:33;5269:10;;5280:1;5269:13;;;;;;;:::i;:::-;;;;;;;5250:33;;;;;;;;;;;;:48;;;;;-1:-1:-1::0;;;;;5250:48:27::1;;;;;-1:-1:-1::0;;;;;5250:48:27::1;;;;;;5340:9;;5350:1;5340:12;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;5311:42:27::1;5325:10;;5336:1;5325:13;;;;;;;:::i;:::-;;;;;;;5311:42;;;;;;;;;;5237:3;;5194:166;;;;5074:290:::0;;;;:::o;10851:866::-;10984:19;;;;;;11087:576;11107:31;;;11087:576;;;11257:20;;11278:1;11257:23;;;;;;;:::i;:::-;;;;;;;11284:2;11257:29;11253:363;;-1:-1:-1;;;11306:15:27;;11322:6;11306:23;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;;;;;11306:55:27;;;11298:86;;;;-1:-1:-1;;;11298:86:27;;;;;;;:::i;:::-;11408:70;11439:15;;11455:10;:6;11464:1;11455:10;:::i;:::-;11439:38;11466:10;:6;11475:1;11466:10;:::i;:::-;11439:38;;;;;;;:::i;:::-;11408:70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;11408:30:27;;-1:-1:-1;;;11408:70:27:i;:::-;11394:84;-1:-1:-1;11503:15:27;;11519:10;:6;11528:1;11519:10;:::i;:::-;11503:27;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;11556:15:27;;-1:-1:-1;11556:15:27;11572:11;:6;11581:2;11572:11;:::i;:::-;11556:28;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;11603:4:27;;-1:-1:-1;;11253:363:27;11633:20;;11654:1;11633:23;;;;;;;:::i;:::-;;;;;;;11623:33;;;;;:::i;:::-;;-1:-1:-1;11140:3:27;;11087:576;;;;11676:5;11668:44;;;;-1:-1:-1;;;11668:44:27;;18598:2:31;11668:44:27;;;18580:21:31;18637:2;18617:18;;;18610:30;18676:28;18656:18;;;18649:56;18722:18;;11668:44:27;18396:350:31;11668:44:27;11033:684;;10851:866;;;;;;;;:::o;18112:1587::-;18219:4;4674:6;;18219:4;;-1:-1:-1;;;4674:6:27;;;;4673:7;4665:38;;;;-1:-1:-1;;;4665:38:27;;18953:2:31;4665:38:27;;;18935:21:31;18992:2;18972:18;;;18965:30;-1:-1:-1;;;19011:18:31;;;19004:48;19069:18;;4665:38:27;18751:342:31;4665:38:27;18240:16:::1;18259:29;18272:15:::0;::::1;18259:12;:29::i;:::-;18240:48:::0;-1:-1:-1;18454:30:27::1;18516:2;18487:19;;::::0;::::1;:6:::0;:19:::1;:::i;:::-;:31;::::0;;-1:-1:-1;18487:31:27::1;:::i;:::-;18454:64:::0;-1:-1:-1;18567:48:27::1;18592:19;;::::0;::::1;:6:::0;:19:::1;:::i;:::-;18612:1;18592:22;;;;;;;:::i;:::-;;;;;;;18567:24;:48::i;:::-;18660:44;18681:19;;::::0;::::1;:6:::0;:19:::1;:::i;:::-;18701:1;18681:22;;;;;;;:::i;:::-;;;;;;;18660:20;:44::i;:::-;18762:59;18772:19;;::::0;::::1;:6:::0;:19:::1;:::i;:::-;18762:59;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;::::0;;;;-1:-1:-1;;;;18793:27:27::1;::::0;::::1;;18762:9;:59::i;:::-;18747:122;;;::::0;-1:-1:-1;;;18747:122:27;;19983:2:31;18747:122:27::1;::::0;::::1;19965:21:31::0;;;20002:18;;;19995:30;20061:34;20041:18;;;20034:62;20113:18;;18747:122:27::1;19781:356:31::0;18747:122:27::1;18919:62;18932:19;;::::0;::::1;:6:::0;:19:::1;:::i;:::-;18953:13;;::::0;::::1;:6:::0;:13:::1;:::i;:::-;18968:12;;::::0;::::1;:6:::0;:12:::1;:::i;18919:62::-;18911:89;;;::::0;-1:-1:-1;;;18911:89:27;;20871:2:31;18911:89:27::1;::::0;::::1;20853:21:31::0;20910:2;20890:18;;;20883:30;-1:-1:-1;;;20929:18:31;;;20922:44;20983:18;;18911:89:27::1;20669:338:31::0;18911:89:27::1;19068:207;19154:19;;::::0;::::1;:6:::0;:19:::1;:::i;:::-;19174:2;::::0;19177:26:::1;19202:1;19177:22:::0;:26:::1;:::i;:::-;19154:50;;;;;;;:::i;:::-;19068:207;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;::::0;;;;-1:-1:-1;19212:22:27::1;::::0;-1:-1:-1;;;19212:22:27::1;::::0;::::1;::::0;::::1;:::i;:::-;19242:27;;::::0;::::1;:6:::0;:27:::1;:::i;:::-;19068:207;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;::::0;;;;-1:-1:-1;19068:21:27::1;::::0;-1:-1:-1;;;19068:207:27:i:1;:::-;19473:1;19406:19;;::::0;::::1;:6:::0;:19:::1;:::i;:::-;19426:26;19451:1;19426:22:::0;:26:::1;:::i;:::-;19406:47;;;;;;;:::i;:::-;;;;;;;:70;;:88;;;-1:-1:-1::0;19480:14:27::1;::::0;;;::::1;::::0;::::1;;:::i;:::-;19391:159;;;::::0;-1:-1:-1;;;19391:159:27;;22650:2:31;19391:159:27::1;::::0;::::1;22632:21:31::0;22689:2;22669:18;;;22662:30;22728:34;22708:18;;;22701:62;-1:-1:-1;;;22779:18:31;;;22772:38;22827:19;;19391:159:27::1;22448:404:31::0;19391:159:27::1;-1:-1:-1::0;;;;;19572:26:27;::::1;;19599:12;;::::0;::::1;:6:::0;:12:::1;:::i;:::-;19613:19;;::::0;::::1;:6:::0;:19:::1;:::i;:::-;19572:61;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;19641:19;;::::0;::::1;:6:::0;:19:::1;:::i;:::-;19661:26;19686:1;19661:22:::0;:26:::1;:::i;:::-;19641:47;;;;;;;:::i;:::-;;;;;;;19557:137;;;;;;18112:1587:::0;;;:::o;9088:822::-;9226:25;;9287:14;;;9335:516;9355:31;;;9335:516;;;9509:20;;9530:1;9509:23;;;;;;;:::i;:::-;;;;;;;9536:3;9509:30;9505:299;;9599:18;9559:15;;9575:6;9559:23;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;;;;;9559:60:27;;;9551:91;;;;-1:-1:-1;;;9551:91:27;;;;;;;:::i;:::-;9667:15;;9683:10;:6;9692:1;9683:10;:::i;:::-;9667:39;9694:11;:6;9703:2;9694:11;:::i;:::-;9667:39;;;;;;;:::i;:::-;9652:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;9652:54:27;;-1:-1:-1;9732:15:27;;-1:-1:-1;9732:15:27;;-1:-1:-1;9748:11:27;;-1:-1:-1;9748:6:27;9757:2;9748:11;:::i;:::-;9732:41;9760:12;:6;9769:3;9760:12;:::i;:::-;9732:41;;;;;;;:::i;:::-;9716:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;9716:57:27;;-1:-1:-1;9791:4:27;;-1:-1:-1;;;;9505:299:27;9821:20;;9842:1;9821:23;;;;;;;:::i;:::-;;;;;;;9811:33;;;;;:::i;:::-;;-1:-1:-1;9388:3:27;;9335:516;;;;9864:5;9856:49;;;;-1:-1:-1;;;9856:49:27;;24085:2:31;9856:49:27;;;24067:21:31;24124:2;24104:18;;;24097:30;24163:33;24143:18;;;24136:61;24214:18;;9856:49:27;23883:355:31;9856:49:27;9281:629;;9088:822;;;;;;;:::o;9914:933::-;10073:19;;;;;;10182:610;10202:31;;;10182:610;;;10351:20;;10372:1;10351:23;;;;;;;:::i;:::-;;;;;;;10378:2;10351:29;:84;;;;;10424:9;10418:16;;;;;;;;:::i;:::-;10411:24;;-1:-1:-1;;;;;10384:51:27;;:15;;10400:6;10384:23;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;;;;;10384:51:27;;;10351:84;10347:398;;;10461:70;10492:15;;10508:10;:6;10517:1;10508:10;:::i;10461:70::-;10447:84;-1:-1:-1;10551:71:27;10582:15;;10598:10;:6;10607:1;10598:10;:::i;:::-;10582:39;10609:11;:6;10618:2;10609:11;:::i;10551:71::-;10541:81;-1:-1:-1;10642:72:27;10673:15;;10689:11;:6;10698:2;10689:11;:::i;:::-;10673:40;10701:11;:6;10710:2;10701:11;:::i;10642:72::-;10632:82;;10732:4;10724:12;;10347:398;10762:20;;10783:1;10762:23;;;;;;;:::i;:::-;;;;;;;10752:33;;;;;:::i;:::-;;-1:-1:-1;10235:3:27;;10182:610;;;;10805:5;10797:45;;;;-1:-1:-1;;;10797:45:27;;24445:2:31;10797:45:27;;;24427:21:31;24484:2;24464:18;;;24457:30;24523:29;24503:18;;;24496:57;24570:18;;10797:45:27;24243:351:31;10797:45:27;10128:719;;9914:933;;;;;;;;;:::o;841:616:26:-;897:13;948:5;957:1;948:10;944:41;;-1:-1:-1;;968:10:26;;;;;;;;;;;;-1:-1:-1;;;968:10:26;;;;;841:616::o;944:41::-;1059:5;1044:12;1090:59;1097:9;;1090:59;;1116:8;;;;:::i;:::-;;-1:-1:-1;1132:10:26;;-1:-1:-1;1140:2:26;1132:10;;:::i;:::-;;;1090:59;;;1209:19;1241:6;-1:-1:-1;;;;;1231:17:26;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1231:17:26;;1209:39;;1297:128;1304:10;;1297:128;;1324:11;1334:1;1324:11;;:::i;:::-;;-1:-1:-1;1386:10:26;1394:2;1386:5;:10;:::i;:::-;1373:24;;:2;:24;:::i;:::-;1360:39;;1343:6;1350;1343:14;;;;;;;;:::i;:::-;;;;:56;-1:-1:-1;;;;;1343:56:26;;;;;;;;-1:-1:-1;1407:11:26;1416:2;1407:11;;:::i;:::-;;;1297:128;;;1445:6;841:616;-1:-1:-1;;;;841:616:26:o;262:101::-;338:15;:20;;262:101::o;1965:1238:20:-;523:17;;;;;;;;;;;;-1:-1:-1;;;523:17:20;;;;;2056:15;;;;;;2037:7;;2056:49;;2052:78;;-1:-1:-1;2122:1:20;;1965:1238;-1:-1:-1;1965:1238:20:o;2052:78::-;2135:12;2291:26;2309:4;2314:1;2309:7;;;;;;;;:::i;:::-;;;;;-1:-1:-1;;;;;;2309:7:20;2291:17;:26::i;:::-;2245;2263:4;2268:1;2263:7;;;;;;;;:::i;2245:26::-;:37;;2280:2;2245:37;:::i;:::-;2198:26;2216:4;2221:1;2216:7;;;;;;;;:::i;2198:26::-;:38;;2233:3;2198:38;:::i;:::-;2150:26;2168:4;2173:1;2168:7;;;;;;;;:::i;2150:26::-;:39;;2185:4;2150:39;:::i;:::-;:86;;;;:::i;:::-;:132;;;;:::i;:::-;:167;;;;:::i;:::-;2135:182;;2323:13;2373:26;2391:4;2396:1;2391:7;;;;;;;;:::i;2373:26::-;2339;2357:4;2362:1;2357:7;;;;;;;;:::i;2339:26::-;:31;;2368:2;2339:31;:::i;:::-;:60;;;;:::i;:::-;2323:76;;2405:11;2453:26;2471:4;2476:1;2471:7;;;;;;;;:::i;2453:26::-;2419;2437:4;2442:1;2437:7;;;;;;;;:::i;2419:26::-;:31;;2448:2;2419:31;:::i;:::-;:60;;;;:::i;:::-;2405:74;;173:4;2493;:29;;2485:64;;;;-1:-1:-1;;;2485:64:20;;25315:2:31;2485:64:20;;;25297:21:31;25354:2;25334:18;;;25327:30;-1:-1:-1;;;25373:18:31;;;25366:52;25435:18;;2485:64:20;25113:346:31;2485:64:20;2572:1;2563:5;:10;;:25;;;;;2586:2;2577:5;:11;;2563:25;2555:51;;;;-1:-1:-1;;;2555:51:20;;25666:2:31;2555:51:20;;;25648:21:31;25705:2;25685:18;;;25678:30;-1:-1:-1;;;25724:18:31;;;25717:43;25777:18;;2555:51:20;25464:337:31;2555:51:20;2627:1;2620:3;:8;;:46;;;;;2639:27;2654:5;2661:4;2639:14;:27::i;:::-;2632:3;:34;;2620:46;2612:70;;;;-1:-1:-1;;;2612:70:20;;26008:2:31;2612:70:20;;;25990:21:31;26047:2;26027:18;;;26020:30;-1:-1:-1;;;26066:18:31;;;26059:41;26117:18;;2612:70:20;25806:335:31;2612:70:20;2727:17;173:4;2754:108;2798:4;2794:1;:8;2754:108;;;2830:13;2841:1;2830:10;:13::i;:::-;:25;;2852:3;2830:25;;;2846:3;2830:25;2817:38;;;;;;:::i;:::-;;-1:-1:-1;2804:3:20;;2754:108;;;-1:-1:-1;2924:1:20;2907:87;2931:5;2927:1;:9;2907:87;;;2964:23;2979:1;2982:4;2964:14;:23::i;:::-;2951:36;;;;:::i;:::-;;-1:-1:-1;2938:3:20;;2907:87;;;-1:-1:-1;3046:7:20;3052:1;3046:3;:7;:::i;:::-;3033:20;;;;:::i;:::-;;-1:-1:-1;3171:27:20;350:5;3033:20;3171:27;:::i;:::-;3164:34;1965:1238;-1:-1:-1;;;;;;1965:1238:20:o;17013:210:27:-;17076:7;17110:28;;;:18;:28;;;;;;-1:-1:-1;;;;;17110:28:27;;17144:53;;;;-1:-1:-1;;;17144:53:27;;26348:2:31;17144:53:27;;;26330:21:31;26387:2;26367:18;;;26360:30;-1:-1:-1;;;26406:18:31;;;26399:48;26464:18;;17144:53:27;26146:342:31;17144:53:27;17210:8;17013:210;-1:-1:-1;;17013:210:27:o;17227:394::-;17442:47;;;;:30;:47;;;;;;;;;:125;;-1:-1:-1;17501:12:27;;:66;;-1:-1:-1;;;17501:66:27;;:12;:66;;;26667:25:31;26708:18;;;26701:34;;;-1:-1:-1;;;;;17501:12:27;;;;:24;;26640:18:31;;17501:66:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;17306:310;;;;-1:-1:-1;;;17306:310:27;;26948:2:31;17306:310:27;;;26930:21:31;26987:2;26967:18;;;26960:30;27026:34;27006:18;;;26999:62;-1:-1:-1;;;27077:18:31;;;27070:31;27118:19;;17306:310:27;26746:397:31;17306:310:27;17227:394;:::o;17625:194::-;17711:12;;:58;;-1:-1:-1;;;17711:58:27;;3379:1;17711:58;;;26667:25:31;26708:18;;;26701:34;;;-1:-1:-1;;;;;17711:12:27;;;;:24;;26640:18:31;;17711:58:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;17696:118;;;;-1:-1:-1;;;17696:118:27;;27350:2:31;17696:118:27;;;27332:21:31;27389:2;27369:18;;;27362:30;27428:31;27408:18;;;27401:59;27477:18;;17696:118:27;27148:353:31;6437:344:27;6591:12;;;6601:1;6591:12;;;;;;;;;6552:4;;;;6591:12;;;;;;;;;;;-1:-1:-1;;6564:39:27;-1:-1:-1;6626:1:27;6609:99;6633:2;6629:1;:6;6609:99;;;6697:3;6678:12;6691:1;6678:15;;;;;;;;:::i;:::-;;;;;;;:22;;6650:11;6666:1;6662;:5;;;;:::i;:::-;6650:18;;;;;;;;:::i;:::-;;;;:51;-1:-1:-1;;;;;6650:51:27;;;;;;;;-1:-1:-1;6637:3:27;;6609:99;;;;6720:56;6742:11;6755:20;6720:21;:56::i;16398:611::-;16571:14;;16595:410;16619:20;:27;16615:1;:31;16595:410;;;16741:28;16874:1;16772:98;16805:15;;16821:6;16805:56;16837:20;16858:1;16837:23;;;;;;;;:::i;:::-;;;;;;;16828:6;:32;;;;:::i;:::-;16805:56;;;;;;;:::i;:::-;16788:74;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;16788:74:27;;;;;;;;;;16772:98;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:103;;16741:134;;16915:16;16932:1;16915:19;;;;;;;;:::i;:::-;;;;;;;16891:20;:43;16883:74;;;;-1:-1:-1;;;16883:74:27;;27990:2:31;16883:74:27;;;27972:21:31;28029:2;28009:18;;;28002:30;-1:-1:-1;;;28048:18:31;;;28041:48;28106:18;;16883:74:27;27788:342:31;16883:74:27;16975:20;16996:1;16975:23;;;;;;;;:::i;:::-;;;;;;;16965:33;;;;;:::i;:::-;;-1:-1:-1;;16648:3:27;;16595:410;;;;16565:444;16398:611;;;;:::o;704:116:20:-;772:7;794:21;813:2;794:16;;;;:21;:::i;:::-;787:28;;;704:116;-1:-1:-1;;704:116:20:o;1376:421::-;1452:7;1484:1;1475:5;:10;;:25;;;;;1498:2;1489:5;:11;;1475:25;1467:51;;;;-1:-1:-1;;;1467:51:20;;25666:2:31;1467:51:20;;;25648:21:31;25705:2;25685:18;;;25678:30;-1:-1:-1;;;25724:18:31;;;25717:43;25777:18;;1467:51:20;25464:337:31;1467:51:20;1573:5;1582:1;1573:10;1569:64;;1600:16;1611:4;1600:10;:16::i;:::-;:26;;1624:2;1600:26;;;1619:2;1600:26;1593:33;;;;;;1569:64;1671:5;1680:1;1671:10;:24;;;;1685:5;1694:1;1685:10;1671:24;:38;;;;1699:5;1708:1;1699:10;1671:38;:53;;;;1713:5;1722:2;1713:11;1671:53;1667:83;;;-1:-1:-1;1741:2:20;1734:9;;1667:83;-1:-1:-1;1790:2:20;1376:421;;;;:::o;975:199::-;1032:4;1048:8;1055:1;1048:4;:8;:::i;:::-;:13;1044:31;;-1:-1:-1;1070:5:20;;975:199;-1:-1:-1;975:199:20:o;1044:31::-;1085:10;1092:3;1085:4;:10;:::i;:::-;:15;1081:32;;-1:-1:-1;1109:4:20;;975:199;-1:-1:-1;975:199:20:o;1081:32::-;1123:10;1130:3;1123:4;:10;:::i;:::-;:15;1119:33;;-1:-1:-1;1147:5:20;;975:199;-1:-1:-1;975:199:20:o;1119:33::-;-1:-1:-1;1165:4:20;;975:199;-1:-1:-1;975:199:20:o;3465:401::-;3570:4;3582:17;3602:26;3623:4;3602:20;:26::i;:::-;3582:46;-1:-1:-1;3634:31:20;3680:38;350:5;3680:20;:38;:::i;:::-;3668:50;;:9;:50;:::i;:::-;3634:84;;3756:9;3737:15;:28;;:73;;;;;3801:9;3775:23;:35;3737:73;:124;;;;;3846:15;3820:23;:41;3737:124;3724:137;3465:401;-1:-1:-1;;;;;3465:401:20:o;14:347:31:-;65:8;75:6;129:3;122:4;114:6;110:17;106:27;96:55;;147:1;144;137:12;96:55;-1:-1:-1;170:20:31;;-1:-1:-1;;;;;202:30:31;;199:50;;;245:1;242;235:12;199:50;282:4;274:6;270:17;258:29;;334:3;327:4;318:6;310;306:19;302:30;299:39;296:59;;;351:1;348;341:12;296:59;14:347;;;;;:::o;366:118::-;452:5;445:13;438:21;431:5;428:32;418:60;;474:1;471;464:12;489:538;565:6;573;581;634:2;622:9;613:7;609:23;605:32;602:52;;;650:1;647;640:12;602:52;690:9;677:23;-1:-1:-1;;;;;715:6:31;712:30;709:50;;;755:1;752;745:12;709:50;794:58;844:7;835:6;824:9;820:22;794:58;:::i;:::-;871:8;;-1:-1:-1;768:84:31;-1:-1:-1;;956:2:31;941:18;;928:32;969:28;928:32;969:28;:::i;:::-;1016:5;1006:15;;;489:538;;;;;:::o;1032:300::-;1085:3;1123:5;1117:12;1150:6;1145:3;1138:19;1206:6;1199:4;1192:5;1188:16;1181:4;1176:3;1172:14;1166:47;1258:1;1251:4;1242:6;1237:3;1233:16;1229:27;1222:38;1321:4;1314:2;1310:7;1305:2;1297:6;1293:15;1289:29;1284:3;1280:39;1276:50;1269:57;;;1032:300;;;;:::o;1337:1455::-;1822:3;1811:9;1804:22;1785:4;1849:57;1901:3;1890:9;1886:19;1878:6;1849:57;:::i;:::-;1954:9;1946:6;1942:22;1937:2;1926:9;1922:18;1915:50;1988:44;2025:6;2017;1988:44;:::i;:::-;1974:58;;2080:9;2072:6;2068:22;2063:2;2052:9;2048:18;2041:50;2114:44;2151:6;2143;2114:44;:::i;:::-;2100:58;;2206:9;2198:6;2194:22;2189:2;2178:9;2174:18;2167:50;2240:44;2277:6;2269;2240:44;:::i;:::-;2226:58;;2333:9;2325:6;2321:22;2315:3;2304:9;2300:19;2293:51;2367:44;2404:6;2396;2367:44;:::i;:::-;2353:58;;2460:9;2452:6;2448:22;2442:3;2431:9;2427:19;2420:51;2494:44;2531:6;2523;2494:44;:::i;:::-;2480:58;;2587:9;2579:6;2575:22;2569:3;2558:9;2554:19;2547:51;2621:44;2658:6;2650;2621:44;:::i;:::-;2607:58;;2714:9;2706:6;2702:22;2696:3;2685:9;2681:19;2674:51;2742:44;2779:6;2771;2742:44;:::i;:::-;2734:52;1337:1455;-1:-1:-1;;;;;;;;;;;1337:1455:31:o;2797:409::-;2867:6;2875;2928:2;2916:9;2907:7;2903:23;2899:32;2896:52;;;2944:1;2941;2934:12;2896:52;2984:9;2971:23;-1:-1:-1;;;;;3009:6:31;3006:30;3003:50;;;3049:1;3046;3039:12;3003:50;3088:58;3138:7;3129:6;3118:9;3114:22;3088:58;:::i;:::-;3165:8;;3062:84;;-1:-1:-1;2797:409:31;-1:-1:-1;;;;2797:409:31:o;3211:328::-;-1:-1:-1;;;;;3388:32:31;;3370:51;;3457:2;3452;3437:18;;3430:30;;;-1:-1:-1;;3477:56:31;;3514:18;;3506:6;3477:56;:::i;3544:367::-;3607:8;3617:6;3671:3;3664:4;3656:6;3652:17;3648:27;3638:55;;3689:1;3686;3679:12;3638:55;-1:-1:-1;3712:20:31;;-1:-1:-1;;;;;3744:30:31;;3741:50;;;3787:1;3784;3777:12;3741:50;3824:4;3816:6;3812:17;3800:29;;3884:3;3877:4;3867:6;3864:1;3860:14;3852:6;3848:27;3844:38;3841:47;3838:67;;;3901:1;3898;3891:12;3916:899;4046:6;4054;4062;4070;4078;4131:2;4119:9;4110:7;4106:23;4102:32;4099:52;;;4147:1;4144;4137:12;4099:52;4187:9;4174:23;-1:-1:-1;;;;;4212:6:31;4209:30;4206:50;;;4252:1;4249;4242:12;4206:50;4291:58;4341:7;4332:6;4321:9;4317:22;4291:58;:::i;:::-;4368:8;;-1:-1:-1;4265:84:31;-1:-1:-1;;4456:2:31;4441:18;;4428:32;-1:-1:-1;;;;;4472:32:31;;4469:52;;;4517:1;4514;4507:12;4469:52;4556:72;4620:7;4609:8;4598:9;4594:24;4556:72;:::i;:::-;4647:8;;-1:-1:-1;4530:98:31;-1:-1:-1;;4732:2:31;4717:18;;4704:32;4765:1;4755:12;;4745:40;;4781:1;4778;4771:12;4745:40;4804:5;4794:15;;;3916:899;;;;;;;;:::o;4820:793::-;4982:4;5030:2;5019:9;5015:18;5060:2;5049:9;5042:21;5083:6;5118;5112:13;5149:6;5141;5134:22;5187:2;5176:9;5172:18;5165:25;;5249:2;5239:6;5236:1;5232:14;5221:9;5217:30;5213:39;5199:53;;5287:2;5279:6;5275:15;5308:1;5318:266;5332:6;5329:1;5326:13;5318:266;;;5425:2;5421:7;5409:9;5401:6;5397:22;5393:36;5388:3;5381:49;5453:51;5497:6;5488;5482:13;5453:51;:::i;:::-;5443:61;-1:-1:-1;5539:2:31;5562:12;;;;5527:15;;;;;5354:1;5347:9;5318:266;;;-1:-1:-1;5601:6:31;;4820:793;-1:-1:-1;;;;;;4820:793:31:o;5618:241::-;5674:6;5727:2;5715:9;5706:7;5702:23;5698:32;5695:52;;;5743:1;5740;5733:12;5695:52;5782:9;5769:23;5801:28;5823:5;5801:28;:::i;:::-;5848:5;5618:241;-1:-1:-1;;;5618:241:31:o;5864:286::-;5923:6;5976:2;5964:9;5955:7;5951:23;5947:32;5944:52;;;5992:1;5989;5982:12;5944:52;6018:23;;-1:-1:-1;;;;;6070:31:31;;6060:42;;6050:70;;6116:1;6113;6106:12;6155:180;6214:6;6267:2;6255:9;6246:7;6242:23;6238:32;6235:52;;;6283:1;6280;6273:12;6235:52;-1:-1:-1;6306:23:31;;6155:180;-1:-1:-1;6155:180:31:o;6714:740::-;6820:6;6828;6836;6844;6897:2;6885:9;6876:7;6872:23;6868:32;6865:52;;;6913:1;6910;6903:12;6865:52;6953:9;6940:23;-1:-1:-1;;;;;6978:6:31;6975:30;6972:50;;;7018:1;7015;7008:12;6972:50;7057:58;7107:7;7098:6;7087:9;7083:22;7057:58;:::i;:::-;7134:8;;-1:-1:-1;7031:84:31;-1:-1:-1;;7222:2:31;7207:18;;7194:32;-1:-1:-1;;;;;7238:32:31;;7235:52;;;7283:1;7280;7273:12;7235:52;7322:72;7386:7;7375:8;7364:9;7360:24;7322:72;:::i;:::-;6714:740;;;;-1:-1:-1;7413:8:31;-1:-1:-1;;;;6714:740:31:o;7459:229::-;7606:2;7595:9;7588:21;7569:4;7626:56;7678:2;7667:9;7663:18;7655:6;7626:56;:::i;7901:1045::-;8029:6;8037;8045;8053;8061;8069;8122:2;8110:9;8101:7;8097:23;8093:32;8090:52;;;8138:1;8135;8128:12;8090:52;8178:9;8165:23;-1:-1:-1;;;;;8203:6:31;8200:30;8197:50;;;8243:1;8240;8233:12;8197:50;8282:70;8344:7;8335:6;8324:9;8320:22;8282:70;:::i;:::-;8371:8;;-1:-1:-1;8256:96:31;-1:-1:-1;;8459:2:31;8444:18;;8431:32;-1:-1:-1;;;;;8475:32:31;;8472:52;;;8520:1;8517;8510:12;8472:52;8559:60;8611:7;8600:8;8589:9;8585:24;8559:60;:::i;:::-;8638:8;;-1:-1:-1;8533:86:31;-1:-1:-1;;8726:2:31;8711:18;;8698:32;-1:-1:-1;;;;;8742:32:31;;8739:52;;;8787:1;8784;8777:12;8739:52;8826:60;8878:7;8867:8;8856:9;8852:24;8826:60;:::i;:::-;7901:1045;;;;-1:-1:-1;7901:1045:31;;-1:-1:-1;7901:1045:31;;8905:8;;7901:1045;-1:-1:-1;;;7901:1045:31:o;8951:437::-;9037:6;9045;9098:2;9086:9;9077:7;9073:23;9069:32;9066:52;;;9114:1;9111;9104:12;9066:52;9154:9;9141:23;-1:-1:-1;;;;;9179:6:31;9176:30;9173:50;;;9219:1;9216;9209:12;9173:50;9258:70;9320:7;9311:6;9300:9;9296:22;9258:70;:::i;9393:768::-;9515:6;9523;9531;9539;9592:2;9580:9;9571:7;9567:23;9563:32;9560:52;;;9608:1;9605;9598:12;9560:52;9648:9;9635:23;-1:-1:-1;;;;;9673:6:31;9670:30;9667:50;;;9713:1;9710;9703:12;9667:50;9752:70;9814:7;9805:6;9794:9;9790:22;9752:70;:::i;10735:404::-;10838:6;10891:2;10879:9;10870:7;10866:23;10862:32;10859:52;;;10907:1;10904;10897:12;10859:52;10947:9;10934:23;-1:-1:-1;;;;;10972:6:31;10969:30;10966:50;;;11012:1;11009;11002:12;10966:50;11035:22;;11091:3;11073:16;;;11069:26;11066:46;;;11108:1;11105;11098:12;11407:401;11600:2;11589:9;11582:21;11563:4;11626:56;11678:2;11667:9;11663:18;11655:6;11626:56;:::i;:::-;11730:9;11722:6;11718:22;11713:2;11702:9;11698:18;11691:50;11758:44;11795:6;11787;11758:44;:::i;12137:127::-;12198:10;12193:3;12189:20;12186:1;12179:31;12229:4;12226:1;12219:15;12253:4;12250:1;12243:15;12269:125;12334:9;;;12355:10;;;12352:36;;;12368:18;;:::i;12399:331::-;12504:9;12515;12557:8;12545:10;12542:24;12539:44;;;12579:1;12576;12569:12;12539:44;12608:6;12598:8;12595:20;12592:40;;;12628:1;12625;12618:12;12592:40;-1:-1:-1;;12654:23:31;;;12699:25;;;;;-1:-1:-1;12399:331:31:o;12735:127::-;12796:10;12791:3;12787:20;12784:1;12777:31;12827:4;12824:1;12817:15;12851:4;12848:1;12841:15;12867:127;12928:10;12923:3;12919:20;12916:1;12909:31;12959:4;12956:1;12949:15;12983:4;12980:1;12973:15;12999:323;13119:19;;-1:-1:-1;;;;;;13156:24:31;;;13200:1;13192:10;;13189:127;;;-1:-1:-1;;;;;;13261:1:31;13257:11;;;13254:1;13250:19;13246:41;;;13238:50;;13234:72;;-1:-1:-1;13189:127:31;;12999:323;;;;:::o;13327:374::-;13448:19;;-1:-1:-1;;13485:40:31;;;13545:2;13537:11;;13534:161;;;-1:-1:-1;;13607:2:31;13603:12;;;;13600:1;13596:20;13592:58;;;13584:67;13580:105;;;;13327:374;-1:-1:-1;;13327:374:31:o;13706:155::-;13797:6;13774:14;;;13790;;;13770:35;;13817:15;;13814:41;;;13835:18;;:::i;13866:127::-;13927:10;13922:3;13918:20;13915:1;13908:31;13958:4;13955:1;13948:15;13982:4;13979:1;13972:15;13998:168;14071:9;;;14102;;14119:15;;;14113:22;;14099:37;14089:71;;14140:18;;:::i;14530:350::-;14732:2;14714:21;;;14771:2;14751:18;;;14744:30;14810:28;14805:2;14790:18;;14783:56;14871:2;14856:18;;14530:350::o;15290:342::-;15492:2;15474:21;;;15531:2;15511:18;;;15504:30;-1:-1:-1;;;15565:2:31;15550:18;;15543:48;15623:2;15608:18;;15290:342::o;17047:212::-;17089:3;17127:5;17121:12;17171:6;17164:4;17157:5;17153:16;17148:3;17142:36;17233:1;17197:16;;17222:13;;;-1:-1:-1;17197:16:31;;17047:212;-1:-1:-1;17047:212:31:o;17264:465::-;17598:6;17590;17585:3;17572:33;17554:3;17633:6;17628:3;17624:16;-1:-1:-1;;;17656:2:31;17649:21;17686:37;17720:1;17716:2;17712:10;17704:6;17686:37;:::i;17734:190::-;17863:3;17888:30;17914:3;17906:6;17888:30;:::i;17929:184::-;17999:6;18052:2;18040:9;18031:7;18027:23;18023:32;18020:52;;;18068:1;18065;18058:12;18020:52;-1:-1:-1;18091:16:31;;17929:184;-1:-1:-1;17929:184:31:o;18118:273::-;18303:6;18295;18290:3;18277:33;18259:3;18329:16;;18354:13;;;18329:16;18118:273;-1:-1:-1;18118:273:31:o;19098:545::-;19191:4;19197:6;19257:11;19244:25;19351:2;19347:7;19336:8;19320:14;19316:29;19312:43;19292:18;19288:68;19278:96;;19370:1;19367;19360:12;19278:96;19397:33;;19449:20;;;-1:-1:-1;;;;;;19481:30:31;;19478:50;;;19524:1;19521;19514:12;19478:50;19557:4;19545:17;;-1:-1:-1;19608:1:31;19604:14;;;19588;19584:35;19574:46;;19571:66;;;19633:1;19630;19623:12;19648:128;19715:9;;;19736:11;;;19733:37;;;19750:18;;:::i;20142:522::-;20220:4;20226:6;20286:11;20273:25;20380:2;20376:7;20365:8;20349:14;20345:29;20341:43;20321:18;20317:68;20307:96;;20399:1;20396;20389:12;20307:96;20426:33;;20478:20;;;-1:-1:-1;;;;;;20510:30:31;;20507:50;;;20553:1;20550;20543:12;20507:50;20586:4;20574:17;;-1:-1:-1;20617:14:31;20613:27;;;20603:38;;20600:58;;;20654:1;20651;20644:12;21012:355;21133:9;21144;21186:8;21174:10;21171:24;21168:44;;;21208:1;21205;21198:12;21168:44;21237:6;21227:8;21224:20;21221:40;;;21257:1;21254;21247:12;21221:40;-1:-1:-1;;21299:1:31;21295:18;;;21283:31;;21336:25;;;;;-1:-1:-1;21012:355:31:o;22857:771::-;23102:2;23091:9;23084:21;23141:6;23136:2;23125:9;23121:18;23114:34;23198:6;23190;23185:2;23174:9;23170:18;23157:48;23254:1;23249:2;23225:22;;;23221:31;;23214:42;;;-1:-1:-1;;23315:2:31;23294:15;;23290:29;23275:45;;23362:18;;;23358:27;;23351:4;23336:20;;23329:57;23402:11;;;23395:27;;;-1:-1:-1;;;;;23434:31:31;;23431:51;;;23478:1;23475;23468:12;23431:51;23512:6;23509:1;23505:14;23563:6;23555;23549:3;23545:2;23541:12;23528:42;23595:15;23587:35;;;;-1:-1:-1;;;;;;22857:771:31:o;23633:245::-;23700:6;23753:2;23741:9;23732:7;23728:23;23724:32;23721:52;;;23769:1;23766;23759:12;23721:52;23801:9;23795:16;23820:28;23842:5;23820:28;:::i;24599:135::-;24638:3;24659:17;;;24656:43;;24679:18;;:::i;:::-;-1:-1:-1;24726:1:31;24715:13;;24599:135::o;24739:127::-;24800:10;24795:3;24791:20;24788:1;24781:31;24831:4;24828:1;24821:15;24855:4;24852:1;24845:15;24871:120;24911:1;24937;24927:35;;24942:18;;:::i;:::-;-1:-1:-1;24976:9:31;;24871:120::o;24996:112::-;25028:1;25054;25044:35;;25059:18;;:::i;:::-;-1:-1:-1;25093:9:31;;24996:112::o;28135:151::-;28225:4;28218:12;;;28204;;;28200:31;;28243:14;;28240:40;;;28260:18;;:::i",
383
+ linkReferences: {}
384
+ },
385
+ methodIdentifiers: {
386
+ "CERTIFICATE_REGISTRY_ID()": "41a0e2c2",
387
+ "CIRCUIT_REGISTRY_ID()": "6c40d5d6",
388
+ "addCertificateRegistryRoot(bytes32)": "3a316e62",
389
+ "addVerifiers(bytes32[],address[])": "a6df2c01",
390
+ "admin()": "f851a440",
391
+ "getAgeProofInputs(bytes,uint256[])": "b2b37a4c",
392
+ "getBindProofInputs(bytes,uint256[])": "4601173c",
393
+ "getBoundData(bytes)": "0af18ba6",
394
+ "getCountryProofInputs(bytes,uint256[],uint8)": "126f7559",
395
+ "getDateProofInputs(bytes,uint256[],uint8)": "ec1374cd",
396
+ "getDiscloseProofInputs(bytes,uint256[])": "ddf3eec9",
397
+ "getDisclosedData(bytes,bool)": "03d37eae",
398
+ "isValidCertificateRegistryRoot(bytes32)": "45e21c90",
399
+ "paused()": "5c975abb",
400
+ "removeCertificateRegistryRoot(bytes32)": "886c3533",
401
+ "removeVerifiers(bytes32[])": "8d6937b8",
402
+ "rootRegistry()": "b96b161c",
403
+ "setPaused(bool)": "16c38b3c",
404
+ "transferAdmin(address)": "75829def",
405
+ "updateRootRegistry(address)": "18677f2a",
406
+ "verifyProof((bytes32,bytes,bytes32[],bytes,uint256[],uint256,string,string,bool))": "d7bf616a",
407
+ "verifyScopes(bytes32[],string,string)": "847755e3",
408
+ "vkeyHashToVerifier(bytes32)": "8163f231"
409
+ },
410
+ rawMetadata: '{"compiler":{"version":"0.8.29+commit.ab55807c"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"address","name":"_rootRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":true,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"certificateRegistryRoot","type":"bytes32"}],"name":"CertificateRegistryRootAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"certificateRegistryRoot","type":"bytes32"}],"name":"CertificateRegistryRootRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"paused","type":"bool"}],"name":"PausedStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"vkeyHash","type":"bytes32"},{"indexed":true,"internalType":"address","name":"verifier","type":"address"}],"name":"VerifierAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"vkeyHash","type":"bytes32"}],"name":"VerifierRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ZKPassportVerifierDeployed","type":"event"},{"inputs":[],"name":"CERTIFICATE_REGISTRY_ID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CIRCUIT_REGISTRY_ID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"certificateRegistryRoot","type":"bytes32"}],"name":"addCertificateRegistryRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"vkeyHashes","type":"bytes32[]"},{"internalType":"address[]","name":"verifiers","type":"address[]"}],"name":"addVerifiers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"committedInputs","type":"bytes"},{"internalType":"uint256[]","name":"committedInputCounts","type":"uint256[]"}],"name":"getAgeProofInputs","outputs":[{"internalType":"uint256","name":"currentDate","type":"uint256"},{"internalType":"uint8","name":"minAge","type":"uint8"},{"internalType":"uint8","name":"maxAge","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"committedInputs","type":"bytes"},{"internalType":"uint256[]","name":"committedInputCounts","type":"uint256[]"}],"name":"getBindProofInputs","outputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"getBoundData","outputs":[{"internalType":"address","name":"senderAddress","type":"address"},{"internalType":"string","name":"customData","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"committedInputs","type":"bytes"},{"internalType":"uint256[]","name":"committedInputCounts","type":"uint256[]"},{"internalType":"enum ProofType","name":"proofType","type":"uint8"}],"name":"getCountryProofInputs","outputs":[{"internalType":"string[]","name":"countryList","type":"string[]"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"committedInputs","type":"bytes"},{"internalType":"uint256[]","name":"committedInputCounts","type":"uint256[]"},{"internalType":"enum ProofType","name":"proofType","type":"uint8"}],"name":"getDateProofInputs","outputs":[{"internalType":"uint256","name":"currentDate","type":"uint256"},{"internalType":"uint256","name":"minDate","type":"uint256"},{"internalType":"uint256","name":"maxDate","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"committedInputs","type":"bytes"},{"internalType":"uint256[]","name":"committedInputCounts","type":"uint256[]"}],"name":"getDiscloseProofInputs","outputs":[{"internalType":"bytes","name":"discloseMask","type":"bytes"},{"internalType":"bytes","name":"discloseBytes","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"discloseBytes","type":"bytes"},{"internalType":"bool","name":"isIDCard","type":"bool"}],"name":"getDisclosedData","outputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"issuingCountry","type":"string"},{"internalType":"string","name":"nationality","type":"string"},{"internalType":"string","name":"gender","type":"string"},{"internalType":"string","name":"birthDate","type":"string"},{"internalType":"string","name":"expiryDate","type":"string"},{"internalType":"string","name":"documentNumber","type":"string"},{"internalType":"string","name":"documentType","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"isValidCertificateRegistryRoot","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"certificateRegistryRoot","type":"bytes32"}],"name":"removeCertificateRegistryRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"vkeyHashes","type":"bytes32[]"}],"name":"removeVerifiers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rootRegistry","outputs":[{"internalType":"contract IRootRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"transferAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rootRegistry","type":"address"}],"name":"updateRootRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"vkeyHash","type":"bytes32"},{"internalType":"bytes","name":"proof","type":"bytes"},{"internalType":"bytes32[]","name":"publicInputs","type":"bytes32[]"},{"internalType":"bytes","name":"committedInputs","type":"bytes"},{"internalType":"uint256[]","name":"committedInputCounts","type":"uint256[]"},{"internalType":"uint256","name":"validityPeriodInDays","type":"uint256"},{"internalType":"string","name":"domain","type":"string"},{"internalType":"string","name":"scope","type":"string"},{"internalType":"bool","name":"devMode","type":"bool"}],"internalType":"struct ProofVerificationParams","name":"params","type":"tuple"}],"name":"verifyProof","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"publicInputs","type":"bytes32[]"},{"internalType":"string","name":"domain","type":"string"},{"internalType":"string","name":"scope","type":"string"}],"name":"verifyScopes","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"vkeyHashToVerifier","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}],"devdoc":{"kind":"dev","methods":{"constructor":{"details":"Constructor"},"verifyProof((bytes32,bytes,bytes32[],bytes,uint256[],uint256,string,string,bool))":{"params":{"params":"The proof verification parameters"},"returns":{"_0":"isValid True if the proof is valid, false otherwise","_1":"uniqueIdentifier The unique identifier associated to the identity document that generated the proof"}}},"version":1},"userdoc":{"kind":"user","methods":{"verifyProof((bytes32,bytes,bytes32[],bytes,uint256[],uint256,string,string,bool))":{"notice":"Verifies a proof from ZKPassport"}},"version":1}},"settings":{"compilationTarget":{"src/ZKPassportVerifier.sol":"ZKPassportVerifier"},"evmVersion":"cancun","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[":forge-std/=lib/forge-std/src/"]},"sources":{"src/ArrayUtils.sol":{"keccak256":"0x8decadfca50750cbdcb00be06030305478292f0042affa868e733d85a3fc9882","license":"Apache-2.0","urls":["bzz-raw://87c9fef005d1894a5fd5dcb1dd46d9a8643ce7496f6aaed7e000fe7a518cf0d1","dweb:/ipfs/QmdCn9qvZXQDpBWcDXumLagWg5dEV5yE1DCMiE1PidqCBe"]},"src/DateUtils.sol":{"keccak256":"0xd3fe7fd4a910fe7ef1e4cf22e09a94b2cb1de70e9ccf4bc0015fa2d9da35da95","license":"Apache-2.0","urls":["bzz-raw://c842a171154773f3a56b4f0842fb7a9811b865dce05abad4060659db18553500","dweb:/ipfs/QmSs5UgmLUPSqL43khS7WbM15iKKAz4bwEpbEu319m9caL"]},"src/IRootRegistry.sol":{"keccak256":"0xa9955e80821ca9ccbdf7d05a8ce9a3e237b4771e1f6e09190ed1c803a5e1e516","license":"MIT","urls":["bzz-raw://fd9fc9fbd7057a6bcc16a682e52be9ebd012954898626a11f0a0e8788644789d","dweb:/ipfs/QmZYpMRHdv4gMCNXCQtGQu8XqRVtNR9Kgkzh7u1YMpvrEB"]},"src/OuterCount4.sol":{"keccak256":"0x5b0c5790560ca35d8e2cc4d546d96f26394715ebebce9af645373fd92c207bb7","license":"Apache-2.0","urls":["bzz-raw://52359801317456c1cd804564c46ad154e7e317ab12aeda3d5d5b6aeb8338425d","dweb:/ipfs/QmTNnxQ9L1nnnXeFm6ShxQoDsMm8htKuoeU5B4sAF1VzBq"]},"src/StringUtils.sol":{"keccak256":"0x518791675043f4c927aa2d02b543b8be56b77b9c0c9aab46dd8dcea45ee7e8d5","license":"Apache-2.0","urls":["bzz-raw://851a2758819d8cf3d3628fa6b43f3ae84c0f0a684c3a08dd3a640c0a4075268d","dweb:/ipfs/QmRZn415Bgyv6rcCfiZhfDNt6uDCgxCTMi48nU2KmDZBTb"]},"src/ZKPassportVerifier.sol":{"keccak256":"0x6d8cf82b75a01991928051283aa4e3486d2abc7bfa1fb86473b509befc96cf87","license":"Apache-2.0","urls":["bzz-raw://14437bd7a55b01f03c03f2267cbbf02ceff4f27c3745592bf12d96573acf73c6","dweb:/ipfs/QmWRX56rHi4Vm4h1322exjg6soQbt1dT1mPNv6VtdUM5tK"]}},"version":1}',
411
+ metadata: {
412
+ compiler: { version: "0.8.29+commit.ab55807c" },
413
+ language: "Solidity",
414
+ output: {
415
+ abi: [
416
+ {
417
+ inputs: [{ internalType: "address", name: "_rootRegistry", type: "address" }],
418
+ stateMutability: "nonpayable",
419
+ type: "constructor"
420
+ },
421
+ {
422
+ inputs: [
423
+ { internalType: "address", name: "oldAdmin", type: "address", indexed: true },
424
+ { internalType: "address", name: "newAdmin", type: "address", indexed: true }
425
+ ],
426
+ type: "event",
427
+ name: "AdminUpdated",
428
+ anonymous: false
429
+ },
430
+ {
431
+ inputs: [
432
+ {
433
+ internalType: "bytes32",
434
+ name: "certificateRegistryRoot",
435
+ type: "bytes32",
436
+ indexed: true
437
+ }
438
+ ],
439
+ type: "event",
440
+ name: "CertificateRegistryRootAdded",
441
+ anonymous: false
442
+ },
443
+ {
444
+ inputs: [
445
+ {
446
+ internalType: "bytes32",
447
+ name: "certificateRegistryRoot",
448
+ type: "bytes32",
449
+ indexed: true
450
+ }
451
+ ],
452
+ type: "event",
453
+ name: "CertificateRegistryRootRemoved",
454
+ anonymous: false
455
+ },
456
+ {
457
+ inputs: [
458
+ { internalType: "bool", name: "paused", type: "bool", indexed: false }
459
+ ],
460
+ type: "event",
461
+ name: "PausedStatusChanged",
462
+ anonymous: false
463
+ },
464
+ {
465
+ inputs: [
466
+ { internalType: "bytes32", name: "vkeyHash", type: "bytes32", indexed: true },
467
+ { internalType: "address", name: "verifier", type: "address", indexed: true }
468
+ ],
469
+ type: "event",
470
+ name: "VerifierAdded",
471
+ anonymous: false
472
+ },
473
+ {
474
+ inputs: [
475
+ { internalType: "bytes32", name: "vkeyHash", type: "bytes32", indexed: true }
476
+ ],
477
+ type: "event",
478
+ name: "VerifierRemoved",
479
+ anonymous: false
480
+ },
481
+ {
482
+ inputs: [
483
+ { internalType: "address", name: "admin", type: "address", indexed: true },
484
+ { internalType: "uint256", name: "timestamp", type: "uint256", indexed: false }
485
+ ],
486
+ type: "event",
487
+ name: "ZKPassportVerifierDeployed",
488
+ anonymous: false
489
+ },
490
+ {
491
+ inputs: [],
492
+ stateMutability: "view",
493
+ type: "function",
494
+ name: "CERTIFICATE_REGISTRY_ID",
495
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }]
496
+ },
497
+ {
498
+ inputs: [],
499
+ stateMutability: "view",
500
+ type: "function",
501
+ name: "CIRCUIT_REGISTRY_ID",
502
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }]
503
+ },
504
+ {
505
+ inputs: [
506
+ { internalType: "bytes32", name: "certificateRegistryRoot", type: "bytes32" }
507
+ ],
508
+ stateMutability: "nonpayable",
509
+ type: "function",
510
+ name: "addCertificateRegistryRoot"
511
+ },
512
+ {
513
+ inputs: [
514
+ { internalType: "bytes32[]", name: "vkeyHashes", type: "bytes32[]" },
515
+ { internalType: "address[]", name: "verifiers", type: "address[]" }
516
+ ],
517
+ stateMutability: "nonpayable",
518
+ type: "function",
519
+ name: "addVerifiers"
520
+ },
521
+ {
522
+ inputs: [],
523
+ stateMutability: "view",
524
+ type: "function",
525
+ name: "admin",
526
+ outputs: [{ internalType: "address", name: "", type: "address" }]
527
+ },
528
+ {
529
+ inputs: [
530
+ { internalType: "bytes", name: "committedInputs", type: "bytes" },
531
+ { internalType: "uint256[]", name: "committedInputCounts", type: "uint256[]" }
532
+ ],
533
+ stateMutability: "pure",
534
+ type: "function",
535
+ name: "getAgeProofInputs",
536
+ outputs: [
537
+ { internalType: "uint256", name: "currentDate", type: "uint256" },
538
+ { internalType: "uint8", name: "minAge", type: "uint8" },
539
+ { internalType: "uint8", name: "maxAge", type: "uint8" }
540
+ ]
541
+ },
542
+ {
543
+ inputs: [
544
+ { internalType: "bytes", name: "committedInputs", type: "bytes" },
545
+ { internalType: "uint256[]", name: "committedInputCounts", type: "uint256[]" }
546
+ ],
547
+ stateMutability: "pure",
548
+ type: "function",
549
+ name: "getBindProofInputs",
550
+ outputs: [{ internalType: "bytes", name: "data", type: "bytes" }]
551
+ },
552
+ {
553
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
554
+ stateMutability: "pure",
555
+ type: "function",
556
+ name: "getBoundData",
557
+ outputs: [
558
+ { internalType: "address", name: "senderAddress", type: "address" },
559
+ { internalType: "string", name: "customData", type: "string" }
560
+ ]
561
+ },
562
+ {
563
+ inputs: [
564
+ { internalType: "bytes", name: "committedInputs", type: "bytes" },
565
+ { internalType: "uint256[]", name: "committedInputCounts", type: "uint256[]" },
566
+ { internalType: "enum ProofType", name: "proofType", type: "uint8" }
567
+ ],
568
+ stateMutability: "pure",
569
+ type: "function",
570
+ name: "getCountryProofInputs",
571
+ outputs: [{ internalType: "string[]", name: "countryList", type: "string[]" }]
572
+ },
573
+ {
574
+ inputs: [
575
+ { internalType: "bytes", name: "committedInputs", type: "bytes" },
576
+ { internalType: "uint256[]", name: "committedInputCounts", type: "uint256[]" },
577
+ { internalType: "enum ProofType", name: "proofType", type: "uint8" }
578
+ ],
579
+ stateMutability: "pure",
580
+ type: "function",
581
+ name: "getDateProofInputs",
582
+ outputs: [
583
+ { internalType: "uint256", name: "currentDate", type: "uint256" },
584
+ { internalType: "uint256", name: "minDate", type: "uint256" },
585
+ { internalType: "uint256", name: "maxDate", type: "uint256" }
586
+ ]
587
+ },
588
+ {
589
+ inputs: [
590
+ { internalType: "bytes", name: "committedInputs", type: "bytes" },
591
+ { internalType: "uint256[]", name: "committedInputCounts", type: "uint256[]" }
592
+ ],
593
+ stateMutability: "pure",
594
+ type: "function",
595
+ name: "getDiscloseProofInputs",
596
+ outputs: [
597
+ { internalType: "bytes", name: "discloseMask", type: "bytes" },
598
+ { internalType: "bytes", name: "discloseBytes", type: "bytes" }
599
+ ]
600
+ },
601
+ {
602
+ inputs: [
603
+ { internalType: "bytes", name: "discloseBytes", type: "bytes" },
604
+ { internalType: "bool", name: "isIDCard", type: "bool" }
605
+ ],
606
+ stateMutability: "pure",
607
+ type: "function",
608
+ name: "getDisclosedData",
609
+ outputs: [
610
+ { internalType: "string", name: "name", type: "string" },
611
+ { internalType: "string", name: "issuingCountry", type: "string" },
612
+ { internalType: "string", name: "nationality", type: "string" },
613
+ { internalType: "string", name: "gender", type: "string" },
614
+ { internalType: "string", name: "birthDate", type: "string" },
615
+ { internalType: "string", name: "expiryDate", type: "string" },
616
+ { internalType: "string", name: "documentNumber", type: "string" },
617
+ { internalType: "string", name: "documentType", type: "string" }
618
+ ]
619
+ },
620
+ {
621
+ inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
622
+ stateMutability: "view",
623
+ type: "function",
624
+ name: "isValidCertificateRegistryRoot",
625
+ outputs: [{ internalType: "bool", name: "", type: "bool" }]
626
+ },
627
+ {
628
+ inputs: [],
629
+ stateMutability: "view",
630
+ type: "function",
631
+ name: "paused",
632
+ outputs: [{ internalType: "bool", name: "", type: "bool" }]
633
+ },
634
+ {
635
+ inputs: [
636
+ { internalType: "bytes32", name: "certificateRegistryRoot", type: "bytes32" }
637
+ ],
638
+ stateMutability: "nonpayable",
639
+ type: "function",
640
+ name: "removeCertificateRegistryRoot"
641
+ },
642
+ {
643
+ inputs: [{ internalType: "bytes32[]", name: "vkeyHashes", type: "bytes32[]" }],
644
+ stateMutability: "nonpayable",
645
+ type: "function",
646
+ name: "removeVerifiers"
647
+ },
648
+ {
649
+ inputs: [],
650
+ stateMutability: "view",
651
+ type: "function",
652
+ name: "rootRegistry",
653
+ outputs: [{ internalType: "contract IRootRegistry", name: "", type: "address" }]
654
+ },
655
+ {
656
+ inputs: [{ internalType: "bool", name: "_paused", type: "bool" }],
657
+ stateMutability: "nonpayable",
658
+ type: "function",
659
+ name: "setPaused"
660
+ },
661
+ {
662
+ inputs: [{ internalType: "address", name: "newAdmin", type: "address" }],
663
+ stateMutability: "nonpayable",
664
+ type: "function",
665
+ name: "transferAdmin"
666
+ },
667
+ {
668
+ inputs: [{ internalType: "address", name: "_rootRegistry", type: "address" }],
669
+ stateMutability: "nonpayable",
670
+ type: "function",
671
+ name: "updateRootRegistry"
672
+ },
673
+ {
674
+ inputs: [
675
+ {
676
+ internalType: "struct ProofVerificationParams",
677
+ name: "params",
678
+ type: "tuple",
679
+ components: [
680
+ { internalType: "bytes32", name: "vkeyHash", type: "bytes32" },
681
+ { internalType: "bytes", name: "proof", type: "bytes" },
682
+ { internalType: "bytes32[]", name: "publicInputs", type: "bytes32[]" },
683
+ { internalType: "bytes", name: "committedInputs", type: "bytes" },
684
+ {
685
+ internalType: "uint256[]",
686
+ name: "committedInputCounts",
687
+ type: "uint256[]"
688
+ },
689
+ { internalType: "uint256", name: "validityPeriodInDays", type: "uint256" },
690
+ { internalType: "string", name: "domain", type: "string" },
691
+ { internalType: "string", name: "scope", type: "string" },
692
+ { internalType: "bool", name: "devMode", type: "bool" }
693
+ ]
694
+ }
695
+ ],
696
+ stateMutability: "view",
697
+ type: "function",
698
+ name: "verifyProof",
699
+ outputs: [
700
+ { internalType: "bool", name: "", type: "bool" },
701
+ { internalType: "bytes32", name: "", type: "bytes32" }
702
+ ]
703
+ },
704
+ {
705
+ inputs: [
706
+ { internalType: "bytes32[]", name: "publicInputs", type: "bytes32[]" },
707
+ { internalType: "string", name: "domain", type: "string" },
708
+ { internalType: "string", name: "scope", type: "string" }
709
+ ],
710
+ stateMutability: "view",
711
+ type: "function",
712
+ name: "verifyScopes",
713
+ outputs: [{ internalType: "bool", name: "", type: "bool" }]
714
+ },
715
+ {
716
+ inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
717
+ stateMutability: "view",
718
+ type: "function",
719
+ name: "vkeyHashToVerifier",
720
+ outputs: [{ internalType: "address", name: "", type: "address" }]
721
+ }
722
+ ],
723
+ devdoc: {
724
+ kind: "dev",
725
+ methods: {
726
+ constructor: { details: "Constructor" },
727
+ "verifyProof((bytes32,bytes,bytes32[],bytes,uint256[],uint256,string,string,bool))": {
728
+ params: { params: "The proof verification parameters" },
729
+ returns: {
730
+ _0: "isValid True if the proof is valid, false otherwise",
731
+ _1: "uniqueIdentifier The unique identifier associated to the identity document that generated the proof"
732
+ }
733
+ }
734
+ },
735
+ version: 1
736
+ },
737
+ userdoc: {
738
+ kind: "user",
739
+ methods: {
740
+ "verifyProof((bytes32,bytes,bytes32[],bytes,uint256[],uint256,string,string,bool))": {
741
+ notice: "Verifies a proof from ZKPassport"
742
+ }
743
+ },
744
+ version: 1
745
+ }
746
+ },
747
+ settings: {
748
+ remappings: ["forge-std/=lib/forge-std/src/"],
749
+ optimizer: { enabled: true, runs: 200 },
750
+ metadata: { bytecodeHash: "ipfs" },
751
+ compilationTarget: { "src/ZKPassportVerifier.sol": "ZKPassportVerifier" },
752
+ evmVersion: "cancun",
753
+ libraries: {}
754
+ },
755
+ sources: {
756
+ "src/ArrayUtils.sol": {
757
+ keccak256: "0x8decadfca50750cbdcb00be06030305478292f0042affa868e733d85a3fc9882",
758
+ urls: [
759
+ "bzz-raw://87c9fef005d1894a5fd5dcb1dd46d9a8643ce7496f6aaed7e000fe7a518cf0d1",
760
+ "dweb:/ipfs/QmdCn9qvZXQDpBWcDXumLagWg5dEV5yE1DCMiE1PidqCBe"
761
+ ],
762
+ license: "Apache-2.0"
763
+ },
764
+ "src/DateUtils.sol": {
765
+ keccak256: "0xd3fe7fd4a910fe7ef1e4cf22e09a94b2cb1de70e9ccf4bc0015fa2d9da35da95",
766
+ urls: [
767
+ "bzz-raw://c842a171154773f3a56b4f0842fb7a9811b865dce05abad4060659db18553500",
768
+ "dweb:/ipfs/QmSs5UgmLUPSqL43khS7WbM15iKKAz4bwEpbEu319m9caL"
769
+ ],
770
+ license: "Apache-2.0"
771
+ },
772
+ "src/IRootRegistry.sol": {
773
+ keccak256: "0xa9955e80821ca9ccbdf7d05a8ce9a3e237b4771e1f6e09190ed1c803a5e1e516",
774
+ urls: [
775
+ "bzz-raw://fd9fc9fbd7057a6bcc16a682e52be9ebd012954898626a11f0a0e8788644789d",
776
+ "dweb:/ipfs/QmZYpMRHdv4gMCNXCQtGQu8XqRVtNR9Kgkzh7u1YMpvrEB"
777
+ ],
778
+ license: "MIT"
779
+ },
780
+ "src/OuterCount4.sol": {
781
+ keccak256: "0x5b0c5790560ca35d8e2cc4d546d96f26394715ebebce9af645373fd92c207bb7",
782
+ urls: [
783
+ "bzz-raw://52359801317456c1cd804564c46ad154e7e317ab12aeda3d5d5b6aeb8338425d",
784
+ "dweb:/ipfs/QmTNnxQ9L1nnnXeFm6ShxQoDsMm8htKuoeU5B4sAF1VzBq"
785
+ ],
786
+ license: "Apache-2.0"
787
+ },
788
+ "src/StringUtils.sol": {
789
+ keccak256: "0x518791675043f4c927aa2d02b543b8be56b77b9c0c9aab46dd8dcea45ee7e8d5",
790
+ urls: [
791
+ "bzz-raw://851a2758819d8cf3d3628fa6b43f3ae84c0f0a684c3a08dd3a640c0a4075268d",
792
+ "dweb:/ipfs/QmRZn415Bgyv6rcCfiZhfDNt6uDCgxCTMi48nU2KmDZBTb"
793
+ ],
794
+ license: "Apache-2.0"
795
+ },
796
+ "src/ZKPassportVerifier.sol": {
797
+ keccak256: "0x6d8cf82b75a01991928051283aa4e3486d2abc7bfa1fb86473b509befc96cf87",
798
+ urls: [
799
+ "bzz-raw://14437bd7a55b01f03c03f2267cbbf02ceff4f27c3745592bf12d96573acf73c6",
800
+ "dweb:/ipfs/QmWRX56rHi4Vm4h1322exjg6soQbt1dT1mPNv6VtdUM5tK"
801
+ ],
802
+ license: "Apache-2.0"
803
+ }
804
+ },
805
+ version: 1
806
+ },
807
+ id: 27
808
+ };
809
+
810
+ // src/index.ts
811
+ var import_registry = require("@zkpassport/registry");
812
+ var import_bridge = require("@obsidion/bridge");
813
+ var import_utils4 = require("@zkpassport/utils");
814
+ var VERSION = "0.5.5";
815
+ var DEFAULT_DATE_VALUE = new Date(1111, 10, 11);
816
+ if (typeof globalThis.Buffer === "undefined") {
817
+ globalThis.Buffer = import_buffer.Buffer;
818
+ if (typeof window !== "undefined") {
819
+ window.Buffer = import_buffer.Buffer;
820
+ }
821
+ }
822
+ function getChainIdFromEVMChain(chain) {
823
+ if (chain === "ethereum_sepolia") {
824
+ return 11155111;
825
+ } else if (chain === "local_anvil") {
826
+ return 31337;
827
+ }
828
+ throw new Error(`Unsupported chain: ${chain}`);
829
+ }
830
+ function getEVMChainFromChainId(chainId) {
831
+ if (chainId === 11155111) {
832
+ return "ethereum_sepolia";
833
+ } else if (chainId === 31337) {
834
+ return "local_anvil";
835
+ }
836
+ throw new Error(`Unsupported chain ID: ${chainId}`);
837
+ }
838
+ (0, import_i18n_iso_countries.registerLocale)(import_en.default);
839
+ function hasRequestedAccessToField(credentialsRequest, field) {
840
+ const fieldValue = credentialsRequest[field];
841
+ const isDefined = fieldValue !== void 0 && fieldValue !== null;
842
+ if (!isDefined) {
843
+ return false;
844
+ }
845
+ for (const key in fieldValue) {
846
+ if (fieldValue[key] !== void 0 && fieldValue[key] !== null) {
847
+ return true;
848
+ }
849
+ }
850
+ return false;
851
+ }
852
+ function normalizeCountry(country) {
853
+ if (country === "Zero Knowledge Republic") {
854
+ return "ZKR";
855
+ }
856
+ let normalizedCountry;
857
+ const alpha3 = (0, import_i18n_iso_countries.getAlpha3Code)(country, "en");
858
+ normalizedCountry = alpha3 || country || "ZKR";
859
+ return normalizedCountry;
860
+ }
861
+ function numericalCompare(fnName, key, value, requestId, requestIdToConfig) {
862
+ requestIdToConfig[requestId][key] = {
863
+ ...requestIdToConfig[requestId][key],
864
+ [fnName]: value
865
+ };
866
+ }
867
+ function rangeCompare(key, value, requestId, requestIdToConfig) {
868
+ requestIdToConfig[requestId][key] = {
869
+ ...requestIdToConfig[requestId][key],
870
+ range: value
871
+ };
872
+ }
873
+ function generalCompare(fnName, key, value, requestId, requestIdToConfig) {
874
+ requestIdToConfig[requestId][key] = {
875
+ ...requestIdToConfig[requestId][key],
876
+ [fnName]: value
877
+ };
878
+ }
879
+ var ZKPassport = class {
880
+ //private wasmVerifierInit: boolean = false
881
+ constructor(_domain) {
882
+ this.topicToConfig = {};
883
+ this.topicToLocalConfig = {};
884
+ this.topicToPublicKey = {};
885
+ this.topicToBridge = {};
886
+ this.topicToRequestReceived = {};
887
+ this.topicToService = {};
888
+ this.topicToProofs = {};
889
+ this.topicToExpectedProofCount = {};
890
+ this.topicToFailedProofCount = {};
891
+ this.topicToResults = {};
892
+ this.onRequestReceivedCallbacks = {};
893
+ this.onGeneratingProofCallbacks = {};
894
+ this.onBridgeConnectCallbacks = {};
895
+ this.onProofGeneratedCallbacks = {};
896
+ this.onResultCallbacks = {};
897
+ this.onRejectCallbacks = {};
898
+ this.onErrorCallbacks = {};
899
+ if (!_domain && typeof window === "undefined") {
900
+ throw new Error("Domain argument is required in Node.js environment");
901
+ }
902
+ this.domain = _domain || window.location.hostname;
903
+ }
904
+ async handleResult(topic) {
905
+ const result = this.topicToResults[topic];
906
+ delete this.topicToResults[topic];
907
+ const { uniqueIdentifier, verified, queryResultErrors } = await this.verify({
908
+ proofs: this.topicToProofs[topic],
909
+ queryResult: result,
910
+ validity: this.topicToLocalConfig[topic]?.validity,
911
+ scope: this.topicToService[topic]?.scope,
912
+ evmChain: this.topicToService[topic]?.chainId ? getEVMChainFromChainId(this.topicToService[topic]?.chainId) : void 0,
913
+ devMode: this.topicToLocalConfig[topic]?.devMode
914
+ });
915
+ delete this.topicToProofs[topic];
916
+ const hasFailedProofs = this.topicToFailedProofCount[topic] > 0;
917
+ await Promise.all(
918
+ this.onResultCallbacks[topic].map(
919
+ (callback) => callback({
920
+ // If there are failed proofs, we don't return the unique identifier
921
+ // and we set the verified result to false
922
+ uniqueIdentifier: hasFailedProofs ? void 0 : uniqueIdentifier,
923
+ verified: hasFailedProofs ? false : verified,
924
+ result,
925
+ queryResultErrors
926
+ })
927
+ )
928
+ );
929
+ delete this.topicToExpectedProofCount[topic];
930
+ delete this.topicToFailedProofCount[topic];
931
+ }
932
+ setExpectedProofCount(topic) {
933
+ if (this.topicToLocalConfig[topic].mode !== "fast") {
934
+ this.topicToExpectedProofCount[topic] = 1;
935
+ return;
936
+ }
937
+ const fields = Object.keys(this.topicToConfig[topic]).filter(
938
+ (key) => hasRequestedAccessToField(this.topicToConfig[topic], key)
939
+ );
940
+ const neededCircuits = [];
941
+ for (const field of fields) {
942
+ for (const key in this.topicToConfig[topic][field]) {
943
+ switch (key) {
944
+ case "eq":
945
+ case "disclose":
946
+ if (field !== "age" && !neededCircuits.includes("disclose_bytes")) {
947
+ neededCircuits.push("disclose_bytes");
948
+ } else if (field === "age" && !neededCircuits.includes("compare_age")) {
949
+ neededCircuits.push("compare_age");
950
+ }
951
+ break;
952
+ case "gte":
953
+ case "gt":
954
+ case "lte":
955
+ case "lt":
956
+ case "range":
957
+ if (field === "age" && !neededCircuits.includes("compare_age")) {
958
+ neededCircuits.push("compare_age");
959
+ } else if (field === "expiry_date" && !neededCircuits.includes("compare_expiry")) {
960
+ neededCircuits.push("compare_expiry");
961
+ } else if (field === "birthdate" && !neededCircuits.includes("compare_birthdate")) {
962
+ neededCircuits.push("compare_birthdate");
963
+ }
964
+ break;
965
+ case "in":
966
+ if (field === "nationality" && !neededCircuits.includes("inclusion_check_nationality")) {
967
+ neededCircuits.push("inclusion_check_nationality");
968
+ } else if (field === "issuing_country" && !neededCircuits.includes("inclusion_check_issuing_country")) {
969
+ neededCircuits.push("inclusion_check_issuing_country");
970
+ }
971
+ break;
972
+ case "out":
973
+ if (field === "nationality" && !neededCircuits.includes("exclusion_check_nationality")) {
974
+ neededCircuits.push("exclusion_check_nationality");
975
+ } else if (field === "issuing_country" && !neededCircuits.includes("exclusion_check_issuing_country")) {
976
+ neededCircuits.push("exclusion_check_issuing_country");
977
+ }
978
+ break;
979
+ }
980
+ }
981
+ }
982
+ if (this.topicToConfig[topic].bind) {
983
+ neededCircuits.push("bind");
984
+ }
985
+ this.topicToExpectedProofCount[topic] = neededCircuits.length === 0 ? 4 : 3 + neededCircuits.length;
986
+ this.topicToFailedProofCount[topic] = 0;
987
+ }
988
+ /**
989
+ * @notice Handle an encrypted message.
990
+ * @param request The request.
991
+ * @param outerRequest The outer request.
992
+ */
993
+ async handleEncryptedMessage(topic, request) {
994
+ noLogger.debug("Received encrypted message:", request);
995
+ if (request.method === "accept") {
996
+ noLogger.debug(`User accepted the request and is generating a proof`);
997
+ await Promise.all(this.onGeneratingProofCallbacks[topic].map((callback) => callback(topic)));
998
+ } else if (request.method === "reject") {
999
+ noLogger.debug(`User rejected the request`);
1000
+ await Promise.all(this.onRejectCallbacks[topic].map((callback) => callback()));
1001
+ } else if (request.method === "proof") {
1002
+ noLogger.debug(`User generated proof`);
1003
+ this.topicToProofs[topic].push(request.params);
1004
+ await Promise.all(
1005
+ this.onProofGeneratedCallbacks[topic].map((callback) => callback(request.params))
1006
+ );
1007
+ if (this.topicToResults[topic] && this.topicToExpectedProofCount[topic] === this.topicToProofs[topic].length) {
1008
+ await this.handleResult(topic);
1009
+ }
1010
+ } else if (request.method === "done") {
1011
+ noLogger.debug(`User sent the query result`);
1012
+ const formattedResult = request.params;
1013
+ if (formattedResult.birthdate && formattedResult.birthdate.disclose) {
1014
+ formattedResult.birthdate.disclose.result = new Date(
1015
+ formattedResult.birthdate.disclose.result
1016
+ );
1017
+ }
1018
+ if (formattedResult.expiry_date && formattedResult.expiry_date.disclose) {
1019
+ formattedResult.expiry_date.disclose.result = new Date(
1020
+ formattedResult.expiry_date.disclose.result
1021
+ );
1022
+ }
1023
+ this.topicToResults[topic] = formattedResult;
1024
+ if (this.topicToExpectedProofCount[topic] === this.topicToProofs[topic].length) {
1025
+ await this.handleResult(topic);
1026
+ }
1027
+ } else if (request.method === "error") {
1028
+ const error = request.params.error;
1029
+ if (error && error === "This ID is not supported yet") {
1030
+ this.topicToExpectedProofCount[topic] = 0;
1031
+ this.topicToFailedProofCount[topic] += this.topicToExpectedProofCount[topic];
1032
+ if (this.topicToResults[topic]) {
1033
+ await this.handleResult(topic);
1034
+ }
1035
+ } else if (error && error.startsWith("Cannot generate proof")) {
1036
+ this.topicToExpectedProofCount[topic] -= 1;
1037
+ this.topicToFailedProofCount[topic] += 1;
1038
+ if (this.topicToResults[topic] && this.topicToExpectedProofCount[topic] === this.topicToProofs[topic].length) {
1039
+ await this.handleResult(topic);
1040
+ }
1041
+ }
1042
+ await Promise.all(this.onErrorCallbacks[topic].map((callback) => callback(error)));
1043
+ }
1044
+ }
1045
+ getZkPassportRequest(topic) {
1046
+ return {
1047
+ eq: (key, value) => {
1048
+ if (key === "issuing_country" || key === "nationality") {
1049
+ value = normalizeCountry(value);
1050
+ }
1051
+ generalCompare("eq", key, value, topic, this.topicToConfig);
1052
+ return this.getZkPassportRequest(topic);
1053
+ },
1054
+ gte: (key, value) => {
1055
+ numericalCompare("gte", key, value, topic, this.topicToConfig);
1056
+ if (key === "age" && (value < 1 || value >= 100)) {
1057
+ throw new Error("Age must be between 1 and 99 (inclusive)");
1058
+ }
1059
+ return this.getZkPassportRequest(topic);
1060
+ },
1061
+ /*gt: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => {
1062
+ numericalCompare('gt', key, value, topic, this.topicToConfig)
1063
+ return this.getZkPassportRequest(topic)
1064
+ },*/
1065
+ lte: (key, value) => {
1066
+ numericalCompare("lte", key, value, topic, this.topicToConfig);
1067
+ return this.getZkPassportRequest(topic);
1068
+ },
1069
+ lt: (key, value) => {
1070
+ numericalCompare("lt", key, value, topic, this.topicToConfig);
1071
+ return this.getZkPassportRequest(topic);
1072
+ },
1073
+ range: (key, start, end) => {
1074
+ rangeCompare(key, [start, end], topic, this.topicToConfig);
1075
+ return this.getZkPassportRequest(topic);
1076
+ },
1077
+ in: (key, value) => {
1078
+ value = value.map((v) => normalizeCountry(v));
1079
+ generalCompare("in", key, value, topic, this.topicToConfig);
1080
+ return this.getZkPassportRequest(topic);
1081
+ },
1082
+ out: (key, value) => {
1083
+ value = value.map((v) => normalizeCountry(v));
1084
+ generalCompare("out", key, value, topic, this.topicToConfig);
1085
+ return this.getZkPassportRequest(topic);
1086
+ },
1087
+ disclose: (key) => {
1088
+ this.topicToConfig[topic][key] = {
1089
+ ...this.topicToConfig[topic][key],
1090
+ disclose: true
1091
+ };
1092
+ return this.getZkPassportRequest(topic);
1093
+ },
1094
+ bind: (key, value) => {
1095
+ this.topicToConfig[topic].bind = {
1096
+ ...this.topicToConfig[topic].bind,
1097
+ [key]: value
1098
+ };
1099
+ return this.getZkPassportRequest(topic);
1100
+ },
1101
+ done: () => {
1102
+ this.setExpectedProofCount(topic);
1103
+ return {
1104
+ url: this._getUrl(topic),
1105
+ requestId: topic,
1106
+ onRequestReceived: (callback) => this.onRequestReceivedCallbacks[topic].push(callback),
1107
+ onGeneratingProof: (callback) => this.onGeneratingProofCallbacks[topic].push(callback),
1108
+ onBridgeConnect: (callback) => this.onBridgeConnectCallbacks[topic].push(callback),
1109
+ onProofGenerated: (callback) => this.onProofGeneratedCallbacks[topic].push(callback),
1110
+ onResult: (callback) => this.onResultCallbacks[topic].push(callback),
1111
+ onReject: (callback) => this.onRejectCallbacks[topic].push(callback),
1112
+ onError: (callback) => this.onErrorCallbacks[topic].push(callback),
1113
+ isBridgeConnected: () => this.topicToBridge[topic].isBridgeConnected(),
1114
+ requestReceived: () => this.topicToRequestReceived[topic] === true
1115
+ };
1116
+ }
1117
+ };
1118
+ }
1119
+ /**
1120
+ * @notice Create a new request
1121
+ * @param name Your service name
1122
+ * @param logo The logo of your service
1123
+ * @param purpose To explain what you want to do with the user's data
1124
+ * @param scope Scope this request to a specific use case
1125
+ * @param validity How many days ago should have the ID been last scanned by the user?
1126
+ * @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
1127
+ * @param evmChain The EVM chain to use for the request (if using the proof onchain)
1128
+ * @returns The query builder object.
1129
+ */
1130
+ async request({
1131
+ name,
1132
+ logo,
1133
+ purpose,
1134
+ scope,
1135
+ mode,
1136
+ evmChain,
1137
+ validity,
1138
+ devMode,
1139
+ topicOverride,
1140
+ keyPairOverride,
1141
+ cloudProverUrl,
1142
+ bridgeUrl
1143
+ }) {
1144
+ const bridge = await import_bridge.Bridge.create({
1145
+ keyPair: keyPairOverride,
1146
+ bridgeId: topicOverride,
1147
+ bridgeUrl
1148
+ });
1149
+ const topic = bridge.connection.getBridgeId();
1150
+ this.topicToConfig[topic] = {};
1151
+ this.topicToService[topic] = {
1152
+ name,
1153
+ logo,
1154
+ purpose,
1155
+ scope,
1156
+ chainId: evmChain ? getChainIdFromEVMChain(evmChain) : void 0,
1157
+ cloudProverUrl,
1158
+ bridgeUrl
1159
+ };
1160
+ this.topicToProofs[topic] = [];
1161
+ this.topicToExpectedProofCount[topic] = 0;
1162
+ this.topicToLocalConfig[topic] = {
1163
+ // Default to 6 months
1164
+ validity: validity || 6 * 30,
1165
+ mode: mode || "fast",
1166
+ devMode: devMode || false
1167
+ };
1168
+ this.onRequestReceivedCallbacks[topic] = [];
1169
+ this.onGeneratingProofCallbacks[topic] = [];
1170
+ this.onBridgeConnectCallbacks[topic] = [];
1171
+ this.onProofGeneratedCallbacks[topic] = [];
1172
+ this.onResultCallbacks[topic] = [];
1173
+ this.onRejectCallbacks[topic] = [];
1174
+ this.onErrorCallbacks[topic] = [];
1175
+ this.topicToPublicKey[topic] = bridge.getPublicKey();
1176
+ this.topicToBridge[topic] = bridge;
1177
+ bridge.onConnect(async (reconnection) => {
1178
+ noLogger.debug("Bridge connected");
1179
+ noLogger.debug("Is reconnection:", reconnection);
1180
+ await Promise.all(this.onBridgeConnectCallbacks[topic].map((callback) => callback()));
1181
+ });
1182
+ bridge.onSecureChannelEstablished(async () => {
1183
+ noLogger.debug("Secure channel established");
1184
+ await Promise.all(this.onRequestReceivedCallbacks[topic].map((callback) => callback()));
1185
+ });
1186
+ bridge.onSecureMessage(async (message) => {
1187
+ noLogger.debug("Received message:", message);
1188
+ this.handleEncryptedMessage(topic, message);
1189
+ });
1190
+ return this.getZkPassportRequest(topic);
1191
+ }
1192
+ checkDiscloseBytesPublicInputs(proof, queryResult) {
1193
+ const queryResultErrors = {
1194
+ sig_check_dsc: {},
1195
+ sig_check_id_data: {},
1196
+ data_check_integrity: {},
1197
+ disclose: {},
1198
+ age: {},
1199
+ birthdate: {},
1200
+ expiry_date: {},
1201
+ document_type: {},
1202
+ issuing_country: {},
1203
+ gender: {},
1204
+ nationality: {},
1205
+ firstname: {},
1206
+ lastname: {},
1207
+ fullname: {},
1208
+ document_number: {},
1209
+ outer: {},
1210
+ bind: {}
1211
+ };
1212
+ let isCorrect = true;
1213
+ const disclosedDataPassport = import_utils.DisclosedData.fromDisclosedBytes(
1214
+ (proof.committedInputs?.disclose_bytes).disclosedBytes,
1215
+ "passport"
1216
+ );
1217
+ const disclosedDataIDCard = import_utils.DisclosedData.fromDisclosedBytes(
1218
+ (proof.committedInputs?.disclose_bytes).disclosedBytes,
1219
+ "id_card"
1220
+ );
1221
+ if (queryResult.document_type) {
1222
+ if (queryResult.document_type.eq && queryResult.document_type.eq.result && queryResult.document_type.eq.expected !== disclosedDataPassport.documentType) {
1223
+ console.warn("Document type does not match the expected document type");
1224
+ isCorrect = false;
1225
+ queryResultErrors.document_type.eq = {
1226
+ expected: `${queryResult.document_type.eq.expected}`,
1227
+ received: `${disclosedDataPassport.documentType ?? disclosedDataIDCard.documentType}`,
1228
+ message: "Document type does not match the expected document type"
1229
+ };
1230
+ }
1231
+ if (queryResult.document_type.disclose?.result !== disclosedDataIDCard.documentType) {
1232
+ console.warn("Document type does not match the disclosed document type in query result");
1233
+ isCorrect = false;
1234
+ queryResultErrors.document_type.disclose = {
1235
+ expected: `${queryResult.document_type.disclose?.result}`,
1236
+ received: `${disclosedDataIDCard.documentType ?? disclosedDataPassport.documentType}`,
1237
+ message: "Document type does not match the disclosed document type in query result"
1238
+ };
1239
+ }
1240
+ }
1241
+ if (queryResult.birthdate) {
1242
+ const birthdatePassport = disclosedDataPassport.dateOfBirth;
1243
+ const birthdateIDCard = disclosedDataIDCard.dateOfBirth;
1244
+ if (queryResult.birthdate.eq && queryResult.birthdate.eq.result && queryResult.birthdate.eq.expected.getTime() !== birthdatePassport.getTime() && queryResult.birthdate.eq.expected.getTime() !== birthdateIDCard.getTime()) {
1245
+ console.warn("Birthdate does not match the expected birthdate");
1246
+ isCorrect = false;
1247
+ queryResultErrors.birthdate.eq = {
1248
+ expected: `${queryResult.birthdate.eq.expected.toISOString()}`,
1249
+ received: `${birthdatePassport?.toISOString() ?? birthdateIDCard?.toISOString()}`,
1250
+ message: "Birthdate does not match the expected birthdate"
1251
+ };
1252
+ }
1253
+ if (queryResult.birthdate.disclose && queryResult.birthdate.disclose.result.getTime() !== birthdatePassport.getTime() && queryResult.birthdate.disclose.result.getTime() !== birthdateIDCard.getTime()) {
1254
+ console.warn("Birthdate does not match the disclosed birthdate in query result");
1255
+ isCorrect = false;
1256
+ queryResultErrors.birthdate.disclose = {
1257
+ expected: `${queryResult.birthdate.disclose.result.toISOString()}`,
1258
+ received: `${birthdatePassport?.toISOString() ?? birthdateIDCard?.toISOString()}`,
1259
+ message: "Birthdate does not match the disclosed birthdate in query result"
1260
+ };
1261
+ }
1262
+ }
1263
+ if (queryResult.expiry_date) {
1264
+ const expiryDatePassport = disclosedDataPassport.dateOfExpiry;
1265
+ const expiryDateIDCard = disclosedDataIDCard.dateOfExpiry;
1266
+ if (queryResult.expiry_date.eq && queryResult.expiry_date.eq.result && queryResult.expiry_date.eq.expected.getTime() !== expiryDatePassport.getTime() && queryResult.expiry_date.eq.expected.getTime() !== expiryDateIDCard.getTime()) {
1267
+ console.warn("Expiry date does not match the expected expiry date");
1268
+ isCorrect = false;
1269
+ queryResultErrors.expiry_date.eq = {
1270
+ expected: `${queryResult.expiry_date.eq.expected.toISOString()}`,
1271
+ received: `${expiryDatePassport?.toISOString() ?? expiryDateIDCard?.toISOString()}`,
1272
+ message: "Expiry date does not match the expected expiry date"
1273
+ };
1274
+ }
1275
+ if (queryResult.expiry_date.disclose && queryResult.expiry_date.disclose.result.getTime() !== expiryDatePassport.getTime() && queryResult.expiry_date.disclose.result.getTime() !== expiryDateIDCard.getTime()) {
1276
+ console.warn("Expiry date does not match the disclosed expiry date in query result");
1277
+ isCorrect = false;
1278
+ queryResultErrors.expiry_date.disclose = {
1279
+ expected: `${queryResult.expiry_date.disclose.result.toISOString()}`,
1280
+ received: `${expiryDatePassport?.toISOString() ?? expiryDateIDCard?.toISOString()}`,
1281
+ message: "Expiry date does not match the disclosed expiry date in query result"
1282
+ };
1283
+ }
1284
+ }
1285
+ if (queryResult.nationality) {
1286
+ const nationalityPassport = disclosedDataPassport.nationality;
1287
+ const nationalityIDCard = disclosedDataIDCard.nationality;
1288
+ if (queryResult.nationality.eq && queryResult.nationality.eq.result && queryResult.nationality.eq.expected !== nationalityPassport && queryResult.nationality.eq.expected !== nationalityIDCard) {
1289
+ console.warn("Nationality does not match the expected nationality");
1290
+ isCorrect = false;
1291
+ queryResultErrors.nationality.eq = {
1292
+ expected: `${queryResult.nationality.eq.expected}`,
1293
+ received: `${nationalityPassport ?? nationalityIDCard}`,
1294
+ message: "Nationality does not match the expected nationality"
1295
+ };
1296
+ }
1297
+ if (queryResult.nationality.disclose && queryResult.nationality.disclose.result !== nationalityPassport && queryResult.nationality.disclose.result !== nationalityIDCard) {
1298
+ console.warn("Nationality does not match the disclosed nationality in query result");
1299
+ isCorrect = false;
1300
+ queryResultErrors.nationality.disclose = {
1301
+ expected: `${queryResult.nationality.disclose.result}`,
1302
+ received: `${nationalityPassport ?? nationalityIDCard}`,
1303
+ message: "Nationality does not match the disclosed nationality in query result"
1304
+ };
1305
+ }
1306
+ }
1307
+ if (queryResult.document_number) {
1308
+ const documentNumberPassport = disclosedDataPassport.documentNumber;
1309
+ const documentNumberIDCard = disclosedDataIDCard.documentNumber;
1310
+ if (queryResult.document_number.eq && queryResult.document_number.eq.result && queryResult.document_number.eq.expected !== documentNumberPassport && queryResult.document_number.eq.expected !== documentNumberIDCard) {
1311
+ console.warn("Document number does not match the expected document number");
1312
+ isCorrect = false;
1313
+ queryResultErrors.document_number.eq = {
1314
+ expected: `${queryResult.document_number.eq.expected}`,
1315
+ received: `${documentNumberPassport ?? documentNumberIDCard}`,
1316
+ message: "Document number does not match the expected document number"
1317
+ };
1318
+ }
1319
+ if (queryResult.document_number.disclose && queryResult.document_number.disclose.result !== documentNumberPassport && queryResult.document_number.disclose.result !== documentNumberIDCard) {
1320
+ console.warn("Document number does not match the disclosed document number in query result");
1321
+ isCorrect = false;
1322
+ queryResultErrors.document_number.disclose = {
1323
+ expected: `${queryResult.document_number.disclose.result}`,
1324
+ received: `${documentNumberPassport ?? documentNumberIDCard}`,
1325
+ message: "Document number does not match the disclosed document number in query result"
1326
+ };
1327
+ }
1328
+ }
1329
+ if (queryResult.gender) {
1330
+ const genderPassport = disclosedDataPassport.gender;
1331
+ const genderIDCard = disclosedDataIDCard.gender;
1332
+ if (queryResult.gender.eq && queryResult.gender.eq.result && queryResult.gender.eq.expected !== genderPassport && queryResult.gender.eq.expected !== genderIDCard) {
1333
+ console.warn("Gender does not match the expected gender");
1334
+ isCorrect = false;
1335
+ queryResultErrors.gender.eq = {
1336
+ expected: `${queryResult.gender.eq.expected}`,
1337
+ received: `${genderPassport ?? genderIDCard}`,
1338
+ message: "Gender does not match the expected gender"
1339
+ };
1340
+ }
1341
+ if (queryResult.gender.disclose && queryResult.gender.disclose.result !== genderPassport && queryResult.gender.disclose.result !== genderIDCard) {
1342
+ console.warn("Gender does not match the disclosed gender in query result");
1343
+ isCorrect = false;
1344
+ queryResultErrors.gender.disclose = {
1345
+ expected: `${queryResult.gender.disclose.result}`,
1346
+ received: `${genderPassport ?? genderIDCard}`,
1347
+ message: "Gender does not match the disclosed gender in query result"
1348
+ };
1349
+ }
1350
+ }
1351
+ if (queryResult.issuing_country) {
1352
+ const issuingCountryPassport = disclosedDataPassport.issuingCountry;
1353
+ const issuingCountryIDCard = disclosedDataIDCard.issuingCountry;
1354
+ if (queryResult.issuing_country.eq && queryResult.issuing_country.eq.result && queryResult.issuing_country.eq.expected !== issuingCountryPassport && queryResult.issuing_country.eq.expected !== issuingCountryIDCard) {
1355
+ console.warn("Issuing country does not match the expected issuing country");
1356
+ isCorrect = false;
1357
+ queryResultErrors.issuing_country.eq = {
1358
+ expected: `${queryResult.issuing_country.eq.expected}`,
1359
+ received: `${issuingCountryPassport ?? issuingCountryIDCard}`,
1360
+ message: "Issuing country does not match the expected issuing country"
1361
+ };
1362
+ }
1363
+ if (queryResult.issuing_country.disclose && queryResult.issuing_country.disclose.result !== issuingCountryPassport && queryResult.issuing_country.disclose.result !== issuingCountryIDCard) {
1364
+ console.warn("Issuing country does not match the disclosed issuing country in query result");
1365
+ isCorrect = false;
1366
+ queryResultErrors.issuing_country.disclose = {
1367
+ expected: `${queryResult.issuing_country.disclose.result}`,
1368
+ received: `${issuingCountryPassport ?? issuingCountryIDCard}`,
1369
+ message: "Issuing country does not match the disclosed issuing country in query result"
1370
+ };
1371
+ }
1372
+ }
1373
+ if (queryResult.fullname) {
1374
+ const fullnamePassport = disclosedDataPassport.name;
1375
+ const fullnameIDCard = disclosedDataIDCard.name;
1376
+ if (queryResult.fullname.eq && queryResult.fullname.eq.result && (0, import_utils.formatName)(queryResult.fullname.eq.expected).toLowerCase() !== fullnamePassport.toLowerCase() && (0, import_utils.formatName)(queryResult.fullname.eq.expected).toLowerCase() !== fullnameIDCard.toLowerCase()) {
1377
+ console.warn("Fullname does not match the expected fullname");
1378
+ isCorrect = false;
1379
+ queryResultErrors.fullname.eq = {
1380
+ expected: `${queryResult.fullname.eq.expected}`,
1381
+ received: `${fullnamePassport ?? fullnameIDCard}`,
1382
+ message: "Fullname does not match the expected fullname"
1383
+ };
1384
+ }
1385
+ if (queryResult.fullname.disclose && (0, import_utils.formatName)(queryResult.fullname.disclose.result).toLowerCase() !== fullnamePassport.toLowerCase() && (0, import_utils.formatName)(queryResult.fullname.disclose.result).toLowerCase() !== fullnameIDCard.toLowerCase()) {
1386
+ console.warn("Fullname does not match the disclosed fullname in query result");
1387
+ isCorrect = false;
1388
+ queryResultErrors.fullname.disclose = {
1389
+ expected: `${queryResult.fullname.disclose.result}`,
1390
+ received: `${fullnamePassport ?? fullnameIDCard}`,
1391
+ message: "Fullname does not match the disclosed fullname in query result"
1392
+ };
1393
+ }
1394
+ }
1395
+ if (queryResult.firstname) {
1396
+ const firstnamePassport = disclosedDataPassport.firstName && disclosedDataPassport.firstName.length > 0 ? disclosedDataPassport.firstName : disclosedDataPassport.name;
1397
+ const firstnameIDCard = disclosedDataIDCard.firstName && disclosedDataIDCard.firstName.length > 0 ? disclosedDataIDCard.firstName : disclosedDataIDCard.name;
1398
+ if (queryResult.firstname.eq && queryResult.firstname.eq.result && (0, import_utils.formatName)(queryResult.firstname.eq.expected).toLowerCase() !== firstnamePassport.toLowerCase() && (0, import_utils.formatName)(queryResult.firstname.eq.expected).toLowerCase() !== firstnameIDCard.toLowerCase()) {
1399
+ console.warn("Firstname does not match the expected firstname");
1400
+ isCorrect = false;
1401
+ queryResultErrors.firstname.eq = {
1402
+ expected: `${queryResult.firstname.eq.expected}`,
1403
+ received: `${firstnamePassport ?? firstnameIDCard}`,
1404
+ message: "Firstname does not match the expected firstname"
1405
+ };
1406
+ }
1407
+ if (queryResult.firstname.disclose && (0, import_utils.formatName)(queryResult.firstname.disclose.result).toLowerCase() !== firstnamePassport.toLowerCase() && (0, import_utils.formatName)(queryResult.firstname.disclose.result).toLowerCase() !== firstnameIDCard.toLowerCase()) {
1408
+ console.warn("Firstname does not match the disclosed firstname in query result");
1409
+ isCorrect = false;
1410
+ queryResultErrors.firstname.disclose = {
1411
+ expected: `${queryResult.firstname.disclose.result}`,
1412
+ received: `${firstnamePassport ?? firstnameIDCard}`,
1413
+ message: "Firstname does not match the disclosed firstname in query result"
1414
+ };
1415
+ }
1416
+ }
1417
+ if (queryResult.lastname) {
1418
+ const lastnamePassport = disclosedDataPassport.lastName && disclosedDataPassport.lastName.length > 0 ? disclosedDataPassport.lastName : disclosedDataPassport.name;
1419
+ const lastnameIDCard = disclosedDataIDCard.lastName && disclosedDataIDCard.lastName.length > 0 ? disclosedDataIDCard.lastName : disclosedDataIDCard.name;
1420
+ if (queryResult.lastname.eq && queryResult.lastname.eq.result && (0, import_utils.formatName)(queryResult.lastname.eq.expected).toLowerCase() !== lastnamePassport.toLowerCase() && (0, import_utils.formatName)(queryResult.lastname.eq.expected).toLowerCase() !== lastnameIDCard.toLowerCase()) {
1421
+ console.warn("Lastname does not match the expected lastname");
1422
+ isCorrect = false;
1423
+ queryResultErrors.lastname.eq = {
1424
+ expected: `${queryResult.lastname.eq.expected}`,
1425
+ received: `${lastnamePassport ?? lastnameIDCard}`,
1426
+ message: "Lastname does not match the expected lastname"
1427
+ };
1428
+ }
1429
+ if (queryResult.lastname.disclose && (0, import_utils.formatName)(queryResult.lastname.disclose.result).toLowerCase() !== lastnamePassport.toLowerCase() && (0, import_utils.formatName)(queryResult.lastname.disclose.result).toLowerCase() !== lastnameIDCard.toLowerCase()) {
1430
+ console.warn("Lastname does not match the disclosed lastname in query result");
1431
+ isCorrect = false;
1432
+ queryResultErrors.lastname.disclose = {
1433
+ expected: `${queryResult.lastname.disclose.result}`,
1434
+ received: `${lastnamePassport ?? lastnameIDCard}`,
1435
+ message: "Lastname does not match the disclosed lastname in query result"
1436
+ };
1437
+ }
1438
+ }
1439
+ return { isCorrect, queryResultErrors };
1440
+ }
1441
+ checkAgePublicInputs(proof, queryResult) {
1442
+ const queryResultErrors = {
1443
+ sig_check_dsc: {},
1444
+ sig_check_id_data: {},
1445
+ data_check_integrity: {},
1446
+ disclose: {},
1447
+ age: {},
1448
+ birthdate: {},
1449
+ expiry_date: {},
1450
+ document_type: {},
1451
+ issuing_country: {},
1452
+ gender: {},
1453
+ nationality: {},
1454
+ firstname: {},
1455
+ lastname: {},
1456
+ fullname: {},
1457
+ document_number: {},
1458
+ outer: {},
1459
+ bind: {}
1460
+ };
1461
+ let isCorrect = true;
1462
+ const currentTime = /* @__PURE__ */ new Date();
1463
+ const today = new Date(
1464
+ currentTime.getFullYear(),
1465
+ currentTime.getMonth(),
1466
+ currentTime.getDate(),
1467
+ 0,
1468
+ 0,
1469
+ 0,
1470
+ 0
1471
+ );
1472
+ const minAge = (0, import_utils.getMinAgeFromCommittedInputs)(
1473
+ proof.committedInputs?.compare_age
1474
+ );
1475
+ const maxAge = (0, import_utils.getMaxAgeFromCommittedInputs)(
1476
+ proof.committedInputs?.compare_age
1477
+ );
1478
+ if (queryResult.age) {
1479
+ if (queryResult.age.gte && queryResult.age.gte.result && minAge !== queryResult.age.gte.expected) {
1480
+ console.warn("Age is not greater than or equal to the expected age");
1481
+ isCorrect = false;
1482
+ queryResultErrors.age.gte = {
1483
+ expected: queryResult.age.gte.expected,
1484
+ received: minAge,
1485
+ message: "Age is not greater than or equal to the expected age"
1486
+ };
1487
+ }
1488
+ if (queryResult.age.lt && queryResult.age.lt.result && maxAge !== queryResult.age.lt.expected) {
1489
+ console.warn("Age is not less than the expected age");
1490
+ isCorrect = false;
1491
+ queryResultErrors.age.lt = {
1492
+ expected: queryResult.age.lt.expected,
1493
+ received: maxAge,
1494
+ message: "Age is not less than the expected age"
1495
+ };
1496
+ }
1497
+ if (queryResult.age.range) {
1498
+ if (queryResult.age.range.result && (minAge !== queryResult.age.range.expected[0] || maxAge !== queryResult.age.range.expected[1])) {
1499
+ console.warn("Age is not in the expected range");
1500
+ isCorrect = false;
1501
+ queryResultErrors.age.range = {
1502
+ expected: queryResult.age.range.expected,
1503
+ received: [minAge, maxAge],
1504
+ message: "Age is not in the expected range"
1505
+ };
1506
+ }
1507
+ }
1508
+ if (!queryResult.age.lt && !queryResult.age.range && maxAge != 0) {
1509
+ console.warn("Maximum age should be equal to 0");
1510
+ isCorrect = false;
1511
+ queryResultErrors.age.disclose = {
1512
+ expected: 0,
1513
+ received: maxAge,
1514
+ message: "Maximum age should be equal to 0"
1515
+ };
1516
+ }
1517
+ if (!queryResult.age.gte && !queryResult.age.range && minAge != 0) {
1518
+ console.warn("Minimum age should be equal to 0");
1519
+ isCorrect = false;
1520
+ queryResultErrors.age.disclose = {
1521
+ expected: 0,
1522
+ received: minAge,
1523
+ message: "Minimum age should be equal to 0"
1524
+ };
1525
+ }
1526
+ if (queryResult.age.disclose && (queryResult.age.disclose.result !== minAge || queryResult.age.disclose.result !== maxAge)) {
1527
+ console.warn("Age does not match the disclosed age in query result");
1528
+ isCorrect = false;
1529
+ queryResultErrors.age.disclose = {
1530
+ expected: `${minAge}`,
1531
+ received: `${queryResult.age.disclose.result}`,
1532
+ message: "Age does not match the disclosed age in query result"
1533
+ };
1534
+ }
1535
+ } else {
1536
+ console.warn("Age is not set in the query result");
1537
+ isCorrect = false;
1538
+ queryResultErrors.age.disclose = {
1539
+ message: "Age is not set in the query result"
1540
+ };
1541
+ }
1542
+ const currentDate = (0, import_utils.getCurrentDateFromCommittedInputs)(
1543
+ proof.committedInputs?.compare_age
1544
+ );
1545
+ if (currentDate.getTime() !== today.getTime() && currentDate.getTime() !== today.getTime() - 864e5) {
1546
+ console.warn("Current date in the proof is too old");
1547
+ isCorrect = false;
1548
+ queryResultErrors.age.disclose = {
1549
+ expected: `${today.toISOString()}`,
1550
+ received: `${currentDate.toISOString()}`,
1551
+ message: "Current date in the proof is too old"
1552
+ };
1553
+ }
1554
+ return { isCorrect, queryResultErrors };
1555
+ }
1556
+ checkBirthdatePublicInputs(proof, queryResult) {
1557
+ const queryResultErrors = {
1558
+ sig_check_dsc: {},
1559
+ sig_check_id_data: {},
1560
+ data_check_integrity: {},
1561
+ disclose: {},
1562
+ age: {},
1563
+ birthdate: {},
1564
+ expiry_date: {},
1565
+ document_type: {},
1566
+ issuing_country: {},
1567
+ gender: {},
1568
+ nationality: {},
1569
+ firstname: {},
1570
+ lastname: {},
1571
+ fullname: {},
1572
+ document_number: {},
1573
+ outer: {},
1574
+ bind: {}
1575
+ };
1576
+ let isCorrect = true;
1577
+ const currentTime = /* @__PURE__ */ new Date();
1578
+ const today = new Date(
1579
+ currentTime.getFullYear(),
1580
+ currentTime.getMonth(),
1581
+ currentTime.getDate(),
1582
+ 0,
1583
+ 0,
1584
+ 0
1585
+ );
1586
+ const minDate = (0, import_utils.getMinDateFromCommittedInputs)(
1587
+ proof.committedInputs?.compare_birthdate
1588
+ );
1589
+ const maxDate = (0, import_utils.getMaxDateFromCommittedInputs)(
1590
+ proof.committedInputs?.compare_birthdate
1591
+ );
1592
+ const currentDate = (0, import_utils.getCurrentDateFromCommittedInputs)(
1593
+ proof.committedInputs?.compare_birthdate
1594
+ );
1595
+ if (queryResult.birthdate) {
1596
+ if (queryResult.birthdate.gte && queryResult.birthdate.gte.result && minDate !== queryResult.birthdate.gte.expected) {
1597
+ console.warn("Birthdate is not greater than or equal to the expected birthdate");
1598
+ isCorrect = false;
1599
+ queryResultErrors.birthdate.gte = {
1600
+ expected: queryResult.birthdate.gte.expected,
1601
+ received: minDate,
1602
+ message: "Birthdate is not greater than or equal to the expected birthdate"
1603
+ };
1604
+ }
1605
+ if (queryResult.birthdate.lte && queryResult.birthdate.lte.result && maxDate !== queryResult.birthdate.lte.expected) {
1606
+ console.warn("Birthdate is not less than the expected birthdate");
1607
+ isCorrect = false;
1608
+ queryResultErrors.birthdate.lte = {
1609
+ expected: queryResult.birthdate.lte.expected,
1610
+ received: maxDate,
1611
+ message: "Birthdate is not less than the expected birthdate"
1612
+ };
1613
+ }
1614
+ if (queryResult.birthdate.range) {
1615
+ if (queryResult.birthdate.range.result && (minDate !== queryResult.birthdate.range.expected[0] || maxDate !== queryResult.birthdate.range.expected[1])) {
1616
+ console.warn("Birthdate is not in the expected range");
1617
+ isCorrect = false;
1618
+ queryResultErrors.birthdate.range = {
1619
+ expected: queryResult.birthdate.range.expected,
1620
+ received: [minDate, maxDate],
1621
+ message: "Birthdate is not in the expected range"
1622
+ };
1623
+ }
1624
+ }
1625
+ if (!queryResult.birthdate.lte && !queryResult.birthdate.range && maxDate.getTime() != DEFAULT_DATE_VALUE.getTime()) {
1626
+ console.warn("Maximum birthdate should be equal to default date value");
1627
+ isCorrect = false;
1628
+ queryResultErrors.birthdate.disclose = {
1629
+ expected: `${DEFAULT_DATE_VALUE.toISOString()}`,
1630
+ received: `${maxDate.toISOString()}`,
1631
+ message: "Maximum birthdate should be equal to default date value"
1632
+ };
1633
+ }
1634
+ if (!queryResult.birthdate.gte && !queryResult.birthdate.range && minDate.getTime() != DEFAULT_DATE_VALUE.getTime()) {
1635
+ console.warn("Minimum birthdate should be equal to default date value");
1636
+ isCorrect = false;
1637
+ queryResultErrors.birthdate.disclose = {
1638
+ expected: `${DEFAULT_DATE_VALUE.toISOString()}`,
1639
+ received: `${minDate.toISOString()}`,
1640
+ message: "Minimum birthdate should be equal to default date value"
1641
+ };
1642
+ }
1643
+ } else {
1644
+ console.warn("Birthdate is not set in the query result");
1645
+ isCorrect = false;
1646
+ queryResultErrors.birthdate.disclose = {
1647
+ message: "Birthdate is not set in the query result"
1648
+ };
1649
+ }
1650
+ if (currentDate.getTime() !== today.getTime() && currentDate.getTime() !== today.getTime() - 864e5) {
1651
+ console.warn("Current date in the proof is too old");
1652
+ isCorrect = false;
1653
+ queryResultErrors.age.disclose = {
1654
+ expected: `${today.toISOString()}`,
1655
+ received: `${currentDate.toISOString()}`,
1656
+ message: "Current date in the proof is too old"
1657
+ };
1658
+ }
1659
+ return { isCorrect, queryResultErrors };
1660
+ }
1661
+ checkExpiryDatePublicInputs(proof, queryResult) {
1662
+ const queryResultErrors = {
1663
+ sig_check_dsc: {},
1664
+ sig_check_id_data: {},
1665
+ data_check_integrity: {},
1666
+ disclose: {},
1667
+ age: {},
1668
+ birthdate: {},
1669
+ expiry_date: {},
1670
+ document_type: {},
1671
+ issuing_country: {},
1672
+ gender: {},
1673
+ nationality: {},
1674
+ firstname: {},
1675
+ lastname: {},
1676
+ fullname: {},
1677
+ document_number: {},
1678
+ outer: {},
1679
+ bind: {}
1680
+ };
1681
+ let isCorrect = true;
1682
+ const currentTime = /* @__PURE__ */ new Date();
1683
+ const today = new Date(
1684
+ currentTime.getFullYear(),
1685
+ currentTime.getMonth(),
1686
+ currentTime.getDate(),
1687
+ 0,
1688
+ 0,
1689
+ 0
1690
+ );
1691
+ const minDate = (0, import_utils.getMinDateFromCommittedInputs)(
1692
+ proof.committedInputs?.compare_expiry
1693
+ );
1694
+ const maxDate = (0, import_utils.getMaxDateFromCommittedInputs)(
1695
+ proof.committedInputs?.compare_expiry
1696
+ );
1697
+ const currentDate = (0, import_utils.getCurrentDateFromCommittedInputs)(
1698
+ proof.committedInputs?.compare_expiry
1699
+ );
1700
+ if (queryResult.expiry_date) {
1701
+ if (queryResult.expiry_date.gte && queryResult.expiry_date.gte.result && minDate !== queryResult.expiry_date.gte.expected) {
1702
+ console.warn("Expiry date is not greater than or equal to the expected expiry date");
1703
+ isCorrect = false;
1704
+ queryResultErrors.expiry_date.gte = {
1705
+ expected: queryResult.expiry_date.gte.expected,
1706
+ received: minDate,
1707
+ message: "Expiry date is not greater than or equal to the expected expiry date"
1708
+ };
1709
+ }
1710
+ if (queryResult.expiry_date.lte && queryResult.expiry_date.lte.result && maxDate !== queryResult.expiry_date.lte.expected) {
1711
+ console.warn("Expiry date is not less than the expected expiry date");
1712
+ isCorrect = false;
1713
+ queryResultErrors.expiry_date.lte = {
1714
+ expected: queryResult.expiry_date.lte.expected,
1715
+ received: maxDate,
1716
+ message: "Expiry date is not less than the expected expiry date"
1717
+ };
1718
+ }
1719
+ if (queryResult.expiry_date.range) {
1720
+ if (queryResult.expiry_date.range.result && (minDate !== queryResult.expiry_date.range.expected[0] || maxDate !== queryResult.expiry_date.range.expected[1])) {
1721
+ console.warn("Expiry date is not in the expected range");
1722
+ isCorrect = false;
1723
+ queryResultErrors.expiry_date.range = {
1724
+ expected: queryResult.expiry_date.range.expected,
1725
+ received: [minDate, maxDate],
1726
+ message: "Expiry date is not in the expected range"
1727
+ };
1728
+ }
1729
+ }
1730
+ if (!queryResult.expiry_date.lte && !queryResult.expiry_date.range && maxDate.getTime() != DEFAULT_DATE_VALUE.getTime()) {
1731
+ console.warn("Maximum expiry date should be equal to default date value");
1732
+ isCorrect = false;
1733
+ queryResultErrors.expiry_date.disclose = {
1734
+ expected: `${DEFAULT_DATE_VALUE.toISOString()}`,
1735
+ received: `${maxDate.toISOString()}`,
1736
+ message: "Maximum expiry date should be equal to default date value"
1737
+ };
1738
+ }
1739
+ if (!queryResult.expiry_date.gte && !queryResult.expiry_date.range && minDate.getTime() != DEFAULT_DATE_VALUE.getTime()) {
1740
+ console.warn("Minimum expiry date should be equal to default date value");
1741
+ isCorrect = false;
1742
+ queryResultErrors.expiry_date.disclose = {
1743
+ expected: `${DEFAULT_DATE_VALUE.toISOString()}`,
1744
+ received: `${minDate.toISOString()}`,
1745
+ message: "Minimum expiry date should be equal to default date value"
1746
+ };
1747
+ }
1748
+ } else {
1749
+ console.warn("Expiry date is not set in the query result");
1750
+ isCorrect = false;
1751
+ queryResultErrors.expiry_date.disclose = {
1752
+ message: "Expiry date is not set in the query result"
1753
+ };
1754
+ }
1755
+ if (currentDate.getTime() !== today.getTime() && currentDate.getTime() !== today.getTime() - 864e5) {
1756
+ console.warn("Current date in the proof is too old");
1757
+ isCorrect = false;
1758
+ queryResultErrors.age.disclose = {
1759
+ expected: `${today.toISOString()}`,
1760
+ received: `${currentDate.toISOString()}`,
1761
+ message: "Current date in the proof is too old"
1762
+ };
1763
+ }
1764
+ return { isCorrect, queryResultErrors };
1765
+ }
1766
+ checkNationalityExclusionPublicInputs(queryResult, countryList) {
1767
+ const queryResultErrors = {
1768
+ sig_check_dsc: {},
1769
+ sig_check_id_data: {},
1770
+ data_check_integrity: {},
1771
+ disclose: {},
1772
+ age: {},
1773
+ birthdate: {},
1774
+ expiry_date: {},
1775
+ document_type: {},
1776
+ issuing_country: {},
1777
+ gender: {},
1778
+ nationality: {},
1779
+ firstname: {},
1780
+ lastname: {},
1781
+ fullname: {},
1782
+ document_number: {},
1783
+ outer: {},
1784
+ bind: {}
1785
+ };
1786
+ let isCorrect = true;
1787
+ if (queryResult.nationality && queryResult.nationality.out && queryResult.nationality.out.result) {
1788
+ if (!queryResult.nationality.out.expected?.every((country) => countryList.includes(country))) {
1789
+ console.warn("Nationality exclusion list does not match the one from the query results");
1790
+ isCorrect = false;
1791
+ queryResultErrors.nationality.out = {
1792
+ expected: queryResult.nationality.out.expected,
1793
+ received: countryList,
1794
+ message: "Nationality exclusion list does not match the one from the query results"
1795
+ };
1796
+ }
1797
+ } else if (!queryResult.nationality || !queryResult.nationality.out) {
1798
+ console.warn("Nationality exclusion is not set in the query result");
1799
+ isCorrect = false;
1800
+ queryResultErrors.nationality.out = {
1801
+ message: "Nationality exclusion is not set in the query result"
1802
+ };
1803
+ }
1804
+ for (let i = 1; i < countryList.length; i++) {
1805
+ if (countryList[i] < countryList[i - 1]) {
1806
+ console.warn(
1807
+ "The nationality exclusion list has not been sorted, and thus the proof cannot be trusted"
1808
+ );
1809
+ isCorrect = false;
1810
+ queryResultErrors.nationality.out = {
1811
+ message: "The nationality exclusion list has not been sorted, and thus the proof cannot be trusted"
1812
+ };
1813
+ }
1814
+ }
1815
+ return { isCorrect, queryResultErrors };
1816
+ }
1817
+ checkIssuingCountryExclusionPublicInputs(queryResult, countryList) {
1818
+ const queryResultErrors = {
1819
+ sig_check_dsc: {},
1820
+ sig_check_id_data: {},
1821
+ data_check_integrity: {},
1822
+ disclose: {},
1823
+ age: {},
1824
+ birthdate: {},
1825
+ expiry_date: {},
1826
+ document_type: {},
1827
+ issuing_country: {},
1828
+ gender: {},
1829
+ nationality: {},
1830
+ firstname: {},
1831
+ lastname: {},
1832
+ fullname: {},
1833
+ document_number: {},
1834
+ outer: {},
1835
+ bind: {}
1836
+ };
1837
+ let isCorrect = true;
1838
+ if (queryResult.issuing_country && queryResult.issuing_country.out && queryResult.issuing_country.out.result) {
1839
+ if (!queryResult.issuing_country.out.expected?.every((country) => countryList.includes(country))) {
1840
+ console.warn("Issuing country exclusion list does not match the one from the query results");
1841
+ isCorrect = false;
1842
+ queryResultErrors.issuing_country.out = {
1843
+ expected: queryResult.issuing_country.out.expected,
1844
+ received: countryList,
1845
+ message: "Issuing country exclusion list does not match the one from the query results"
1846
+ };
1847
+ }
1848
+ } else if (!queryResult.issuing_country || !queryResult.issuing_country.out) {
1849
+ console.warn("Issuing country exclusion is not set in the query result");
1850
+ isCorrect = false;
1851
+ queryResultErrors.issuing_country.out = {
1852
+ message: "Issuing country exclusion is not set in the query result"
1853
+ };
1854
+ }
1855
+ for (let i = 1; i < countryList.length; i++) {
1856
+ if (countryList[i] < countryList[i - 1]) {
1857
+ console.warn(
1858
+ "The issuing country exclusion list has not been sorted, and thus the proof cannot be trusted"
1859
+ );
1860
+ isCorrect = false;
1861
+ queryResultErrors.issuing_country.out = {
1862
+ message: "The issuing country exclusion list has not been sorted, and thus the proof cannot be trusted"
1863
+ };
1864
+ }
1865
+ }
1866
+ return { isCorrect, queryResultErrors };
1867
+ }
1868
+ checkNationalityInclusionPublicInputs(queryResult, countryList) {
1869
+ const queryResultErrors = {
1870
+ sig_check_dsc: {},
1871
+ sig_check_id_data: {},
1872
+ data_check_integrity: {},
1873
+ disclose: {},
1874
+ age: {},
1875
+ birthdate: {},
1876
+ expiry_date: {},
1877
+ document_type: {},
1878
+ issuing_country: {},
1879
+ gender: {},
1880
+ nationality: {},
1881
+ firstname: {},
1882
+ lastname: {},
1883
+ fullname: {},
1884
+ document_number: {},
1885
+ outer: {},
1886
+ bind: {}
1887
+ };
1888
+ let isCorrect = true;
1889
+ if (queryResult.nationality && queryResult.nationality.in && queryResult.nationality.in.result) {
1890
+ if (!queryResult.nationality.in.expected?.every((country) => countryList.includes(country))) {
1891
+ console.warn("Nationality inclusion list does not match the one from the query results");
1892
+ isCorrect = false;
1893
+ queryResultErrors.nationality.in = {
1894
+ expected: queryResult.nationality.in.expected,
1895
+ received: countryList,
1896
+ message: "Nationality inclusion list does not match the one from the query results"
1897
+ };
1898
+ }
1899
+ } else if (!queryResult.nationality || !queryResult.nationality.in) {
1900
+ console.warn("Nationality inclusion is not set in the query result");
1901
+ isCorrect = false;
1902
+ queryResultErrors.nationality.in = {
1903
+ message: "Nationality inclusion is not set in the query result"
1904
+ };
1905
+ }
1906
+ return { isCorrect, queryResultErrors };
1907
+ }
1908
+ checkIssuingCountryInclusionPublicInputs(queryResult, countryList) {
1909
+ const queryResultErrors = {
1910
+ sig_check_dsc: {},
1911
+ sig_check_id_data: {},
1912
+ data_check_integrity: {},
1913
+ disclose: {},
1914
+ age: {},
1915
+ birthdate: {},
1916
+ expiry_date: {},
1917
+ document_type: {},
1918
+ issuing_country: {},
1919
+ gender: {},
1920
+ nationality: {},
1921
+ firstname: {},
1922
+ lastname: {},
1923
+ fullname: {},
1924
+ document_number: {},
1925
+ outer: {},
1926
+ bind: {}
1927
+ };
1928
+ let isCorrect = true;
1929
+ if (queryResult.issuing_country && queryResult.issuing_country.in && queryResult.issuing_country.in.result) {
1930
+ if (!queryResult.issuing_country.in.expected?.every((country) => countryList.includes(country))) {
1931
+ console.warn("Issuing country inclusion list does not match the one from the query results");
1932
+ isCorrect = false;
1933
+ queryResultErrors.issuing_country.in = {
1934
+ expected: queryResult.issuing_country.in.expected,
1935
+ received: countryList,
1936
+ message: "Issuing country inclusion list does not match the one from the query results"
1937
+ };
1938
+ }
1939
+ } else if (!queryResult.issuing_country || !queryResult.issuing_country.in) {
1940
+ console.warn("Issuing country inclusion is not set in the query result");
1941
+ isCorrect = false;
1942
+ queryResultErrors.issuing_country.in = {
1943
+ message: "Issuing country inclusion is not set in the query result"
1944
+ };
1945
+ }
1946
+ return { isCorrect, queryResultErrors };
1947
+ }
1948
+ checkScopeFromDisclosureProof(proofData, queryResultErrors, key, scope, chainId) {
1949
+ let isCorrect = true;
1950
+ if (this.domain && (0, import_utils.getServiceScopeHash)(this.domain, chainId) !== BigInt(proofData.publicInputs[1])) {
1951
+ console.warn("The proof comes from a different domain than the one expected");
1952
+ isCorrect = false;
1953
+ queryResultErrors[key].scope = {
1954
+ expected: `Scope: ${(0, import_utils.getServiceScopeHash)(this.domain, chainId).toString()}`,
1955
+ received: `Scope: ${BigInt(proofData.publicInputs[1]).toString()}`,
1956
+ message: "The proof comes from a different domain than the one expected"
1957
+ };
1958
+ }
1959
+ if (scope && (0, import_utils.getScopeHash)(scope) !== BigInt(proofData.publicInputs[2])) {
1960
+ console.warn("The proof uses a different scope than the one expected");
1961
+ isCorrect = false;
1962
+ queryResultErrors[key].scope = {
1963
+ expected: `Scope: ${(0, import_utils.getScopeHash)(scope).toString()}`,
1964
+ received: `Scope: ${BigInt(proofData.publicInputs[2]).toString()}`,
1965
+ message: "The proof uses a different scope than the one expected"
1966
+ };
1967
+ }
1968
+ return { isCorrect, queryResultErrors };
1969
+ }
1970
+ async checkCertificateRegistryRoot(root, queryResultErrors, outer) {
1971
+ let isCorrect = true;
1972
+ try {
1973
+ const registryClient = new import_registry.RegistryClient({ chainId: 11155111 });
1974
+ const isValid = await registryClient.isCertificateRootValid(root);
1975
+ if (!isValid) {
1976
+ console.warn("The ID was signed by an unrecognized root certificate");
1977
+ isCorrect = false;
1978
+ queryResultErrors[outer ? "outer" : "sig_check_dsc"].certificate = {
1979
+ expected: `A valid root from ZKPassport Registry`,
1980
+ received: `Got invalid certificate registry root: ${root}`,
1981
+ message: "The ID was signed by an unrecognized root certificate"
1982
+ };
1983
+ }
1984
+ } catch (error) {
1985
+ console.warn(error);
1986
+ console.warn("The ID was signed by an unrecognized root certificate");
1987
+ isCorrect = false;
1988
+ queryResultErrors[outer ? "outer" : "sig_check_dsc"].certificate = {
1989
+ expected: `A valid root from ZKPassport Registry`,
1990
+ received: `Got invalid certificate registry root: ${root}`,
1991
+ message: "The ID was signed by an unrecognized root certificate"
1992
+ };
1993
+ }
1994
+ return { isCorrect, queryResultErrors };
1995
+ }
1996
+ async checkCircuitRegistryRoot(root, queryResultErrors) {
1997
+ let isCorrect = true;
1998
+ try {
1999
+ const registryClient = new import_registry.RegistryClient({ chainId: 11155111 });
2000
+ const isValid = await registryClient.isCircuitRootValid(root);
2001
+ if (!isValid) {
2002
+ console.warn("The proof uses unrecognized circuits");
2003
+ isCorrect = false;
2004
+ queryResultErrors.outer.circuit = {
2005
+ expected: `A valid circuit from ZKPassport Registry`,
2006
+ received: `Got invalid circuit registry root: ${root}`,
2007
+ message: "The proof uses an unrecognized circuit"
2008
+ };
2009
+ }
2010
+ } catch (error) {
2011
+ console.warn(error);
2012
+ console.warn("The proof uses unrecognized circuits");
2013
+ isCorrect = false;
2014
+ queryResultErrors.outer.circuit = {
2015
+ expected: `A valid circuit from ZKPassport Registry`,
2016
+ received: `Got invalid circuit registry root: ${root}`,
2017
+ message: "The proof uses an unrecognized circuit"
2018
+ };
2019
+ }
2020
+ return { isCorrect, queryResultErrors };
2021
+ }
2022
+ checkBindPublicInputs(queryResult, boundData) {
2023
+ const queryResultErrors = {
2024
+ sig_check_dsc: {},
2025
+ sig_check_id_data: {},
2026
+ data_check_integrity: {},
2027
+ disclose: {},
2028
+ age: {},
2029
+ birthdate: {},
2030
+ expiry_date: {},
2031
+ document_type: {},
2032
+ issuing_country: {},
2033
+ gender: {},
2034
+ nationality: {},
2035
+ firstname: {},
2036
+ lastname: {},
2037
+ fullname: {},
2038
+ document_number: {},
2039
+ outer: {},
2040
+ bind: {}
2041
+ };
2042
+ let isCorrect = true;
2043
+ if (queryResult.bind) {
2044
+ if (queryResult.bind.user_address?.toLowerCase().replace("0x", "") !== boundData.user_address?.toLowerCase().replace("0x", "")) {
2045
+ console.warn("Bound user address does not match the one from the query results");
2046
+ isCorrect = false;
2047
+ queryResultErrors.bind.eq = {
2048
+ expected: queryResult.bind.user_address,
2049
+ received: boundData.user_address,
2050
+ message: "Bound user address does not match the one from the query results"
2051
+ };
2052
+ }
2053
+ if (queryResult.bind.custom_data?.trim().toLowerCase() !== boundData.custom_data?.trim().toLowerCase()) {
2054
+ console.warn("Bound custom data does not match the one from the query results");
2055
+ isCorrect = false;
2056
+ queryResultErrors.bind.eq = {
2057
+ expected: queryResult.bind.custom_data,
2058
+ received: boundData.custom_data,
2059
+ message: "Bound custom data does not match the one from the query results"
2060
+ };
2061
+ }
2062
+ }
2063
+ return { isCorrect, queryResultErrors };
2064
+ }
2065
+ async checkPublicInputs(proofs, queryResult, validity, scope, chainId) {
2066
+ let commitmentIn;
2067
+ let commitmentOut;
2068
+ let isCorrect = true;
2069
+ let uniqueIdentifier;
2070
+ const currentTime = /* @__PURE__ */ new Date();
2071
+ const today = new Date(
2072
+ currentTime.getFullYear(),
2073
+ currentTime.getMonth(),
2074
+ currentTime.getDate(),
2075
+ 0,
2076
+ 0,
2077
+ 0,
2078
+ 0
2079
+ );
2080
+ let queryResultErrors = {
2081
+ sig_check_dsc: {},
2082
+ sig_check_id_data: {},
2083
+ data_check_integrity: {},
2084
+ disclose: {},
2085
+ age: {},
2086
+ birthdate: {},
2087
+ expiry_date: {},
2088
+ document_type: {},
2089
+ issuing_country: {},
2090
+ gender: {},
2091
+ nationality: {},
2092
+ firstname: {},
2093
+ lastname: {},
2094
+ fullname: {},
2095
+ document_number: {},
2096
+ outer: {},
2097
+ bind: {}
2098
+ };
2099
+ const sortedProofs = proofs.sort((a, b) => {
2100
+ const proofOrder = [
2101
+ "sig_check_dsc",
2102
+ "sig_check_id_data",
2103
+ "data_check_integrity",
2104
+ "disclose_bytes",
2105
+ "compare_age",
2106
+ "compare_birthdate",
2107
+ "compare_expiry",
2108
+ "exclusion_check_nationality",
2109
+ "inclusion_check_nationality",
2110
+ "exclusion_check_issuing_country",
2111
+ "inclusion_check_issuing_country",
2112
+ "bind"
2113
+ ];
2114
+ const getIndex = (proof) => {
2115
+ const name = proof.name || "";
2116
+ return proofOrder.findIndex((p) => name.startsWith(p));
2117
+ };
2118
+ return getIndex(a) - getIndex(b);
2119
+ });
2120
+ for (const proof of sortedProofs) {
2121
+ const proofData = (0, import_utils.getProofData)(proof.proof, (0, import_utils.getNumberOfPublicInputs)(proof.name));
2122
+ if (proof.name?.startsWith("outer")) {
2123
+ const isForEVM = proof.name?.startsWith("outer_evm");
2124
+ const certificateRegistryRoot = (0, import_utils.getCertificateRegistryRootFromOuterProof)(proofData);
2125
+ const {
2126
+ isCorrect: isCorrectCertificateRegistryRoot,
2127
+ queryResultErrors: queryResultErrorsCertificateRegistryRoot
2128
+ } = await this.checkCertificateRegistryRoot(
2129
+ certificateRegistryRoot.toString(16),
2130
+ queryResultErrors,
2131
+ true
2132
+ );
2133
+ isCorrect = isCorrect && isCorrectCertificateRegistryRoot;
2134
+ queryResultErrors = {
2135
+ ...queryResultErrors,
2136
+ ...queryResultErrorsCertificateRegistryRoot
2137
+ };
2138
+ const circuitRegistryRoot = (0, import_utils.getCircuitRegistryRootFromOuterProof)(proofData);
2139
+ const {
2140
+ isCorrect: isCorrectCircuitRegistryRoot,
2141
+ queryResultErrors: queryResultErrorsCircuitRegistryRoot
2142
+ } = await this.checkCircuitRegistryRoot(circuitRegistryRoot.toString(16), queryResultErrors);
2143
+ isCorrect = isCorrect && isCorrectCircuitRegistryRoot;
2144
+ queryResultErrors = {
2145
+ ...queryResultErrors,
2146
+ ...queryResultErrorsCircuitRegistryRoot
2147
+ };
2148
+ const currentDate = (0, import_utils.getCurrentDateFromOuterProof)(proofData);
2149
+ const todayToCurrentDate = today.getTime() - currentDate.getTime();
2150
+ const differenceInDays = validity ?? 180;
2151
+ const expectedDifference = differenceInDays * 864e5;
2152
+ const actualDifference = today.getTime() - (today.getTime() - expectedDifference);
2153
+ if (todayToCurrentDate >= actualDifference) {
2154
+ console.warn(
2155
+ `The date used to check the validity of the ID is older than ${differenceInDays} days. You can ask the user to rescan their ID or ask them to disclose their expiry date`
2156
+ );
2157
+ isCorrect = false;
2158
+ queryResultErrors.outer.date = {
2159
+ expected: `Difference: ${differenceInDays} days`,
2160
+ received: `Difference: ${Math.round(todayToCurrentDate / 864e5)} days`,
2161
+ message: "The date used to check the validity of the ID is older than the validity period"
2162
+ };
2163
+ }
2164
+ const paramCommitments = (0, import_utils.getParamCommitmentsFromOuterProof)(proofData);
2165
+ const committedInputs = proof.committedInputs;
2166
+ const keysInCommittedInputs = Object.keys(committedInputs || {});
2167
+ if (keysInCommittedInputs.length !== paramCommitments.length) {
2168
+ console.warn("The proof does not verify all the requested conditions and information");
2169
+ isCorrect = false;
2170
+ queryResultErrors.outer.commitment = {
2171
+ expected: `Number of parameter commitments: ${paramCommitments.length}`,
2172
+ received: `Number of disclosure proofs provided: ${keysInCommittedInputs.length}`,
2173
+ message: "The proof does not verify all the requested conditions and information"
2174
+ };
2175
+ }
2176
+ if (this.domain && (0, import_utils.getServiceScopeHash)(this.domain, chainId) !== (0, import_utils.getScopeFromOuterProof)(proofData)) {
2177
+ console.warn("The proof comes from a different domain than the one expected");
2178
+ isCorrect = false;
2179
+ queryResultErrors.outer.scope = {
2180
+ expected: `Scope: ${(0, import_utils.getServiceScopeHash)(this.domain, chainId).toString()}`,
2181
+ received: `Scope: ${(0, import_utils.getScopeFromOuterProof)(proofData).toString()}`,
2182
+ message: "The proof comes from a different domain than the one expected"
2183
+ };
2184
+ }
2185
+ if (scope && (0, import_utils.getScopeHash)(scope) !== (0, import_utils.getSubscopeFromOuterProof)(proofData)) {
2186
+ console.warn("The proof uses a different scope than the one expected");
2187
+ isCorrect = false;
2188
+ queryResultErrors.outer.scope = {
2189
+ expected: `Scope: ${(0, import_utils.getScopeHash)(scope).toString()}`,
2190
+ received: `Scope: ${(0, import_utils.getSubscopeFromOuterProof)(proofData).toString()}`,
2191
+ message: "The proof uses a different scope than the one expected"
2192
+ };
2193
+ }
2194
+ if (!!committedInputs?.compare_age) {
2195
+ const ageCommittedInputs = committedInputs?.compare_age;
2196
+ const ageParameterCommitment = isForEVM ? await (0, import_utils.getAgeEVMParameterCommitment)(
2197
+ ageCommittedInputs.currentDate,
2198
+ ageCommittedInputs.minAge,
2199
+ ageCommittedInputs.maxAge
2200
+ ) : await (0, import_utils.getAgeParameterCommitment)(
2201
+ ageCommittedInputs.currentDate,
2202
+ ageCommittedInputs.minAge,
2203
+ ageCommittedInputs.maxAge
2204
+ );
2205
+ if (!paramCommitments.includes(ageParameterCommitment)) {
2206
+ console.warn("This proof does not verify the age");
2207
+ isCorrect = false;
2208
+ queryResultErrors.age.commitment = {
2209
+ expected: `Age parameter commitment: ${ageParameterCommitment.toString()}`,
2210
+ received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
2211
+ message: "This proof does not verify the age"
2212
+ };
2213
+ }
2214
+ const { isCorrect: isCorrectAge, queryResultErrors: queryResultErrorsAge } = this.checkAgePublicInputs(proof, queryResult);
2215
+ isCorrect = isCorrect && isCorrectAge;
2216
+ queryResultErrors = {
2217
+ ...queryResultErrors,
2218
+ ...queryResultErrorsAge
2219
+ };
2220
+ } else if (!!committedInputs?.compare_birthdate) {
2221
+ const birthdateCommittedInputs = committedInputs?.compare_birthdate;
2222
+ const birthdateParameterCommitment = isForEVM ? await (0, import_utils.getDateEVMParameterCommitment)(
2223
+ import_utils.ProofType.BIRTHDATE,
2224
+ birthdateCommittedInputs.currentDate,
2225
+ birthdateCommittedInputs.minDate,
2226
+ birthdateCommittedInputs.maxDate
2227
+ ) : await (0, import_utils.getDateParameterCommitment)(
2228
+ import_utils.ProofType.BIRTHDATE,
2229
+ birthdateCommittedInputs.currentDate,
2230
+ birthdateCommittedInputs.minDate,
2231
+ birthdateCommittedInputs.maxDate
2232
+ );
2233
+ if (!paramCommitments.includes(birthdateParameterCommitment)) {
2234
+ console.warn("This proof does not verify the birthdate");
2235
+ isCorrect = false;
2236
+ queryResultErrors.birthdate.commitment = {
2237
+ expected: `Birthdate parameter commitment: ${birthdateParameterCommitment.toString()}`,
2238
+ received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
2239
+ message: "This proof does not verify the birthdate"
2240
+ };
2241
+ }
2242
+ const { isCorrect: isCorrectBirthdate, queryResultErrors: queryResultErrorsBirthdate } = this.checkBirthdatePublicInputs(proof, queryResult);
2243
+ isCorrect = isCorrect && isCorrectBirthdate;
2244
+ queryResultErrors = {
2245
+ ...queryResultErrors,
2246
+ ...queryResultErrorsBirthdate
2247
+ };
2248
+ } else if (!!committedInputs?.compare_expiry) {
2249
+ const expiryCommittedInputs = committedInputs?.compare_expiry;
2250
+ const expiryParameterCommitment = isForEVM ? await (0, import_utils.getDateEVMParameterCommitment)(
2251
+ import_utils.ProofType.EXPIRY_DATE,
2252
+ expiryCommittedInputs.currentDate,
2253
+ expiryCommittedInputs.minDate,
2254
+ expiryCommittedInputs.maxDate
2255
+ ) : await (0, import_utils.getDateParameterCommitment)(
2256
+ import_utils.ProofType.EXPIRY_DATE,
2257
+ expiryCommittedInputs.currentDate,
2258
+ expiryCommittedInputs.minDate,
2259
+ expiryCommittedInputs.maxDate
2260
+ );
2261
+ if (!paramCommitments.includes(expiryParameterCommitment)) {
2262
+ console.warn("This proof does not verify the expiry date");
2263
+ isCorrect = false;
2264
+ queryResultErrors.expiry_date.commitment = {
2265
+ expected: `Expiry date parameter commitment: ${expiryParameterCommitment.toString()}`,
2266
+ received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
2267
+ message: "This proof does not verify the expiry date"
2268
+ };
2269
+ }
2270
+ const { isCorrect: isCorrectExpiryDate, queryResultErrors: queryResultErrorsExpiryDate } = this.checkExpiryDatePublicInputs(proof, queryResult);
2271
+ isCorrect = isCorrect && isCorrectExpiryDate;
2272
+ queryResultErrors = {
2273
+ ...queryResultErrors,
2274
+ ...queryResultErrorsExpiryDate
2275
+ };
2276
+ } else if (!!committedInputs?.disclose_bytes) {
2277
+ const discloseCommittedInputs = committedInputs?.disclose_bytes;
2278
+ const discloseParameterCommitment = isForEVM ? await (0, import_utils.getDiscloseEVMParameterCommitment)(
2279
+ discloseCommittedInputs.discloseMask,
2280
+ discloseCommittedInputs.disclosedBytes
2281
+ ) : await (0, import_utils.getDiscloseParameterCommitment)(
2282
+ discloseCommittedInputs.discloseMask,
2283
+ discloseCommittedInputs.disclosedBytes
2284
+ );
2285
+ if (!paramCommitments.includes(discloseParameterCommitment)) {
2286
+ console.warn("This proof does not verify any of the data disclosed");
2287
+ isCorrect = false;
2288
+ queryResultErrors.disclose.commitment = {
2289
+ expected: `Disclosure parameter commitment: ${discloseParameterCommitment.toString()}`,
2290
+ received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
2291
+ message: "This proof does not verify any of the data disclosed"
2292
+ };
2293
+ }
2294
+ const { isCorrect: isCorrectDisclose, queryResultErrors: queryResultErrorsDisclose } = this.checkDiscloseBytesPublicInputs(proof, queryResult);
2295
+ isCorrect = isCorrect && isCorrectDisclose;
2296
+ queryResultErrors = {
2297
+ ...queryResultErrors,
2298
+ ...queryResultErrorsDisclose
2299
+ };
2300
+ } else if (!!committedInputs?.inclusion_check_nationality) {
2301
+ const inclusionCheckNationalityCommittedInputs = committedInputs?.inclusion_check_nationality;
2302
+ const inclusionCheckNationalityParameterCommitment = isForEVM ? await (0, import_utils.getCountryEVMParameterCommitment)(
2303
+ import_utils.ProofType.NATIONALITY_INCLUSION,
2304
+ inclusionCheckNationalityCommittedInputs.countries
2305
+ ) : await (0, import_utils.getCountryParameterCommitment)(
2306
+ import_utils.ProofType.NATIONALITY_INCLUSION,
2307
+ inclusionCheckNationalityCommittedInputs.countries
2308
+ );
2309
+ if (!paramCommitments.includes(inclusionCheckNationalityParameterCommitment)) {
2310
+ console.warn("This proof does not verify the inclusion of the nationality");
2311
+ isCorrect = false;
2312
+ queryResultErrors.nationality.commitment = {
2313
+ expected: `Nationality parameter commitment: ${inclusionCheckNationalityParameterCommitment.toString()}`,
2314
+ received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
2315
+ message: "This proof does not verify the inclusion of the nationality"
2316
+ };
2317
+ }
2318
+ const countryList = inclusionCheckNationalityCommittedInputs.countries;
2319
+ const {
2320
+ isCorrect: isCorrectNationalityInclusion,
2321
+ queryResultErrors: queryResultErrorsNationalityInclusion
2322
+ } = this.checkNationalityInclusionPublicInputs(queryResult, countryList);
2323
+ isCorrect = isCorrect && isCorrectNationalityInclusion;
2324
+ queryResultErrors = {
2325
+ ...queryResultErrors,
2326
+ ...queryResultErrorsNationalityInclusion
2327
+ };
2328
+ } else if (!!committedInputs?.inclusion_check_issuing_country) {
2329
+ const inclusionCheckIssuingCountryCommittedInputs = committedInputs?.inclusion_check_issuing_country;
2330
+ const inclusionCheckIssuingCountryParameterCommitment = isForEVM ? await (0, import_utils.getCountryEVMParameterCommitment)(
2331
+ import_utils.ProofType.ISSUING_COUNTRY_INCLUSION,
2332
+ inclusionCheckIssuingCountryCommittedInputs.countries
2333
+ ) : await (0, import_utils.getCountryParameterCommitment)(
2334
+ import_utils.ProofType.ISSUING_COUNTRY_INCLUSION,
2335
+ inclusionCheckIssuingCountryCommittedInputs.countries
2336
+ );
2337
+ if (!paramCommitments.includes(inclusionCheckIssuingCountryParameterCommitment)) {
2338
+ console.warn("This proof does not verify the inclusion of the issuing country");
2339
+ isCorrect = false;
2340
+ queryResultErrors.issuing_country.commitment = {
2341
+ expected: `Issuing country parameter commitment: ${inclusionCheckIssuingCountryParameterCommitment.toString()}`,
2342
+ received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
2343
+ message: "This proof does not verify the inclusion of the issuing country"
2344
+ };
2345
+ }
2346
+ const countryList = inclusionCheckIssuingCountryCommittedInputs.countries;
2347
+ const {
2348
+ isCorrect: isCorrectIssuingCountryInclusion,
2349
+ queryResultErrors: queryResultErrorsIssuingCountryInclusion
2350
+ } = this.checkIssuingCountryInclusionPublicInputs(queryResult, countryList);
2351
+ isCorrect = isCorrect && isCorrectIssuingCountryInclusion;
2352
+ queryResultErrors = {
2353
+ ...queryResultErrors,
2354
+ ...queryResultErrorsIssuingCountryInclusion
2355
+ };
2356
+ } else if (!!committedInputs?.exclusion_check_nationality) {
2357
+ const exclusionCheckNationalityCommittedInputs = committedInputs?.exclusion_check_nationality;
2358
+ const exclusionCheckNationalityParameterCommitment = isForEVM ? await (0, import_utils.getCountryEVMParameterCommitment)(
2359
+ import_utils.ProofType.NATIONALITY_EXCLUSION,
2360
+ exclusionCheckNationalityCommittedInputs.countries
2361
+ ) : await (0, import_utils.getCountryParameterCommitment)(
2362
+ import_utils.ProofType.NATIONALITY_EXCLUSION,
2363
+ exclusionCheckNationalityCommittedInputs.countries
2364
+ );
2365
+ if (!paramCommitments.includes(exclusionCheckNationalityParameterCommitment)) {
2366
+ console.warn("This proof does not verify the exclusion of the nationality");
2367
+ isCorrect = false;
2368
+ queryResultErrors.nationality.commitment = {
2369
+ expected: `Nationality parameter commitment: ${exclusionCheckNationalityParameterCommitment.toString()}`,
2370
+ received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
2371
+ message: "This proof does not verify the exclusion of the nationality"
2372
+ };
2373
+ }
2374
+ const countryList = exclusionCheckNationalityCommittedInputs.countries;
2375
+ const {
2376
+ isCorrect: isCorrectNationalityExclusion,
2377
+ queryResultErrors: queryResultErrorsNationalityExclusion
2378
+ } = this.checkNationalityExclusionPublicInputs(queryResult, countryList);
2379
+ isCorrect = isCorrect && isCorrectNationalityExclusion;
2380
+ queryResultErrors = {
2381
+ ...queryResultErrors,
2382
+ ...queryResultErrorsNationalityExclusion
2383
+ };
2384
+ } else if (!!committedInputs?.exclusion_check_issuing_country) {
2385
+ const exclusionCheckIssuingCountryCommittedInputs = committedInputs?.exclusion_check_issuing_country;
2386
+ const exclusionCheckIssuingCountryParameterCommitment = isForEVM ? await (0, import_utils.getCountryEVMParameterCommitment)(
2387
+ import_utils.ProofType.ISSUING_COUNTRY_EXCLUSION,
2388
+ exclusionCheckIssuingCountryCommittedInputs.countries
2389
+ ) : await (0, import_utils.getCountryParameterCommitment)(
2390
+ import_utils.ProofType.ISSUING_COUNTRY_EXCLUSION,
2391
+ exclusionCheckIssuingCountryCommittedInputs.countries
2392
+ );
2393
+ if (!paramCommitments.includes(exclusionCheckIssuingCountryParameterCommitment)) {
2394
+ console.warn("This proof does not verify the exclusion of the issuing country");
2395
+ isCorrect = false;
2396
+ queryResultErrors.issuing_country.commitment = {
2397
+ expected: `Issuing country parameter commitment: ${exclusionCheckIssuingCountryParameterCommitment.toString()}`,
2398
+ received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
2399
+ message: "This proof does not verify the exclusion of the issuing country"
2400
+ };
2401
+ }
2402
+ const countryList = exclusionCheckIssuingCountryCommittedInputs.countries;
2403
+ const {
2404
+ isCorrect: isCorrectIssuingCountryExclusion,
2405
+ queryResultErrors: queryResultErrorsIssuingCountryExclusion
2406
+ } = this.checkIssuingCountryExclusionPublicInputs(queryResult, countryList);
2407
+ isCorrect = isCorrect && isCorrectIssuingCountryExclusion;
2408
+ queryResultErrors = {
2409
+ ...queryResultErrors,
2410
+ ...queryResultErrorsIssuingCountryExclusion
2411
+ };
2412
+ } else if (!!committedInputs?.bind) {
2413
+ const bindCommittedInputs = committedInputs?.bind;
2414
+ const bindParameterCommitment = isForEVM ? await (0, import_utils.getBindEVMParameterCommitment)((0, import_utils.formatBoundData)(bindCommittedInputs.data)) : await (0, import_utils.getBindParameterCommitment)((0, import_utils.formatBoundData)(bindCommittedInputs.data));
2415
+ if (!paramCommitments.includes(bindParameterCommitment)) {
2416
+ console.warn("This proof does not verify the bound data");
2417
+ isCorrect = false;
2418
+ queryResultErrors.bind.commitment = {
2419
+ expected: `Bind parameter commitment: ${bindParameterCommitment.toString()}`,
2420
+ received: `Parameter commitments included: ${paramCommitments.join(", ")}`,
2421
+ message: "This proof does not verify the bound data"
2422
+ };
2423
+ }
2424
+ const { isCorrect: isCorrectBind, queryResultErrors: queryResultErrorsBind } = this.checkBindPublicInputs(queryResult, bindCommittedInputs.data);
2425
+ isCorrect = isCorrect && isCorrectBind;
2426
+ queryResultErrors = {
2427
+ ...queryResultErrors,
2428
+ ...queryResultErrorsBind
2429
+ };
2430
+ }
2431
+ uniqueIdentifier = (0, import_utils.getNullifierFromOuterProof)(proofData).toString(10);
2432
+ } else if (proof.name?.startsWith("sig_check_dsc")) {
2433
+ commitmentOut = (0, import_utils.getCommitmentFromDSCProof)(proofData);
2434
+ const merkleRoot = (0, import_utils.getMerkleRootFromDSCProof)(proofData);
2435
+ const {
2436
+ isCorrect: isCorrectCertificateRegistryRoot,
2437
+ queryResultErrors: queryResultErrorsCertificateRegistryRoot
2438
+ } = await this.checkCertificateRegistryRoot(
2439
+ merkleRoot.toString(16),
2440
+ queryResultErrors,
2441
+ false
2442
+ );
2443
+ isCorrect = isCorrect && isCorrectCertificateRegistryRoot;
2444
+ queryResultErrors = {
2445
+ ...queryResultErrors,
2446
+ ...queryResultErrorsCertificateRegistryRoot
2447
+ };
2448
+ } else if (proof.name?.startsWith("sig_check_id_data")) {
2449
+ commitmentIn = (0, import_utils.getCommitmentInFromIDDataProof)(proofData);
2450
+ if (commitmentIn !== commitmentOut) {
2451
+ console.warn(
2452
+ "Failed to check the link between the certificate signature and ID signature"
2453
+ );
2454
+ isCorrect = false;
2455
+ queryResultErrors.sig_check_id_data.commitment = {
2456
+ expected: `Commitment: ${commitmentOut?.toString() || "undefined"}`,
2457
+ received: `Commitment: ${commitmentIn?.toString() || "undefined"}`,
2458
+ message: "Failed to check the link between the certificate signature and ID signature"
2459
+ };
2460
+ }
2461
+ commitmentOut = (0, import_utils.getCommitmentOutFromIDDataProof)(proofData);
2462
+ } else if (proof.name?.startsWith("data_check_integrity")) {
2463
+ commitmentIn = (0, import_utils.getCommitmentInFromIntegrityProof)(proofData);
2464
+ if (commitmentIn !== commitmentOut) {
2465
+ console.warn("Failed to check the link between the ID signature and the data signed");
2466
+ isCorrect = false;
2467
+ queryResultErrors.data_check_integrity.commitment = {
2468
+ expected: `Commitment: ${commitmentOut?.toString() || "undefined"}`,
2469
+ received: `Commitment: ${commitmentIn?.toString() || "undefined"}`,
2470
+ message: "Failed to check the link between the ID signature and the data signed"
2471
+ };
2472
+ }
2473
+ commitmentOut = (0, import_utils.getCommitmentOutFromIntegrityProof)(proofData);
2474
+ const currentDate = (0, import_utils.getCurrentDateFromIntegrityProof)(proofData);
2475
+ const todayToCurrentDate = today.getTime() - currentDate.getTime();
2476
+ const differenceInDays = validity ?? 180;
2477
+ const expectedDifference = differenceInDays * 864e5;
2478
+ const actualDifference = today.getTime() - (today.getTime() - expectedDifference);
2479
+ if (todayToCurrentDate >= actualDifference) {
2480
+ console.warn(
2481
+ `The date used to check the validity of the ID is older than ${differenceInDays} days. You can ask the user to rescan their ID or ask them to disclose their expiry date`
2482
+ );
2483
+ isCorrect = false;
2484
+ queryResultErrors.data_check_integrity.date = {
2485
+ expected: `Difference: ${differenceInDays} days`,
2486
+ received: `Difference: ${Math.round(todayToCurrentDate / 864e5)} days`,
2487
+ message: "The date used to check the validity of the ID is older than the validity period"
2488
+ };
2489
+ }
2490
+ } else if (proof.name === "disclose_bytes") {
2491
+ commitmentIn = (0, import_utils.getCommitmentInFromDisclosureProof)(proofData);
2492
+ if (commitmentIn !== commitmentOut) {
2493
+ console.warn(
2494
+ "Failed to check the link between the validity of the ID and the data to disclose"
2495
+ );
2496
+ isCorrect = false;
2497
+ queryResultErrors.disclose.commitment = {
2498
+ expected: `Commitment: ${commitmentOut?.toString() || "undefined"}`,
2499
+ received: `Commitment: ${commitmentIn?.toString() || "undefined"}`,
2500
+ message: "Failed to check the link between the validity of the ID and the data to disclose"
2501
+ };
2502
+ }
2503
+ const paramCommitment = (0, import_utils.getParameterCommitmentFromDisclosureProof)(proofData);
2504
+ const calculatedParamCommitment = await (0, import_utils.getDiscloseParameterCommitment)(
2505
+ (proof.committedInputs?.disclose_bytes).discloseMask,
2506
+ (proof.committedInputs?.disclose_bytes).disclosedBytes
2507
+ );
2508
+ if (paramCommitment !== calculatedParamCommitment) {
2509
+ console.warn("The disclosed data does not match the data committed by the proof");
2510
+ isCorrect = false;
2511
+ queryResultErrors.disclose.commitment = {
2512
+ expected: `Commitment: ${calculatedParamCommitment}`,
2513
+ received: `Commitment: ${paramCommitment}`,
2514
+ message: "The disclosed data does not match the data committed by the proof"
2515
+ };
2516
+ }
2517
+ const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "disclose", scope);
2518
+ isCorrect = isCorrect && isCorrectScope;
2519
+ queryResultErrors = {
2520
+ ...queryResultErrors,
2521
+ ...queryResultErrorsScope
2522
+ };
2523
+ const { isCorrect: isCorrectDisclose, queryResultErrors: queryResultErrorsDisclose } = this.checkDiscloseBytesPublicInputs(proof, queryResult);
2524
+ isCorrect = isCorrect && isCorrectDisclose && isCorrectScope;
2525
+ queryResultErrors = {
2526
+ ...queryResultErrors,
2527
+ ...queryResultErrorsDisclose,
2528
+ ...queryResultErrorsScope
2529
+ };
2530
+ uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
2531
+ } else if (proof.name === "compare_age") {
2532
+ commitmentIn = (0, import_utils.getCommitmentInFromDisclosureProof)(proofData);
2533
+ if (commitmentIn !== commitmentOut) {
2534
+ console.warn(
2535
+ "Failed to check the link between the validity of the ID and the age derived from it"
2536
+ );
2537
+ isCorrect = false;
2538
+ queryResultErrors.age.commitment = {
2539
+ expected: `Commitment: ${commitmentOut}`,
2540
+ received: `Commitment: ${commitmentIn}`,
2541
+ message: "Failed to check the link between the validity of the ID and the age derived from it"
2542
+ };
2543
+ }
2544
+ const paramCommitment = (0, import_utils.getParameterCommitmentFromDisclosureProof)(proofData);
2545
+ const committedInputs = proof.committedInputs?.compare_age;
2546
+ const calculatedParamCommitment = await (0, import_utils.getAgeParameterCommitment)(
2547
+ committedInputs.currentDate,
2548
+ committedInputs.minAge,
2549
+ committedInputs.maxAge
2550
+ );
2551
+ if (paramCommitment !== calculatedParamCommitment) {
2552
+ console.warn(
2553
+ "The conditions for the age check do not match the conditions checked by the proof"
2554
+ );
2555
+ isCorrect = false;
2556
+ queryResultErrors.age.commitment = {
2557
+ expected: `Commitment: ${calculatedParamCommitment}`,
2558
+ received: `Commitment: ${paramCommitment}`,
2559
+ message: "The conditions for the age check do not match the conditions checked by the proof"
2560
+ };
2561
+ }
2562
+ const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "age", scope);
2563
+ const { isCorrect: isCorrectAge, queryResultErrors: queryResultErrorsAge } = this.checkAgePublicInputs(proof, queryResult);
2564
+ isCorrect = isCorrect && isCorrectAge && isCorrectScope;
2565
+ queryResultErrors = {
2566
+ ...queryResultErrors,
2567
+ ...queryResultErrorsAge,
2568
+ ...queryResultErrorsScope
2569
+ };
2570
+ uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
2571
+ } else if (proof.name === "compare_birthdate") {
2572
+ commitmentIn = (0, import_utils.getCommitmentInFromDisclosureProof)(proofData);
2573
+ if (commitmentIn !== commitmentOut) {
2574
+ console.warn(
2575
+ "Failed to check the link between the validity of the ID and the birthdate derived from it"
2576
+ );
2577
+ isCorrect = false;
2578
+ queryResultErrors.birthdate.commitment = {
2579
+ expected: `Commitment: ${commitmentOut}`,
2580
+ received: `Commitment: ${commitmentIn}`,
2581
+ message: "Failed to check the link between the validity of the ID and the birthdate derived from it"
2582
+ };
2583
+ }
2584
+ const paramCommitment = (0, import_utils.getParameterCommitmentFromDisclosureProof)(proofData);
2585
+ const committedInputs = proof.committedInputs?.compare_birthdate;
2586
+ const calculatedParamCommitment = await (0, import_utils.getDateParameterCommitment)(
2587
+ import_utils.ProofType.BIRTHDATE,
2588
+ committedInputs.currentDate,
2589
+ committedInputs.minDate,
2590
+ committedInputs.maxDate
2591
+ );
2592
+ if (paramCommitment !== calculatedParamCommitment) {
2593
+ console.warn(
2594
+ "The conditions for the birthdate check do not match the conditions checked by the proof"
2595
+ );
2596
+ isCorrect = false;
2597
+ queryResultErrors.birthdate.commitment = {
2598
+ expected: `Commitment: ${calculatedParamCommitment}`,
2599
+ received: `Commitment: ${paramCommitment}`,
2600
+ message: "The conditions for the birthdate check do not match the conditions checked by the proof"
2601
+ };
2602
+ }
2603
+ const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "birthdate", scope);
2604
+ const { isCorrect: isCorrectBirthdate, queryResultErrors: queryResultErrorsBirthdate } = this.checkBirthdatePublicInputs(proof, queryResult);
2605
+ isCorrect = isCorrect && isCorrectBirthdate && isCorrectScope;
2606
+ queryResultErrors = {
2607
+ ...queryResultErrors,
2608
+ ...queryResultErrorsBirthdate,
2609
+ ...queryResultErrorsScope
2610
+ };
2611
+ uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
2612
+ } else if (proof.name === "compare_expiry") {
2613
+ commitmentIn = (0, import_utils.getCommitmentInFromDisclosureProof)(proofData);
2614
+ if (commitmentIn !== commitmentOut) {
2615
+ console.warn(
2616
+ "Failed to check the link between the validity of the ID and its expiry date"
2617
+ );
2618
+ isCorrect = false;
2619
+ queryResultErrors.expiry_date.commitment = {
2620
+ expected: `Commitment: ${commitmentOut}`,
2621
+ received: `Commitment: ${commitmentIn}`,
2622
+ message: "Failed to check the link between the validity of the ID and its expiry date"
2623
+ };
2624
+ }
2625
+ const paramCommitment = (0, import_utils.getParameterCommitmentFromDisclosureProof)(proofData);
2626
+ const committedInputs = proof.committedInputs?.compare_expiry;
2627
+ const calculatedParamCommitment = await (0, import_utils.getDateParameterCommitment)(
2628
+ import_utils.ProofType.EXPIRY_DATE,
2629
+ committedInputs.currentDate,
2630
+ committedInputs.minDate,
2631
+ committedInputs.maxDate
2632
+ );
2633
+ if (paramCommitment !== calculatedParamCommitment) {
2634
+ console.warn(
2635
+ "The conditions for the expiry date check do not match the conditions checked by the proof"
2636
+ );
2637
+ isCorrect = false;
2638
+ queryResultErrors.expiry_date.commitment = {
2639
+ expected: `Commitment: ${calculatedParamCommitment}`,
2640
+ received: `Commitment: ${paramCommitment}`,
2641
+ message: "The conditions for the expiry date check do not match the conditions checked by the proof"
2642
+ };
2643
+ }
2644
+ const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "expiry_date", scope);
2645
+ const { isCorrect: isCorrectExpiryDate, queryResultErrors: queryResultErrorsExpiryDate } = this.checkExpiryDatePublicInputs(proof, queryResult);
2646
+ isCorrect = isCorrect && isCorrectExpiryDate && isCorrectScope;
2647
+ queryResultErrors = {
2648
+ ...queryResultErrors,
2649
+ ...queryResultErrorsExpiryDate,
2650
+ ...queryResultErrorsScope
2651
+ };
2652
+ uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
2653
+ } else if (proof.name === "exclusion_check_nationality") {
2654
+ commitmentIn = (0, import_utils.getCommitmentInFromDisclosureProof)(proofData);
2655
+ if (commitmentIn !== commitmentOut) {
2656
+ console.warn(
2657
+ "Failed to check the link between the validity of the ID and the nationality exclusion check"
2658
+ );
2659
+ isCorrect = false;
2660
+ queryResultErrors.nationality.commitment = {
2661
+ expected: `Commitment: ${commitmentOut}`,
2662
+ received: `Commitment: ${commitmentIn}`,
2663
+ message: "Failed to check the link between the validity of the ID and the nationality exclusion check"
2664
+ };
2665
+ }
2666
+ const countryList = (proof.committedInputs?.exclusion_check_nationality).countries;
2667
+ const paramCommittment = (0, import_utils.getParameterCommitmentFromDisclosureProof)(proofData);
2668
+ const calculatedParamCommitment = await (0, import_utils.getCountryParameterCommitment)(
2669
+ import_utils.ProofType.NATIONALITY_EXCLUSION,
2670
+ countryList,
2671
+ true
2672
+ );
2673
+ if (paramCommittment !== calculatedParamCommitment) {
2674
+ console.warn(
2675
+ "The committed country list for the exclusion check does not match the one from the proof"
2676
+ );
2677
+ isCorrect = false;
2678
+ queryResultErrors.nationality.commitment = {
2679
+ expected: `Commitment: ${calculatedParamCommitment}`,
2680
+ received: `Commitment: ${paramCommittment}`,
2681
+ message: "The committed country list for the exclusion check does not match the one from the proof"
2682
+ };
2683
+ }
2684
+ const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "nationality", scope);
2685
+ const {
2686
+ isCorrect: isCorrectNationalityExclusion,
2687
+ queryResultErrors: queryResultErrorsNationalityExclusion
2688
+ } = this.checkNationalityExclusionPublicInputs(queryResult, countryList);
2689
+ isCorrect = isCorrect && isCorrectNationalityExclusion && isCorrectScope;
2690
+ queryResultErrors = {
2691
+ ...queryResultErrors,
2692
+ ...queryResultErrorsNationalityExclusion,
2693
+ ...queryResultErrorsScope
2694
+ };
2695
+ uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
2696
+ } else if (proof.name === "exclusion_check_issuing_country") {
2697
+ commitmentIn = (0, import_utils.getCommitmentInFromDisclosureProof)(proofData);
2698
+ if (commitmentIn !== commitmentOut) {
2699
+ console.warn(
2700
+ "Failed to check the link between the validity of the ID and the issuing country exclusion check"
2701
+ );
2702
+ isCorrect = false;
2703
+ queryResultErrors.nationality.commitment = {
2704
+ expected: `Commitment: ${commitmentOut}`,
2705
+ received: `Commitment: ${commitmentIn}`,
2706
+ message: "Failed to check the link between the validity of the ID and the issuing country exclusion check"
2707
+ };
2708
+ }
2709
+ const countryList = (proof.committedInputs?.exclusion_check_issuing_country).countries;
2710
+ const paramCommittment = (0, import_utils.getParameterCommitmentFromDisclosureProof)(proofData);
2711
+ const calculatedParamCommitment = await (0, import_utils.getCountryParameterCommitment)(
2712
+ import_utils.ProofType.ISSUING_COUNTRY_EXCLUSION,
2713
+ countryList,
2714
+ true
2715
+ );
2716
+ if (paramCommittment !== calculatedParamCommitment) {
2717
+ console.warn(
2718
+ "The committed country list for the issuing country exclusion check does not match the one from the proof"
2719
+ );
2720
+ isCorrect = false;
2721
+ queryResultErrors.issuing_country.commitment = {
2722
+ expected: `Commitment: ${calculatedParamCommitment}`,
2723
+ received: `Commitment: ${paramCommittment}`,
2724
+ message: "The committed country list for the issuing country exclusion check does not match the one from the proof"
2725
+ };
2726
+ }
2727
+ const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "nationality", scope);
2728
+ const {
2729
+ isCorrect: isCorrectIssuingCountryExclusion,
2730
+ queryResultErrors: queryResultErrorsIssuingCountryExclusion
2731
+ } = this.checkIssuingCountryExclusionPublicInputs(queryResult, countryList);
2732
+ isCorrect = isCorrect && isCorrectIssuingCountryExclusion && isCorrectScope;
2733
+ queryResultErrors = {
2734
+ ...queryResultErrors,
2735
+ ...queryResultErrorsIssuingCountryExclusion,
2736
+ ...queryResultErrorsScope
2737
+ };
2738
+ uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
2739
+ } else if (proof.name === "inclusion_check_nationality") {
2740
+ commitmentIn = (0, import_utils.getCommitmentInFromDisclosureProof)(proofData);
2741
+ if (commitmentIn !== commitmentOut) {
2742
+ console.warn(
2743
+ "Failed to check the link between the validity of the ID and the nationality inclusion check"
2744
+ );
2745
+ isCorrect = false;
2746
+ queryResultErrors.nationality.commitment = {
2747
+ expected: `Commitment: ${commitmentOut}`,
2748
+ received: `Commitment: ${commitmentIn}`,
2749
+ message: "Failed to check the link between the validity of the ID and the nationality inclusion check"
2750
+ };
2751
+ }
2752
+ const countryList = (proof.committedInputs?.inclusion_check_nationality).countries;
2753
+ const paramCommittment = (0, import_utils.getParameterCommitmentFromDisclosureProof)(proofData);
2754
+ const calculatedParamCommitment = await (0, import_utils.getCountryParameterCommitment)(
2755
+ import_utils.ProofType.NATIONALITY_INCLUSION,
2756
+ countryList,
2757
+ false
2758
+ );
2759
+ if (paramCommittment !== calculatedParamCommitment) {
2760
+ console.warn(
2761
+ "The committed country list for the nationality inclusion check does not match the one from the proof"
2762
+ );
2763
+ isCorrect = false;
2764
+ queryResultErrors.nationality.commitment = {
2765
+ expected: `Commitment: ${calculatedParamCommitment}`,
2766
+ received: `Commitment: ${paramCommittment}`,
2767
+ message: "The committed country list for the nationality inclusion check does not match the one from the proof"
2768
+ };
2769
+ }
2770
+ const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "nationality", scope);
2771
+ const {
2772
+ isCorrect: isCorrectNationalityInclusion,
2773
+ queryResultErrors: queryResultErrorsNationalityInclusion
2774
+ } = this.checkNationalityInclusionPublicInputs(queryResult, countryList);
2775
+ isCorrect = isCorrect && isCorrectNationalityInclusion && isCorrectScope;
2776
+ queryResultErrors = {
2777
+ ...queryResultErrors,
2778
+ ...queryResultErrorsNationalityInclusion,
2779
+ ...queryResultErrorsScope
2780
+ };
2781
+ uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
2782
+ } else if (proof.name === "inclusion_check_issuing_country") {
2783
+ commitmentIn = (0, import_utils.getCommitmentInFromDisclosureProof)(proofData);
2784
+ if (commitmentIn !== commitmentOut) {
2785
+ console.warn(
2786
+ "Failed to check the link between the validity of the ID and the issuing country inclusion check"
2787
+ );
2788
+ isCorrect = false;
2789
+ queryResultErrors.nationality.commitment = {
2790
+ expected: `Commitment: ${commitmentOut}`,
2791
+ received: `Commitment: ${commitmentIn}`,
2792
+ message: "Failed to check the link between the validity of the ID and the issuing country inclusion check"
2793
+ };
2794
+ }
2795
+ const countryList = (proof.committedInputs?.inclusion_check_issuing_country).countries;
2796
+ const paramCommittment = (0, import_utils.getParameterCommitmentFromDisclosureProof)(proofData);
2797
+ const calculatedParamCommitment = await (0, import_utils.getCountryParameterCommitment)(
2798
+ import_utils.ProofType.ISSUING_COUNTRY_INCLUSION,
2799
+ countryList,
2800
+ false
2801
+ );
2802
+ if (paramCommittment !== calculatedParamCommitment) {
2803
+ console.warn(
2804
+ "The committed country list for the issuing country inclusion check does not match the one from the proof"
2805
+ );
2806
+ isCorrect = false;
2807
+ queryResultErrors.issuing_country.commitment = {
2808
+ expected: `Commitment: ${calculatedParamCommitment}`,
2809
+ received: `Commitment: ${paramCommittment}`,
2810
+ message: "The committed country list for the issuing country inclusion check does not match the one from the proof"
2811
+ };
2812
+ }
2813
+ const { isCorrect: isCorrectScope, queryResultErrors: queryResultErrorsScope } = this.checkScopeFromDisclosureProof(proofData, queryResultErrors, "nationality", scope);
2814
+ const {
2815
+ isCorrect: isCorrectIssuingCountryInclusion,
2816
+ queryResultErrors: queryResultErrorsIssuingCountryInclusion
2817
+ } = this.checkIssuingCountryInclusionPublicInputs(queryResult, countryList);
2818
+ isCorrect = isCorrect && isCorrectIssuingCountryInclusion && isCorrectScope;
2819
+ queryResultErrors = {
2820
+ ...queryResultErrors,
2821
+ ...queryResultErrorsIssuingCountryInclusion,
2822
+ ...queryResultErrorsScope
2823
+ };
2824
+ uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
2825
+ } else if (proof.name === "bind") {
2826
+ const bindCommittedInputs = proof.committedInputs?.bind;
2827
+ const paramCommittment = (0, import_utils.getParameterCommitmentFromDisclosureProof)(proofData);
2828
+ const calculatedParamCommitment = await (0, import_utils.getBindParameterCommitment)(
2829
+ (0, import_utils.formatBoundData)(bindCommittedInputs.data)
2830
+ );
2831
+ if (paramCommittment !== calculatedParamCommitment) {
2832
+ console.warn("The bound data does not match the one from the proof");
2833
+ isCorrect = false;
2834
+ queryResultErrors.bind.commitment = {
2835
+ expected: `Commitment: ${calculatedParamCommitment}`,
2836
+ received: `Commitment: ${paramCommittment}`,
2837
+ message: "The bound data does not match the one from the proof"
2838
+ };
2839
+ }
2840
+ const { isCorrect: isCorrectBind, queryResultErrors: queryResultErrorsBind } = this.checkBindPublicInputs(queryResult, bindCommittedInputs.data);
2841
+ isCorrect = isCorrect && isCorrectBind;
2842
+ queryResultErrors = {
2843
+ ...queryResultErrors,
2844
+ ...queryResultErrorsBind
2845
+ };
2846
+ uniqueIdentifier = (0, import_utils.getNullifierFromDisclosureProof)(proofData).toString(10);
2847
+ }
2848
+ }
2849
+ return { isCorrect, uniqueIdentifier, queryResultErrors };
2850
+ }
2851
+ /**
2852
+ * @notice Verify the proofs received from the mobile app.
2853
+ * @param proofs The proofs to verify.
2854
+ * @param queryResult The query result to verify against
2855
+ * @param validity How many days ago should have the ID been last scanned by the user?
2856
+ * @param scope Scope this request to a specific use case
2857
+ * @param evmChain The EVM chain to use for the verification (if using the proof onchain)
2858
+ * @param devMode Whether to enable dev mode. This will allow you to verify mock proofs (i.e. from ZKR)
2859
+ * @param writingDirectory The directory (e.g. `./tmp`) where the necessary temporary artifacts for verification are written to.
2860
+ * It should only be needed when running the `verify` function on a server with restricted write access (e.g. Vercel)
2861
+ * @returns An object containing the unique identifier associated to the user
2862
+ * and a boolean indicating whether the proofs were successfully verified.
2863
+ */
2864
+ async verify({
2865
+ proofs,
2866
+ queryResult,
2867
+ validity,
2868
+ scope,
2869
+ evmChain,
2870
+ devMode = false,
2871
+ writingDirectory
2872
+ }) {
2873
+ if (!proofs || proofs.length === 0) {
2874
+ return {
2875
+ uniqueIdentifier: void 0,
2876
+ verified: false
2877
+ };
2878
+ }
2879
+ const formattedResult = queryResult;
2880
+ if (formattedResult.birthdate && formattedResult.birthdate.disclose) {
2881
+ formattedResult.birthdate.disclose.result = new Date(
2882
+ formattedResult.birthdate.disclose.result
2883
+ );
2884
+ }
2885
+ if (formattedResult.expiry_date && formattedResult.expiry_date.disclose) {
2886
+ formattedResult.expiry_date.disclose.result = new Date(
2887
+ formattedResult.expiry_date.disclose.result
2888
+ );
2889
+ }
2890
+ const { BarretenbergVerifier } = await import("@aztec/bb.js");
2891
+ if (typeof window === "undefined" && !writingDirectory) {
2892
+ writingDirectory = "/tmp";
2893
+ }
2894
+ const verifier = new BarretenbergVerifier({
2895
+ crsPath: writingDirectory ? writingDirectory + "/.bb-crs" : void 0
2896
+ });
2897
+ let verified = true;
2898
+ let uniqueIdentifier;
2899
+ let queryResultErrors;
2900
+ const chainId = evmChain ? getChainIdFromEVMChain(evmChain) : void 0;
2901
+ const {
2902
+ isCorrect,
2903
+ uniqueIdentifier: uniqueIdentifierFromPublicInputs,
2904
+ queryResultErrors: queryResultErrorsFromPublicInputs
2905
+ } = await this.checkPublicInputs(proofs, formattedResult, validity, scope, chainId);
2906
+ uniqueIdentifier = uniqueIdentifierFromPublicInputs;
2907
+ verified = isCorrect;
2908
+ queryResultErrors = isCorrect ? void 0 : queryResultErrorsFromPublicInputs;
2909
+ if (uniqueIdentifier && (BigInt(uniqueIdentifier) === BigInt(1) || BigInt(uniqueIdentifier) === BigInt(0)) && !devMode) {
2910
+ verified = false;
2911
+ console.warn(
2912
+ "You are trying to verify a mock proof. This is only allowed in dev mode. To enable dev mode, set the `devMode` parameter to `true` in the request function parameters."
2913
+ );
2914
+ }
2915
+ if (verified) {
2916
+ const registryClient = new import_registry.RegistryClient({ chainId: 11155111 });
2917
+ const circuitManifest = await registryClient.getCircuitManifest(void 0, {
2918
+ // We assume all proofs have the same version
2919
+ version: proofs[0].version
2920
+ });
2921
+ for (const proof of proofs) {
2922
+ const proofData = (0, import_utils.getProofData)(proof.proof, (0, import_utils.getNumberOfPublicInputs)(proof.name));
2923
+ const hostedPackagedCircuit = await registryClient.getPackagedCircuit(
2924
+ proof.name,
2925
+ circuitManifest
2926
+ );
2927
+ if (proof.name?.startsWith("outer_evm")) {
2928
+ try {
2929
+ const { createPublicClient, http } = await import("viem");
2930
+ const { sepolia } = await import("viem/chains");
2931
+ const { address, abi, functionName } = this.getSolidityVerifierDetails("ethereum_sepolia");
2932
+ const client = createPublicClient({
2933
+ chain: sepolia,
2934
+ transport: http("https://ethereum-sepolia-rpc.publicnode.com")
2935
+ });
2936
+ const params = this.getSolidityVerifierParameters({
2937
+ proof,
2938
+ validityPeriodInDays: validity,
2939
+ domain: this.domain,
2940
+ scope,
2941
+ devMode
2942
+ });
2943
+ const result = await client.readContract({
2944
+ address,
2945
+ abi,
2946
+ functionName,
2947
+ args: [params]
2948
+ });
2949
+ const isVerified = Array.isArray(result) ? Boolean(result[0]) : false;
2950
+ verified = isVerified;
2951
+ } catch (error) {
2952
+ console.warn("Error verifying proof", error);
2953
+ verified = false;
2954
+ }
2955
+ } else {
2956
+ const vkeyBytes = import_buffer.Buffer.from(hostedPackagedCircuit.vkey, "base64");
2957
+ try {
2958
+ verified = await verifier.verifyUltraHonkProof(
2959
+ {
2960
+ proof: import_buffer.Buffer.from(proofData.proof.join(""), "hex"),
2961
+ publicInputs: proofData.publicInputs
2962
+ },
2963
+ new Uint8Array(vkeyBytes)
2964
+ );
2965
+ } catch (e) {
2966
+ console.warn("Error verifying proof", e);
2967
+ verified = false;
2968
+ }
2969
+ }
2970
+ if (!verified) {
2971
+ break;
2972
+ }
2973
+ }
2974
+ }
2975
+ uniqueIdentifier = verified ? uniqueIdentifier : void 0;
2976
+ return { uniqueIdentifier, verified, queryResultErrors };
2977
+ }
2978
+ getSolidityVerifierDetails(network) {
2979
+ const baseConfig = {
2980
+ functionName: "verifyProof",
2981
+ abi: ZKPassportVerifier_default.abi
2982
+ };
2983
+ if (network === "ethereum_sepolia") {
2984
+ return {
2985
+ ...baseConfig,
2986
+ address: "0xDDeFf76024052D26B78A7Fac66FFbd6fbc5bd9Ad"
2987
+ };
2988
+ } else if (network === "local_anvil") {
2989
+ return {
2990
+ ...baseConfig,
2991
+ address: "0x0"
2992
+ };
2993
+ }
2994
+ throw new Error(`Unsupported network: ${network}`);
2995
+ }
2996
+ getSolidityVerifierParameters({
2997
+ proof,
2998
+ validityPeriodInDays = 7,
2999
+ domain,
3000
+ scope,
3001
+ devMode = false
3002
+ }) {
3003
+ if (!proof.name?.startsWith("outer_evm")) {
3004
+ throw new Error(
3005
+ "This proof cannot be verified on an EVM chain. Please make sure to use the `compressed-evm` mode."
3006
+ );
3007
+ }
3008
+ const proofData = (0, import_utils.getProofData)(proof.proof, (0, import_utils.getNumberOfPublicInputs)(proof.name));
3009
+ const actualProof = proofData.proof.slice(16);
3010
+ const actualPublicInputs = proofData.publicInputs.concat(
3011
+ proofData.proof.slice(0, 16).map((x) => `0x${x}`)
3012
+ );
3013
+ let committedInputCounts = [];
3014
+ let committedInputs = [];
3015
+ for (const key in proof.committedInputs) {
3016
+ const committedInputCount = (0, import_utils.getCommittedInputCount)(key);
3017
+ const circuitName = key;
3018
+ committedInputCounts.push({ circuitName, count: committedInputCount });
3019
+ let compressedCommittedInputs2 = "";
3020
+ if (circuitName === "inclusion_check_issuing_country_evm" || circuitName === "inclusion_check_nationality_evm" || circuitName === "exclusion_check_issuing_country_evm" || circuitName === "exclusion_check_nationality_evm") {
3021
+ const value = proof.committedInputs[circuitName];
3022
+ const formattedCountries = value.countries;
3023
+ if (circuitName === "exclusion_check_issuing_country_evm" || circuitName === "exclusion_check_nationality_evm") {
3024
+ formattedCountries.sort((a, b) => a.localeCompare(b));
3025
+ }
3026
+ const proofType = (() => {
3027
+ switch (circuitName) {
3028
+ case "exclusion_check_issuing_country_evm":
3029
+ return import_utils.ProofType.ISSUING_COUNTRY_EXCLUSION;
3030
+ case "exclusion_check_nationality_evm":
3031
+ return import_utils.ProofType.NATIONALITY_EXCLUSION;
3032
+ case "inclusion_check_issuing_country_evm":
3033
+ return import_utils.ProofType.ISSUING_COUNTRY_INCLUSION;
3034
+ case "inclusion_check_nationality_evm":
3035
+ return import_utils.ProofType.NATIONALITY_INCLUSION;
3036
+ }
3037
+ })();
3038
+ compressedCommittedInputs2 = proofType.toString(16).padStart(2, "0") + (0, import_utils.rightPadArrayWithZeros)(
3039
+ formattedCountries.map((c) => Array.from(new TextEncoder().encode(c))).flat(),
3040
+ 600
3041
+ ).map((x) => x.toString(16).padStart(2, "0")).join("");
3042
+ } else if (circuitName === "compare_age_evm") {
3043
+ const value = proof.committedInputs[circuitName];
3044
+ const currentDateBytes = Array.from(new TextEncoder().encode(value.currentDate));
3045
+ compressedCommittedInputs2 = import_utils.ProofType.AGE.toString(16).padStart(2, "0") + currentDateBytes.map((x) => x.toString(16).padStart(2, "0")).join("") + value.minAge.toString(16).padStart(2, "0") + value.maxAge.toString(16).padStart(2, "0");
3046
+ } else if (circuitName === "compare_birthdate_evm") {
3047
+ const value = proof.committedInputs[circuitName];
3048
+ const currentDateBytes = Array.from(new TextEncoder().encode(value.currentDate));
3049
+ const minDateBytes = Array.from(new TextEncoder().encode(value.minDate));
3050
+ const maxDateBytes = Array.from(new TextEncoder().encode(value.maxDate));
3051
+ compressedCommittedInputs2 = import_utils.ProofType.BIRTHDATE.toString(16).padStart(2, "0") + currentDateBytes.map((x) => x.toString(16).padStart(2, "0")).join("") + minDateBytes.map((x) => x.toString(16).padStart(2, "0")).join("") + maxDateBytes.map((x) => x.toString(16).padStart(2, "0")).join("");
3052
+ } else if (circuitName === "compare_expiry_evm") {
3053
+ const value = proof.committedInputs[circuitName];
3054
+ const currentDateBytes = Array.from(new TextEncoder().encode(value.currentDate));
3055
+ const minDateBytes = Array.from(new TextEncoder().encode(value.minDate));
3056
+ const maxDateBytes = Array.from(new TextEncoder().encode(value.maxDate));
3057
+ compressedCommittedInputs2 = import_utils.ProofType.EXPIRY_DATE.toString(16).padStart(2, "0") + currentDateBytes.map((x) => x.toString(16).padStart(2, "0")).join("") + minDateBytes.map((x) => x.toString(16).padStart(2, "0")).join("") + maxDateBytes.map((x) => x.toString(16).padStart(2, "0")).join("");
3058
+ } else if (circuitName === "disclose_bytes_evm") {
3059
+ const value = proof.committedInputs[circuitName];
3060
+ compressedCommittedInputs2 = import_utils.ProofType.DISCLOSE.toString(16).padStart(2, "0") + value.discloseMask.map((x) => x.toString(16).padStart(2, "0")).join("") + value.disclosedBytes.map((x) => x.toString(16).padStart(2, "0")).join("");
3061
+ } else if (circuitName === "bind_evm") {
3062
+ const value = proof.committedInputs[circuitName];
3063
+ compressedCommittedInputs2 = import_utils.ProofType.BIND.toString(16).padStart(2, "0") + (0, import_utils.rightPadArrayWithZeros)((0, import_utils.formatBoundData)(value.data), 500).map((x) => x.toString(16).padStart(2, "0")).join("");
3064
+ } else {
3065
+ throw new Error(`Unsupported circuit for EVM verification: ${circuitName}`);
3066
+ }
3067
+ committedInputs.push({ circuitName, inputs: compressedCommittedInputs2 });
3068
+ }
3069
+ const parameterCommitments = proofData.publicInputs.slice(12, proofData.publicInputs.length - 1);
3070
+ let compressedCommittedInputs = "";
3071
+ let committedInputCountsArray = [];
3072
+ for (const commitment of parameterCommitments) {
3073
+ const committedInput = committedInputs.find((x) => {
3074
+ const rawHashedInputs = (0, import_sha2.sha256)((0, import_utils3.hexToBytes)(x.inputs));
3075
+ const hashedInputs = new Uint8Array(rawHashedInputs.length);
3076
+ for (let i = 0; i < rawHashedInputs.length - 1; i++) {
3077
+ hashedInputs[i + 1] = rawHashedInputs[i];
3078
+ }
3079
+ hashedInputs[0] = 0;
3080
+ return (0, import_utils2.bytesToHex)(hashedInputs) === commitment.replace("0x", "");
3081
+ });
3082
+ if (committedInput) {
3083
+ const count = committedInputCounts.find(
3084
+ (x) => x.circuitName === committedInput.circuitName
3085
+ )?.count;
3086
+ if (count) {
3087
+ committedInputCountsArray.push(count);
3088
+ compressedCommittedInputs += committedInput.inputs;
3089
+ } else {
3090
+ throw new Error(`Unknown circuit name: ${committedInput.circuitName}`);
3091
+ }
3092
+ } else {
3093
+ throw new Error(`Invalid commitment: ${commitment}`);
3094
+ }
3095
+ }
3096
+ const params = {
3097
+ // Make sure the vkeyHash is 32 bytes
3098
+ vkeyHash: `0x${proof.vkeyHash.replace("0x", "").padStart(64, "0")}`,
3099
+ proof: `0x${actualProof.join("")}`,
3100
+ publicInputs: actualPublicInputs,
3101
+ committedInputs: `0x${compressedCommittedInputs}`,
3102
+ committedInputCounts: committedInputCountsArray,
3103
+ validityPeriodInDays,
3104
+ domain: domain ?? this.domain,
3105
+ scope: scope ?? "",
3106
+ devMode
3107
+ };
3108
+ return params;
3109
+ }
3110
+ _getUrl(requestId) {
3111
+ const base64Config = import_buffer.Buffer.from(JSON.stringify(this.topicToConfig[requestId])).toString(
3112
+ "base64"
3113
+ );
3114
+ const base64Service = import_buffer.Buffer.from(JSON.stringify(this.topicToService[requestId])).toString(
3115
+ "base64"
3116
+ );
3117
+ const pubkey = this.topicToPublicKey[requestId];
3118
+ return `https://zkpassport.id/r?d=${this.domain}&t=${requestId}&c=${base64Config}&s=${base64Service}&p=${pubkey}&m=${this.topicToLocalConfig[requestId].mode}&v=${VERSION}`;
3119
+ }
3120
+ /**
3121
+ * @notice Returns the URL of the request.
3122
+ * @param requestId The request ID.
3123
+ * @returns The URL of the request.
3124
+ */
3125
+ getUrl(requestId) {
3126
+ return this._getUrl(requestId);
3127
+ }
3128
+ /**
3129
+ * @notice Cancels a request by closing the WebSocket connection and deleting the associated data.
3130
+ * @param requestId The request ID.
3131
+ */
3132
+ cancelRequest(requestId) {
3133
+ if (this.topicToBridge[requestId]) {
3134
+ this.topicToBridge[requestId].close();
3135
+ delete this.topicToBridge[requestId];
3136
+ }
3137
+ delete this.topicToPublicKey[requestId];
3138
+ delete this.topicToConfig[requestId];
3139
+ delete this.topicToLocalConfig[requestId];
3140
+ delete this.topicToProofs[requestId];
3141
+ delete this.topicToExpectedProofCount[requestId];
3142
+ delete this.topicToFailedProofCount[requestId];
3143
+ delete this.topicToResults[requestId];
3144
+ this.onRequestReceivedCallbacks[requestId] = [];
3145
+ this.onGeneratingProofCallbacks[requestId] = [];
3146
+ this.onBridgeConnectCallbacks[requestId] = [];
3147
+ this.onProofGeneratedCallbacks[requestId] = [];
3148
+ this.onRejectCallbacks[requestId] = [];
3149
+ this.onErrorCallbacks[requestId] = [];
3150
+ }
3151
+ /**
3152
+ * @notice Clears all requests.
3153
+ */
3154
+ clearAllRequests() {
3155
+ for (const requestId in this.topicToBridge) {
3156
+ this.cancelRequest(requestId);
3157
+ }
3158
+ }
3159
+ };
3160
+ // Annotate the CommonJS export names for ESM import in node:
3161
+ 0 && (module.exports = {
3162
+ ASEAN_COUNTRIES,
3163
+ EEA_COUNTRIES,
3164
+ EU_COUNTRIES,
3165
+ MERCOSUR_COUNTRIES,
3166
+ SANCTIONED_COUNTRIES,
3167
+ SCHENGEN_COUNTRIES,
3168
+ ZKPassport
3169
+ });