@mailwoman/resolver 10.0.0 → 10.1.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 (134) hide show
  1. package/README.md +9 -7
  2. package/lib/admin/coherence-passes.ts +19 -160
  3. package/lib/admin/containment.ts +12 -30
  4. package/lib/admin/jp-municipality.ts +20 -13
  5. package/lib/admin/winner.ts +30 -62
  6. package/lib/backend-capabilities.ts +25 -24
  7. package/lib/bare-toponym-race.ts +69 -37
  8. package/lib/decorate-node.ts +17 -41
  9. package/lib/fold-name.ts +5 -18
  10. package/lib/index.ts +5 -9
  11. package/lib/plausibility.ts +35 -62
  12. package/lib/postcode/country-coherence.ts +64 -284
  13. package/lib/postcode/prefix.ts +20 -84
  14. package/lib/postcode/shape-coherence.ts +23 -113
  15. package/lib/remote-resolver.ts +32 -29
  16. package/lib/rerank.ts +34 -50
  17. package/lib/resolve/passes.ts +144 -147
  18. package/lib/resolve.ts +726 -0
  19. package/lib/span-rescore.ts +215 -172
  20. package/lib/street/evidence.ts +65 -73
  21. package/lib/street/tier.ts +33 -175
  22. package/lib/toponym-prior.ts +53 -179
  23. package/out/admin/coherence-passes.d.ts +17 -68
  24. package/out/admin/coherence-passes.d.ts.map +1 -1
  25. package/out/admin/coherence-passes.js +18 -160
  26. package/out/admin/coherence-passes.js.map +1 -1
  27. package/out/admin/containment.d.ts +11 -29
  28. package/out/admin/containment.d.ts.map +1 -1
  29. package/out/admin/containment.js +12 -30
  30. package/out/admin/containment.js.map +1 -1
  31. package/out/admin/jp-municipality.d.ts +20 -13
  32. package/out/admin/jp-municipality.d.ts.map +1 -1
  33. package/out/admin/jp-municipality.js +18 -12
  34. package/out/admin/jp-municipality.js.map +1 -1
  35. package/out/admin/winner.d.ts +30 -62
  36. package/out/admin/winner.d.ts.map +1 -1
  37. package/out/admin/winner.js +18 -51
  38. package/out/admin/winner.js.map +1 -1
  39. package/out/{admin/index.d.ts → admin.d.ts} +1 -1
  40. package/out/admin.d.ts.map +1 -0
  41. package/out/{admin/index.js → admin.js} +1 -1
  42. package/out/admin.js.map +1 -0
  43. package/out/backend-capabilities.d.ts +18 -19
  44. package/out/backend-capabilities.d.ts.map +1 -1
  45. package/out/backend-capabilities.js +25 -24
  46. package/out/backend-capabilities.js.map +1 -1
  47. package/out/bare-toponym-race.d.ts +54 -27
  48. package/out/bare-toponym-race.d.ts.map +1 -1
  49. package/out/bare-toponym-race.js +69 -37
  50. package/out/bare-toponym-race.js.map +1 -1
  51. package/out/decorate-node.d.ts +6 -8
  52. package/out/decorate-node.d.ts.map +1 -1
  53. package/out/decorate-node.js +17 -41
  54. package/out/decorate-node.js.map +1 -1
  55. package/out/fold-name.d.ts +5 -18
  56. package/out/fold-name.d.ts.map +1 -1
  57. package/out/fold-name.js +5 -18
  58. package/out/fold-name.js.map +1 -1
  59. package/out/index.d.ts +5 -6
  60. package/out/index.d.ts.map +1 -1
  61. package/out/index.js +5 -8
  62. package/out/index.js.map +1 -1
  63. package/out/plausibility.d.ts +27 -57
  64. package/out/plausibility.d.ts.map +1 -1
  65. package/out/plausibility.js +16 -49
  66. package/out/plausibility.js.map +1 -1
  67. package/out/postcode/country-coherence.d.ts +48 -162
  68. package/out/postcode/country-coherence.d.ts.map +1 -1
  69. package/out/postcode/country-coherence.js +19 -252
  70. package/out/postcode/country-coherence.js.map +1 -1
  71. package/out/postcode/prefix.d.ts +17 -68
  72. package/out/postcode/prefix.d.ts.map +1 -1
  73. package/out/postcode/prefix.js +8 -77
  74. package/out/postcode/prefix.js.map +1 -1
  75. package/out/postcode/shape-coherence.d.ts +17 -84
  76. package/out/postcode/shape-coherence.d.ts.map +1 -1
  77. package/out/postcode/shape-coherence.js +9 -105
  78. package/out/postcode/shape-coherence.js.map +1 -1
  79. package/out/{postcode/index.d.ts → postcode.d.ts} +1 -1
  80. package/out/postcode.d.ts.map +1 -0
  81. package/out/{postcode/index.js → postcode.js} +1 -1
  82. package/out/postcode.js.map +1 -0
  83. package/out/remote-resolver.d.ts +27 -28
  84. package/out/remote-resolver.d.ts.map +1 -1
  85. package/out/remote-resolver.js +9 -19
  86. package/out/remote-resolver.js.map +1 -1
  87. package/out/rerank.d.ts +28 -45
  88. package/out/rerank.d.ts.map +1 -1
  89. package/out/rerank.js +13 -38
  90. package/out/rerank.js.map +1 -1
  91. package/out/resolve/passes.d.ts +95 -85
  92. package/out/resolve/passes.d.ts.map +1 -1
  93. package/out/resolve/passes.js +40 -105
  94. package/out/resolve/passes.js.map +1 -1
  95. package/out/resolve.d.ts +15 -0
  96. package/out/resolve.d.ts.map +1 -0
  97. package/out/resolve.js +543 -0
  98. package/out/resolve.js.map +1 -0
  99. package/out/span-rescore.d.ts +51 -64
  100. package/out/span-rescore.d.ts.map +1 -1
  101. package/out/span-rescore.js +132 -130
  102. package/out/span-rescore.js.map +1 -1
  103. package/out/street/evidence.d.ts +56 -61
  104. package/out/street/evidence.d.ts.map +1 -1
  105. package/out/street/evidence.js +22 -46
  106. package/out/street/evidence.js.map +1 -1
  107. package/out/street/tier.d.ts +17 -29
  108. package/out/street/tier.d.ts.map +1 -1
  109. package/out/street/tier.js +27 -175
  110. package/out/street/tier.js.map +1 -1
  111. package/out/{street/index.d.ts → street.d.ts} +1 -1
  112. package/out/street.d.ts.map +1 -0
  113. package/out/{street/index.js → street.js} +1 -1
  114. package/out/street.js.map +1 -0
  115. package/out/toponym-prior.d.ts +21 -109
  116. package/out/toponym-prior.d.ts.map +1 -1
  117. package/out/toponym-prior.js +41 -170
  118. package/out/toponym-prior.js.map +1 -1
  119. package/package.json +44 -147
  120. package/lib/resolve/index.ts +0 -989
  121. package/out/admin/index.d.ts.map +0 -1
  122. package/out/admin/index.js.map +0 -1
  123. package/out/postcode/index.d.ts.map +0 -1
  124. package/out/postcode/index.js.map +0 -1
  125. package/out/resolve/index.d.ts +0 -20
  126. package/out/resolve/index.d.ts.map +0 -1
  127. package/out/resolve/index.js +0 -808
  128. package/out/resolve/index.js.map +0 -1
  129. package/out/street/index.d.ts.map +0 -1
  130. package/out/street/index.js.map +0 -1
  131. package/vitest.config.ts +0 -38
  132. /package/lib/{admin/index.ts → admin.ts} +0 -0
  133. /package/lib/{postcode/index.ts → postcode.ts} +0 -0
  134. /package/lib/{street/index.ts → street.ts} +0 -0
@@ -4,12 +4,14 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  * @file A compound Japanese municipality split into the two units the gazetteer keys separately.
6
6
  *
7
- * The JP model tags `神戸市西区` (city + ward) and `猿島郡五霞町` (county + town) as ONE `municipality` span, which is
8
- * the postal form, and WOF keys the city, the ward and the town — never the compound. Probed whole, the span misses
9
- * and the coordinate falls to the prefecture centroid (25–52 km on the JP board). Probed as its trailing unit
10
- * UNSCOPED it does worse: a bare `西区` resolves a namesake ward in another city (Kobe's answered Fukuoka's, 407 km;
11
- * 251 of 300 rows against 271 whole). The split is therefore consumed by the resolver walk as a SCOPED pair: the
12
- * head resolves first, the tail probes as its child, and a namesake outside the head is not admissible.
7
+ * The JP model tags `神戸市西区` (city plus ward) and `猿島郡五霞町` (county plus town) as one
8
+ * `municipality` span. This matches the postal form. WOF keys the city, ward and town separately.
9
+ * A whole-span probe misses, so the coordinate falls to the prefecture centroid. The JP board records
10
+ * errors of 25–52 km. An unscoped probe of the trailing unit performs worse. A bare `西区` resolves to a
11
+ * namesake ward in another city. In the test, Kobe's query resolves to Fukuoka, 407 km away.
12
+ * The split scores 251 of 300 rows, compared with 271 for the whole-span probe. The resolver uses the
13
+ * head and tail as a scoped pair. It resolves the head first, then probes the tail as its child.
14
+ * Candidate matching stays within the head scope.
13
15
  */
14
16
  const CITY_WARD = /^(.+?市)(.+区)$/u;
15
17
  const COUNTY_TOWN = /^(.+?郡)(.+[町村])$/u;
@@ -32,12 +34,16 @@ function stamp(pick, split, answered) {
32
34
  return pick ? { ...pick, metadata: { ...pick.metadata, municipality_split: { ...split, answered } } } : null;
33
35
  }
34
36
  /**
35
- * A compound municipality probed as a SCOPED pair after the whole span missed: the head under the node's own parent
36
- * with the walk's ordinary fallback, then the tail as the head's child with the parent fallback WITHHELD, so a namesake
37
- * ward or town outside the head is never admissible — including one the backend re-admits through its own region-scope
38
- * fallback (`regionScopeMiss`). A county head usually has no key; the tail then probes under the parent the walk
39
- * already holds. Answers the tail when it hits, else the head, else null. Two probes at most, each drawn from the
40
- * caller's budget (`hasBudget`).
37
+ * A compound municipality probed as a scoped pair after the whole span missed: the head under the
38
+ * node's own parent with the walk's ordinary fallback, then the tail as the head's child with
39
+ * the parent fallback withheld, so a namesake ward or town outside the head is never admissible,
40
+ * including one the backend re-admits through its own region-scope fallback (`regionScopeMiss`).
41
+ *
42
+ * A county head usually has no key.
43
+ * The tail then probes under the parent the walk already holds.
44
+ * Answers the tail when it hits, else the head, else null.
45
+ *
46
+ * Two probes at most, each drawn from the caller's budget (`hasBudget`).
41
47
  */
42
48
  export async function resolveCompoundMunicipality(value, parent, hasBudget, probe) {
43
49
  const split = compoundMunicipality(value);
@@ -1 +1 @@
1
- {"version":3,"file":"jp-municipality.js","sourceRoot":"","sources":["../../lib/admin/jp-municipality.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAcH,MAAM,SAAS,GAAG,gBAAgB,CAAA;AAClC,MAAM,WAAW,GAAG,mBAAmB,CAAA;AAEvC;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IACjD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;IAC5B,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAExC,IAAI,QAAQ,EAAE,CAAC;QACd,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAA;IACtE,CAAC;IAED,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAE5C,IAAI,UAAU,EAAE,C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KAAK,CAAC,CAAA;IAEzC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE;QAAE,OAAO,IAAI,CAAA;IAEvC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;IAElD,IAAI,CAAC,SAAS,EAAE;QAAE,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IAEnD,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,MAAM,EAAE,KAAK,CAAC,CAAA;IAEhE,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe;QAAE,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IAExE,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;AAClC,CAAC"}
@@ -2,81 +2,53 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- * @file Which resolved admin place answers the query — the one ordering whose postcode rung is not a constant.
5
+ * @file Which resolved admin place answers the query: the one ordering whose postcode rung is not a constant.
6
6
  *
7
- * `postalcode` is the only placetype whose specificity depends on the hit rather than the name. An NL PC6 or a GB unit
8
- * postcode covers ~8 and ~15 addresses, categorically tighter than any locality centroid; a US ZIP, a French code
9
- * postal or a German PLZ covers a delivery AREA. `PLACETYPE_SPECIFICITY` answers "which placetype covers less ground"
10
- * and cannot express that split, so a consumer that sorts by it alone promotes every postcode.
11
- *
12
- * Two consumers need the split in two shapes, and both live here so a divergence is a test failure rather than a
13
- * silent disagreement: result assembly walks a TAG ladder, and the eval harnesses sort resolved nodes by placetype.
7
+ * `postalcode` is the only placetype whose specificity depends on the resolved hit.
8
+ * `PLACETYPE_SPECIFICITY` cannot express that split.
14
9
  */
15
10
  import type { AddressNode } from "@mailwoman/core/decoder";
16
11
  /**
17
- * The admin fallback order when the postcode leads — a unit-grade exact hit, or an address system whose area-grade code
18
- * is still finer than its locality ({@link areaPostcodeLeadsLocality}).
19
- *
20
- * The JP rungs (`municipality`, `district`, `prefecture`) sit beside their Latin counterparts, and `municipality`
21
- * stands ABOVE `district` on purpose. `subregion` (a county, a Korean 시군구) sits between the postcode and `region`:
22
- * finer than the region it belongs to, coarser than any postcode. Absent from the ladder it was never the answer, and
23
- * `부산광역시 해운대구 반송로 910-1` resolved both nodes and reported Busan's point, 3.3 km from the address, over Haeundae's. It
24
- * stands ABOVE `district` on purpose: a district (大字 / 町名) resolves without its municipality as a parent more often
25
- * than not, and the unscoped namesake it then picks can be another prefecture's (`市原市大作` → 921 km). Measured on 300 JP
26
- * board rows @15 km: district-first 202 accepted, municipality-first 271.
12
+ * The admin fallback order when the postcode leads, with the JP rungs beside their
13
+ * Latin counterparts and `municipality` above `district`.
27
14
  */
28
15
  export declare const ADMIN_LADDER_POSTCODE_FIRST: ReadonlyArray<string>;
29
16
  /**
30
- * The admin fallback order everywhere else: the locality tiers lead and the postcode sits between them and `region`.
31
- *
32
- * This is the #945 epoch convention and the DEFAULT rather than the universal answer — which address systems leave it
33
- * is `AREA_POSTCODE_FINER_THAN_LOCALITY`'s question, and that table carries the per-country measurement.
17
+ * The admin fallback order everywhere else: the locality tiers lead
18
+ * and the postcode sits between them and `region`.
34
19
  */
35
20
  export declare const ADMIN_LADDER_LOCALITY_FIRST: ReadonlyArray<string>;
36
21
  /**
37
- * The resolved postcode a ladder decision reads: the PARSED span, the resolver's own hit, and the country the resolver
38
- * placed it in.
22
+ * The resolved postcode a ladder decision reads.
39
23
  *
40
- * The first two are needed together because a full unit shape the resolver answered with a coarser stem is area-grade,
41
- * whatever the user typed. `country` is separate evidence and answers a different question — not how tight this code
42
- * is, but whether this address system's codes are tighter than its localities at all.
24
+ * It contains the parsed span and the resolver hit.
25
+ * It also contains the country where the resolver placed the postcode.
43
26
  */
44
27
  export interface ResolvedPostcodeHit {
45
28
  value: string;
46
29
  resolverName: string | undefined;
47
30
  /**
48
- * ISO-3166 alpha-2 the RESOLVER placed the postcode in, not a caller's requested scope. Absent when the postcode did
49
- * not resolve to a country, which reads as the locality-first default.
31
+ * ISO-3166 alpha-2 code where the resolver placed the postcode.
32
+ *
33
+ * The code is independent of the caller's requested scope.
34
+ * It is absent when the postcode did not resolve to a country.
35
+ * The ladder then defaults to locality-first.
50
36
  */
51
37
  country?: string;
52
38
  }
53
39
  /**
54
- * Pick the admin fallback order for one resolved tree.
55
- *
56
- * Two independent routes to postcode-first: the code itself is unit-grade, or the address system's area-grade codes are
57
- * finer than its localities. Either one is sufficient and the second is what makes this per-country rather than
58
- * global.
40
+ * Pick the admin fallback order for one resolved tree: postcode-first when the code is
41
+ * unit-grade or the address system's area-grade codes are finer than its localities.
59
42
  */
60
43
  export declare function adminLadderFor(postcode: ResolvedPostcodeHit | undefined): ReadonlyArray<string>;
61
44
  /**
62
- * The ladder for a flat list of resolved nodes — the shape result assembly holds.
63
- *
64
- * Which node counts, and which of its fields the decision reads, is part of the ordering rather than the caller's
65
- * business: `country` is the one the RESOLVER placed the code in, never a caller's requested scope, because the ladder
66
- * is asking which address system this code belongs to and a scope is a filter on the answer rather than evidence about
67
- * it. Getting that wrong at a call site would be invisible.
45
+ * The ladder for a flat list of resolved nodes, reading `country` from the resolver's
46
+ * placement rather than a caller's requested scope.
68
47
  */
69
48
  export declare function adminLadderForNodes(nodes: readonly AddressNode[]): ReadonlyArray<string>;
70
49
  /**
71
- * Where an AREA-grade postal code sits on `PLACETYPE_SPECIFICITY`: below the whole locality tier, above `county` (2).
72
- *
73
- * The tier is `PLACETYPE_FILTER_GROUPS.locality` — `locality` (4), `borough` (5) and `localadmin` (3) — not the
74
- * `locality` placetype alone, because that is what the resolver's own `locality` tag expands to. New England civil
75
- * towns are `localadmin` in WOF, so a value between `locality` and `localadmin` would rank a US ZIP above the town it
76
- * sits in and reproduce the defect on exactly the rows that motivated the group.
77
- *
78
- * Deliberately not an integer. The scale's rungs are placetypes and this is not one — it is the position
79
- * {@link ADMIN_LADDER_LOCALITY_FIRST} puts a postcode in, expressed on the scale the sorting consumers already use.
50
+ * Deliberately non-integer position for an area-grade postal code on `PLACETYPE_SPECIFICITY`:
51
+ * below the whole locality tier and above `county` (2).
80
52
  */
81
53
  export declare const AREA_GRADE_POSTALCODE_SPECIFICITY = 2.5;
82
54
  /**
@@ -85,33 +57,29 @@ export declare const AREA_GRADE_POSTALCODE_SPECIFICITY = 2.5;
85
57
  export interface ResolvedSpecificityInput {
86
58
  placetype: string;
87
59
  /**
88
- * ISO-3166 alpha-2 the resolver placed this candidate in. Read only for a `postalcode`, where it decides whether the
89
- * address system's area-grade codes outrank its localities.
60
+ * ISO-3166 alpha-2 the resolver placed this candidate in, read only for a `postalcode`.
90
61
  */
91
62
  country?: string;
92
63
  /**
93
- * The parsed span. Absent for a non-postcode candidate, where nothing conditional applies.
64
+ * The parsed span.
65
+ * Absent for a non-postcode candidate.
94
66
  */
95
67
  value?: string;
96
68
  /**
97
- * The resolver's own hit name, as `resolver_name` metadata carries it.
69
+ * The resolver's own hit name, as recorded in `resolver_name` metadata.
98
70
  */
99
71
  resolverName?: string;
100
72
  }
101
73
  /**
102
- * Rank a resolved place for "whose coordinate answers the query" — `PLACETYPE_SPECIFICITY`, except that a `postalcode`
103
- * is ranked by its hit.
104
- *
105
- * An unranked placetype returns `-Infinity` so it wins only when nothing else resolved.
74
+ * Rank a resolved place for "whose coordinate answers the query": `PLACETYPE_SPECIFICITY`,
75
+ * except that a `postalcode` is ranked by its hit and an unranked placetype returns `-Infinity`.
106
76
  */
107
77
  export declare function resolvedSpecificity(candidate: ResolvedSpecificityInput): number;
108
78
  /**
109
- * The best of a resolved set under {@link resolvedSpecificity}, or `null` when the set is empty. Ties keep the first,
110
- * which is document order.
79
+ * The best of a resolved set under {@link resolvedSpecificity}, or `null` when the set is empty.
111
80
  *
112
- * `toInput` is explicit rather than structural because each consumer spells the resolver's hit differently — the eval
113
- * harnesses carry it as `name`, result assembly reads it off `resolver_name` metadata — and a projection at the call
114
- * site is where that mapping is visible.
81
+ * Ties keep the first.
82
+ * `toInput` is explicit because each consumer formats the resolver's hit differently.
115
83
  */
116
84
  export declare function mostSpecificResolved<T>(candidates: readonly T[], toInput: (candidate: T) => ResolvedSpecificityInput): T | null;
117
85
  //# sourceMappingURL=winner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"winner.d.ts","sourceRoot":"","sources":["../../lib/admin/winner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAG1D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,EAAE,aAAa,CAAC,MAAM,CAU7D,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,aAAa,CAAC,MAAM,CAU7D,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,mBAAmB,GAAG,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC,CAO/F;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,CAYxF;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iCAAiC,MAAM,CAAA;AAEpD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,SAAS,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;O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,YAAY,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,wBAAwB,GAAG,MAAM,CAU/E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACrC,UAAU,EAAE,SAAS,CAAC,EAAE,EACxB,OAAO,EAAE,CAAC,SAAS,EAAE,CAAC,KAAK,wBAAwB,GACjD,CAAC,GAAG,IAAI,CAcV"}
@@ -2,29 +2,16 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- * @file Which resolved admin place answers the query — the one ordering whose postcode rung is not a constant.
5
+ * @file Which resolved admin place answers the query: the one ordering whose postcode rung is not a constant.
6
6
  *
7
- * `postalcode` is the only placetype whose specificity depends on the hit rather than the name. An NL PC6 or a GB unit
8
- * postcode covers ~8 and ~15 addresses, categorically tighter than any locality centroid; a US ZIP, a French code
9
- * postal or a German PLZ covers a delivery AREA. `PLACETYPE_SPECIFICITY` answers "which placetype covers less ground"
10
- * and cannot express that split, so a consumer that sorts by it alone promotes every postcode.
11
- *
12
- * Two consumers need the split in two shapes, and both live here so a divergence is a test failure rather than a
13
- * silent disagreement: result assembly walks a TAG ladder, and the eval harnesses sort resolved nodes by placetype.
7
+ * `postalcode` is the only placetype whose specificity depends on the resolved hit.
8
+ * `PLACETYPE_SPECIFICITY` cannot express that split.
14
9
  */
15
10
  import { areaPostcodeLeadsLocality, isUnitGradePostcodeHit } from "@mailwoman/codex";
16
11
  import { PLACETYPE_SPECIFICITY } from "@mailwoman/core/resources/whosonfirst/specificity";
17
12
  /**
18
- * The admin fallback order when the postcode leads — a unit-grade exact hit, or an address system whose area-grade code
19
- * is still finer than its locality ({@link areaPostcodeLeadsLocality}).
20
- *
21
- * The JP rungs (`municipality`, `district`, `prefecture`) sit beside their Latin counterparts, and `municipality`
22
- * stands ABOVE `district` on purpose. `subregion` (a county, a Korean 시군구) sits between the postcode and `region`:
23
- * finer than the region it belongs to, coarser than any postcode. Absent from the ladder it was never the answer, and
24
- * `부산광역시 해운대구 반송로 910-1` resolved both nodes and reported Busan's point, 3.3 km from the address, over Haeundae's. It
25
- * stands ABOVE `district` on purpose: a district (大字 / 町名) resolves without its municipality as a parent more often
26
- * than not, and the unscoped namesake it then picks can be another prefecture's (`市原市大作` → 921 km). Measured on 300 JP
27
- * board rows @15 km: district-first 202 accepted, municipality-first 271.
13
+ * The admin fallback order when the postcode leads, with the JP rungs beside their
14
+ * Latin counterparts and `municipality` above `district`.
28
15
  */
29
16
  export const ADMIN_LADDER_POSTCODE_FIRST = [
30
17
  "postcode",
@@ -38,10 +25,8 @@ export const ADMIN_LADDER_POSTCODE_FIRST = [
38
25
  "country",
39
26
  ];
40
27
  /**
41
- * The admin fallback order everywhere else: the locality tiers lead and the postcode sits between them and `region`.
42
- *
43
- * This is the #945 epoch convention and the DEFAULT rather than the universal answer — which address systems leave it
44
- * is `AREA_POSTCODE_FINER_THAN_LOCALITY`'s question, and that table carries the per-country measurement.
28
+ * The admin fallback order everywhere else: the locality tiers lead
29
+ * and the postcode sits between them and `region`.
45
30
  */
46
31
  export const ADMIN_LADDER_LOCALITY_FIRST = [
47
32
  "locality",
@@ -55,11 +40,8 @@ export const ADMIN_LADDER_LOCALITY_FIRST = [
55
40
  "country",
56
41
  ];
57
42
  /**
58
- * Pick the admin fallback order for one resolved tree.
59
- *
60
- * Two independent routes to postcode-first: the code itself is unit-grade, or the address system's area-grade codes are
61
- * finer than its localities. Either one is sufficient and the second is what makes this per-country rather than
62
- * global.
43
+ * Pick the admin fallback order for one resolved tree: postcode-first when the code is
44
+ * unit-grade or the address system's area-grade codes are finer than its localities.
63
45
  */
64
46
  export function adminLadderFor(postcode) {
65
47
  if (postcode === undefined)
@@ -68,12 +50,8 @@ export function adminLadderFor(postcode) {
68
50
  return leads ? ADMIN_LADDER_POSTCODE_FIRST : ADMIN_LADDER_LOCALITY_FIRST;
69
51
  }
70
52
  /**
71
- * The ladder for a flat list of resolved nodes — the shape result assembly holds.
72
- *
73
- * Which node counts, and which of its fields the decision reads, is part of the ordering rather than the caller's
74
- * business: `country` is the one the RESOLVER placed the code in, never a caller's requested scope, because the ladder
75
- * is asking which address system this code belongs to and a scope is a filter on the answer rather than evidence about
76
- * it. Getting that wrong at a call site would be invisible.
53
+ * The ladder for a flat list of resolved nodes, reading `country` from the resolver's
54
+ * placement rather than a caller's requested scope.
77
55
  */
78
56
  export function adminLadderForNodes(nodes) {
79
57
  const node = nodes.find((n) => n.tag === "postcode" && n.lat != null && n.lon != null);
@@ -87,22 +65,13 @@ export function adminLadderForNodes(nodes) {
87
65
  });
88
66
  }
89
67
  /**
90
- * Where an AREA-grade postal code sits on `PLACETYPE_SPECIFICITY`: below the whole locality tier, above `county` (2).
91
- *
92
- * The tier is `PLACETYPE_FILTER_GROUPS.locality` — `locality` (4), `borough` (5) and `localadmin` (3) — not the
93
- * `locality` placetype alone, because that is what the resolver's own `locality` tag expands to. New England civil
94
- * towns are `localadmin` in WOF, so a value between `locality` and `localadmin` would rank a US ZIP above the town it
95
- * sits in and reproduce the defect on exactly the rows that motivated the group.
96
- *
97
- * Deliberately not an integer. The scale's rungs are placetypes and this is not one — it is the position
98
- * {@link ADMIN_LADDER_LOCALITY_FIRST} puts a postcode in, expressed on the scale the sorting consumers already use.
68
+ * Deliberately non-integer position for an area-grade postal code on `PLACETYPE_SPECIFICITY`:
69
+ * below the whole locality tier and above `county` (2).
99
70
  */
100
71
  export const AREA_GRADE_POSTALCODE_SPECIFICITY = 2.5;
101
72
  /**
102
- * Rank a resolved place for "whose coordinate answers the query" — `PLACETYPE_SPECIFICITY`, except that a `postalcode`
103
- * is ranked by its hit.
104
- *
105
- * An unranked placetype returns `-Infinity` so it wins only when nothing else resolved.
73
+ * Rank a resolved place for "whose coordinate answers the query": `PLACETYPE_SPECIFICITY`,
74
+ * except that a `postalcode` is ranked by its hit and an unranked placetype returns `-Infinity`.
106
75
  */
107
76
  export function resolvedSpecificity(candidate) {
108
77
  if (candidate.placetype !== "postalcode") {
@@ -113,12 +82,10 @@ export function resolvedSpecificity(candidate) {
113
82
  return leads ? (PLACETYPE_SPECIFICITY["postalcode"] ?? Number.NEGATIVE_INFINITY) : AREA_GRADE_POSTALCODE_SPECIFICITY;
114
83
  }
115
84
  /**
116
- * The best of a resolved set under {@link resolvedSpecificity}, or `null` when the set is empty. Ties keep the first,
117
- * which is document order.
85
+ * The best of a resolved set under {@link resolvedSpecificity}, or `null` when the set is empty.
118
86
  *
119
- * `toInput` is explicit rather than structural because each consumer spells the resolver's hit differently — the eval
120
- * harnesses carry it as `name`, result assembly reads it off `resolver_name` metadata — and a projection at the call
121
- * site is where that mapping is visible.
87
+ * Ties keep the first.
88
+ * `toInput` is explicit because each consumer formats the resolver's hit differently.
122
89
  */
123
90
  export function mostSpecificResolved(candidates, toInput) {
124
91
  let best = null;
@@ -1 +1 @@
1
- {"version":3,"file":"winner.js","sourceRoot":"","sources":["../../lib/admin/winner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAEpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AAEzF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAA0B;IACjE,UAAU;IACV,UAAU;IACV,cAAc;IACd,oBAAoB;IACpB,UAAU;IACV,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,SAAS;CACT,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAA0B;IACjE,UAAU;IACV,cAAc;IACd,oBAAoB;IACpB,UAAU;IACV,UAAU;IACV,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,SAAS;CACT,CAAA;AAoBD;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,QAAyC;IACvE,IAAI,QAAQ,KAAK,SAAS;QAAE,OAA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AAC,iBAAiB,CAAA;IAC9E,CAAC;IAED,MAAM,KAAK,GACV,sBAAsB,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,EAAE,SAAS,CAAC,YAAY,CAAC;QACrE,yBAAyB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IAE7C,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,YAAY,CAAC,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,iCAAiC,CAAA;AACrH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CACnC,UAAwB,EACxB,OAAmD;IAEnD,IAAI,IAAI,GAAa,IAAI,CAAA;IACzB,IAAI,QAAQ,GAAG,MAAM,CAAC,iBAAiB,CAAA;IAEvC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,mBAAmB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAA;QAEpD,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,GAAG,QAAQ,EAAE,CAAC;YACtC,IAAI,GAAG,SAAS,CAAA;YAChB,QAAQ,GAAG,IAAI,CAAA;QAChB,CAAC;IACF,CAAC;IAED,OAAO,IAAI,CAAA;AACZ,CAAC"}
@@ -7,4 +7,4 @@ export * from "#admin/coherence-passes";
7
7
  export * from "#admin/containment";
8
8
  export * from "#admin/jp-municipality";
9
9
  export * from "#admin/winner";
10
- //# sourceMappingURL=index.d.ts.map
10
+ //# sourceMappingURL=admin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../lib/admin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA"}
@@ -7,4 +7,4 @@ export * from "#admin/coherence-passes";
7
7
  export * from "#admin/containment";
8
8
  export * from "#admin/jp-municipality";
9
9
  export * from "#admin/winner";
10
- //# sourceMappingURL=index.js.map
10
+ //# sourceMappingURL=admin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin.js","sourceRoot":"","sources":["../lib/admin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA"}
@@ -3,35 +3,34 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Which optional {@link ResolverBackend} methods the loaded backend does not implement, and what each absence
7
- * silently costs.
6
+ * Lists optional {@link ResolverBackend} methods that the loaded backend lacks and the cost of each omission.
8
7
  *
9
- * `ancestors` and `coincidentLocalitiesFor` are optional on the backend contract, so a backend that omits them is
10
- * valid — but the resolver passes that lack through as a guard that simply returns. The option those guards serve
11
- * (`hierarchyCompletion`) defaults to ON, so a caller who never touched it gets a feature that reports success while
12
- * doing nothing. That is absence read as a negative answer, and the rule is that a magnitude never carries its own
13
- * absence: the gap has to be stated somewhere a caller can read it.
14
- *
15
- * This module states it. `describeCapabilityGaps` is pure and cheap enough to run at construction; the resolver
16
- * exposes the result on `Resolver.capabilityGaps` and warns once so the gap appears in a log without a caller having
17
- * to ask. It changes no resolution behavior — a gap that was silent is now legible, nothing more.
8
+ * Optional backend methods can make default-on resolver features no-op. This module exposes and
9
+ * reports those gaps without changing resolution behavior.
18
10
  */
19
11
  import type { BackendCapabilityGap, ResolverBackend } from "@mailwoman/core/resolver";
20
12
  /**
21
- * Enumerate the consequential capabilities this backend does not implement. Empty means every default-ON option the
22
- * resolver offers has the backend support it needs.
13
+ * Enumerate the consequential capabilities this backend does not implement.
14
+ *
15
+ * Empty means every default-on option the resolver offers has the backend support it needs.
23
16
  */
24
17
  export declare function describeCapabilityGaps(backend: ResolverBackend): readonly BackendCapabilityGap[];
25
18
  /**
26
- * One log line for a backend's whole set of gaps. Deliberately short: what is missing, which option that costs, and
27
- * where the consequences are written down. The per-gap `degrades` prose stays on the data for a consumer that wants it,
28
- * because a line long enough to carry it is a line an operator learns to skip.
19
+ * One log line for a backend's whole set of gaps.
20
+ *
21
+ * Keep the log line short.
22
+ * It states the missing methods and affected options.
23
+ *
24
+ * A reference points to the document that describes their consequences.
25
+ * Each gap's `degrades` field retains details for consumers.
26
+ * Long log lines are harder for operators to scan.
29
27
  */
30
28
  export declare function formatCapabilityGaps(gaps: readonly BackendCapabilityGap[]): string;
31
29
  /**
32
- * Report a backend's gaps to stderr the first time this process sees them. The gaps are data on
33
- * `Resolver.capabilityGaps` regardless; this exists so they also reach an operator who never thought to look. The line
34
- * disappears on its own once the backend implements the methods, so it cannot become permanent wallpaper.
30
+ * Report a backend's gaps to stderr the first time this process sees them.
31
+ *
32
+ * The gaps are data on `Resolver.capabilityGaps` regardless.
33
+ * This also reports them to an operator.
35
34
  */
36
35
  export declare function reportCapabilityGaps(gaps: readonly BackendCapabilityGap[]): void;
37
36
  //# sourceMappingURL=backend-capabilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"backend-capabilities.d.ts","sourceRoot":"","sources":["../lib/backend-capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAwBrF;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS,oBAAoB,EAAE,CAMhG;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,oBAAoB,EAAE,GAAG,MAAM,CAOlF;AAQD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,oBAAoB,EAAE,GAAG,IAAI,CAOhF"}
1
+ {"version":3,"file":"backend-capabilities.d.ts","sourceRoot":"","sources":["../lib/backend-capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AA0BrF;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS,oBAAoB,EAAE,CAMhG;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,oBAAoB,EAAE,GAAG,MAAM,CAOlF;AAQD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,oBAAoB,EAAE,GAAG,IAAI,CAOhF"}
@@ -3,23 +3,17 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Which optional {@link ResolverBackend} methods the loaded backend does not implement, and what each absence
7
- * silently costs.
6
+ * Lists optional {@link ResolverBackend} methods that the loaded backend lacks and the cost of each omission.
8
7
  *
9
- * `ancestors` and `coincidentLocalitiesFor` are optional on the backend contract, so a backend that omits them is
10
- * valid — but the resolver passes that lack through as a guard that simply returns. The option those guards serve
11
- * (`hierarchyCompletion`) defaults to ON, so a caller who never touched it gets a feature that reports success while
12
- * doing nothing. That is absence read as a negative answer, and the rule is that a magnitude never carries its own
13
- * absence: the gap has to be stated somewhere a caller can read it.
14
- *
15
- * This module states it. `describeCapabilityGaps` is pure and cheap enough to run at construction; the resolver
16
- * exposes the result on `Resolver.capabilityGaps` and warns once so the gap appears in a log without a caller having
17
- * to ask. It changes no resolution behavior — a gap that was silent is now legible, nothing more.
8
+ * Optional backend methods can make default-on resolver features no-op. This module exposes and
9
+ * reports those gaps without changing resolution behavior.
18
10
  */
19
11
  /**
20
- * The optional backend methods whose absence degrades a passing default, paired with what stops working. A method whose
21
- * absence is inert (or whose option is opt-in and therefore a deliberate caller choice) does not belong here — the list
22
- * exists to name silent degradation, not to inventory the interface.
12
+ * The optional backend methods whose absence degrades a passing default, paired with what stops working.
13
+ *
14
+ * A method whose absence is inert (or whose option is opt-in and therefore a
15
+ * deliberate caller choice) does not belong here.
16
+ * The list exists to name silent degradation rather than to inventory the interface.
23
17
  */
24
18
  const CONSEQUENTIAL_CAPABILITIES = [
25
19
  {
@@ -36,17 +30,23 @@ const CONSEQUENTIAL_CAPABILITIES = [
36
30
  },
37
31
  ];
38
32
  /**
39
- * Enumerate the consequential capabilities this backend does not implement. Empty means every default-ON option the
40
- * resolver offers has the backend support it needs.
33
+ * Enumerate the consequential capabilities this backend does not implement.
34
+ *
35
+ * Empty means every default-on option the resolver offers has the backend support it needs.
41
36
  */
42
37
  export function describeCapabilityGaps(backend) {
43
38
  const name = backend.constructor?.name || "backend";
44
39
  return CONSEQUENTIAL_CAPABILITIES.filter((c) => typeof backend[c.capability] !== "function").map((c) => ({ ...c, backend: name }));
45
40
  }
46
41
  /**
47
- * One log line for a backend's whole set of gaps. Deliberately short: what is missing, which option that costs, and
48
- * where the consequences are written down. The per-gap `degrades` prose stays on the data for a consumer that wants it,
49
- * because a line long enough to carry it is a line an operator learns to skip.
42
+ * One log line for a backend's whole set of gaps.
43
+ *
44
+ * Keep the log line short.
45
+ * It states the missing methods and affected options.
46
+ *
47
+ * A reference points to the document that describes their consequences.
48
+ * Each gap's `degrades` field retains details for consumers.
49
+ * Long log lines are harder for operators to scan.
50
50
  */
51
51
  export function formatCapabilityGaps(gaps) {
52
52
  const [first] = gaps;
@@ -56,14 +56,15 @@ export function formatCapabilityGaps(gaps) {
56
56
  return `[resolver] ${first?.backend} lacks ${names} — ${options} (${posture}) silently no-ops; see docs/engineering/reference/resolver-backends.mdx`;
57
57
  }
58
58
  /**
59
- * Backends already reported, so a process that builds many resolvers over one artifact — the eval harness, the
60
- * gauntlet, a batch worker — states the gap once rather than once per construction.
59
+ * Backends already reported, so a process that builds many resolvers over one artifact — the eval
60
+ * harness, the gauntlet, a batch worker — states the gap once rather than once per construction.
61
61
  */
62
62
  const reported = new Set();
63
63
  /**
64
- * Report a backend's gaps to stderr the first time this process sees them. The gaps are data on
65
- * `Resolver.capabilityGaps` regardless; this exists so they also reach an operator who never thought to look. The line
66
- * disappears on its own once the backend implements the methods, so it cannot become permanent wallpaper.
64
+ * Report a backend's gaps to stderr the first time this process sees them.
65
+ *
66
+ * The gaps are data on `Resolver.capabilityGaps` regardless.
67
+ * This also reports them to an operator.
67
68
  */
68
69
  export function reportCapabilityGaps(gaps) {
69
70
  const [first] = gaps;
@@ -1 +1 @@
1
- {"version":3,"file":"backend-capabilities.js","sourceRoot":"","sources":["../lib/backend-capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;;;GAIG;AACH,MAAM,0BAA0B,GAAyD;IACxF;QACC,UAAU,EAAE,WAAW;QACvB,MAAM,EAAE,qBAAqB;QAC7B,SAAS,EAAE,IAAI;QACf,QAAQ,EACP,gOAAgO;KACjO;IACD;QACC,UAAU,EAAE,yBAAyB;QACrC,MAAM,EAAE,qBAAqB;QAC7B,SAAS,EAAE,IAAI;QACf,QAAQ,EACP,+GAA+G;KAChH;CACD,CAAA;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAwB;IAC9D,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,IAAI,IAAI,SAAS,CAAA;IAEnD,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,UAAU,CAAC,CAAC,GAAG,CAC/F,CAAC,CAAC,EAAwB,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CACtD,CAAA;AACF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAqC;IACzE,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;IACpB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAA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