asterui 0.12.70 → 0.12.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,39 @@
1
+ import { default as React } from 'react';
2
+ import { FormItemProps } from './Form';
3
+ export type DateOfBirthOrder = 'mdy' | 'dmy' | 'ymd';
4
+ export type DateOfBirthMonthStyle = 'select' | 'grid';
5
+ export type DateOfBirthYearStyle = 'select' | 'input';
6
+ export interface DateOfBirthValue {
7
+ month?: string;
8
+ day?: string;
9
+ year?: string;
10
+ }
11
+ export interface DateOfBirthProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
12
+ value?: DateOfBirthValue;
13
+ defaultValue?: DateOfBirthValue;
14
+ onChange?: (value: DateOfBirthValue) => void;
15
+ yearSpan?: number;
16
+ minAge?: number;
17
+ maxAge?: number;
18
+ order?: DateOfBirthOrder;
19
+ monthStyle?: DateOfBirthMonthStyle;
20
+ yearStyle?: DateOfBirthYearStyle;
21
+ monthPlaceholder?: string;
22
+ dayPlaceholder?: string;
23
+ yearPlaceholder?: string;
24
+ disabled?: boolean;
25
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
26
+ className?: string;
27
+ /** Test ID prefix for child elements */
28
+ 'data-testid'?: string;
29
+ }
30
+ export interface DateOfBirthRequiredOptions {
31
+ message?: string;
32
+ }
33
+ export type DateOfBirthRequiredProps = Pick<FormItemProps, 'rules' | 'validateTrigger'>;
34
+ export declare function dateOfBirthRequired(options?: DateOfBirthRequiredOptions): DateOfBirthRequiredProps;
35
+ type DateOfBirthComponent = React.FC<DateOfBirthProps> & {
36
+ required: (options?: DateOfBirthRequiredOptions) => DateOfBirthRequiredProps;
37
+ };
38
+ export declare const DateOfBirth: DateOfBirthComponent;
39
+ export {};
@@ -0,0 +1,189 @@
1
+ import { jsxs as y, jsx as n } from "react/jsx-runtime";
2
+ import { useState as Z, useEffect as O, useMemo as B } from "react";
3
+ import { useConfig as K } from "../providers/ConfigProvider.js";
4
+ import { Button as I } from "./Button.js";
5
+ import { Flex as _ } from "./Flex.js";
6
+ import { InputNumber as ee } from "./InputNumber.js";
7
+ import { Select as C } from "./Select.js";
8
+ import { Space as te } from "./Space.js";
9
+ const re = Array.from({ length: 12 }, (r, a) => String(a + 1));
10
+ function ne(r = {}) {
11
+ const a = r.message ?? "Please select a complete date of birth.";
12
+ return {
13
+ validateTrigger: ["onBlur", "onSubmit"],
14
+ rules: [({ isSubmitAttempted: d }) => ({
15
+ validate: (s) => {
16
+ const i = s ?? {};
17
+ return !!!(i.month || i.day || i.year) && !d() || i.month && i.day && i.year ? !0 : a;
18
+ }
19
+ })]
20
+ };
21
+ }
22
+ function ae(r, a) {
23
+ const u = new Intl.DateTimeFormat(r, { month: a });
24
+ return re.map((d, s) => ({
25
+ value: d,
26
+ label: u.format(new Date(2020, s, 1))
27
+ }));
28
+ }
29
+ function oe(r, a) {
30
+ return new Date(r, a, 0).getDate();
31
+ }
32
+ function ie(r, a, u) {
33
+ if (!r.year || !r.month || !r.day) return !0;
34
+ const d = Number(r.year), s = Number(r.month) - 1, i = Number(r.day), l = new Date(d, s, i);
35
+ if (Number.isNaN(l.getTime())) return !1;
36
+ const c = /* @__PURE__ */ new Date();
37
+ let f = c.getFullYear() - l.getFullYear();
38
+ return c.getMonth() > l.getMonth() || c.getMonth() === l.getMonth() && c.getDate() >= l.getDate() || (f -= 1), !(a !== void 0 && f < a || u !== void 0 && f > u);
39
+ }
40
+ const q = ({
41
+ value: r,
42
+ defaultValue: a,
43
+ onChange: u,
44
+ yearSpan: d = 120,
45
+ minAge: s = 13,
46
+ maxAge: i,
47
+ order: l = "mdy",
48
+ monthStyle: c = "select",
49
+ yearStyle: f = "select",
50
+ monthPlaceholder: F = "Month",
51
+ dayPlaceholder: E = "Day",
52
+ yearPlaceholder: S = "Year",
53
+ disabled: p = !1,
54
+ size: H,
55
+ className: L = "",
56
+ "data-testid": o,
57
+ onBlur: j,
58
+ onFocus: R,
59
+ ...U
60
+ }) => {
61
+ const { locale: W, componentSize: k } = K(), v = H ?? k ?? "md", b = r !== void 0, [V, T] = Z(
62
+ r ?? a ?? {}
63
+ );
64
+ O(() => {
65
+ b && T(r ?? {});
66
+ }, [b, r]);
67
+ const t = b ? r ?? {} : V, z = W?.locale ?? "en-US", A = B(
68
+ () => ae(z, c === "grid" ? "short" : "long"),
69
+ [z, c]
70
+ ), N = B(() => {
71
+ const e = (/* @__PURE__ */ new Date()).getFullYear();
72
+ return Array.from({ length: d }, (m, g) => String(e - g));
73
+ }, [d]), w = B(() => {
74
+ if (!t.month) return Array.from({ length: 31 }, (D, M) => String(M + 1));
75
+ const e = Number(t.month), m = t.year ? Number(t.year) : 2e3, g = oe(m, e);
76
+ return Array.from({ length: g }, (D, M) => String(M + 1));
77
+ }, [t.month, t.year]);
78
+ O(() => {
79
+ t.day && !w.includes(t.day) && h({ ...t, day: void 0 });
80
+ }, [t.day, w]);
81
+ const h = (e) => {
82
+ b || T(e), u?.(e);
83
+ }, Y = () => c === "grid" ? /* @__PURE__ */ n("div", { className: "grid grid-cols-3 gap-2", children: A.map((e) => {
84
+ const m = t.month === e.value;
85
+ return /* @__PURE__ */ n(
86
+ I,
87
+ {
88
+ htmlType: "button",
89
+ size: "sm",
90
+ color: m ? "primary" : void 0,
91
+ variant: m ? "solid" : "ghost",
92
+ disabled: p,
93
+ onClick: () => h({ ...t, month: e.value }),
94
+ "data-testid": o ? `${o}-month-${e.value}` : void 0,
95
+ children: e.label
96
+ },
97
+ e.value
98
+ );
99
+ }) }) : /* @__PURE__ */ y(
100
+ C,
101
+ {
102
+ value: t.month ?? "",
103
+ onChange: (e) => h({ ...t, month: e.target.value }),
104
+ disabled: p,
105
+ size: v,
106
+ "data-testid": o ? `${o}-month` : void 0,
107
+ children: [
108
+ /* @__PURE__ */ n("option", { value: "", children: F }),
109
+ A.map((e) => /* @__PURE__ */ n("option", { value: e.value, children: e.label }, e.value))
110
+ ]
111
+ }
112
+ ), G = () => /* @__PURE__ */ y(
113
+ C,
114
+ {
115
+ value: t.day ?? "",
116
+ onChange: (e) => h({ ...t, day: e.target.value }),
117
+ disabled: p,
118
+ size: v,
119
+ "data-testid": o ? `${o}-day` : void 0,
120
+ children: [
121
+ /* @__PURE__ */ n("option", { value: "", children: E }),
122
+ w.map((e) => /* @__PURE__ */ n("option", { value: e, children: e }, e))
123
+ ]
124
+ }
125
+ ), J = () => f === "input" ? /* @__PURE__ */ n(
126
+ ee,
127
+ {
128
+ value: t.year ? Number(t.year) : void 0,
129
+ min: Number(N[N.length - 1]),
130
+ max: Number(N[0]),
131
+ placeholder: S,
132
+ disabled: p,
133
+ size: v,
134
+ onChange: (e) => h({ ...t, year: e ? String(e) : void 0 }),
135
+ "data-testid": o ? `${o}-year` : void 0
136
+ }
137
+ ) : /* @__PURE__ */ y(
138
+ C,
139
+ {
140
+ value: t.year ?? "",
141
+ onChange: (e) => h({ ...t, year: e.target.value }),
142
+ disabled: p,
143
+ size: v,
144
+ "data-testid": o ? `${o}-year` : void 0,
145
+ children: [
146
+ /* @__PURE__ */ n("option", { value: "", children: S }),
147
+ N.map((e) => /* @__PURE__ */ n("option", { value: e, children: e }, e))
148
+ ]
149
+ }
150
+ ), $ = {
151
+ m: Y(),
152
+ d: G(),
153
+ y: J()
154
+ }, P = l.split("").map((e) => e), Q = l.split("").filter((e) => e !== "m").map((e) => e), x = {
155
+ m: "w-full sm:w-[7rem]",
156
+ d: "w-full sm:w-[5rem]",
157
+ y: "w-full sm:w-[5rem]"
158
+ }, X = t.year && t.month && t.day && !ie(t, s, i);
159
+ return /* @__PURE__ */ y(
160
+ "div",
161
+ {
162
+ className: L,
163
+ "data-testid": o,
164
+ onBlur: (e) => {
165
+ const m = e.currentTarget, g = e.relatedTarget;
166
+ g && m.contains(g) || requestAnimationFrame(() => {
167
+ const D = document.activeElement;
168
+ D && m.contains(D) || j?.(e);
169
+ });
170
+ },
171
+ onFocus: R,
172
+ ...U,
173
+ children: [
174
+ c === "grid" ? /* @__PURE__ */ y(te, { direction: "vertical", size: "sm", children: [
175
+ Y(),
176
+ /* @__PURE__ */ n(_, { gap: "sm", children: Q.map((e) => /* @__PURE__ */ n("div", { className: x[e], children: $[e] }, e)) })
177
+ ] }) : /* @__PURE__ */ n(_, { wrap: "wrap", gap: "sm", children: P.map((e) => /* @__PURE__ */ n("div", { className: x[e], children: $[e] }, e)) }),
178
+ X && /* @__PURE__ */ n("div", { className: "text-xs text-error mt-2", children: s ? `You must be at least ${s} years old.` : "Date of birth is not valid." })
179
+ ]
180
+ }
181
+ );
182
+ };
183
+ q.required = ne;
184
+ q.displayName = "DateOfBirth";
185
+ export {
186
+ q as DateOfBirth,
187
+ ne as dateOfBirthRequired
188
+ };
189
+ //# sourceMappingURL=DateOfBirth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateOfBirth.js","sources":["../../src/components/DateOfBirth.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react'\nimport { useConfig } from '../providers/ConfigProvider'\nimport { Button } from './Button'\nimport { Flex } from './Flex'\nimport { InputNumber } from './InputNumber'\nimport { Select } from './Select'\nimport { Space } from './Space'\nimport type { FormItemProps, FormRuleInput } from './Form'\n\nexport type DateOfBirthOrder = 'mdy' | 'dmy' | 'ymd'\nexport type DateOfBirthMonthStyle = 'select' | 'grid'\nexport type DateOfBirthYearStyle = 'select' | 'input'\n\nexport interface DateOfBirthValue {\n month?: string\n day?: string\n year?: string\n}\n\nexport interface DateOfBirthProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {\n value?: DateOfBirthValue\n defaultValue?: DateOfBirthValue\n onChange?: (value: DateOfBirthValue) => void\n yearSpan?: number\n minAge?: number\n maxAge?: number\n order?: DateOfBirthOrder\n monthStyle?: DateOfBirthMonthStyle\n yearStyle?: DateOfBirthYearStyle\n monthPlaceholder?: string\n dayPlaceholder?: string\n yearPlaceholder?: string\n disabled?: boolean\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n className?: string\n /** Test ID prefix for child elements */\n 'data-testid'?: string\n}\n\nconst DEFAULT_MONTHS = Array.from({ length: 12 }, (_, index) => String(index + 1))\n\nexport interface DateOfBirthRequiredOptions {\n message?: string\n}\n\nexport type DateOfBirthRequiredProps = Pick<FormItemProps, 'rules' | 'validateTrigger'>\n\nexport function dateOfBirthRequired(options: DateOfBirthRequiredOptions = {}): DateOfBirthRequiredProps {\n const message = options.message ?? 'Please select a complete date of birth.'\n\n const rules: FormRuleInput[] = [({ isSubmitAttempted }) => ({\n validate: (value: DateOfBirthValue | undefined) => {\n const dob = value ?? {}\n const hasAny = !!(dob.month || dob.day || dob.year)\n if (!hasAny && !isSubmitAttempted()) {\n return true\n }\n return dob.month && dob.day && dob.year ? true : message\n },\n })]\n\n return {\n validateTrigger: ['onBlur', 'onSubmit'],\n rules,\n }\n}\n\ntype DateOfBirthComponent = React.FC<DateOfBirthProps> & {\n required: (options?: DateOfBirthRequiredOptions) => DateOfBirthRequiredProps\n}\n\nfunction getMonthLabels(locale: string, format: 'long' | 'short') {\n const formatter = new Intl.DateTimeFormat(locale, { month: format })\n return DEFAULT_MONTHS.map((value, index) => ({\n value,\n label: formatter.format(new Date(2020, index, 1)),\n }))\n}\n\nfunction getDaysInMonth(year: number, month: number) {\n return new Date(year, month, 0).getDate()\n}\n\nfunction validateAge(value: DateOfBirthValue, minAge?: number, maxAge?: number) {\n if (!value.year || !value.month || !value.day) return true\n const year = Number(value.year)\n const month = Number(value.month) - 1\n const day = Number(value.day)\n const birthDate = new Date(year, month, day)\n if (Number.isNaN(birthDate.getTime())) return false\n const today = new Date()\n let age = today.getFullYear() - birthDate.getFullYear()\n const hasHadBirthday =\n today.getMonth() > birthDate.getMonth() ||\n (today.getMonth() === birthDate.getMonth() && today.getDate() >= birthDate.getDate())\n if (!hasHadBirthday) age -= 1\n if (minAge !== undefined && age < minAge) return false\n if (maxAge !== undefined && age > maxAge) return false\n return true\n}\n\nexport const DateOfBirth: DateOfBirthComponent = ({\n value,\n defaultValue,\n onChange,\n yearSpan = 120,\n minAge = 13,\n maxAge,\n order = 'mdy',\n monthStyle = 'select',\n yearStyle = 'select',\n monthPlaceholder = 'Month',\n dayPlaceholder = 'Day',\n yearPlaceholder = 'Year',\n disabled = false,\n size,\n className = '',\n 'data-testid': testId,\n onBlur,\n onFocus,\n ...rest\n}) => {\n const { locale, componentSize } = useConfig()\n const effectiveSize = size ?? componentSize ?? 'md'\n const isControlled = value !== undefined\n const [internalValue, setInternalValue] = useState<DateOfBirthValue>(\n value ?? defaultValue ?? {}\n )\n\n useEffect(() => {\n if (isControlled) {\n setInternalValue(value ?? {})\n }\n }, [isControlled, value])\n\n const currentValue = isControlled ? (value ?? {}) : internalValue\n const localeCode = locale?.locale ?? 'en-US'\n const monthLabels = useMemo(\n () => getMonthLabels(localeCode, monthStyle === 'grid' ? 'short' : 'long'),\n [localeCode, monthStyle]\n )\n\n const yearRange = useMemo(() => {\n const currentYear = new Date().getFullYear()\n return Array.from({ length: yearSpan }, (_, i) => String(currentYear - i))\n }, [yearSpan])\n\n const dayOptions = useMemo(() => {\n if (!currentValue.month) return Array.from({ length: 31 }, (_, i) => String(i + 1))\n const month = Number(currentValue.month)\n const year = currentValue.year ? Number(currentValue.year) : 2000\n const daysInMonth = getDaysInMonth(year, month)\n return Array.from({ length: daysInMonth }, (_, i) => String(i + 1))\n }, [currentValue.month, currentValue.year])\n\n useEffect(() => {\n if (currentValue.day && !dayOptions.includes(currentValue.day)) {\n handleChange({ ...currentValue, day: undefined })\n }\n }, [currentValue.day, dayOptions])\n\n const handleChange = (nextValue: DateOfBirthValue) => {\n if (!isControlled) {\n setInternalValue(nextValue)\n }\n onChange?.(nextValue)\n }\n\n const renderMonth = () => {\n if (monthStyle === 'grid') {\n return (\n <div className=\"grid grid-cols-3 gap-2\">\n {monthLabels.map((month) => {\n const isActive = currentValue.month === month.value\n return (\n <Button\n key={month.value}\n htmlType=\"button\"\n size=\"sm\"\n color={isActive ? 'primary' : undefined}\n variant={isActive ? 'solid' : 'ghost'}\n disabled={disabled}\n onClick={() => handleChange({ ...currentValue, month: month.value })}\n data-testid={testId ? `${testId}-month-${month.value}` : undefined}\n >\n {month.label}\n </Button>\n )\n })}\n </div>\n )\n }\n\n return (\n <Select\n value={currentValue.month ?? ''}\n onChange={(e) => handleChange({ ...currentValue, month: e.target.value })}\n disabled={disabled}\n size={effectiveSize}\n data-testid={testId ? `${testId}-month` : undefined}\n >\n <option value=\"\">{monthPlaceholder}</option>\n {monthLabels.map((month) => (\n <option key={month.value} value={month.value}>\n {month.label}\n </option>\n ))}\n </Select>\n )\n }\n\n const renderDay = () => (\n <Select\n value={currentValue.day ?? ''}\n onChange={(e) => handleChange({ ...currentValue, day: e.target.value })}\n disabled={disabled}\n size={effectiveSize}\n data-testid={testId ? `${testId}-day` : undefined}\n >\n <option value=\"\">{dayPlaceholder}</option>\n {dayOptions.map((day) => (\n <option key={day} value={day}>{day}</option>\n ))}\n </Select>\n )\n\n const renderYear = () => {\n if (yearStyle === 'input') {\n return (\n <InputNumber\n value={currentValue.year ? Number(currentValue.year) : undefined}\n min={Number(yearRange[yearRange.length - 1])}\n max={Number(yearRange[0])}\n placeholder={yearPlaceholder}\n disabled={disabled}\n size={effectiveSize}\n onChange={(nextValue) => handleChange({ ...currentValue, year: nextValue ? String(nextValue) : undefined })}\n data-testid={testId ? `${testId}-year` : undefined}\n />\n )\n }\n\n return (\n <Select\n value={currentValue.year ?? ''}\n onChange={(e) => handleChange({ ...currentValue, year: e.target.value })}\n disabled={disabled}\n size={effectiveSize}\n data-testid={testId ? `${testId}-year` : undefined}\n >\n <option value=\"\">{yearPlaceholder}</option>\n {yearRange.map((year) => (\n <option key={year} value={year}>{year}</option>\n ))}\n </Select>\n )\n }\n\n const fieldMap = {\n m: renderMonth(),\n d: renderDay(),\n y: renderYear(),\n }\n\n const orderedFields = order.split('').map((key) => key as keyof typeof fieldMap)\n const gridFields = order\n .split('')\n .filter((key) => key !== 'm')\n .map((key) => key as keyof typeof fieldMap)\n const fieldWidths: Record<'m' | 'd' | 'y', string> = {\n m: 'w-full sm:w-[7rem]',\n d: 'w-full sm:w-[5rem]',\n y: 'w-full sm:w-[5rem]',\n }\n\n const showAgeWarning = currentValue.year && currentValue.month && currentValue.day && !validateAge(currentValue, minAge, maxAge)\n\n const handleBlur = (event: React.FocusEvent<HTMLDivElement>) => {\n const currentTarget = event.currentTarget\n const next = event.relatedTarget as Node | null\n if (next && currentTarget.contains(next)) return\n requestAnimationFrame(() => {\n const active = document.activeElement\n if (active && currentTarget.contains(active)) return\n onBlur?.(event)\n })\n }\n\n return (\n <div\n className={className}\n data-testid={testId}\n onBlur={handleBlur}\n onFocus={onFocus}\n {...rest}\n >\n {monthStyle === 'grid' ? (\n <Space direction=\"vertical\" size=\"sm\">\n {renderMonth()}\n <Flex gap=\"sm\">\n {gridFields.map((fieldKey) => (\n <div key={fieldKey} className={fieldWidths[fieldKey]}>\n {fieldMap[fieldKey]}\n </div>\n ))}\n </Flex>\n </Space>\n ) : (\n <Flex wrap=\"wrap\" gap=\"sm\">\n {orderedFields.map((fieldKey) => (\n <div key={fieldKey} className={fieldWidths[fieldKey]}>\n {fieldMap[fieldKey]}\n </div>\n ))}\n </Flex>\n )}\n\n {showAgeWarning && (\n <div className=\"text-xs text-error mt-2\">\n {minAge ? `You must be at least ${minAge} years old.` : 'Date of birth is not valid.'}\n </div>\n )}\n </div>\n )\n}\n\nDateOfBirth.required = dateOfBirthRequired\n\nDateOfBirth.displayName = 'DateOfBirth'\n"],"names":["DEFAULT_MONTHS","_","index","dateOfBirthRequired","options","message","isSubmitAttempted","value","dob","getMonthLabels","locale","format","formatter","getDaysInMonth","year","month","validateAge","minAge","maxAge","day","birthDate","today","age","DateOfBirth","defaultValue","onChange","yearSpan","order","monthStyle","yearStyle","monthPlaceholder","dayPlaceholder","yearPlaceholder","disabled","size","className","testId","onBlur","onFocus","rest","componentSize","useConfig","effectiveSize","isControlled","internalValue","setInternalValue","useState","useEffect","currentValue","localeCode","monthLabels","useMemo","yearRange","currentYear","i","dayOptions","daysInMonth","handleChange","nextValue","renderMonth","isActive","jsx","Button","jsxs","Select","renderDay","renderYear","InputNumber","fieldMap","orderedFields","key","gridFields","fieldWidths","showAgeWarning","event","currentTarget","next","active","Space","Flex","fieldKey"],"mappings":";;;;;;;;AAuCA,MAAMA,KAAiB,MAAM,KAAK,EAAE,QAAQ,GAAA,GAAM,CAACC,GAAGC,MAAU,OAAOA,IAAQ,CAAC,CAAC;AAQ1E,SAASC,GAAoBC,IAAsC,IAA8B;AACtG,QAAMC,IAAUD,EAAQ,WAAW;AAanC,SAAO;AAAA,IACL,iBAAiB,CAAC,UAAU,UAAU;AAAA,IACtC,OAb6B,CAAC,CAAC,EAAE,mBAAAE,SAAyB;AAAA,MAC1D,UAAU,CAACC,MAAwC;AACjD,cAAMC,IAAMD,KAAS,CAAA;AAErB,eAAI,CADW,CAAC,EAAEC,EAAI,SAASA,EAAI,OAAOA,EAAI,SAC/B,CAACF,OAGTE,EAAI,SAASA,EAAI,OAAOA,EAAI,OAF1B,KAEwCH;AAAA,MACnD;AAAA,IAAA,EACA;AAAA,EAIA;AAEJ;AAMA,SAASI,GAAeC,GAAgBC,GAA0B;AAChE,QAAMC,IAAY,IAAI,KAAK,eAAeF,GAAQ,EAAE,OAAOC,GAAQ;AACnE,SAAOX,GAAe,IAAI,CAACO,GAAOL,OAAW;AAAA,IAC3C,OAAAK;AAAA,IACA,OAAOK,EAAU,OAAO,IAAI,KAAK,MAAMV,GAAO,CAAC,CAAC;AAAA,EAAA,EAChD;AACJ;AAEA,SAASW,GAAeC,GAAcC,GAAe;AACnD,SAAO,IAAI,KAAKD,GAAMC,GAAO,CAAC,EAAE,QAAA;AAClC;AAEA,SAASC,GAAYT,GAAyBU,GAAiBC,GAAiB;AAC9E,MAAI,CAACX,EAAM,QAAQ,CAACA,EAAM,SAAS,CAACA,EAAM,IAAK,QAAO;AACtD,QAAMO,IAAO,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