@opsinjs/react 0.0.0-stage → 0.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 (266) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +21 -0
  3. package/README.md +114 -2
  4. package/dist/components/accordion.d.ts +82 -0
  5. package/dist/components/accordion.d.ts.map +1 -0
  6. package/dist/components/accordion.js +154 -0
  7. package/dist/components/accordion.js.map +1 -0
  8. package/dist/components/alert-banner.d.ts +291 -0
  9. package/dist/components/alert-banner.d.ts.map +1 -0
  10. package/dist/components/alert-banner.js +529 -0
  11. package/dist/components/alert-banner.js.map +1 -0
  12. package/dist/components/avatar.d.ts +45 -0
  13. package/dist/components/avatar.d.ts.map +1 -0
  14. package/dist/components/avatar.js +159 -0
  15. package/dist/components/avatar.js.map +1 -0
  16. package/dist/components/badge.d.ts +78 -0
  17. package/dist/components/badge.d.ts.map +1 -0
  18. package/dist/components/badge.js +32 -0
  19. package/dist/components/badge.js.map +1 -0
  20. package/dist/components/body-map.d.ts +51 -0
  21. package/dist/components/body-map.d.ts.map +1 -0
  22. package/dist/components/body-map.js +190 -0
  23. package/dist/components/body-map.js.map +1 -0
  24. package/dist/components/button.d.ts +260 -0
  25. package/dist/components/button.d.ts.map +1 -0
  26. package/dist/components/button.js +609 -0
  27. package/dist/components/button.js.map +1 -0
  28. package/dist/components/callout.d.ts +99 -0
  29. package/dist/components/callout.d.ts.map +1 -0
  30. package/dist/components/callout.js +285 -0
  31. package/dist/components/callout.js.map +1 -0
  32. package/dist/components/card.d.ts +156 -0
  33. package/dist/components/card.d.ts.map +1 -0
  34. package/dist/components/card.js +396 -0
  35. package/dist/components/card.js.map +1 -0
  36. package/dist/components/care-card.d.ts +182 -0
  37. package/dist/components/care-card.d.ts.map +1 -0
  38. package/dist/components/care-card.js +544 -0
  39. package/dist/components/care-card.js.map +1 -0
  40. package/dist/components/checkbox.d.ts +58 -0
  41. package/dist/components/checkbox.d.ts.map +1 -0
  42. package/dist/components/checkbox.js +167 -0
  43. package/dist/components/checkbox.js.map +1 -0
  44. package/dist/components/combobox.d.ts +71 -0
  45. package/dist/components/combobox.d.ts.map +1 -0
  46. package/dist/components/combobox.js +204 -0
  47. package/dist/components/combobox.js.map +1 -0
  48. package/dist/components/consent-sheet.d.ts +186 -0
  49. package/dist/components/consent-sheet.d.ts.map +1 -0
  50. package/dist/components/consent-sheet.js +452 -0
  51. package/dist/components/consent-sheet.js.map +1 -0
  52. package/dist/components/dialog.d.ts +108 -0
  53. package/dist/components/dialog.d.ts.map +1 -0
  54. package/dist/components/dialog.js +573 -0
  55. package/dist/components/dialog.js.map +1 -0
  56. package/dist/components/disclaimer-note.d.ts +144 -0
  57. package/dist/components/disclaimer-note.d.ts.map +1 -0
  58. package/dist/components/disclaimer-note.js +486 -0
  59. package/dist/components/disclaimer-note.js.map +1 -0
  60. package/dist/components/divider.d.ts +76 -0
  61. package/dist/components/divider.d.ts.map +1 -0
  62. package/dist/components/divider.js +101 -0
  63. package/dist/components/divider.js.map +1 -0
  64. package/dist/components/dose-tracker.d.ts +137 -0
  65. package/dist/components/dose-tracker.d.ts.map +1 -0
  66. package/dist/components/dose-tracker.js +154 -0
  67. package/dist/components/dose-tracker.js.map +1 -0
  68. package/dist/components/empty-state.d.ts +171 -0
  69. package/dist/components/empty-state.d.ts.map +1 -0
  70. package/dist/components/empty-state.js +387 -0
  71. package/dist/components/empty-state.js.map +1 -0
  72. package/dist/components/field.d.ts +195 -0
  73. package/dist/components/field.d.ts.map +1 -0
  74. package/dist/components/field.js +282 -0
  75. package/dist/components/field.js.map +1 -0
  76. package/dist/components/goal-ring.d.ts +114 -0
  77. package/dist/components/goal-ring.d.ts.map +1 -0
  78. package/dist/components/goal-ring.js +254 -0
  79. package/dist/components/goal-ring.js.map +1 -0
  80. package/dist/components/icon-button.d.ts +124 -0
  81. package/dist/components/icon-button.d.ts.map +1 -0
  82. package/dist/components/icon-button.js +113 -0
  83. package/dist/components/icon-button.js.map +1 -0
  84. package/dist/components/link.d.ts +122 -0
  85. package/dist/components/link.d.ts.map +1 -0
  86. package/dist/components/link.js +164 -0
  87. package/dist/components/link.js.map +1 -0
  88. package/dist/components/log-sheet.d.ts +259 -0
  89. package/dist/components/log-sheet.d.ts.map +1 -0
  90. package/dist/components/log-sheet.js +437 -0
  91. package/dist/components/log-sheet.js.map +1 -0
  92. package/dist/components/menu.d.ts +69 -0
  93. package/dist/components/menu.d.ts.map +1 -0
  94. package/dist/components/menu.js +190 -0
  95. package/dist/components/menu.js.map +1 -0
  96. package/dist/components/metric-tile.d.ts +301 -0
  97. package/dist/components/metric-tile.d.ts.map +1 -0
  98. package/dist/components/metric-tile.js +533 -0
  99. package/dist/components/metric-tile.js.map +1 -0
  100. package/dist/components/number-field.d.ts +62 -0
  101. package/dist/components/number-field.d.ts.map +1 -0
  102. package/dist/components/number-field.js +134 -0
  103. package/dist/components/number-field.js.map +1 -0
  104. package/dist/components/popover.d.ts +70 -0
  105. package/dist/components/popover.d.ts.map +1 -0
  106. package/dist/components/popover.js +174 -0
  107. package/dist/components/popover.js.map +1 -0
  108. package/dist/components/progress.d.ts +83 -0
  109. package/dist/components/progress.d.ts.map +1 -0
  110. package/dist/components/progress.js +140 -0
  111. package/dist/components/progress.js.map +1 -0
  112. package/dist/components/questionnaire.d.ts +123 -0
  113. package/dist/components/questionnaire.d.ts.map +1 -0
  114. package/dist/components/questionnaire.js +148 -0
  115. package/dist/components/questionnaire.js.map +1 -0
  116. package/dist/components/radio-group.d.ts +66 -0
  117. package/dist/components/radio-group.d.ts.map +1 -0
  118. package/dist/components/radio-group.js +186 -0
  119. package/dist/components/radio-group.js.map +1 -0
  120. package/dist/components/range-bar.d.ts +172 -0
  121. package/dist/components/range-bar.d.ts.map +1 -0
  122. package/dist/components/range-bar.js +578 -0
  123. package/dist/components/range-bar.js.map +1 -0
  124. package/dist/components/range-legend.d.ts +97 -0
  125. package/dist/components/range-legend.d.ts.map +1 -0
  126. package/dist/components/range-legend.js +166 -0
  127. package/dist/components/range-legend.js.map +1 -0
  128. package/dist/components/reading-input.d.ts +225 -0
  129. package/dist/components/reading-input.d.ts.map +1 -0
  130. package/dist/components/reading-input.js +651 -0
  131. package/dist/components/reading-input.js.map +1 -0
  132. package/dist/components/relative-time.d.ts +177 -0
  133. package/dist/components/relative-time.d.ts.map +1 -0
  134. package/dist/components/relative-time.js +603 -0
  135. package/dist/components/relative-time.js.map +1 -0
  136. package/dist/components/result-card.d.ts +319 -0
  137. package/dist/components/result-card.d.ts.map +1 -0
  138. package/dist/components/result-card.js +614 -0
  139. package/dist/components/result-card.js.map +1 -0
  140. package/dist/components/scale-input.d.ts +58 -0
  141. package/dist/components/scale-input.d.ts.map +1 -0
  142. package/dist/components/scale-input.js +170 -0
  143. package/dist/components/scale-input.js.map +1 -0
  144. package/dist/components/score-dial.d.ts +205 -0
  145. package/dist/components/score-dial.d.ts.map +1 -0
  146. package/dist/components/score-dial.js +728 -0
  147. package/dist/components/score-dial.js.map +1 -0
  148. package/dist/components/scroll-area.d.ts +38 -0
  149. package/dist/components/scroll-area.d.ts.map +1 -0
  150. package/dist/components/scroll-area.js +138 -0
  151. package/dist/components/scroll-area.js.map +1 -0
  152. package/dist/components/segmented-control.d.ts +69 -0
  153. package/dist/components/segmented-control.d.ts.map +1 -0
  154. package/dist/components/segmented-control.js +259 -0
  155. package/dist/components/segmented-control.js.map +1 -0
  156. package/dist/components/select.d.ts +72 -0
  157. package/dist/components/select.d.ts.map +1 -0
  158. package/dist/components/select.js +205 -0
  159. package/dist/components/select.js.map +1 -0
  160. package/dist/components/sheet.d.ts +192 -0
  161. package/dist/components/sheet.d.ts.map +1 -0
  162. package/dist/components/sheet.js +952 -0
  163. package/dist/components/sheet.js.map +1 -0
  164. package/dist/components/skeleton.d.ts +104 -0
  165. package/dist/components/skeleton.d.ts.map +1 -0
  166. package/dist/components/skeleton.js +266 -0
  167. package/dist/components/skeleton.js.map +1 -0
  168. package/dist/components/slider.d.ts +55 -0
  169. package/dist/components/slider.d.ts.map +1 -0
  170. package/dist/components/slider.js +170 -0
  171. package/dist/components/slider.js.map +1 -0
  172. package/dist/components/source-citation.d.ts +127 -0
  173. package/dist/components/source-citation.d.ts.map +1 -0
  174. package/dist/components/source-citation.js +391 -0
  175. package/dist/components/source-citation.js.map +1 -0
  176. package/dist/components/spinner.d.ts +86 -0
  177. package/dist/components/spinner.d.ts.map +1 -0
  178. package/dist/components/spinner.js +97 -0
  179. package/dist/components/spinner.js.map +1 -0
  180. package/dist/components/status-pill.d.ts +90 -0
  181. package/dist/components/status-pill.d.ts.map +1 -0
  182. package/dist/components/status-pill.js +259 -0
  183. package/dist/components/status-pill.js.map +1 -0
  184. package/dist/components/stepper.d.ts +99 -0
  185. package/dist/components/stepper.d.ts.map +1 -0
  186. package/dist/components/stepper.js +152 -0
  187. package/dist/components/stepper.js.map +1 -0
  188. package/dist/components/surface.d.ts +92 -0
  189. package/dist/components/surface.d.ts.map +1 -0
  190. package/dist/components/surface.js +261 -0
  191. package/dist/components/surface.js.map +1 -0
  192. package/dist/components/switch.d.ts +48 -0
  193. package/dist/components/switch.d.ts.map +1 -0
  194. package/dist/components/switch.js +152 -0
  195. package/dist/components/switch.js.map +1 -0
  196. package/dist/components/symptom-picker.d.ts +69 -0
  197. package/dist/components/symptom-picker.d.ts.map +1 -0
  198. package/dist/components/symptom-picker.js +170 -0
  199. package/dist/components/symptom-picker.js.map +1 -0
  200. package/dist/components/tab-bar.d.ts +110 -0
  201. package/dist/components/tab-bar.d.ts.map +1 -0
  202. package/dist/components/tab-bar.js +118 -0
  203. package/dist/components/tab-bar.js.map +1 -0
  204. package/dist/components/table.d.ts +117 -0
  205. package/dist/components/table.d.ts.map +1 -0
  206. package/dist/components/table.js +65 -0
  207. package/dist/components/table.js.map +1 -0
  208. package/dist/components/tabs.d.ts +106 -0
  209. package/dist/components/tabs.d.ts.map +1 -0
  210. package/dist/components/tabs.js +136 -0
  211. package/dist/components/tabs.js.map +1 -0
  212. package/dist/components/term.d.ts +243 -0
  213. package/dist/components/term.d.ts.map +1 -0
  214. package/dist/components/term.js +562 -0
  215. package/dist/components/term.js.map +1 -0
  216. package/dist/components/textarea.d.ts +157 -0
  217. package/dist/components/textarea.d.ts.map +1 -0
  218. package/dist/components/textarea.js +66 -0
  219. package/dist/components/textarea.js.map +1 -0
  220. package/dist/components/timeline-entry.d.ts +99 -0
  221. package/dist/components/timeline-entry.d.ts.map +1 -0
  222. package/dist/components/timeline-entry.js +47 -0
  223. package/dist/components/timeline-entry.js.map +1 -0
  224. package/dist/components/toast.d.ts +80 -0
  225. package/dist/components/toast.d.ts.map +1 -0
  226. package/dist/components/toast.js +266 -0
  227. package/dist/components/toast.js.map +1 -0
  228. package/dist/components/tooltip.d.ts +48 -0
  229. package/dist/components/tooltip.d.ts.map +1 -0
  230. package/dist/components/tooltip.js +159 -0
  231. package/dist/components/tooltip.js.map +1 -0
  232. package/dist/components/trend-sparkline.d.ts +188 -0
  233. package/dist/components/trend-sparkline.d.ts.map +1 -0
  234. package/dist/components/trend-sparkline.js +796 -0
  235. package/dist/components/trend-sparkline.js.map +1 -0
  236. package/dist/components/value.d.ts +150 -0
  237. package/dist/components/value.d.ts.map +1 -0
  238. package/dist/components/value.js +402 -0
  239. package/dist/components/value.js.map +1 -0
  240. package/dist/components/visually-hidden.d.ts +61 -0
  241. package/dist/components/visually-hidden.d.ts.map +1 -0
  242. package/dist/components/visually-hidden.js +172 -0
  243. package/dist/components/visually-hidden.js.map +1 -0
  244. package/dist/index.d.ts +63 -0
  245. package/dist/index.d.ts.map +1 -0
  246. package/dist/index.js +72 -0
  247. package/dist/index.js.map +1 -0
  248. package/dist/opsinjs.d.ts +443 -0
  249. package/dist/opsinjs.d.ts.map +1 -0
  250. package/dist/opsinjs.js +906 -0
  251. package/dist/opsinjs.js.map +1 -0
  252. package/dist/status.d.ts +111 -0
  253. package/dist/status.d.ts.map +1 -0
  254. package/dist/status.js +125 -0
  255. package/dist/status.js.map +1 -0
  256. package/dist/styles.css +2 -0
  257. package/dist/utils.d.ts +20 -0
  258. package/dist/utils.d.ts.map +1 -0
  259. package/dist/utils.js +82 -0
  260. package/dist/utils.js.map +1 -0
  261. package/package.json +86 -3
  262. package/styles/base.css +132 -0
  263. package/styles/roles.css +412 -0
  264. package/styles/standalone.css +20 -0
  265. package/styles/tailwind.css +18 -0
  266. package/styles/theme.css +309 -0
@@ -0,0 +1,603 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * RelativeTime shows when something happened, in the words a person would use,
4
+ * with the exact instant never more than one element away.
5
+ *
6
+ * IT SHIPS NO STALENESS DEFAULT. That is not an omission, it is the component.
7
+ * What counts as old is a property of the measurement and of the person it
8
+ * belongs to, and a window that is right for one measurement is wrong for the
9
+ * next. So no number is written here, not even as an illustration: no fallback,
10
+ * no per-event default, and nothing inferred from `event`. If the product has
11
+ * not said what stale means for this measurement, this component does not know,
12
+ * and it renders the time with no verdict attached. A verdict with no author is
13
+ * the one thing a formatter must never manufacture, and "readings older than N
14
+ * hours are stale" is a clinical claim wherever N comes from.
15
+ *
16
+ * The one default this file does hold is `absoluteAfterDays`, and it is not a
17
+ * staleness number: it decides only when the exact date joins the relative
18
+ * phrase on screen, so that a recent reading shows the phrase alone and an
19
+ * older one shows the date beside it, and it can neither add, remove nor move a
20
+ * verdict. The demo in apps/www/registry/demos/relative-time.tsx and both
21
+ * worked examples pass no threshold at all, so the muted stale treatment
22
+ * appears in no preview opsinjs ships. That is the cost of not owning a number,
23
+ * and it is the right price.
24
+ *
25
+ * IT IS A SERVER COMPONENT, IT DOES NOT TICK, AND IT NEVER READS THE CLOCK.
26
+ * All three follow from one decision. A relative phrase recomputed in the
27
+ * browser produces a hydration mismatch by construction. The server's
28
+ * "3 minutes ago" and the client's are two different sentences about one
29
+ * instant, and the usual repairs are worse than the defect:
30
+ * `suppressHydrationWarning` keeps the SERVER's text and discards the client's
31
+ * more correct one, and a `setInterval` per timestamp rewrites a health surface
32
+ * silently, in a component the specification forbids from being a live region.
33
+ * So there is no `"use client"` here, no hook, no timer and no `typeof window`
34
+ * branch. There is no `Date.now()` either, which is why `now` is a required
35
+ * prop.
36
+ *
37
+ * That last part is not fastidiousness. `Date.now()` in a render body is an
38
+ * impure call, this repository's lint says so on every commit, and the impurity
39
+ * has two visible consequences: a list of twenty timestamps reads the clock
40
+ * twenty times and can straddle a minute boundary halfway down, and a component
41
+ * whose output depends on when React happened to call it cannot be compared
42
+ * with itself between two renders. Taking `now` from the caller puts the one
43
+ * impure read where it belongs, which is once per screen, in the page that is
44
+ * already rendering at a known instant. That makes every timestamp on that
45
+ * screen agree with every other.
46
+ *
47
+ * The honest consequence, stated here because it is stated on the page: a
48
+ * surface left open for an hour still shows the phrase it was rendered with.
49
+ * Four things stop that from being a lie rather than a limitation. The `time`
50
+ * element's `datetime` always carries the exact instant, unrounded. Within a
51
+ * day the phrase alone is on screen, because a recent time is what a relative
52
+ * phrase is for, and the exact date and time join it on screen once the reading
53
+ * is older than a day, where counting backwards from a phrase would start to
54
+ * cost the reader. The absolute date and time are always in the accessibility
55
+ * tree, and in print, whether or not they are on screen, so what can go out of
56
+ * date is never all a reader has. And the phrase is rounded DOWN at every rung
57
+ * while the staleness verdict is computed from the exact elapsed time, so a
58
+ * stale reading is never made to look fresh by rounding. A product whose surface
59
+ * stays open across its own staleness boundary re-renders with a fresh `now`;
60
+ * this component will not do it behind the product's back.
61
+ *
62
+ * IT DERIVES NOTHING ABOUT THE READING ITSELF. It does not know what was
63
+ * measured, it never colours from either axis, and the stale treatment is a
64
+ * muted typographic change plus explicit words. It is never an amber tint,
65
+ * which would put a clinical status onto a fact about the clock.
66
+ */
67
+ import { isDevelopment } from "../opsinjs.js";
68
+ import { cn } from "../utils.js";
69
+ /**
70
+ * The word each event is written with.
71
+ *
72
+ * `Record<TimeEvent, string>` on purpose: adding a member to the union without
73
+ * writing its word is a compile error rather than a timestamp that renders with
74
+ * no prefix. The five words are English and are not translated by `locale`.
75
+ * `locale` governs numbers and dates, which are the parts Intl owns. That gap
76
+ * is named on the page rather than papered over with a prop that would also let
77
+ * a caller relabel `synced` as *updated*, which is the error above with a
78
+ * friendlier face.
79
+ */
80
+ const EVENT_WORDS = {
81
+ measured: "Measured",
82
+ recorded: "Recorded",
83
+ received: "Received",
84
+ synced: "Synced",
85
+ issued: "Issued",
86
+ };
87
+ /**
88
+ * The words that appear past the product's own threshold.
89
+ *
90
+ * Deliberately hedged, and deliberately about the data rather than about the
91
+ * person: the component knows that a reading is older than a boundary somebody
92
+ * else set, and nothing more than that. It does not know that the reading is
93
+ * wrong, and it must not say *out of date* as a fact.
94
+ */
95
+ const STALENESS_WORDS = "may be out of date";
96
+ const MINUTE_MS = 60_000;
97
+ const HOUR_MS = 3_600_000;
98
+ const DAY_MS = 86_400_000;
99
+ /**
100
+ * When the exact date joins the phrase on screen, if the product has not chosen.
101
+ *
102
+ * THIS IS NOT A STALENESS DEFAULT, and the distinction is the reason the two
103
+ * are separate props. It decides only when the exact date comes onto the screen
104
+ * beside the relative phrase; it says nothing about whether the reading can
105
+ * still be relied on, it never adds or removes the staleness note, and moving it
106
+ * cannot change a verdict. A day is the default because
107
+ * content/numbers-dates-and-time keeps a relative phrase for recency within a
108
+ * day and switches to the absolute date beyond about a day: a reading taken
109
+ * within the day shows the phrase alone, and an older one shows the date beside
110
+ * it so nobody has to count backwards from a phrase standing on its own. The
111
+ * exact date is in the accessibility tree and in print at every age, so this
112
+ * default moves only what a sighted reader sees. `absoluteAfterDays` moves it.
113
+ */
114
+ const DEFAULT_ABSOLUTE_AFTER_DAYS = 1;
115
+ /**
116
+ * RFC 3339, with the offset required.
117
+ *
118
+ * "A timestamp with no offset is not a timestamp" is the specification's line
119
+ * and this pattern is where it is enforced. It matters more than it reads:
120
+ * `new Date("2026-03-14T08:12:00")` is parsed in the RUNTIME's zone, so the
121
+ * same string is a different instant on a London laptop and a UTC server, and
122
+ * the component would render two different ages for one reading with no
123
+ * complaint from anything. A space in place of the `T`, a lower-case `z` and a
124
+ * `+0100` offset are all accepted because databases emit all three; a bare date
125
+ * and a floating local time are refused.
126
+ */
127
+ const RFC_3339 = /^(\d{4})-(\d{2})-(\d{2})[Tt ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(?:([Zz])|([+-])(\d{2}):?(\d{2}))$/;
128
+ /* ------------------------------------------------------------------ *
129
+ * The development warning channel *
130
+ * ------------------------------------------------------------------ */
131
+ /**
132
+ * Every complaint already printed this session.
133
+ *
134
+ * `warnOnce()` in ../opsinjs.ts is the channel a component reaches for, and it
135
+ * is keyed to `tokens/errors.json`, which has no code for a malformed
136
+ * timestamp: the twenty-one codes are about colour axes, ranges, thresholds and
137
+ * status levels. The nearest of them, OPSIN-0016, is about a reading rendered
138
+ * with NO staleness treatment, which is the one outcome the branches below are
139
+ * written to avoid. So it is the wrong complaint rather than an approximate
140
+ * one. Adding OPSIN-0022 is a `tokens/errors.json` change and belongs in the
141
+ * same commit as a generator run, which this file may not do. So this is the
142
+ * same discipline in the same shape, bounded and development-only, and it
143
+ * collapses back into `warnOnce()` the day the code exists.
144
+ */
145
+ let reported;
146
+ /**
147
+ * Where the channel stops rather than grows.
148
+ *
149
+ * `warnOnce()` caps the whole system at 500 distinct keys; this is one
150
+ * component's private channel and a narrower cap is right for it. What is
151
+ * copied from `warnOnce()` is the part that matters: on reaching the cap it says
152
+ * once that it has gone quiet, because a channel that falls silent without
153
+ * saying so is read as a channel with nothing left to report.
154
+ */
155
+ const MAX_REPORTS = 50;
156
+ /** Not a real message. It only records that the cap notice has been printed. */
157
+ const CAP_NOTICE = "\u0000cap";
158
+ /**
159
+ * Report a caller-side defect in development, once per distinct message, and do
160
+ * nothing else. Nothing here throws: a health product must not be taken down by
161
+ * a complaint about how it formatted a date.
162
+ */
163
+ function report(message) {
164
+ if (!isDevelopment())
165
+ return;
166
+ if (reported === undefined)
167
+ reported = new Set();
168
+ if (reported.has(message))
169
+ return;
170
+ let text = message;
171
+ if (reported.size >= MAX_REPORTS) {
172
+ if (reported.has(CAP_NOTICE))
173
+ return;
174
+ reported.add(CAP_NOTICE);
175
+ text =
176
+ `has reported ${MAX_REPORTS} distinct defects in this session and is now ` +
177
+ "quiet. Fix what is already reported, or reload to start counting again.";
178
+ }
179
+ else {
180
+ reported.add(message);
181
+ }
182
+ try {
183
+ console.warn(`[opsinjs] <RelativeTime> ${text}`);
184
+ }
185
+ catch {
186
+ /* A patched console is not a reason to take a health product down. */
187
+ }
188
+ }
189
+ /* ------------------------------------------------------------------ *
190
+ * Parsing and formatting *
191
+ * ------------------------------------------------------------------ */
192
+ /**
193
+ * The timestamp as an instant plus its offset, or `null` if it is not one.
194
+ *
195
+ * Built from the matched fields with `Date.UTC` rather than handed to the
196
+ * `Date` constructor, so the result cannot depend on the runtime's own zone or
197
+ * on how forgiving its parser is. The round trip at the end is what rejects
198
+ * 31 February: `Date.UTC` rolls an impossible date forward without complaint,
199
+ * and a reading dated to a day that does not exist is a data defect worth
200
+ * refusing rather than silently moving.
201
+ */
202
+ function parseInstant(text) {
203
+ const match = RFC_3339.exec(text);
204
+ if (match === null)
205
+ return null;
206
+ /* Widened on purpose. A `RegExpExecArray` is typed as an array of strings, so
207
+ an optional group reads as `string` and `=== undefined` is a type error on a
208
+ value that is undefined at run time roughly half the time. */
209
+ const fields = match;
210
+ const year = Number(fields[1]);
211
+ const month = Number(fields[2]);
212
+ const day = Number(fields[3]);
213
+ const hour = Number(fields[4]);
214
+ const minute = Number(fields[5]);
215
+ const second = fields[6] === undefined ? 0 : Number(fields[6]);
216
+ /* Sub-second precision is parsed so that it is not a syntax error, and then
217
+ truncated to milliseconds, which is all `Date` can hold. Nothing this
218
+ component renders is finer than a minute. */
219
+ const ms = fields[7] === undefined ? 0 : Number(`${fields[7]}000`.slice(0, 3));
220
+ if (month < 1 || month > 12 || day < 1 || day > 31)
221
+ return null;
222
+ if (hour > 23 || minute > 59 || second > 59)
223
+ return null;
224
+ let offsetMinutes = 0;
225
+ if (fields[8] === undefined) {
226
+ const offsetHours = Number(fields[10]);
227
+ const offsetRest = Number(fields[11]);
228
+ if (offsetHours > 23 || offsetRest > 59)
229
+ return null;
230
+ offsetMinutes = (fields[9] === "-" ? -1 : 1) * (offsetHours * 60 + offsetRest);
231
+ }
232
+ const wallClock = Date.UTC(year, month - 1, day, hour, minute, second, ms);
233
+ if (!Number.isFinite(wallClock))
234
+ return null;
235
+ const check = new Date(wallClock);
236
+ if (check.getUTCFullYear() !== year ||
237
+ check.getUTCMonth() !== month - 1 ||
238
+ check.getUTCDate() !== day) {
239
+ return null;
240
+ }
241
+ return { epochMs: wallClock - offsetMinutes * MINUTE_MS, offsetMinutes };
242
+ }
243
+ /**
244
+ * Whether a value is one of the five events.
245
+ *
246
+ * It exists because this file ships as source into JavaScript projects, where
247
+ * `event` is whatever the caller passed. Without the guard the component would
248
+ * index the word table with a string that is not in it, render a timestamp with
249
+ * no prefix, and produce exactly the bare relative phrase the specification
250
+ * refuses.
251
+ */
252
+ function isTimeEvent(value) {
253
+ return typeof value === "string" && value in EVENT_WORDS;
254
+ }
255
+ /**
256
+ * The caller's language tag, or `undefined` where it is not a language tag.
257
+ *
258
+ * `Intl` throws a `RangeError` on a malformed tag, and it throws it during
259
+ * render. A component that takes a screen down because a locale arrived as
260
+ * `"en_GB"` from a settings table has turned a cosmetic defect into an outage,
261
+ * so the tag is checked once and the runtime's own default is used instead.
262
+ */
263
+ function usableLocale(locale) {
264
+ if (locale === undefined)
265
+ return undefined;
266
+ try {
267
+ Intl.getCanonicalLocales(locale);
268
+ return locale;
269
+ }
270
+ catch {
271
+ report(`\`locale="${locale}"\` is not a BCP 47 language tag, so the date and the ` +
272
+ "phrase were formatted with the runtime's default instead. A tag looks " +
273
+ 'like "en-GB", with a hyphen.');
274
+ return undefined;
275
+ }
276
+ }
277
+ /**
278
+ * The caller's IANA time zone, or `undefined` where it is not a usable one.
279
+ *
280
+ * Two failures have to be caught here, not one. `Intl` throws a `RangeError` on
281
+ * a zone it cannot parse at all, such as "GMT+1" or "Not/AZone", and it throws
282
+ * it during render, so a settings row holding one would take a health screen
283
+ * down. But `Intl` also SILENTLY accepts far more than IANA names: a legacy
284
+ * abbreviation does not throw, it resolves to an unrelated zone. On Node 24
285
+ * "BST" resolves to Asia/Dhaka and "EST" to America/Panama, so a reading stored
286
+ * in UTC would render on a Dhaka or Panama wall clock with no label to warn the
287
+ * reader, which is the confidently-wrong time this prop exists to refuse.
288
+ *
289
+ * So the tag is not merely parsed, it is round-tripped: a name is usable only
290
+ * when `Intl` renders it back as itself. That accepts "Europe/London" and its
291
+ * case variants and refuses "BST", "EST" and "US/Pacific". The trade-off is
292
+ * that a genuine legacy alias `Intl` rewrites to a different canonical spelling,
293
+ * "US/Pacific" to America/Los_Angeles and "Asia/Kolkata" to Asia/Calcutta on
294
+ * this runtime, is refused as well and takes the fallback. That is the safe
295
+ * half: the fallback writes the correct instant in the timestamp's own offset
296
+ * with that offset named, never a wrong time. An offset such as "+01:00" parses
297
+ * and round-trips, so it is rejected before the round trip: it is not an IANA
298
+ * name and an offset zone is not portable across runtimes. It never throws.
299
+ */
300
+ function usableTimeZone(timeZone) {
301
+ if (timeZone === undefined)
302
+ return undefined;
303
+ if (timeZone.startsWith("+") || timeZone.startsWith("-")) {
304
+ report(`\`timeZone="${timeZone}"\` is an offset, not an IANA name, so the exact ` +
305
+ "date was written in the timestamp's own offset instead, with that offset " +
306
+ 'named. It takes an IANA name, like "Europe/London".');
307
+ return undefined;
308
+ }
309
+ let resolved;
310
+ try {
311
+ resolved = new Intl.DateTimeFormat(undefined, { timeZone }).resolvedOptions()
312
+ .timeZone;
313
+ }
314
+ catch {
315
+ report(`\`timeZone="${timeZone}"\` is not a time zone Intl recognises, so the exact ` +
316
+ "date was written in the timestamp's own offset instead, with that offset " +
317
+ 'named. It takes an IANA name, like "Europe/London".');
318
+ return undefined;
319
+ }
320
+ if (resolved.toLowerCase() !== timeZone.toLowerCase()) {
321
+ report(`\`timeZone="${timeZone}"\` is not a canonical IANA name Intl renders as ` +
322
+ "itself (an abbreviation like BST or a legacy alias resolves to an " +
323
+ "unrelated zone), so the exact date was written in the timestamp's own " +
324
+ 'offset instead, with that offset named. It takes a canonical IANA name, ' +
325
+ 'like "Europe/London".');
326
+ return undefined;
327
+ }
328
+ return timeZone;
329
+ }
330
+ /**
331
+ * The offset, written the way it is read aloud.
332
+ *
333
+ * This governs only the fallback path, where no `timeZone` was supplied. A
334
+ * caller who names an IANA `timeZone` gets the reader's own wall clock with no
335
+ * label at all, because the zone can then no longer differ from the reader's.
336
+ *
337
+ * On the fallback path the label is on by default, which is a deliberate
338
+ * departure from content/numbers-dates-and-time, whose rule is to name the zone
339
+ * only when it can differ from the reader's. Whether it differs is a fact about
340
+ * the reader's browser, and this component does not run there, so the safe half
341
+ * of that choice is the default: a reading taken abroad rendered as if it were
342
+ * local is exactly the case the specification's own accessibility bullet is
343
+ * about. The choice itself belongs to the product. A product that knows the
344
+ * instant came from the reader's own device passes `showOffset={false}`, because
345
+ * then the zone cannot differ from the reader's and the label is noise.
346
+ */
347
+ function offsetLabel(offsetMinutes) {
348
+ if (offsetMinutes === 0)
349
+ return "UTC";
350
+ const sign = offsetMinutes > 0 ? "+" : "-";
351
+ const total = Math.abs(offsetMinutes);
352
+ const hours = Math.floor(total / 60);
353
+ const minutes = total % 60;
354
+ const remainder = minutes === 0 ? "" : `:${String(minutes).padStart(2, "0")}`;
355
+ return `UTC${sign}${hours}${remainder}`;
356
+ }
357
+ /**
358
+ * The exact date and time, on the reader's wall clock when a `timeZone` is
359
+ * supplied and otherwise in the zone the timestamp was written in.
360
+ *
361
+ * When no `timeZone` is given, the shift-then-format-as-UTC step is what makes
362
+ * the fallback deterministic. Asking `Intl` for an offset time zone is not
363
+ * portable across every runtime a consumer might ship on, and asking it for the
364
+ * runtime's zone would render the reading in the SERVER's afternoon. Shifting
365
+ * the instant by its own offset and formatting the result as UTC gives the wall
366
+ * clock the reading was taken on, in every runtime, with the locale's own word
367
+ * order and month names intact, and offsetLabel names that zone.
368
+ *
369
+ * A caller-supplied `timeZone` is an IANA name, and that is the reason the prop
370
+ * is a zone name rather than an offset: an IANA zone is portable and
371
+ * deterministic across runtimes in a way an offset zone is not, so the raw
372
+ * instant can be formatted in it directly and put on the reader's own wall
373
+ * clock. The label is then dropped, because a caller who has named the reader's
374
+ * zone has removed the one possibility the label exists to cover, that the zone
375
+ * differs from the reader's.
376
+ */
377
+ function absoluteForm(instant, locale, timeZone, showOffset) {
378
+ /* THE READER'S WALL CLOCK. The raw instant, not the offset-shifted date: the
379
+ shift exists only to fake a zone through the UTC formatter, and applying it
380
+ here as well would move the reading by its offset twice. No label is
381
+ appended, because the caller has named the reader's own zone. */
382
+ if (timeZone !== undefined) {
383
+ return new Intl.DateTimeFormat(locale, {
384
+ dateStyle: "long",
385
+ timeStyle: "short",
386
+ hourCycle: "h23",
387
+ timeZone,
388
+ }).format(new Date(instant.epochMs));
389
+ }
390
+ const shifted = new Date(instant.epochMs + instant.offsetMinutes * MINUTE_MS);
391
+ const written = new Intl.DateTimeFormat(locale, {
392
+ dateStyle: "long",
393
+ timeStyle: "short",
394
+ /* 24-hour with a leading zero, per content/numbers-dates-and-time: it is
395
+ unambiguous, it sorts, and it is how appointment letters and device logs
396
+ are already written. */
397
+ hourCycle: "h23",
398
+ timeZone: "UTC",
399
+ }).format(shifted);
400
+ return showOffset ? `${written} ${offsetLabel(instant.offsetMinutes)}` : written;
401
+ }
402
+ /**
403
+ * The human phrase, or `null` where there is no honest one to make.
404
+ *
405
+ * PRECISION FOLLOWS RECENCY: minutes for the last hour, hours for the last day,
406
+ * and days beyond that. Announcing *2 hours and 14 minutes ago* implies a
407
+ * precision the reader neither needs nor believes.
408
+ *
409
+ * Two decisions worth naming. Every rung rounds DOWN, with one exception: the
410
+ * minute floor rounds UP to 1, so a reading thirty seconds old reads "1 minute
411
+ * ago". Rounding down means the phrase can understate an age by up to one unit,
412
+ * which is why the staleness verdict is computed from the exact elapsed time
413
+ * rather than from the phrase. A reading can read "13 days ago" and still carry
414
+ * the note, and no rung can make a stale reading look fresh. The floor is the
415
+ * one place the phrase overstates, which is the harmless direction, and it
416
+ * exists for the reason it is a floor: the specification forbids *just now* for
417
+ * anything the product cannot vouch for to the minute, and a component whose
418
+ * phrase is fixed at render time can vouch for nothing finer.
419
+ *
420
+ * There is no *yesterday*, *this morning* or *last Tuesday* here. Those are
421
+ * calendar facts in the reader's own time zone, and a component that does not
422
+ * run in the reader's browser does not have one. `numeric: "always"` is what
423
+ * keeps `Intl` from offering *yesterday* for anything between 24 and 48 hours
424
+ * old, which would be a calendar claim made from a stopwatch.
425
+ */
426
+ function relativePhrase(elapsedMs, locale) {
427
+ /* A timestamp in the future is a disagreement between two clocks, not an
428
+ event that has not happened: every one of the five events is something that
429
+ already occurred. "In 3 hours" for a reading somebody has already taken is
430
+ the wrong sentence, so the date is rendered on its own instead. The
431
+ complaint is raised in the component body, where both timestamps are in
432
+ scope and the message can name them. The phrase is made for every past age
433
+ and is not withheld once a reading crosses a boundary: past `absoluteAfterDays`
434
+ the exact date joins it rather than replacing it, so the reader keeps the
435
+ quick recency read and gains the date. */
436
+ if (elapsedMs < 0)
437
+ return null;
438
+ const format = new Intl.RelativeTimeFormat(locale, { numeric: "always", style: "long" });
439
+ if (elapsedMs < HOUR_MS) {
440
+ return format.format(-Math.max(1, Math.floor(elapsedMs / MINUTE_MS)), "minute");
441
+ }
442
+ if (elapsedMs < DAY_MS)
443
+ return format.format(-Math.floor(elapsedMs / HOUR_MS), "hour");
444
+ return format.format(-Math.floor(elapsedMs / DAY_MS), "day");
445
+ }
446
+ export function RelativeTime({ at, event, now, staleAfterHours, absoluteAfterDays, showAbsolute = true, showOffset = true, timeZone, locale, className, }) {
447
+ /* THE REFUSALS, AND WHY THEY ARE REFUSALS.
448
+ This file ships as source into JavaScript projects, where a type is advice.
449
+ Every branch below is a case where the component has no honest thing to
450
+ draw: an instant it cannot locate, or an event it cannot name. Rendering a
451
+ plausible-looking timestamp from either would attach a time to a reading
452
+ that the product never asserted, which is the whole failure this component
453
+ exists to prevent. So it renders nothing and says why. */
454
+ const instant = parseInstant(at);
455
+ if (instant === null) {
456
+ report(`\`at="${at}"\` is not an ISO 8601 timestamp with an offset, so there is no ` +
457
+ "instant to render and nothing was rendered. The form is " +
458
+ '"2026-03-14T08:12:00+01:00" or "2026-03-14T07:12:00Z". A timestamp with ' +
459
+ "no offset is read in whichever zone the code is running in, which makes " +
460
+ "one reading two different ages on a server and on a phone.");
461
+ return null;
462
+ }
463
+ if (!isTimeEvent(event)) {
464
+ report(`\`event="${String(event)}"\` is not one of measured, recorded, received, ` +
465
+ "synced or issued, so the time has no event to belong to and nothing was " +
466
+ "rendered. A bare relative phrase is a fragment the reader completes with " +
467
+ "whichever assumption suits them.");
468
+ return null;
469
+ }
470
+ const word = EVENT_WORDS[event];
471
+ const language = usableLocale(locale);
472
+ const zone = usableTimeZone(timeZone);
473
+ /* NO REFERENCE INSTANT, NO PHRASE AND NO VERDICT. `now` is required, so a
474
+ TypeScript caller cannot reach this branch; a JavaScript one can, and the
475
+ degradation is the safest output available rather than an approximation.
476
+ The exact date and time are still rendered, in view rather than only in the
477
+ accessibility tree. A dated timestamp is never wrong, where "3 days ago"
478
+ measured against a clock nobody named would be a guess wearing a fact's
479
+ clothes. */
480
+ const reference = parseInstant(now);
481
+ if (reference === null) {
482
+ report(`\`now="${String(now)}"\` is not an ISO 8601 timestamp with an offset, so ` +
483
+ "there was nothing to measure the age against: the exact date was " +
484
+ "rendered with no relative phrase, and a threshold supplied alongside it " +
485
+ "renders its hedge rather than a verdict. Read the clock once where the " +
486
+ "screen is rendered. Use " +
487
+ "`new Date().toISOString()` and pass the same value to every timestamp " +
488
+ "on it.");
489
+ }
490
+ let boundaryDays = DEFAULT_ABSOLUTE_AFTER_DAYS;
491
+ if (absoluteAfterDays !== undefined) {
492
+ if (Number.isFinite(absoluteAfterDays) && absoluteAfterDays >= 0) {
493
+ boundaryDays = absoluteAfterDays;
494
+ }
495
+ else {
496
+ report(`\`absoluteAfterDays={${String(absoluteAfterDays)}}\` is not a number of ` +
497
+ "days, so the exact date joins the phrase on screen at the default age, " +
498
+ `which is ${DEFAULT_ABSOLUTE_AFTER_DAYS} day, as it would with the prop omitted.`);
499
+ }
500
+ }
501
+ const elapsedMs = reference === null ? null : reference.epochMs - instant.epochMs;
502
+ /* A TIMESTAMP IN THE FUTURE IS A CLOCK DISAGREEMENT, AND IT IS THE ONE
503
+ REFUSAL HERE THAT USED TO BE SILENT. The phrase is dropped and the date is
504
+ rendered on its own by relativePhrase(), because every one of the five
505
+ events is something that has already happened. Device and server clock skew
506
+ is the commonest real cause of a wrong health timestamp, so it earns the
507
+ same paragraph as a malformed string rather than none at all. */
508
+ if (elapsedMs !== null && elapsedMs < 0) {
509
+ report(`\`at="${at}"\` is later than \`now="${String(now)}"\`, so this reading is ` +
510
+ "timestamped in the future. No relative phrase was rendered and the exact " +
511
+ "date was rendered on its own. The usual cause is two clocks " +
512
+ "disagreeing: a device set wrong, or a timestamp written with the wrong " +
513
+ "offset. It is worth finding before the reading is filed under the " +
514
+ "wrong day.");
515
+ }
516
+ /* THE VERDICT IS COMPUTED FROM THE EXACT ELAPSED TIME, NOT FROM THE PHRASE.
517
+ The phrase rounds down, so a reading 13 days and 20 hours old reads
518
+ "13 days ago"; if the product's threshold is 13 days, that reading is stale
519
+ and says so. Rounding is allowed to make a number easier to read and is
520
+ never allowed to move a boundary somebody set.
521
+
522
+ AND A SUPPLIED THRESHOLD ALWAYS PRODUCES WORDS. There are three answers,
523
+ not two: the reading is inside the boundary, it is past it, or the question
524
+ could not be answered at all. The third renders the same hedged words
525
+ as the second rather than rendering nothing. *may be out of date* is
526
+ already the sentence for a component that cannot vouch for a reading's age,
527
+ so it is the honest output when the age could not be checked. Silence is
528
+ not: uncertainty-and-staleness forbids showing a stale value as if it were
529
+ fresh, the warning below is compiled out of a production build, and a
530
+ product that asked the question would be told nothing at all. The direction
531
+ is deliberate. A product whose threshold arrives as a string sees the hedge
532
+ on every row and finds the defect in minutes; the same product seeing
533
+ silence never finds it. */
534
+ let stale = false;
535
+ if (staleAfterHours !== undefined) {
536
+ if (!(Number.isFinite(staleAfterHours) && staleAfterHours >= 0)) {
537
+ stale = true;
538
+ report(`\`staleAfterHours={${String(staleAfterHours)}}\` is not a number of hours, ` +
539
+ "so the age could not be checked against it and the timestamp carries " +
540
+ "the same words it would carry past a threshold. Pass a number. A " +
541
+ "threshold arriving as a string from a settings row or a JSON column is " +
542
+ "the usual cause. A threshold that silently does nothing is worse than " +
543
+ "no threshold: the product believes it asked for one.");
544
+ }
545
+ else if (elapsedMs === null) {
546
+ /* `now` was unusable and has already been complained about above. There is
547
+ nothing to apply the threshold to, so the hedge stands in for the
548
+ verdict rather than a second paragraph on the console. */
549
+ stale = true;
550
+ }
551
+ else {
552
+ stale = elapsedMs > staleAfterHours * HOUR_MS;
553
+ }
554
+ }
555
+ const phrase = elapsedMs === null ? null : relativePhrase(elapsedMs, language);
556
+ const absolute = absoluteForm(instant, language, zone, showOffset);
557
+ /* WHEN THE EXACT DATE IS ON SCREEN, NOT WHETHER IT EXISTS. It always exists,
558
+ in the accessibility tree, in print and in the `datetime` attribute. It is
559
+ drawn on screen when there is no phrase to stand in for it, or when the
560
+ caller allows it and the reading is at least `boundaryDays` old, which is
561
+ the point content/numbers-dates-and-time switches from a relative phrase to
562
+ the absolute date. Below that a recent reading shows the phrase alone. */
563
+ const absoluteOnScreen = phrase === null ||
564
+ (showAbsolute && elapsedMs !== null && elapsedMs >= boundaryDays * DAY_MS);
565
+ return (_jsxs("time", { "data-slot": "relative-time",
566
+ /* The caller's own string, unmodified. It is the exact instant, it
567
+ survives copy, export and scraping, and it is the only part of this
568
+ element that cannot go out of date on a page left open. */
569
+ dateTime: at, className: cn(
570
+ /* No type size and no colour of its own in the ordinary case: a
571
+ timestamp sits inside somebody else's sentence or under somebody
572
+ else's value, and it inherits both. `tabular-nums` is the one
573
+ typographic opinion, so a column of times lines up on its digits.
574
+ `data-opsinjs-value` is deliberately NOT used. That attribute marks
575
+ a measurement a person reads as their own, and an instant is not
576
+ one. */
577
+ "tabular-nums",
578
+ /* The stale treatment: muted, and never tinted from the status axis. An
579
+ amber timestamp would put a clinical verdict onto a fact about the
580
+ clock, and the reader has no way to tell the two reds apart. Only the
581
+ phrase and the absolute date recede. The event word and "may be out of
582
+ date" are left at the inherited foreground on purpose, so the two
583
+ spans that carry the state gain relative prominence exactly when it
584
+ changes rather than sinking to the same low tone as everything around
585
+ them. The comma before the date recedes with the date it introduces,
586
+ and the comma before "may be out of date" stays at the inherited
587
+ foreground with the words after it.
588
+
589
+ IT IS ADDRESSED AT THE TWO SLOTS RATHER THAN AT THE ROOT, AND THAT IS
590
+ NOT A PREFERENCE. `cn()` is tailwind-merge, which does not know the
591
+ `--text-opsin-*` bridge and so files `text-opsin-footnote` in the same
592
+ conflict group as `text-muted-foreground`. On one element the later of
593
+ the two deletes the earlier one whichever way round they arrive: with
594
+ `className` last a caller's type size deletes the muting, which
595
+ renders a stale reading in exactly the tone of a fresh one, and
596
+ reversing the order deletes the caller's type size instead. A
597
+ descendant selector belongs to no conflict group, and both selectors
598
+ below are descendant selectors, so both survive. Measured against
599
+ tailwind-merge 3.6.0, which is what this repository pins. */
600
+ stale &&
601
+ "[&_[data-slot=relative-time-relative]]:text-muted-foreground [&_[data-slot=relative-time-absolute]]:text-muted-foreground", className), children: [_jsx("span", { "data-slot": "relative-time-prefix", children: word }), " ", phrase === null ? null : _jsx("span", { "data-slot": "relative-time-relative", children: phrase }), _jsxs("span", { "data-slot": "relative-time-absolute", className: cn(!absoluteOnScreen && "sr-only print:not-sr-only"), children: [phrase === null ? "on " : _jsx("span", { children: ", on " }), absolute] }), stale ? (_jsxs("span", { "data-slot": "relative-time-staleness", children: [_jsx("span", { children: ", " }), STALENESS_WORDS] })) : null] }));
602
+ }
603
+ //# sourceMappingURL=relative-time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"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