zklicensing 0.1.0-beta.2 → 0.1.0-beta.21

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.
Files changed (317) hide show
  1. package/README.md +417 -201
  2. package/build/agent.d.ts +371 -0
  3. package/build/agent.d.ts.map +1 -0
  4. package/build/agent.js +553 -0
  5. package/build/agent.js.map +1 -0
  6. package/build/agentActions.d.ts +841 -0
  7. package/build/agentActions.d.ts.map +1 -0
  8. package/build/agentActions.js +581 -0
  9. package/build/agentActions.js.map +1 -0
  10. package/build/agentRecord.d.ts +83 -0
  11. package/build/agentRecord.d.ts.map +1 -0
  12. package/build/agentRecord.js +69 -0
  13. package/build/agentRecord.js.map +1 -0
  14. package/build/agentVendor.d.ts +220 -0
  15. package/build/agentVendor.d.ts.map +1 -0
  16. package/build/agentVendor.js +306 -0
  17. package/build/agentVendor.js.map +1 -0
  18. package/build/appsLookup.d.ts +14 -0
  19. package/build/appsLookup.d.ts.map +1 -0
  20. package/build/appsLookup.js +12 -0
  21. package/build/appsLookup.js.map +1 -0
  22. package/build/archiveBootstrap.d.ts +31 -5
  23. package/build/archiveBootstrap.d.ts.map +1 -0
  24. package/build/archiveBootstrap.js +140 -47
  25. package/build/archiveBootstrap.js.map +1 -0
  26. package/build/atomicJson.d.ts +5 -0
  27. package/build/atomicJson.d.ts.map +1 -0
  28. package/build/atomicJson.js +55 -0
  29. package/build/atomicJson.js.map +1 -0
  30. package/build/bindClient.d.ts +85 -0
  31. package/build/bindClient.d.ts.map +1 -0
  32. package/build/bindClient.js +187 -0
  33. package/build/bindClient.js.map +1 -0
  34. package/build/buyClient.d.ts +27 -4
  35. package/build/buyClient.d.ts.map +1 -0
  36. package/build/buyClient.js +72 -26
  37. package/build/buyClient.js.map +1 -0
  38. package/build/chainHead.d.ts +61 -0
  39. package/build/chainHead.d.ts.map +1 -0
  40. package/build/chainHead.js +88 -0
  41. package/build/chainHead.js.map +1 -0
  42. package/build/compactMerkleMap.d.ts +72 -0
  43. package/build/compactMerkleMap.d.ts.map +1 -0
  44. package/build/compactMerkleMap.js +224 -0
  45. package/build/compactMerkleMap.js.map +1 -0
  46. package/build/contractInterface.d.ts +191 -51
  47. package/build/contractInterface.d.ts.map +1 -0
  48. package/build/contractInterface.js +234 -43
  49. package/build/contractInterface.js.map +1 -0
  50. package/build/contractTypes.d.ts +9 -0
  51. package/build/contractTypes.d.ts.map +1 -0
  52. package/build/contractTypes.js +28 -0
  53. package/build/contractTypes.js.map +1 -0
  54. package/build/countryStats.d.ts +12 -3
  55. package/build/countryStats.d.ts.map +1 -0
  56. package/build/countryStats.js +87 -23
  57. package/build/countryStats.js.map +1 -0
  58. package/build/deployClient.d.ts +138 -24
  59. package/build/deployClient.d.ts.map +1 -0
  60. package/build/deployClient.js +91 -31
  61. package/build/deployClient.js.map +1 -0
  62. package/build/deviceIdentity.d.ts +68 -0
  63. package/build/deviceIdentity.d.ts.map +1 -0
  64. package/build/deviceIdentity.js +209 -0
  65. package/build/deviceIdentity.js.map +1 -0
  66. package/build/freezeClient.d.ts +26 -6
  67. package/build/freezeClient.d.ts.map +1 -0
  68. package/build/freezeClient.js +30 -6
  69. package/build/freezeClient.js.map +1 -0
  70. package/build/generationClient.d.ts +6 -3
  71. package/build/generationClient.d.ts.map +1 -0
  72. package/build/generationClient.js +25 -38
  73. package/build/generationClient.js.map +1 -0
  74. package/build/holderSecret.d.ts +70 -0
  75. package/build/holderSecret.d.ts.map +1 -0
  76. package/build/holderSecret.js +76 -0
  77. package/build/holderSecret.js.map +1 -0
  78. package/build/index.d.ts +38 -38
  79. package/build/index.d.ts.map +1 -0
  80. package/build/index.js +97 -121
  81. package/build/index.js.map +1 -0
  82. package/build/keysClient.d.ts +142 -0
  83. package/build/keysClient.d.ts.map +1 -0
  84. package/build/keysClient.js +109 -0
  85. package/build/keysClient.js.map +1 -0
  86. package/build/licenseLeaf.d.ts +76 -0
  87. package/build/licenseLeaf.d.ts.map +1 -0
  88. package/build/licenseLeaf.js +189 -0
  89. package/build/licenseLeaf.js.map +1 -0
  90. package/build/licenseRecord.d.ts +68 -5
  91. package/build/licenseRecord.d.ts.map +1 -0
  92. package/build/licenseRecord.js +26 -1
  93. package/build/licenseRecord.js.map +1 -0
  94. package/build/licenseStore.d.ts +81 -4
  95. package/build/licenseStore.d.ts.map +1 -0
  96. package/build/licenseStore.js +400 -30
  97. package/build/licenseStore.js.map +1 -0
  98. package/build/licenseTrustless.d.ts +43 -0
  99. package/build/licenseTrustless.d.ts.map +1 -0
  100. package/build/licenseTrustless.js +180 -0
  101. package/build/licenseTrustless.js.map +1 -0
  102. package/build/manifestVerify.d.ts +29 -1
  103. package/build/manifestVerify.d.ts.map +1 -0
  104. package/build/manifestVerify.js +46 -4
  105. package/build/manifestVerify.js.map +1 -0
  106. package/build/minaPriceHistory.d.ts +9 -0
  107. package/build/minaPriceHistory.d.ts.map +1 -0
  108. package/build/minaPriceHistory.js +152 -0
  109. package/build/minaPriceHistory.js.map +1 -0
  110. package/build/onChainRoot.d.ts +60 -0
  111. package/build/onChainRoot.d.ts.map +1 -0
  112. package/build/onChainRoot.js +74 -0
  113. package/build/onChainRoot.js.map +1 -0
  114. package/build/ownershipLicenseHash.d.ts +25 -0
  115. package/build/ownershipLicenseHash.d.ts.map +1 -0
  116. package/build/ownershipLicenseHash.js +29 -0
  117. package/build/ownershipLicenseHash.js.map +1 -0
  118. package/build/ownershipSignature.d.ts +153 -0
  119. package/build/ownershipSignature.d.ts.map +1 -0
  120. package/build/ownershipSignature.js +297 -0
  121. package/build/ownershipSignature.js.map +1 -0
  122. package/build/permitCheckFlow.d.ts +155 -0
  123. package/build/permitCheckFlow.d.ts.map +1 -0
  124. package/build/permitCheckFlow.js +196 -0
  125. package/build/permitCheckFlow.js.map +1 -0
  126. package/build/permitDescribe.d.ts +124 -0
  127. package/build/permitDescribe.d.ts.map +1 -0
  128. package/build/permitDescribe.js +324 -0
  129. package/build/permitDescribe.js.map +1 -0
  130. package/build/permitInterface.d.ts +85 -0
  131. package/build/permitInterface.d.ts.map +1 -0
  132. package/build/permitInterface.js +121 -0
  133. package/build/permitInterface.js.map +1 -0
  134. package/build/permitMessages.d.ts +313 -0
  135. package/build/permitMessages.d.ts.map +1 -0
  136. package/build/permitMessages.js +462 -0
  137. package/build/permitMessages.js.map +1 -0
  138. package/build/permitProof.d.ts +108 -0
  139. package/build/permitProof.d.ts.map +1 -0
  140. package/build/permitProof.js +202 -0
  141. package/build/permitProof.js.map +1 -0
  142. package/build/permitRegistryRebuild.d.ts +166 -0
  143. package/build/permitRegistryRebuild.d.ts.map +1 -0
  144. package/build/permitRegistryRebuild.js +347 -0
  145. package/build/permitRegistryRebuild.js.map +1 -0
  146. package/build/permitTree.d.ts +88 -0
  147. package/build/permitTree.d.ts.map +1 -0
  148. package/build/permitTree.js +230 -0
  149. package/build/permitTree.js.map +1 -0
  150. package/build/permitsClient.d.ts +680 -0
  151. package/build/permitsClient.d.ts.map +1 -0
  152. package/build/permitsClient.js +597 -0
  153. package/build/permitsClient.js.map +1 -0
  154. package/build/proveErrors.d.ts +50 -0
  155. package/build/proveErrors.d.ts.map +1 -0
  156. package/build/proveErrors.js +76 -0
  157. package/build/proveErrors.js.map +1 -0
  158. package/build/receipt.d.ts +95 -0
  159. package/build/receipt.d.ts.map +1 -0
  160. package/build/receipt.js +84 -0
  161. package/build/receipt.js.map +1 -0
  162. package/build/refundClient.d.ts +7 -12
  163. package/build/refundClient.d.ts.map +1 -0
  164. package/build/refundClient.js +52 -21
  165. package/build/refundClient.js.map +1 -0
  166. package/build/registryTrustVerify.d.ts +78 -0
  167. package/build/registryTrustVerify.d.ts.map +1 -0
  168. package/build/registryTrustVerify.js +129 -0
  169. package/build/registryTrustVerify.js.map +1 -0
  170. package/build/releaseClient.d.ts +26 -0
  171. package/build/releaseClient.d.ts.map +1 -0
  172. package/build/releaseClient.js +65 -0
  173. package/build/releaseClient.js.map +1 -0
  174. package/build/renewClient.d.ts +28 -2
  175. package/build/renewClient.d.ts.map +1 -0
  176. package/build/renewClient.js +31 -27
  177. package/build/renewClient.js.map +1 -0
  178. package/build/seatName.d.ts +8 -0
  179. package/build/seatName.d.ts.map +1 -0
  180. package/build/seatName.js +136 -0
  181. package/build/seatName.js.map +1 -0
  182. package/build/slotConstants.d.ts +15 -0
  183. package/build/slotConstants.d.ts.map +1 -0
  184. package/build/slotConstants.js +17 -0
  185. package/build/slotConstants.js.map +1 -0
  186. package/build/statsClient.d.ts +61 -7
  187. package/build/statsClient.d.ts.map +1 -0
  188. package/build/statsClient.js +44 -5
  189. package/build/statsClient.js.map +1 -0
  190. package/build/successorChain.d.ts +35 -0
  191. package/build/successorChain.d.ts.map +1 -0
  192. package/build/successorChain.js +69 -0
  193. package/build/successorChain.js.map +1 -0
  194. package/build/taxId.d.ts +44 -0
  195. package/build/taxId.d.ts.map +1 -0
  196. package/build/taxId.js +212 -0
  197. package/build/taxId.js.map +1 -0
  198. package/build/trustAnchorVerify.d.ts +49 -0
  199. package/build/trustAnchorVerify.d.ts.map +1 -0
  200. package/build/trustAnchorVerify.js +432 -0
  201. package/build/trustAnchorVerify.js.map +1 -0
  202. package/build/trustAnchorVerifyCli.d.ts +45 -0
  203. package/build/trustAnchorVerifyCli.d.ts.map +1 -0
  204. package/build/trustAnchorVerifyCli.js +235 -0
  205. package/build/trustAnchorVerifyCli.js.map +1 -0
  206. package/build/txBroadcastClient.d.ts +26 -0
  207. package/build/txBroadcastClient.d.ts.map +1 -0
  208. package/build/txBroadcastClient.js +20 -0
  209. package/build/txBroadcastClient.js.map +1 -0
  210. package/build/unbindClient.d.ts +77 -0
  211. package/build/unbindClient.d.ts.map +1 -0
  212. package/build/unbindClient.js +169 -0
  213. package/build/unbindClient.js.map +1 -0
  214. package/build/units.d.ts +28 -0
  215. package/build/units.d.ts.map +1 -0
  216. package/build/units.js +65 -0
  217. package/build/units.js.map +1 -0
  218. package/build/vatRates.d.ts +54 -0
  219. package/build/vatRates.d.ts.map +1 -0
  220. package/build/vatRates.js +82 -0
  221. package/build/vatRates.js.map +1 -0
  222. package/build/vatRatesData.d.ts +5 -0
  223. package/build/vatRatesData.d.ts.map +1 -0
  224. package/build/vatRatesData.js +42 -0
  225. package/build/vatRatesData.js.map +1 -0
  226. package/build/vendorAccountClient.d.ts +66 -0
  227. package/build/vendorAccountClient.d.ts.map +1 -0
  228. package/build/vendorAccountClient.js +47 -0
  229. package/build/vendorAccountClient.js.map +1 -0
  230. package/build/verifyCore.d.ts +4 -1
  231. package/build/verifyCore.d.ts.map +1 -0
  232. package/build/verifyCore.js +21 -10
  233. package/build/verifyCore.js.map +1 -0
  234. package/build/verifyOffline.d.ts +85 -0
  235. package/build/verifyOffline.d.ts.map +1 -0
  236. package/build/verifyOffline.js +139 -0
  237. package/build/verifyOffline.js.map +1 -0
  238. package/build/verifyService.d.ts.map +1 -0
  239. package/build/verifyService.js +571 -501
  240. package/build/verifyService.js.map +1 -0
  241. package/build/verifyWithAncestors.d.ts +19 -0
  242. package/build/verifyWithAncestors.d.ts.map +1 -0
  243. package/build/verifyWithAncestors.js +127 -0
  244. package/build/verifyWithAncestors.js.map +1 -0
  245. package/build/zipToState.d.ts +2 -0
  246. package/build/zipToState.d.ts.map +1 -0
  247. package/build/zipToState.js +94 -0
  248. package/build/zipToState.js.map +1 -0
  249. package/package.json +141 -16
  250. package/src/agent.ts +682 -0
  251. package/src/agentActions.ts +637 -0
  252. package/src/agentRecord.ts +121 -0
  253. package/src/agentVendor.ts +356 -0
  254. package/src/appsLookup.ts +48 -0
  255. package/src/archiveBootstrap.ts +386 -0
  256. package/src/atomicJson.ts +53 -0
  257. package/src/bindClient.ts +297 -0
  258. package/src/buyClient.ts +344 -0
  259. package/src/chainHead.ts +106 -0
  260. package/src/compactMerkleMap.ts +222 -0
  261. package/src/contractInterface.ts +465 -0
  262. package/src/contractTypes.ts +31 -0
  263. package/src/countryStats.ts +200 -0
  264. package/src/deployClient.ts +517 -0
  265. package/src/deviceIdentity.ts +249 -0
  266. package/src/freezeClient.ts +162 -0
  267. package/src/generationClient.ts +145 -0
  268. package/src/holderSecret.ts +91 -0
  269. package/src/index.ts +362 -0
  270. package/src/keysClient.ts +135 -0
  271. package/src/licenseLeaf.ts +221 -0
  272. package/src/licenseRecord.ts +190 -0
  273. package/src/licenseStore.ts +767 -0
  274. package/src/licenseTrustless.ts +207 -0
  275. package/src/manifestVerify.ts +164 -0
  276. package/src/minaPriceHistory.ts +166 -0
  277. package/src/onChainRoot.ts +90 -0
  278. package/src/ownershipLicenseHash.ts +31 -0
  279. package/src/ownershipSignature.ts +421 -0
  280. package/src/permitCheckFlow.ts +227 -0
  281. package/src/permitDescribe.ts +362 -0
  282. package/src/permitInterface.ts +146 -0
  283. package/src/permitMessages.ts +572 -0
  284. package/src/permitProof.ts +230 -0
  285. package/src/permitRegistryRebuild.ts +423 -0
  286. package/src/permitTree.ts +232 -0
  287. package/src/permitsClient.ts +746 -0
  288. package/src/proveErrors.ts +98 -0
  289. package/src/receipt.ts +156 -0
  290. package/src/refundClient.ts +177 -0
  291. package/src/registryTrustVerify.ts +192 -0
  292. package/src/releaseClient.ts +101 -0
  293. package/src/renewClient.ts +234 -0
  294. package/src/seatName.ts +165 -0
  295. package/src/slotConstants.ts +18 -0
  296. package/src/statsClient.ts +249 -0
  297. package/src/successorChain.ts +87 -0
  298. package/src/taxId.ts +227 -0
  299. package/src/trustAnchorVerify.ts +550 -0
  300. package/src/trustAnchorVerifyCli.ts +234 -0
  301. package/src/txBroadcastClient.ts +48 -0
  302. package/src/unbindClient.ts +233 -0
  303. package/src/units.ts +74 -0
  304. package/src/vatRates.ts +100 -0
  305. package/src/vatRatesData.ts +43 -0
  306. package/src/vendorAccountClient.ts +120 -0
  307. package/src/verifyCore.ts +100 -0
  308. package/src/verifyOffline.ts +212 -0
  309. package/src/verifyService.ts +982 -0
  310. package/src/verifyWithAncestors.ts +163 -0
  311. package/src/zipToState.ts +94 -0
  312. package/build/licenseProof.d.ts +0 -26
  313. package/build/licenseProof.js +0 -41
  314. package/build/migrateClient.d.ts +0 -43
  315. package/build/migrateClient.js +0 -47
  316. package/build/ownership.d.ts +0 -34
  317. package/build/ownership.js +0 -147
@@ -0,0 +1,72 @@
1
+ /**
2
+ * compactMerkleMap.ts
3
+ *
4
+ * A drop-in for o1js's MerkleMap (height 256: set, getRoot, getWitness — same
5
+ * positions, hashes and witnesses) that stores only what the tree can't
6
+ * compute cheaply: the leaves, and the values of the two children of every
7
+ * node where two leaves' paths split ("split children", 2(N − 1) of them).
8
+ * Every other node a witness needs is an empty subtree, a known constant.
9
+ *
10
+ * So it can be saved and loaded without re-hashing (toCompact / fromCompact):
11
+ * a MerkleMap would have to be rebuilt, one 256-hash path per leaf. Changes
12
+ * (setMany) re-hash only the paths above the changed leaves.
13
+ */
14
+ import { Field, MerkleMapWitness } from 'o1js';
15
+ export declare const TREE_HEIGHT = 256;
16
+ /** zeros()[l]: the value of an empty subtree whose top is at level l. */
17
+ export declare function zeros(): bigint[];
18
+ /** A key's leaf position, as MerkleMap places it. */
19
+ export declare function keyIndex(key: Field | string | bigint): bigint;
20
+ /** The split-children positions [level, index], in canonical order, for sorted leaf positions. */
21
+ export declare function splitChildren(sorted: bigint[]): Array<[number, bigint]>;
22
+ /** Field values as 32-byte big-endian words, base64. */
23
+ export declare function encodeFields(values: bigint[]): string;
24
+ export declare function decodeFields(b64: string): bigint[];
25
+ export type CompactMapData = {
26
+ /** Leaf positions, sorted. */
27
+ indices: bigint[];
28
+ /** Leaf values, in the same order. */
29
+ leaves: bigint[];
30
+ /** Split-children values, in splitChildren order. */
31
+ splits: bigint[];
32
+ };
33
+ export declare class CompactMerkleMap {
34
+ private idx;
35
+ private leaves;
36
+ private split;
37
+ private root;
38
+ /** Number of non-empty leaves. */
39
+ get size(): number;
40
+ getRoot(): Field;
41
+ set(key: Field, value: Field): void;
42
+ /** Sets several leaves, re-hashing only above them. */
43
+ setMany(entries: Iterable<[Field | string, Field | bigint]>): void;
44
+ /** A MerkleMapWitness for `key`, as MerkleMap.getWitness gives it. */
45
+ getWitness(key: Field): MerkleMapWitness;
46
+ witnessValues(s: bigint): {
47
+ isLefts: boolean[];
48
+ siblings: bigint[];
49
+ };
50
+ /** A node's value, when it is a leaf, a split child, or empty; otherwise undefined. */
51
+ getNode(level: number, index: bigint): bigint | undefined;
52
+ /** The split-children values in canonical order (for compact copies). */
53
+ splitValues(): bigint[];
54
+ toCompact(): CompactMapData;
55
+ /**
56
+ * Loads a saved copy without re-hashing the tree: only the path from the
57
+ * root down to the first split. Throws if the data is inconsistent, or if
58
+ * `expectedRoot` is given and the copy doesn't fold to it. Values deeper
59
+ * down aren't re-checked (that would cost the full rebuild): protect a
60
+ * stored copy with a checksum.
61
+ */
62
+ static fromCompact(d: CompactMapData, expectedRoot?: string): CompactMerkleMap;
63
+ /** Recomputes split values above the changed positions (sorted), and the root. */
64
+ private recompute;
65
+ private computeRoot;
66
+ /**
67
+ * A node's value: empty, a leaf, a split child kept from before when no
68
+ * changed leaf is below it, one leaf's path, or the hash of its children.
69
+ */
70
+ private valueOf;
71
+ }
72
+ //# sourceMappingURL=compactMerkleMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compactMerkleMap.d.ts","sourceRoot":"","sources":["../src/compactMerkleMap.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAQ,KAAK,EAAa,gBAAgB,EAAY,MAAM,MAAM,CAAC;AAE1E,eAAO,MAAM,WAAW,MAAM,CAAC;AAG/B,yEAAyE;AACzE,wBAAgB,KAAK,IAAI,MAAM,EAAE,CAOhC;AAID,qDAAqD;AACrD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAE7D;AAID,kGAAkG;AAClG,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAQvE;AAED,wDAAwD;AACxD,wBAA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E,kFAAkF;IAClF,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,WAAW;IASnB;;;OAGG;IACH,OAAO,CAAC,OAAO;CA0BhB"}
@@ -0,0 +1,224 @@
1
+ // Copyright (c) 2025-2026 zkLicensing project developers
2
+ // SPDX-License-Identifier: BUSL-1.1
3
+ /**
4
+ * compactMerkleMap.ts
5
+ *
6
+ * A drop-in for o1js's MerkleMap (height 256: set, getRoot, getWitness — same
7
+ * positions, hashes and witnesses) that stores only what the tree can't
8
+ * compute cheaply: the leaves, and the values of the two children of every
9
+ * node where two leaves' paths split ("split children", 2(N − 1) of them).
10
+ * Every other node a witness needs is an empty subtree, a known constant.
11
+ *
12
+ * So it can be saved and loaded without re-hashing (toCompact / fromCompact):
13
+ * a MerkleMap would have to be rebuilt, one 256-hash path per leaf. Changes
14
+ * (setMany) re-hash only the paths above the changed leaves.
15
+ */
16
+ import { Bool, Field, MerkleMap, MerkleMapWitness, Poseidon } from 'o1js';
17
+ export const TREE_HEIGHT = 256;
18
+ let zeroCache = null;
19
+ /** zeros()[l]: the value of an empty subtree whose top is at level l. */
20
+ export function zeros() {
21
+ if (!zeroCache) {
22
+ const z = [0n];
23
+ for (let i = 1; i < TREE_HEIGHT; i++)
24
+ z.push(Poseidon.hash([Field(z[i - 1]), Field(z[i - 1])]).toBigInt());
25
+ zeroCache = z;
26
+ }
27
+ return zeroCache;
28
+ }
29
+ const H = (a, b) => Poseidon.hash([Field(a), Field(b)]).toBigInt();
30
+ const keyMap = new MerkleMap();
31
+ /** A key's leaf position, as MerkleMap places it. */
32
+ export function keyIndex(key) {
33
+ return keyMap._keyToIndex(Field(key));
34
+ }
35
+ function bitLength(x) { let n = 0; while (x > 0n) {
36
+ x >>= 1n;
37
+ n++;
38
+ } return n; }
39
+ /** The split-children positions [level, index], in canonical order, for sorted leaf positions. */
40
+ export function splitChildren(sorted) {
41
+ const out = [];
42
+ for (let i = 0; i + 1 < sorted.length; i++) {
43
+ const a = sorted[i], b = sorted[i + 1];
44
+ const l = bitLength(a ^ b) - 1; // the children's level; they meet at l + 1
45
+ out.push([l, a >> BigInt(l)], [l, b >> BigInt(l)]);
46
+ }
47
+ return out;
48
+ }
49
+ /** Field values as 32-byte big-endian words, base64. */
50
+ export function encodeFields(values) {
51
+ const bytes = new Uint8Array(values.length * 32);
52
+ values.forEach((v, i) => { for (let k = 31; k >= 0; k--) {
53
+ bytes[i * 32 + k] = Number(v & 0xffn);
54
+ v >>= 8n;
55
+ } });
56
+ let bin = '';
57
+ for (let i = 0; i < bytes.length; i += 0x8000)
58
+ bin += String.fromCharCode(...bytes.subarray(i, i + 0x8000));
59
+ return btoa(bin);
60
+ }
61
+ export function decodeFields(b64) {
62
+ const bin = atob(b64);
63
+ if (bin.length % 32)
64
+ throw new Error('compact data is not a whole number of fields');
65
+ const out = [];
66
+ for (let i = 0; i < bin.length; i += 32) {
67
+ let v = 0n;
68
+ for (let k = 0; k < 32; k++)
69
+ v = (v << 8n) | BigInt(bin.charCodeAt(i + k));
70
+ out.push(v);
71
+ }
72
+ return out;
73
+ }
74
+ const nodeKey = (l, j) => `${l}:${j}`;
75
+ const cmp = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
76
+ /** First position >= x in a sorted array. */
77
+ function lower(arr, x) {
78
+ let lo = 0, hi = arr.length;
79
+ while (lo < hi) {
80
+ const m = (lo + hi) >> 1;
81
+ if (arr[m] < x)
82
+ lo = m + 1;
83
+ else
84
+ hi = m;
85
+ }
86
+ return lo;
87
+ }
88
+ export class CompactMerkleMap {
89
+ idx = [];
90
+ leaves = new Map();
91
+ split = new Map();
92
+ root = zeros()[TREE_HEIGHT - 1];
93
+ /** Number of non-empty leaves. */
94
+ get size() { return this.idx.length; }
95
+ getRoot() { return Field(this.root); }
96
+ set(key, value) { this.setMany([[key, value]]); }
97
+ /** Sets several leaves, re-hashing only above them. */
98
+ setMany(entries) {
99
+ const changed = [];
100
+ for (const [k, v] of entries) {
101
+ const i = keyIndex(k);
102
+ const val = typeof v === 'bigint' ? v : v.toBigInt();
103
+ if (!this.leaves.has(i))
104
+ this.idx.splice(lower(this.idx, i), 0, i);
105
+ this.leaves.set(i, val);
106
+ changed.push(i);
107
+ }
108
+ if (changed.length === 0)
109
+ return;
110
+ changed.sort(cmp);
111
+ this.recompute(changed);
112
+ }
113
+ /** A MerkleMapWitness for `key`, as MerkleMap.getWitness gives it. */
114
+ getWitness(key) {
115
+ const { isLefts, siblings } = this.witnessValues(keyIndex(key));
116
+ return new MerkleMapWitness(isLefts.map(b => Bool(b)), siblings.map(s => Field(s)));
117
+ }
118
+ witnessValues(s) {
119
+ const isLefts = [];
120
+ const siblings = [];
121
+ const memo = new Map();
122
+ for (let l = 0; l < TREE_HEIGHT - 1; l++) {
123
+ const at = s >> BigInt(l);
124
+ isLefts.push((at & 1n) === 0n);
125
+ // A split child, or empty — except for a key not in the map, whose
126
+ // path meets one non-empty subtree that isn't a split child: computed.
127
+ siblings.push(this.split.get(nodeKey(l, at ^ 1n)) ?? this.valueOf(l, at ^ 1n, [], memo));
128
+ }
129
+ return { isLefts, siblings };
130
+ }
131
+ /** A node's value, when it is a leaf, a split child, or empty; otherwise undefined. */
132
+ getNode(level, index) {
133
+ if (level === 0 && this.leaves.has(index))
134
+ return this.leaves.get(index);
135
+ const v = this.split.get(nodeKey(level, index));
136
+ if (v !== undefined)
137
+ return v;
138
+ const lo = index << BigInt(level), hi = ((index + 1n) << BigInt(level)) - 1n;
139
+ return lower(this.idx, lo) === lower(this.idx, hi + 1n) ? zeros()[level] : undefined;
140
+ }
141
+ /** The split-children values in canonical order (for compact copies). */
142
+ splitValues() {
143
+ return splitChildren(this.idx).map(([l, j]) => this.split.get(nodeKey(l, j)));
144
+ }
145
+ toCompact() {
146
+ return { indices: [...this.idx], leaves: this.idx.map(i => this.leaves.get(i)), splits: this.splitValues() };
147
+ }
148
+ /**
149
+ * Loads a saved copy without re-hashing the tree: only the path from the
150
+ * root down to the first split. Throws if the data is inconsistent, or if
151
+ * `expectedRoot` is given and the copy doesn't fold to it. Values deeper
152
+ * down aren't re-checked (that would cost the full rebuild): protect a
153
+ * stored copy with a checksum.
154
+ */
155
+ static fromCompact(d, expectedRoot) {
156
+ const m = new CompactMerkleMap();
157
+ for (let i = 1; i < d.indices.length; i++)
158
+ if (d.indices[i] <= d.indices[i - 1])
159
+ throw new Error('compact map: positions are not sorted');
160
+ if (d.leaves.length !== d.indices.length)
161
+ throw new Error('compact map: one value per leaf expected');
162
+ const positions = splitChildren(d.indices);
163
+ if (d.splits.length !== positions.length)
164
+ throw new Error(`compact map: expected ${positions.length} split values, got ${d.splits.length}`);
165
+ m.idx = [...d.indices];
166
+ d.indices.forEach((i, k) => m.leaves.set(i, d.leaves[k]));
167
+ positions.forEach(([l, j], k) => m.split.set(nodeKey(l, j), d.splits[k]));
168
+ m.root = m.computeRoot([]);
169
+ if (expectedRoot !== undefined && m.root.toString() !== expectedRoot)
170
+ throw new Error('compact map: the saved copy does not fold to its root');
171
+ return m;
172
+ }
173
+ /** Recomputes split values above the changed positions (sorted), and the root. */
174
+ recompute(changed) {
175
+ this.root = this.computeRoot(changed);
176
+ }
177
+ computeRoot(changed) {
178
+ const memo = new Map();
179
+ const next = new Map();
180
+ for (const [l, j] of splitChildren(this.idx))
181
+ next.set(nodeKey(l, j), this.valueOf(l, j, changed, memo));
182
+ const root = this.valueOf(TREE_HEIGHT - 1, 0n, changed, memo);
183
+ this.split = next;
184
+ return root;
185
+ }
186
+ /**
187
+ * A node's value: empty, a leaf, a split child kept from before when no
188
+ * changed leaf is below it, one leaf's path, or the hash of its children.
189
+ */
190
+ valueOf(l, j, changed, memo) {
191
+ const k = nodeKey(l, j);
192
+ const m = memo.get(k);
193
+ if (m !== undefined)
194
+ return m;
195
+ const z = zeros();
196
+ const idx = this.idx;
197
+ const lo = j << BigInt(l), hi = ((j + 1n) << BigInt(l)) - 1n;
198
+ const a = lower(idx, lo), b = lower(idx, hi + 1n);
199
+ let v;
200
+ if (a === b)
201
+ v = z[l];
202
+ else if (l === 0)
203
+ v = this.leaves.get(j);
204
+ else {
205
+ const touched = lower(changed, lo) !== lower(changed, hi + 1n);
206
+ const kept = touched ? undefined : this.split.get(k);
207
+ if (kept !== undefined)
208
+ v = kept;
209
+ else if (b - a === 1) {
210
+ // One leaf below: its path up to here, beside empty subtrees.
211
+ const pos = idx[a];
212
+ let h = this.leaves.get(pos);
213
+ for (let t = 0; t < l; t++)
214
+ h = ((pos >> BigInt(t)) & 1n) === 0n ? H(h, z[t]) : H(z[t], h);
215
+ v = h;
216
+ }
217
+ else
218
+ v = H(this.valueOf(l - 1, 2n * j, changed, memo), this.valueOf(l - 1, 2n * j + 1n, changed, memo));
219
+ }
220
+ memo.set(k, v);
221
+ return v;
222
+ }
223
+ }
224
+ //# sourceMappingURL=compactMerkleMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compactMerkleMap.js","sourceRoot":"","sources":["../src/compactMerkleMap.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,oCAAoC;AAEpC;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAE1E,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAE/B,IAAI,SAAS,GAAoB,IAAI,CAAC;AACtC,yEAAyE;AACzE,MAAM,UAAU,KAAK;IACnB,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE;YAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAA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CAAC,CAAC;YACR,CAAC;;gBAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QAC5G,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACf,OAAO,CAAC,CAAC;IACX,CAAC;CACF"}
@@ -1,55 +1,195 @@
1
- // Hand-written declarations for contractInterface.ts.
2
- // tsc can't emit these automatically because the inferred return types of
3
- // Struct() and SmartContract reference internal o1js paths outside this
4
- // package's rootDir, triggering TS2742. Callers get full typing on the
5
- // methods they actually invoke by importing the corresponding o1js types
6
- // directly (Field, PublicKey, etc.) in their own code.
7
-
8
- import type { Field, UInt64 } from 'o1js';
9
-
10
- export const LicenseIssuedEvent: any;
1
+ /**
2
+ * contractInterface.ts
3
+ *
4
+ * Public contract interface: event Structs, slot/grace constants, duration
5
+ * helpers, and a minimal `LicensingAppEventsContract` SmartContract subclass
6
+ * that has the events declaration but no @method bodies.
7
+ *
8
+ * The full `LicensingApp` (with provable method bodies) lives in the private
9
+ * zklicensing-app package; only the things needed to decode events and reason
10
+ * about durations are published here so a public verify service can replay
11
+ * the archive without pulling in the contract source.
12
+ *
13
+ * `CANONICAL_VK_HASH` is the verification-key hash of the published
14
+ * `LicensingApp` circuit. Bump it whenever the on-chain zkApp changes
15
+ * and rerun the backend's boot assertion (see zklicensing-app/src/keeperService.ts)
16
+ * / the verify service's `ensureCompiled()` check to catch drift.
17
+ */
18
+ import { Bool, Field, PublicKey, SmartContract, UInt32, UInt64 } from 'o1js';
19
+ export declare const LicenseIssuedEvent: any;
11
20
  export type LicenseIssuedEvent = any;
12
-
13
- export const ExpiryUpdateEvent: any;
21
+ export declare const ExpiryUpdateEvent: any;
14
22
  export type ExpiryUpdateEvent = any;
15
-
16
- export const PriceUpdatedEvent: any;
23
+ export declare const PriceUpdatedEvent: any;
17
24
  export type PriceUpdatedEvent = any;
18
-
19
- export const AppCreatedEvent: any;
25
+ export declare const AppCreatedEvent: any;
20
26
  export type AppCreatedEvent = any;
21
-
22
- export const LicenseMigratedEvent: any;
23
- export type LicenseMigratedEvent = any;
24
-
25
- export function unpackPrices(packed: Field): { priceMonthly: UInt64; priceYearly: UInt64; priceFiveYear: UInt64 };
26
-
27
- export const MONTHLY_SLOTS_N: number;
28
- export const ONE_YEAR_SLOTS_N: number;
29
- export const FIVE_YEAR_SLOTS_N: number;
30
- export const REFUND_WINDOW_N: number;
31
- export const GRACE_PERIOD_N: number;
32
- export const MS_PER_SLOT_N: number;
33
- export const SLOTS_PER_DAY_N: number;
34
- export const TOLERANCE_WINDOW_N: number;
35
-
36
- export const EMPTY: Field;
37
- export const EMPTY_ROOT: Field;
38
-
39
- export const DURATION_LABELS: readonly ['1 Month', '1 Year', '5 Years'];
40
- export type DurationLabel = '1 Month' | '1 Year' | '5 Years';
41
- export const DURATION_INDEX: { readonly '1 Month': 0; readonly '1 Year': 1; readonly '5 Years': 2 };
42
-
43
- export function durationSlotsFromLabel(label?: string | null): number | null;
44
- export function durationIndexFromLabel(label?: string | null): number | null;
45
- export function durationLabelFromIndex(idx: number): DurationLabel | null;
46
-
47
- export const LicensingAppEventsContract: any;
48
-
49
- export const SUPPORTED_LICENSING_APP_VERSIONS: readonly number[];
50
- export function fetchLicensingAppVersion(zkAppAddress: string): Promise<number | null>;
51
-
52
- export const CANONICAL_VK_HASHES: Readonly<Record<number, string>>;
53
- export const CURRENT_GENERATION: number;
54
- export const CANONICAL_VK_HASH: string;
55
- export const CANONICAL_LICENSE_PROOF_VK_HASH: string;
27
+ export declare const AppRetiredEvent: any;
28
+ export type AppRetiredEvent = any;
29
+ /**
30
+ * What the vendor or the platform signs to retire an app: bound to the app,
31
+ * its frozen root, the one successor that may start from it, and `force`
32
+ * (only the platform may: retire with purchases in escrow, whose funds then
33
+ * stay on the retired contract).
34
+ */
35
+ export declare const APP_RETIRE_TAG: Field;
36
+ export declare function appRetireMessage(app: PublicKey, licensesRoot: Field, successor: PublicKey, force: Bool): Field[];
37
+ /**
38
+ * LicensingApp's on-chain state, in declaration order (appState index of
39
+ * each field; a PublicKey takes two). A successor's initializeSuccessor
40
+ * reads its predecessor's through account preconditions.
41
+ */
42
+ export declare const LICENSING_APP_STATE: {
43
+ readonly licensesRoot: 0;
44
+ readonly vendorX: 1;
45
+ readonly vendorIsOdd: 2;
46
+ readonly escrowRoot: 3;
47
+ readonly pricesPacked: 4;
48
+ readonly version: 5;
49
+ readonly ancestorsRoot: 6;
50
+ readonly forkActivationSlot: 7;
51
+ readonly deviceCap: 8;
52
+ readonly retired: 9;
53
+ readonly successorX: 10;
54
+ readonly successorIsOdd: 11;
55
+ readonly payoutX: 12;
56
+ readonly payoutIsOdd: 13;
57
+ readonly pendingPayoutX: 14;
58
+ readonly pendingPayoutIsOdd: 15;
59
+ readonly pendingPayoutSlot: 16;
60
+ readonly platformX: 17;
61
+ readonly platformIsOdd: 18;
62
+ readonly treasuryX: 19;
63
+ readonly treasuryIsOdd: 20;
64
+ readonly platformEpoch: 21;
65
+ readonly vendorNonce: 22;
66
+ readonly networkId: 23;
67
+ };
68
+ export declare const KEY_TAGS: Readonly<Record<'PLATFORM_KEY' | 'PLATFORM_RECOVER' | 'VENDOR_KEY' | 'LICENSE_TRANSFER', Field>>;
69
+ /**
70
+ * The platform's key (signs platform retires and cancels), its treasury
71
+ * (receives the 2%) and how many times they changed, as every app and
72
+ * registry holds them. A new contract starts with the current ones (the
73
+ * keeper checks them before listing it); a successor carries its
74
+ * predecessor's over, checked on chain.
75
+ */
76
+ export declare const PlatformState: any;
77
+ export type PlatformState = any;
78
+ /**
79
+ * A change of the platform key and treasury: signed by the current platform
80
+ * key and the new one. Bound to the network and the next epoch, not to a
81
+ * contract, so one pair of signatures updates every app and registry on the
82
+ * network (anyone may send them; each contract takes it once).
83
+ */
84
+ export declare function platformKeyMessage(a: {
85
+ network: Field;
86
+ epoch: UInt32;
87
+ key: PublicKey;
88
+ treasury: PublicKey;
89
+ }): Field[];
90
+ /**
91
+ * The same, signed by the offline recovery key alone (compiled into the
92
+ * circuits): it can always set a new platform key and treasury, lost or
93
+ * stolen, at any epoch above a contract's current one.
94
+ */
95
+ export declare function platformRecoverMessage(a: {
96
+ network: Field;
97
+ epoch: UInt32;
98
+ key: PublicKey;
99
+ treasury: PublicKey;
100
+ }): Field[];
101
+ /** A new vendor key for an app: signed by the current vendor key and the new one; `nonce` is the app's vendorNonce. */
102
+ export declare function vendorKeyMessage(a: {
103
+ network: Field;
104
+ app: PublicKey;
105
+ nonce: UInt32;
106
+ vendor: PublicKey;
107
+ }): Field[];
108
+ /**
109
+ * A license moving to a new owner key (`to` = ownerPubKeyHash of the new
110
+ * key): signed by the current owner key and the new one, over the license
111
+ * as it is now (its leaf hash) and a last slot it may land by.
112
+ */
113
+ export declare function licenseTransferMessage(a: {
114
+ network: Field;
115
+ app: PublicKey;
116
+ leafHash: Field;
117
+ to: Field;
118
+ validUntil: UInt32;
119
+ }): Field[];
120
+ /**
121
+ * How long a new payout address waits before it takes effect: 48 hours at
122
+ * 90 s per slot. Payments keep going to the current one until it is
123
+ * applied, and the owner can cancel it meanwhile.
124
+ */
125
+ export declare const PAYOUT_DELAY_SLOTS_N = 1920;
126
+ /** A payout address was proposed; anyone may apply it from `effectiveSlot` on. */
127
+ export declare const PayoutProposedEvent: any;
128
+ export type PayoutProposedEvent = any;
129
+ /** The payout address now in use (applied), or the pending one cancelled (`applied` false). */
130
+ export declare const PayoutChangedEvent: any;
131
+ export type PayoutChangedEvent = any;
132
+ export declare const PlatformChangedEvent: any;
133
+ export type PlatformChangedEvent = any;
134
+ export declare const VendorChangedEvent: any;
135
+ export type VendorChangedEvent = any;
136
+ /**
137
+ * A license moved to a new owner key: the same leaf under `to`. `wallet` is
138
+ * the transaction's sender, the new owner's wallet that paid for it (as
139
+ * LicenseIssuedEvent's `buyer`), so a replay lists it under that wallet.
140
+ */
141
+ export declare const LicenseTransferredEvent: any;
142
+ export type LicenseTransferredEvent = any;
143
+ export declare const DeviceBoundEvent: any;
144
+ export type DeviceBoundEvent = any;
145
+ export declare const DeviceUnboundEvent: any;
146
+ export type DeviceUnboundEvent = any;
147
+ import { MONTHLY_SLOTS_N, ONE_YEAR_SLOTS_N, FIVE_YEAR_SLOTS_N, PERPETUAL_SLOTS_N, REFUND_WINDOW_N, GRACE_PERIOD_N, MS_PER_SLOT_N, SLOTS_PER_DAY_N } from './slotConstants.js';
148
+ export { MONTHLY_SLOTS_N, ONE_YEAR_SLOTS_N, FIVE_YEAR_SLOTS_N, PERPETUAL_SLOTS_N, REFUND_WINDOW_N, GRACE_PERIOD_N, MS_PER_SLOT_N, SLOTS_PER_DAY_N, };
149
+ export declare const TOLERANCE_WINDOW_N = 40;
150
+ export declare const MIGRATION_BUMP_LOOKBACK_N = 20160;
151
+ /**
152
+ * A license's expiry as the app's contract treats it: a successor deployed
153
+ * across a Mina hardfork (forkActivationSlot > 0) starts with its
154
+ * predecessor's licenses, and a license that lapsed during the pre-fork
155
+ * freeze (expiry before the fork slot, but within grace + lookback of it)
156
+ * counts as expiring at the fork slot, so the 7-day grace runs from there.
157
+ * renewLicense applies the same rule in-circuit; verification uses this.
158
+ */
159
+ export declare function effectiveExpirySlot(expirySlot: number, forkActivationSlot?: number): number;
160
+ /**
161
+ * The fork bump shared by licenses and permits: an expiry before the fork
162
+ * slot, but within `grace` + MIGRATION_BUMP_LOOKBACK_N of it (it lapsed
163
+ * during the pre-fork freeze, when it couldn't be renewed), counts as
164
+ * expiring at the fork slot. Licenses use their 7-day grace, permits their
165
+ * registry's grace period.
166
+ */
167
+ export declare function forkBumpedExpiry(expirySlot: number, forkActivationSlot: number, grace: number): number;
168
+ export declare const EMPTY: Field;
169
+ export declare const EMPTY_ROOT: Field;
170
+ export declare const DURATION_LABELS: readonly ["1 Month", "1 Year", "5 Years", "Perpetual"];
171
+ export type DurationLabel = typeof DURATION_LABELS[number];
172
+ export declare const DURATION_INDEX: {
173
+ readonly '1 Month': 0;
174
+ readonly '1 Year': 1;
175
+ readonly '5 Years': 2;
176
+ readonly Perpetual: 3;
177
+ };
178
+ export declare function durationSlotsFromLabel(label?: string | null): number | null;
179
+ export declare function durationIndexFromLabel(label?: string | null): number | null;
180
+ export declare function durationLabelFromIndex(idx: number): DurationLabel | null;
181
+ export declare class LicensingAppEventsContract extends SmartContract {
182
+ events: any;
183
+ }
184
+ export declare function unpackPrices(packed: Field): {
185
+ priceMonthly: UInt64;
186
+ priceYearly: UInt64;
187
+ priceFiveYear: UInt64;
188
+ pricePerpetual: UInt64;
189
+ };
190
+ export declare const SUPPORTED_LICENSING_APP_VERSIONS: readonly number[];
191
+ export declare function fetchLicensingAppVersion(zkAppAddress: string): Promise<number | null>;
192
+ export declare const CANONICAL_VK_HASHES: Readonly<Record<number, string>>;
193
+ export declare const CURRENT_GENERATION: number;
194
+ export declare const CANONICAL_VK_HASH: string;
195
+ //# sourceMappingURL=contractInterface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contractInterface.d.ts","sourceRoot":"","sources":["../src/contractInterface.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,IAAI,EAA8B,KAAK,EAAE,SAAS,EAAE,aAAa,EAAU,MAAM,EAAE,MAAM,EAAa,MAAM,MAAM,CAAC;AA8B5H,eAAO,MAAM,kBAAkB,EAAE,GAO/B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAErC,eAAO,MAAM,iBAAiB,EAAE,GAG9B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAEpC,eAAO,MAAM,iBAAiB,EAAE,GAK9B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,G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