@mailwoman/registry 10.7.0 → 11.0.0

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 (399) hide show
  1. package/README.md +93 -98
  2. package/data/manifests/artifacts.json +32 -0
  3. package/data/manifests/coverage.json +56 -0
  4. package/data/manifests/sources.lock.json +48 -0
  5. package/data/normalized/iata-airports.json +126749 -0
  6. package/data/normalized/iso3166-1.json +2035 -0
  7. package/definitions/namespaces.json +63 -0
  8. package/definitions/sections.json +73 -0
  9. package/docs/data-policy.md +81 -0
  10. package/docs/performance.md +146 -0
  11. package/docs/rgy1.md +144 -0
  12. package/lib/artifacts/country-airport-collision.ts +26 -0
  13. package/lib/artifacts/iata-airport/membership.ts +26 -0
  14. package/lib/artifacts/iata-airport/records.ts +26 -0
  15. package/lib/artifacts/iso3166-1/alpha2-membership.ts +26 -0
  16. package/lib/artifacts/iso3166-1/alpha3-membership.ts +26 -0
  17. package/lib/artifacts/iso3166-1/records.ts +26 -0
  18. package/lib/errors.ts +44 -0
  19. package/lib/iata/airports/records.ts +174 -0
  20. package/lib/iata/airports/validate.ts +49 -0
  21. package/lib/index.ts +25 -15
  22. package/lib/inspect.ts +56 -0
  23. package/lib/iso3166/alpha2.ts +48 -0
  24. package/lib/iso3166/alpha3.ts +51 -0
  25. package/lib/iso3166/records.ts +149 -0
  26. package/lib/iso3166/relations.ts +30 -0
  27. package/lib/key.ts +146 -0
  28. package/lib/normalize.ts +31 -0
  29. package/lib/overlap/country-airport.ts +108 -0
  30. package/lib/rgy1/base64.ts +24 -0
  31. package/lib/rgy1/reader.ts +316 -0
  32. package/lib/rgy1/sections.generated.ts +79 -0
  33. package/lib/rgy1/views.ts +267 -0
  34. package/lib/types.ts +88 -74
  35. package/lib/wasm.ts +285 -0
  36. package/out/artifacts/country-airport-collision.d.ts +15 -0
  37. package/out/artifacts/country-airport-collision.d.ts.map +1 -0
  38. package/out/artifacts/country-airport-collision.js +21 -0
  39. package/out/artifacts/country-airport-collision.js.map +1 -0
  40. package/out/artifacts/iata-airport/membership.d.ts +15 -0
  41. package/out/artifacts/iata-airport/membership.d.ts.map +1 -0
  42. package/out/artifacts/iata-airport/membership.js +21 -0
  43. package/out/artifacts/iata-airport/membership.js.map +1 -0
  44. package/out/artifacts/iata-airport/records.d.ts +15 -0
  45. package/out/artifacts/iata-airport/records.d.ts.map +1 -0
  46. package/out/artifacts/iata-airport/records.js +21 -0
  47. package/out/artifacts/iata-airport/records.js.map +1 -0
  48. package/out/artifacts/iso3166-1/alpha2-membership.d.ts +15 -0
  49. package/out/artifacts/iso3166-1/alpha2-membership.d.ts.map +1 -0
  50. package/out/artifacts/iso3166-1/alpha2-membership.js +21 -0
  51. package/out/artifacts/iso3166-1/alpha2-membership.js.map +1 -0
  52. package/out/artifacts/iso3166-1/alpha3-membership.d.ts +15 -0
  53. package/out/artifacts/iso3166-1/alpha3-membership.d.ts.map +1 -0
  54. package/out/artifacts/iso3166-1/alpha3-membership.js +21 -0
  55. package/out/artifacts/iso3166-1/alpha3-membership.js.map +1 -0
  56. package/out/artifacts/iso3166-1/records.d.ts +15 -0
  57. package/out/artifacts/iso3166-1/records.d.ts.map +1 -0
  58. package/out/artifacts/iso3166-1/records.js +21 -0
  59. package/out/artifacts/iso3166-1/records.js.map +1 -0
  60. package/out/errors.d.ts +38 -0
  61. package/out/errors.d.ts.map +1 -0
  62. package/out/errors.js +35 -0
  63. package/out/errors.js.map +1 -0
  64. package/out/iata/airports/records.d.ts +44 -0
  65. package/out/iata/airports/records.d.ts.map +1 -0
  66. package/out/iata/airports/records.js +137 -0
  67. package/out/iata/airports/records.js.map +1 -0
  68. package/out/iata/airports/validate.d.ts +27 -0
  69. package/out/iata/airports/validate.d.ts.map +1 -0
  70. package/out/iata/airports/validate.js +42 -0
  71. package/out/iata/airports/validate.js.map +1 -0
  72. package/out/index.d.ts +19 -15
  73. package/out/index.d.ts.map +1 -1
  74. package/out/index.js +14 -15
  75. package/out/index.js.map +1 -1
  76. package/out/inspect.d.ts +38 -0
  77. package/out/inspect.d.ts.map +1 -0
  78. package/out/inspect.js +33 -0
  79. package/out/inspect.js.map +1 -0
  80. package/out/iso3166/alpha2.d.ts +24 -0
  81. package/out/iso3166/alpha2.d.ts.map +1 -0
  82. package/out/iso3166/alpha2.js +41 -0
  83. package/out/iso3166/alpha2.js.map +1 -0
  84. package/out/iso3166/alpha3.d.ts +29 -0
  85. package/out/iso3166/alpha3.d.ts.map +1 -0
  86. package/out/iso3166/alpha3.js +44 -0
  87. package/out/iso3166/alpha3.js.map +1 -0
  88. package/out/iso3166/records.d.ts +38 -0
  89. package/out/iso3166/records.d.ts.map +1 -0
  90. package/out/iso3166/records.js +105 -0
  91. package/out/iso3166/records.js.map +1 -0
  92. package/out/iso3166/relations.d.ts +20 -0
  93. package/out/iso3166/relations.d.ts.map +1 -0
  94. package/out/iso3166/relations.js +27 -0
  95. package/out/iso3166/relations.js.map +1 -0
  96. package/out/key.d.ts +68 -0
  97. package/out/key.d.ts.map +1 -0
  98. package/out/key.js +122 -0
  99. package/out/key.js.map +1 -0
  100. package/out/normalize.d.ts +25 -0
  101. package/out/normalize.d.ts.map +1 -0
  102. package/out/normalize.js +21 -0
  103. package/out/normalize.js.map +1 -0
  104. package/out/overlap/country-airport.d.ts +57 -0
  105. package/out/overlap/country-airport.d.ts.map +1 -0
  106. package/out/overlap/country-airport.js +71 -0
  107. package/out/overlap/country-airport.js.map +1 -0
  108. package/out/rgy1/base64.d.ts +15 -0
  109. package/out/rgy1/base64.d.ts.map +1 -0
  110. package/out/rgy1/base64.js +22 -0
  111. package/out/rgy1/base64.js.map +1 -0
  112. package/out/rgy1/reader.d.ts +103 -0
  113. package/out/rgy1/reader.d.ts.map +1 -0
  114. package/out/rgy1/reader.js +230 -0
  115. package/out/rgy1/reader.js.map +1 -0
  116. package/out/rgy1/sections.generated.d.ts +54 -0
  117. package/out/rgy1/sections.generated.d.ts.map +1 -0
  118. package/out/rgy1/sections.generated.js +69 -0
  119. package/out/rgy1/sections.generated.js.map +1 -0
  120. package/out/rgy1/views.d.ts +96 -0
  121. package/out/rgy1/views.d.ts.map +1 -0
  122. package/out/rgy1/views.js +218 -0
  123. package/out/rgy1/views.js.map +1 -0
  124. package/out/sdk/fetch.d.ts +53 -0
  125. package/out/sdk/fetch.d.ts.map +1 -0
  126. package/out/sdk/fetch.js +107 -0
  127. package/out/sdk/fetch.js.map +1 -0
  128. package/out/sdk/fetch.run.d.ts +14 -0
  129. package/out/sdk/fetch.run.d.ts.map +1 -0
  130. package/out/sdk/fetch.run.js +20 -0
  131. package/out/sdk/fetch.run.js.map +1 -0
  132. package/out/sdk/sources.d.ts +111 -0
  133. package/out/sdk/sources.d.ts.map +1 -0
  134. package/out/sdk/sources.js +98 -0
  135. package/out/sdk/sources.js.map +1 -0
  136. package/out/tools/artifact-path.d.ts +10 -0
  137. package/out/tools/artifact-path.d.ts.map +1 -0
  138. package/out/tools/artifact-path.js +12 -0
  139. package/out/tools/artifact-path.js.map +1 -0
  140. package/out/tools/bench.run.d.ts +19 -0
  141. package/out/tools/bench.run.d.ts.map +1 -0
  142. package/out/tools/bench.run.js +204 -0
  143. package/out/tools/bench.run.js.map +1 -0
  144. package/out/tools/build-wasm.run.d.ts +18 -0
  145. package/out/tools/build-wasm.run.d.ts.map +1 -0
  146. package/out/tools/build-wasm.run.js +71 -0
  147. package/out/tools/build-wasm.run.js.map +1 -0
  148. package/out/tools/generate-sections.run.d.ts +13 -0
  149. package/out/tools/generate-sections.run.d.ts.map +1 -0
  150. package/out/tools/generate-sections.run.js +136 -0
  151. package/out/tools/generate-sections.run.js.map +1 -0
  152. package/out/tools/generate.run.d.ts +18 -0
  153. package/out/tools/generate.run.d.ts.map +1 -0
  154. package/out/tools/generate.run.js +118 -0
  155. package/out/tools/generate.run.js.map +1 -0
  156. package/out/tools/normalize.d.ts +155 -0
  157. package/out/tools/normalize.d.ts.map +1 -0
  158. package/out/tools/normalize.js +303 -0
  159. package/out/tools/normalize.js.map +1 -0
  160. package/out/tools/normalize.run.d.ts +14 -0
  161. package/out/tools/normalize.run.d.ts.map +1 -0
  162. package/out/tools/normalize.run.js +29 -0
  163. package/out/tools/normalize.run.js.map +1 -0
  164. package/out/types.d.ts +90 -76
  165. package/out/types.d.ts.map +1 -1
  166. package/out/types.js +20 -4
  167. package/out/types.js.map +1 -1
  168. package/out/wasm.d.ts +98 -0
  169. package/out/wasm.d.ts.map +1 -0
  170. package/out/wasm.js +137 -0
  171. package/out/wasm.js.map +1 -0
  172. package/package.json +49 -28
  173. package/sdk/fetch.run.ts +24 -0
  174. package/sdk/fetch.ts +146 -0
  175. package/sdk/sources.ts +162 -0
  176. package/tools/artifact-path.ts +12 -0
  177. package/tools/bench.run.ts +265 -0
  178. package/tools/build-wasm.run.ts +82 -0
  179. package/tools/generate-sections.run.ts +152 -0
  180. package/tools/generate.run.ts +146 -0
  181. package/tools/normalize.run.ts +36 -0
  182. package/tools/normalize.ts +474 -0
  183. package/wasm/registry-simd.wasm +0 -0
  184. package/wasm/registry.wasm +0 -0
  185. package/lib/address-key.ts +0 -46
  186. package/lib/geocode-handler.ts +0 -37
  187. package/lib/geojson.ts +0 -73
  188. package/lib/ingest.ts +0 -349
  189. package/lib/learned-scorer.ts +0 -134
  190. package/lib/map-html.ts +0 -287
  191. package/lib/models/crosssource-gbt-en-us.ts +0 -43
  192. package/lib/models/dedup-gbt-en-us.ts +0 -47
  193. package/lib/models/org-crosssource-gbt-en-us.ts +0 -43
  194. package/lib/reconcile.ts +0 -239
  195. package/lib/resolve.ts +0 -570
  196. package/out/address-key.d.ts +0 -34
  197. package/out/address-key.d.ts.map +0 -1
  198. package/out/address-key.js +0 -41
  199. package/out/address-key.js.map +0 -1
  200. package/out/geocode-handler.d.ts +0 -20
  201. package/out/geocode-handler.d.ts.map +0 -1
  202. package/out/geocode-handler.js +0 -29
  203. package/out/geocode-handler.js.map +0 -1
  204. package/out/geojson.d.ts +0 -28
  205. package/out/geojson.d.ts.map +0 -1
  206. package/out/geojson.js +0 -63
  207. package/out/geojson.js.map +0 -1
  208. package/out/ingest.d.ts +0 -173
  209. package/out/ingest.d.ts.map +0 -1
  210. package/out/ingest.js +0 -185
  211. package/out/ingest.js.map +0 -1
  212. package/out/learned-scorer.d.ts +0 -61
  213. package/out/learned-scorer.d.ts.map +0 -1
  214. package/out/learned-scorer.js +0 -91
  215. package/out/learned-scorer.js.map +0 -1
  216. package/out/map-html.d.ts +0 -39
  217. package/out/map-html.d.ts.map +0 -1
  218. package/out/map-html.js +0 -220
  219. package/out/map-html.js.map +0 -1
  220. package/out/models/crosssource-gbt-en-us.d.ts +0 -45
  221. package/out/models/crosssource-gbt-en-us.d.ts.map +0 -1
  222. package/out/models/crosssource-gbt-en-us.js +0 -40
  223. package/out/models/crosssource-gbt-en-us.js.map +0 -1
  224. package/out/models/dedup-gbt-en-us.d.ts +0 -44
  225. package/out/models/dedup-gbt-en-us.d.ts.map +0 -1
  226. package/out/models/dedup-gbt-en-us.js +0 -44
  227. package/out/models/dedup-gbt-en-us.js.map +0 -1
  228. package/out/models/org-crosssource-gbt-en-us.d.ts +0 -45
  229. package/out/models/org-crosssource-gbt-en-us.d.ts.map +0 -1
  230. package/out/models/org-crosssource-gbt-en-us.js +0 -40
  231. package/out/models/org-crosssource-gbt-en-us.js.map +0 -1
  232. package/out/reconcile.d.ts +0 -96
  233. package/out/reconcile.d.ts.map +0 -1
  234. package/out/reconcile.js +0 -127
  235. package/out/reconcile.js.map +0 -1
  236. package/out/resolve.d.ts +0 -264
  237. package/out/resolve.d.ts.map +0 -1
  238. package/out/resolve.js +0 -282
  239. package/out/resolve.js.map +0 -1
  240. package/out/tools/coverage-reconciliation.d.ts +0 -67
  241. package/out/tools/coverage-reconciliation.d.ts.map +0 -1
  242. package/out/tools/coverage-reconciliation.js +0 -113
  243. package/out/tools/coverage-reconciliation.js.map +0 -1
  244. package/out/tools/cross/dataset-correlation.d.ts +0 -61
  245. package/out/tools/cross/dataset-correlation.d.ts.map +0 -1
  246. package/out/tools/cross/dataset-correlation.js +0 -244
  247. package/out/tools/cross/dataset-correlation.js.map +0 -1
  248. package/out/tools/cross/source-threshold-sweep.d.ts +0 -60
  249. package/out/tools/cross/source-threshold-sweep.d.ts.map +0 -1
  250. package/out/tools/cross/source-threshold-sweep.js +0 -264
  251. package/out/tools/cross/source-threshold-sweep.js.map +0 -1
  252. package/out/tools/dedup-ceiling.d.ts +0 -62
  253. package/out/tools/dedup-ceiling.d.ts.map +0 -1
  254. package/out/tools/dedup-ceiling.js +0 -171
  255. package/out/tools/dedup-ceiling.js.map +0 -1
  256. package/out/tools/eval-geocoder.d.ts +0 -68
  257. package/out/tools/eval-geocoder.d.ts.map +0 -1
  258. package/out/tools/eval-geocoder.js +0 -13
  259. package/out/tools/eval-geocoder.js.map +0 -1
  260. package/out/tools/geocoder/namesake-probe.d.ts +0 -33
  261. package/out/tools/geocoder/namesake-probe.d.ts.map +0 -1
  262. package/out/tools/geocoder/namesake-probe.js +0 -60
  263. package/out/tools/geocoder/namesake-probe.js.map +0 -1
  264. package/out/tools/geocoder/vs-provided-coords.d.ts +0 -53
  265. package/out/tools/geocoder/vs-provided-coords.d.ts.map +0 -1
  266. package/out/tools/geocoder/vs-provided-coords.js +0 -161
  267. package/out/tools/geocoder/vs-provided-coords.js.map +0 -1
  268. package/out/tools/gold-set-sample.d.ts +0 -67
  269. package/out/tools/gold-set-sample.d.ts.map +0 -1
  270. package/out/tools/gold-set-sample.js +0 -81
  271. package/out/tools/gold-set-sample.js.map +0 -1
  272. package/out/tools/learned/scorer/clustering-eval.d.ts +0 -77
  273. package/out/tools/learned/scorer/clustering-eval.d.ts.map +0 -1
  274. package/out/tools/learned/scorer/clustering-eval.js +0 -207
  275. package/out/tools/learned/scorer/clustering-eval.js.map +0 -1
  276. package/out/tools/learned/scorer/crossstate-eval.d.ts +0 -65
  277. package/out/tools/learned/scorer/crossstate-eval.d.ts.map +0 -1
  278. package/out/tools/learned/scorer/crossstate-eval.js +0 -168
  279. package/out/tools/learned/scorer/crossstate-eval.js.map +0 -1
  280. package/out/tools/learned/scorer/eval.d.ts +0 -64
  281. package/out/tools/learned/scorer/eval.d.ts.map +0 -1
  282. package/out/tools/learned/scorer/eval.js +0 -275
  283. package/out/tools/learned/scorer/eval.js.map +0 -1
  284. package/out/tools/matcher-scale.d.ts +0 -40
  285. package/out/tools/matcher-scale.d.ts.map +0 -1
  286. package/out/tools/matcher-scale.js +0 -111
  287. package/out/tools/matcher-scale.js.map +0 -1
  288. package/out/tools/nppes/dedup-benchmark.d.ts +0 -82
  289. package/out/tools/nppes/dedup-benchmark.d.ts.map +0 -1
  290. package/out/tools/nppes/dedup-benchmark.js +0 -226
  291. package/out/tools/nppes/dedup-benchmark.js.map +0 -1
  292. package/out/tools/nppes/org-name.d.ts +0 -15
  293. package/out/tools/nppes/org-name.d.ts.map +0 -1
  294. package/out/tools/nppes/org-name.js +0 -6
  295. package/out/tools/nppes/org-name.js.map +0 -1
  296. package/out/tools/nppes/overmerge-packet.d.ts +0 -43
  297. package/out/tools/nppes/overmerge-packet.d.ts.map +0 -1
  298. package/out/tools/nppes/overmerge-packet.js +0 -54
  299. package/out/tools/nppes/overmerge-packet.js.map +0 -1
  300. package/out/tools/nppes/report.d.ts +0 -97
  301. package/out/tools/nppes/report.d.ts.map +0 -1
  302. package/out/tools/nppes/report.js +0 -178
  303. package/out/tools/nppes/report.js.map +0 -1
  304. package/out/tools/nppes/sample.d.ts +0 -101
  305. package/out/tools/nppes/sample.d.ts.map +0 -1
  306. package/out/tools/nppes/sample.js +0 -127
  307. package/out/tools/nppes/sample.js.map +0 -1
  308. package/out/tools/nppes/scoring.d.ts +0 -37
  309. package/out/tools/nppes/scoring.d.ts.map +0 -1
  310. package/out/tools/nppes/scoring.js +0 -81
  311. package/out/tools/nppes/scoring.js.map +0 -1
  312. package/out/tools/nppes/settings.d.ts +0 -41
  313. package/out/tools/nppes/settings.d.ts.map +0 -1
  314. package/out/tools/nppes/settings.js +0 -79
  315. package/out/tools/nppes/settings.js.map +0 -1
  316. package/out/tools/nppes/truth-grains.d.ts +0 -63
  317. package/out/tools/nppes/truth-grains.d.ts.map +0 -1
  318. package/out/tools/nppes/truth-grains.js +0 -139
  319. package/out/tools/nppes/truth-grains.js.map +0 -1
  320. package/out/tools/shared.d.ts +0 -325
  321. package/out/tools/shared.d.ts.map +0 -1
  322. package/out/tools/shared.js +0 -453
  323. package/out/tools/shared.js.map +0 -1
  324. package/out/tools/train/cross-gbt.d.ts +0 -89
  325. package/out/tools/train/cross-gbt.d.ts.map +0 -1
  326. package/out/tools/train/cross-gbt.js +0 -132
  327. package/out/tools/train/cross-gbt.js.map +0 -1
  328. package/out/tools/train/gbt.d.ts +0 -85
  329. package/out/tools/train/gbt.d.ts.map +0 -1
  330. package/out/tools/train/gbt.js +0 -155
  331. package/out/tools/train/gbt.js.map +0 -1
  332. package/out/tools/train/org-cross-gbt.d.ts +0 -85
  333. package/out/tools/train/org-cross-gbt.d.ts.map +0 -1
  334. package/out/tools/train/org-cross-gbt.js +0 -122
  335. package/out/tools/train/org-cross-gbt.js.map +0 -1
  336. package/out/tools/txhhsc-to-oarow.d.ts +0 -42
  337. package/out/tools/txhhsc-to-oarow.d.ts.map +0 -1
  338. package/out/tools/txhhsc-to-oarow.js +0 -78
  339. package/out/tools/txhhsc-to-oarow.js.map +0 -1
  340. package/out/tools/viz/browser.d.ts +0 -31
  341. package/out/tools/viz/browser.d.ts.map +0 -1
  342. package/out/tools/viz/browser.js +0 -26
  343. package/out/tools/viz/browser.js.map +0 -1
  344. package/out/tools/viz/cross-dataset-map.d.ts +0 -39
  345. package/out/tools/viz/cross-dataset-map.d.ts.map +0 -1
  346. package/out/tools/viz/cross-dataset-map.js +0 -84
  347. package/out/tools/viz/cross-dataset-map.js.map +0 -1
  348. package/out/tools/viz/geocode-first-surface.d.ts +0 -36
  349. package/out/tools/viz/geocode-first-surface.d.ts.map +0 -1
  350. package/out/tools/viz/geocode-first-surface.js +0 -234
  351. package/out/tools/viz/geocode-first-surface.js.map +0 -1
  352. package/out/tools/viz/render/map.d.ts +0 -42
  353. package/out/tools/viz/render/map.d.ts.map +0 -1
  354. package/out/tools/viz/render/map.js +0 -40
  355. package/out/tools/viz/render/map.js.map +0 -1
  356. package/out/tools/viz/render.d.ts +0 -46
  357. package/out/tools/viz/render.d.ts.map +0 -1
  358. package/out/tools/viz/render.js +0 -49
  359. package/out/tools/viz/render.js.map +0 -1
  360. package/out/tools/viz/source-provenance-map.d.ts +0 -57
  361. package/out/tools/viz/source-provenance-map.d.ts.map +0 -1
  362. package/out/tools/viz/source-provenance-map.js +0 -82
  363. package/out/tools/viz/source-provenance-map.js.map +0 -1
  364. package/out/tools/viz/yardstick-figure.d.ts +0 -22
  365. package/out/tools/viz/yardstick-figure.d.ts.map +0 -1
  366. package/out/tools/viz/yardstick-figure.js +0 -106
  367. package/out/tools/viz/yardstick-figure.js.map +0 -1
  368. package/tools/coverage-reconciliation.ts +0 -192
  369. package/tools/cross/dataset-correlation.ts +0 -380
  370. package/tools/cross/source-threshold-sweep.ts +0 -416
  371. package/tools/dedup-ceiling.ts +0 -225
  372. package/tools/eval-geocoder.ts +0 -77
  373. package/tools/geocoder/namesake-probe.ts +0 -91
  374. package/tools/geocoder/vs-provided-coords.ts +0 -232
  375. package/tools/gold-set-sample.ts +0 -147
  376. package/tools/learned/scorer/clustering-eval.ts +0 -349
  377. package/tools/learned/scorer/crossstate-eval.ts +0 -280
  378. package/tools/learned/scorer/eval.ts +0 -429
  379. package/tools/matcher-scale.ts +0 -185
  380. package/tools/nppes/dedup-benchmark.ts +0 -364
  381. package/tools/nppes/org-name.ts +0 -15
  382. package/tools/nppes/overmerge-packet.ts +0 -98
  383. package/tools/nppes/report.ts +0 -380
  384. package/tools/nppes/sample.ts +0 -250
  385. package/tools/nppes/scoring.ts +0 -115
  386. package/tools/nppes/settings.ts +0 -102
  387. package/tools/nppes/truth-grains.ts +0 -181
  388. package/tools/shared.ts +0 -743
  389. package/tools/train/cross-gbt.ts +0 -214
  390. package/tools/train/gbt.ts +0 -261
  391. package/tools/train/org-cross-gbt.ts +0 -189
  392. package/tools/txhhsc-to-oarow.ts +0 -118
  393. package/tools/viz/browser.ts +0 -41
  394. package/tools/viz/cross-dataset-map.ts +0 -133
  395. package/tools/viz/geocode-first-surface.ts +0 -305
  396. package/tools/viz/render/map.ts +0 -61
  397. package/tools/viz/render.ts +0 -103
  398. package/tools/viz/source-provenance-map.ts +0 -154
  399. package/tools/viz/yardstick-figure.ts +0 -197
@@ -0,0 +1,230 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The synchronous RGY1 reader: validate an artifact once, then probe its tables in place.
7
+ *
8
+ * The reader mirrors `crates/registry-core/src/artifact.rs` and follows `docs/rgy1.md`. It reads through a
9
+ * `DataView` over the caller's bytes, honoring `byteOffset`, so an artifact handed over as a subarray behaves as the
10
+ * same bytes would in their own buffer. No `Map` is rebuilt: a probe is an arithmetic index into the section's payload.
11
+ */
12
+ import { RGY1_ALIGNMENT, RGY1_DIRECTORY_ENTRY_BYTES, RGY1_FLAG_REQUIRED, RGY1_HEADER_OFFSET, RGY1_MAGIC, RGY1_VERSION, SECTION_ENCODING, SectionKind, } from "#rgy1/sections.generated";
13
+ /**
14
+ * Why bytes are not an RGY1 artifact this reader accepts.
15
+ */
16
+ export class RGY1Error extends Error {
17
+ code;
18
+ constructor(code, message) {
19
+ super(`RGY1 ${code}: ${message}`);
20
+ this.name = "RGY1Error";
21
+ this.code = code;
22
+ }
23
+ }
24
+ const KEY_SPACES = { 0: 1000, 2: 676, 3: 17_576 };
25
+ /**
26
+ * The byte width of a `u32` cell.
27
+ */
28
+ const BYTES_PER_U32 = 4;
29
+ /**
30
+ * Rounds up to the section alignment.
31
+ */
32
+ export function align(value) {
33
+ return Math.ceil(value / RGY1_ALIGNMENT) * RGY1_ALIGNMENT;
34
+ }
35
+ const decoder = new TextDecoder("utf-8", { fatal: true });
36
+ /**
37
+ * A validated artifact over the caller's bytes.
38
+ */
39
+ export class Artifact {
40
+ bytes;
41
+ header;
42
+ sections;
43
+ constructor(bytes, header, sections) {
44
+ this.bytes = bytes;
45
+ this.header = header;
46
+ this.sections = sections;
47
+ }
48
+ /**
49
+ * Parses and validates the envelope, directory and every section's framing.
50
+ */
51
+ static parse(bytes) {
52
+ if (bytes.byteLength < RGY1_HEADER_OFFSET)
53
+ throw new RGY1Error("truncated", `${bytes.byteLength} bytes`);
54
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
55
+ for (let index = 0; index < RGY1_MAGIC.length; index++) {
56
+ if (bytes[index] !== RGY1_MAGIC.charCodeAt(index))
57
+ throw new RGY1Error("magic", "the first bytes are not RGY1");
58
+ }
59
+ const version = view.getUint16(4, true);
60
+ if (version !== RGY1_VERSION)
61
+ throw new RGY1Error("version", `envelope version ${version}`);
62
+ const flags = view.getUint16(6, true);
63
+ if (flags !== 0)
64
+ throw new RGY1Error("flags", `envelope flags ${flags}`);
65
+ const headerLength = view.getUint32(8, true);
66
+ const sectionCount = view.getUint32(12, true);
67
+ const directoryOffset = view.getUint32(16, true);
68
+ const totalLength = view.getUint32(20, true);
69
+ const firstPayload = view.getUint32(24, true);
70
+ if (view.getUint32(28, true) !== 0)
71
+ throw new RGY1Error("reserved", "the reserved field is set");
72
+ if (totalLength !== bytes.byteLength) {
73
+ throw new RGY1Error("length", `stated ${totalLength} bytes, given ${bytes.byteLength}`);
74
+ }
75
+ const headerEnd = RGY1_HEADER_OFFSET + headerLength;
76
+ if (headerEnd > bytes.byteLength || directoryOffset !== align(headerEnd)) {
77
+ throw new RGY1Error("layout", `directory at ${directoryOffset}, header ends at ${headerEnd}`);
78
+ }
79
+ const directoryEnd = directoryOffset + sectionCount * RGY1_DIRECTORY_ENTRY_BYTES;
80
+ if (directoryEnd > bytes.byteLength || firstPayload !== align(directoryEnd) || firstPayload > bytes.byteLength) {
81
+ throw new RGY1Error("layout", `first payload at ${firstPayload}, directory ends at ${directoryEnd}`);
82
+ }
83
+ let headerText;
84
+ try {
85
+ headerText = decoder.decode(bytes.subarray(RGY1_HEADER_OFFSET, headerEnd));
86
+ }
87
+ catch {
88
+ throw new RGY1Error("header-utf8", "the header is not strict UTF-8");
89
+ }
90
+ for (let at = headerEnd; at < directoryOffset; at++) {
91
+ if (bytes[at] !== 0)
92
+ throw new RGY1Error("layout", `byte ${at} between header and directory is not zero`);
93
+ }
94
+ // oxlint-disable-next-line eslint/no-restricted-properties -- the library has no dependency on @mailwoman/core, so it reads the header with the platform parser
95
+ const header = JSON.parse(headerText);
96
+ const sections = [];
97
+ let cursor = firstPayload;
98
+ for (let index = 0; index < sectionCount; index++) {
99
+ const at = directoryOffset + index * RGY1_DIRECTORY_ENTRY_BYTES;
100
+ const kind = view.getUint16(at, true);
101
+ const encoding = view.getUint16(at + 2, true);
102
+ const elementWidth = view.getUint16(at + 4, true);
103
+ const sectionFlags = view.getUint16(at + 6, true);
104
+ const offset = view.getUint32(at + 8, true);
105
+ const length = view.getUint32(at + 12, true);
106
+ const count = view.getUint32(at + 16, true);
107
+ const aux = view.getUint32(at + 20, true);
108
+ const known = SECTION_ENCODING[kind];
109
+ if (known == null) {
110
+ if (sectionFlags & RGY1_FLAG_REQUIRED)
111
+ throw new RGY1Error("unknown-required-kind", `section ${index} kind ${kind}`);
112
+ }
113
+ else if (known !== encoding) {
114
+ throw new RGY1Error("encoding", `kind ${kind} encoding ${encoding}`);
115
+ }
116
+ const end = offset + length;
117
+ if (offset % RGY1_ALIGNMENT !== 0 || offset < cursor || end > bytes.byteLength) {
118
+ throw new RGY1Error("section-bounds", `section ${index} at ${offset}..${end}`);
119
+ }
120
+ for (let gap = cursor; gap < offset; gap++) {
121
+ if (bytes[gap] !== 0)
122
+ throw new RGY1Error("section-bounds", `byte ${gap} before section ${index} is not zero`);
123
+ }
124
+ const payload = bytes.subarray(offset, end);
125
+ const section = {
126
+ kind,
127
+ encoding,
128
+ elementWidth,
129
+ flags: sectionFlags,
130
+ offset,
131
+ length,
132
+ count,
133
+ aux,
134
+ payload,
135
+ view: new DataView(payload.buffer, payload.byteOffset, payload.byteLength),
136
+ };
137
+ checkShape(section);
138
+ sections.push(section);
139
+ cursor = end;
140
+ }
141
+ if (bytes.byteLength - cursor >= RGY1_ALIGNMENT)
142
+ throw new RGY1Error("layout", "trailing bytes after the last section");
143
+ for (let at = cursor; at < bytes.byteLength; at++) {
144
+ if (bytes[at] !== 0)
145
+ throw new RGY1Error("layout", `trailing byte ${at} is not zero`);
146
+ }
147
+ return new Artifact(bytes, header, sections);
148
+ }
149
+ /**
150
+ * The first section of a kind with the given `aux`, or `null`.
151
+ */
152
+ section(kind, aux) {
153
+ return this.sections.find((section) => section.kind === kind && section.aux === aux) ?? null;
154
+ }
155
+ /**
156
+ * The first section of a kind, whatever its `aux`, or `null`.
157
+ */
158
+ firstSection(kind) {
159
+ return this.sections.find((section) => section.kind === kind) ?? null;
160
+ }
161
+ /**
162
+ * The section a lookup needs, or an error naming it.
163
+ */
164
+ require(kind, aux) {
165
+ const section = aux == null ? this.firstSection(kind) : this.section(kind, aux);
166
+ if (!section)
167
+ throw new RGY1Error("missing-section", `kind ${kind}${aux == null ? "" : ` aux ${aux}`}`);
168
+ return section;
169
+ }
170
+ }
171
+ function checkShape(section) {
172
+ const { kind, elementWidth, length, count, aux } = section;
173
+ switch (kind) {
174
+ case SectionKind.BITSET: {
175
+ if (elementWidth !== 0)
176
+ throw new RGY1Error("element-width", `bitset width ${elementWidth}`);
177
+ const space = KEY_SPACES[aux];
178
+ if (space == null)
179
+ throw new RGY1Error("key-space", `arity ${aux}`);
180
+ if (count !== space || length !== Math.ceil(count / 8))
181
+ throw new RGY1Error("count", `bitset ${count} keys in ${length} bytes`);
182
+ break;
183
+ }
184
+ case SectionKind.ID_TABLE: {
185
+ if (![1, 2, 4].includes(elementWidth))
186
+ throw new RGY1Error("element-width", `id-table width ${elementWidth}`);
187
+ const space = KEY_SPACES[aux];
188
+ if (space == null)
189
+ throw new RGY1Error("key-space", `arity ${aux}`);
190
+ if (count !== space || length !== count * elementWidth)
191
+ throw new RGY1Error("count", `id-table ${count} × ${elementWidth}`);
192
+ break;
193
+ }
194
+ case SectionKind.STRING_OFFSETS:
195
+ case SectionKind.RELATION_OFFSETS:
196
+ case SectionKind.RELATION_TARGETS:
197
+ if (elementWidth !== BYTES_PER_U32)
198
+ throw new RGY1Error("element-width", `kind ${kind} width ${elementWidth}`);
199
+ if (length !== count * BYTES_PER_U32)
200
+ throw new RGY1Error("count", `kind ${kind} ${count} × ${BYTES_PER_U32}`);
201
+ break;
202
+ case SectionKind.UTF8:
203
+ if (elementWidth !== 0)
204
+ throw new RGY1Error("element-width", `utf8 width ${elementWidth}`);
205
+ if (length !== count)
206
+ throw new RGY1Error("count", `utf8 ${count} in ${length}`);
207
+ break;
208
+ case SectionKind.COLUMN:
209
+ if (![1, 2, 4, 8].includes(elementWidth))
210
+ throw new RGY1Error("element-width", `column width ${elementWidth}`);
211
+ if (length !== count * elementWidth)
212
+ throw new RGY1Error("count", `column ${count} × ${elementWidth}`);
213
+ break;
214
+ default:
215
+ }
216
+ }
217
+ /**
218
+ * Reads the unsigned element at `index` of a section of width 1, 2 or 4.
219
+ */
220
+ export function element(section, index) {
221
+ switch (section.elementWidth) {
222
+ case 1:
223
+ return section.payload[index];
224
+ case 2:
225
+ return section.view.getUint16(index * 2, true);
226
+ default:
227
+ return section.view.getUint32(index * BYTES_PER_U32, true);
228
+ }
229
+ }
230
+ //# sourceMappingURL=reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reader.js","sourceRoot":"","sources":["../../lib/rgy1/reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACN,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,WAAW,GACX,MAAM,0BAA0B,CAAA;AA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IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,aAAa,EAAE,IAAI,CAAC,CAAA;IAC5D,CAAC;AACF,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The RGY1 section kinds. Generated from definitions/sections.json by tools/generate-sections.run.ts. Edit the
7
+ * definition rather than this file.
8
+ */
9
+ /**
10
+ * The four ASCII bytes an artifact starts with.
11
+ */
12
+ export declare const RGY1_MAGIC = "RGY1";
13
+ /**
14
+ * The envelope version this reader implements.
15
+ */
16
+ export declare const RGY1_VERSION = 1;
17
+ /**
18
+ * The byte offset of the header JSON, after the fixed envelope fields.
19
+ */
20
+ export declare const RGY1_HEADER_OFFSET = 32;
21
+ /**
22
+ * The byte length of one directory entry.
23
+ */
24
+ export declare const RGY1_DIRECTORY_ENTRY_BYTES = 24;
25
+ /**
26
+ * The alignment of the directory and of every section payload.
27
+ */
28
+ export declare const RGY1_ALIGNMENT = 8;
29
+ /**
30
+ * The section flag bit that marks a section required for interpretation.
31
+ */
32
+ export declare const RGY1_FLAG_REQUIRED = 1;
33
+ /**
34
+ * Each section kind's identifier, as the directory entry stores it.
35
+ */
36
+ export declare const SectionKind: {
37
+ readonly BITSET: 1;
38
+ readonly ID_TABLE: 2;
39
+ readonly STRING_OFFSETS: 3;
40
+ readonly UTF8: 4;
41
+ readonly COLUMN: 5;
42
+ readonly RELATION_OFFSETS: 6;
43
+ readonly RELATION_TARGETS: 7;
44
+ };
45
+ export type SectionKind = (typeof SectionKind)[keyof typeof SectionKind];
46
+ /**
47
+ * The encoding version each kind is written with.
48
+ */
49
+ export declare const SECTION_ENCODING: Readonly<Record<SectionKind, number>>;
50
+ /**
51
+ * Each kind's name, for diagnostics.
52
+ */
53
+ export declare const SECTION_NAME: Readonly<Record<SectionKind, string>>;
54
+ //# sourceMappingURL=sections.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sections.generated.d.ts","sourceRoot":"","sources":["../../lib/rgy1/sections.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU,SAAS,CAAA;AAEhC;;GAEG;AACH,eAAO,MAAM,YAAY,IAAI,CAAA;AAE7B;;GAEG;AACH,eAAO,MAAM,kBAAkB,KAAK,CAAA;AAEpC;;GAEG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAA;AAE5C;;GAEG;AACH,eAAO,MAAM,cAAc,IAAI,CAAA;AAE/B;;GAEG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAEnC;;GAEG;AACH,eAAO,MAAM,WAAW;aACvB,MAAM,EAAE,CAAC;aACT,QAAQ,EAAE,CAAC;aACX,cAAc,EAAE,CAAC;aACjB,IAAI,EAAE,CAAC;aACP,MAAM,EAAE,CAAC;aACT,gBAAgB,EAAE,CAAC;aACnB,gBAAgB,EAAE,CAAC;CACV,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAA;AAExE;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAQlE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAQ9D,CAAA"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The RGY1 section kinds. Generated from definitions/sections.json by tools/generate-sections.run.ts. Edit the
7
+ * definition rather than this file.
8
+ */
9
+ /**
10
+ * The four ASCII bytes an artifact starts with.
11
+ */
12
+ export const RGY1_MAGIC = "RGY1";
13
+ /**
14
+ * The envelope version this reader implements.
15
+ */
16
+ export const RGY1_VERSION = 1;
17
+ /**
18
+ * The byte offset of the header JSON, after the fixed envelope fields.
19
+ */
20
+ export const RGY1_HEADER_OFFSET = 32;
21
+ /**
22
+ * The byte length of one directory entry.
23
+ */
24
+ export const RGY1_DIRECTORY_ENTRY_BYTES = 24;
25
+ /**
26
+ * The alignment of the directory and of every section payload.
27
+ */
28
+ export const RGY1_ALIGNMENT = 8;
29
+ /**
30
+ * The section flag bit that marks a section required for interpretation.
31
+ */
32
+ export const RGY1_FLAG_REQUIRED = 1;
33
+ /**
34
+ * Each section kind's identifier, as the directory entry stores it.
35
+ */
36
+ export const SectionKind = {
37
+ BITSET: 1,
38
+ ID_TABLE: 2,
39
+ STRING_OFFSETS: 3,
40
+ UTF8: 4,
41
+ COLUMN: 5,
42
+ RELATION_OFFSETS: 6,
43
+ RELATION_TARGETS: 7,
44
+ };
45
+ /**
46
+ * The encoding version each kind is written with.
47
+ */
48
+ export const SECTION_ENCODING = {
49
+ [SectionKind.BITSET]: 1,
50
+ [SectionKind.ID_TABLE]: 1,
51
+ [SectionKind.STRING_OFFSETS]: 1,
52
+ [SectionKind.UTF8]: 1,
53
+ [SectionKind.COLUMN]: 1,
54
+ [SectionKind.RELATION_OFFSETS]: 1,
55
+ [SectionKind.RELATION_TARGETS]: 1,
56
+ };
57
+ /**
58
+ * Each kind's name, for diagnostics.
59
+ */
60
+ export const SECTION_NAME = {
61
+ [SectionKind.BITSET]: "bitset",
62
+ [SectionKind.ID_TABLE]: "id-table",
63
+ [SectionKind.STRING_OFFSETS]: "string-offsets",
64
+ [SectionKind.UTF8]: "utf8",
65
+ [SectionKind.COLUMN]: "column",
66
+ [SectionKind.RELATION_OFFSETS]: "relation-offsets",
67
+ [SectionKind.RELATION_TARGETS]: "relation-targets",
68
+ };
69
+ //# sourceMappingURL=sections.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sections.generated.js","sourceRoot":"","sources":["../../lib/rgy1/sections.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;A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C,EAAE,MAAM;IAC1B,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,QAAQ;IAC9B,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE,kBAAkB;IAClD,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE,kBAAkB;CAClD,CAAA"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Typed views over an artifact's sections: bitset, id table, column, string pool and relation.
7
+ */
8
+ import { type Artifact, type Section } from "#rgy1/reader";
9
+ /**
10
+ * A dense bitset over a key space.
11
+ */
12
+ export declare class BitsetView {
13
+ #private;
14
+ readonly arity: number;
15
+ constructor(section: Section);
16
+ static of(artifact: Artifact): BitsetView;
17
+ /**
18
+ * Whether `key` is a member.
19
+ * A key outside the space is not.
20
+ */
21
+ test(key: number): boolean;
22
+ /**
23
+ * Whether a code in its canonical spelling is a member.
24
+ * A code outside the grammar is not.
25
+ */
26
+ contains(code: string): boolean;
27
+ /**
28
+ * The number of set bits.
29
+ */
30
+ get size(): number;
31
+ }
32
+ /**
33
+ * A direct-address table from key to row id, with zero stored for absent.
34
+ */
35
+ export declare class IDTableView {
36
+ #private;
37
+ constructor(section: Section);
38
+ static of(artifact: Artifact, arity: number): IDTableView;
39
+ /**
40
+ * The row id for a key, or `-1` when absent.
41
+ */
42
+ get(key: number): number;
43
+ /**
44
+ * The row id for a code in its canonical spelling, or `-1`.
45
+ */
46
+ lookup(code: string): number;
47
+ }
48
+ /**
49
+ * A fixed-width record column.
50
+ */
51
+ export declare class ColumnView {
52
+ #private;
53
+ constructor(section: Section);
54
+ static of(artifact: Artifact, index: number): ColumnView;
55
+ get rows(): number;
56
+ /**
57
+ * An unsigned integer cell of width 1, 2 or 4.
58
+ */
59
+ integer(row: number): number;
60
+ /**
61
+ * A double cell.
62
+ */
63
+ double(row: number): number;
64
+ }
65
+ /**
66
+ * A string pool: offsets into a strict UTF-8 byte section, decoded on read.
67
+ */
68
+ export declare class StringPoolView {
69
+ #private;
70
+ constructor(offsets: Section, bytes: Section);
71
+ static of(artifact: Artifact): StringPoolView;
72
+ get size(): number;
73
+ /**
74
+ * The string at `index`, or `null` outside the pool.
75
+ */
76
+ get(index: number): string | null;
77
+ }
78
+ /**
79
+ * A relation from each source key to its target rows.
80
+ */
81
+ export declare class RelationView {
82
+ #private;
83
+ constructor(offsets: Section, targets: Section);
84
+ static of(artifact: Artifact, index: number): RelationView;
85
+ get sources(): number;
86
+ /**
87
+ * The target rows of one source key, as a fresh array.
88
+ */
89
+ targets(source: number): number[];
90
+ /**
91
+ * Writes the target rows of one source key into `out` and returns the count written,
92
+ * or `-1` when `out` is too small.
93
+ */
94
+ targetsInto(source: number, out: Uint32Array): number;
95
+ }
96
+ //# sourceMappingURL=views.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"views.d.ts","sourceRoot":"","sources":["../../lib/rgy1/views.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,KAAK,QAAQ,EAAsB,KAAK,OAAO,EAAE,MAAM,cAAc,CAAA;AAQ9E;;GAEG;AACH,qBAAa,UAAU;;IAEtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IAEtB,YAAY,OAAO,EAAE,OAAO,EAG3B;IAED,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAExC;IAED;;;OAGG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAMzB;IAED;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9B;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAajB;CACD;AAED;;GAEG;AACH,qBAAa,WAAW;;IAGvB,YAAY,OAAO,EAAE,OAAO,EAE3B;IAED,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,WAA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