@alfadocs/ui-kit 0.36.0 → 0.38.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.
- package/dist/_chunks/Alfadocs_Logo_Mark-7o3L3WBI.js +56 -0
- package/dist/_chunks/{alia-sidebar-BEoMl6UL.js → alia-sidebar-DXsYPinm.js} +2 -2
- package/dist/_chunks/{ar-CEpIJtcO.js → ar-Cn_NxqkN.js} +2 -2
- package/dist/_chunks/bmi-BxD-tFzU.js +32 -0
- package/dist/_chunks/bmi-calculator-BRUru9QX.js +213 -0
- package/dist/_chunks/{booking-eM0y0NIR.js → booking-DK_BPHnQ.js} +4 -4
- package/dist/_chunks/calculator-dialog-B74fqpFZ.js +40 -0
- package/dist/_chunks/chart-DnHvmiDX.js +312 -0
- package/dist/_chunks/{chat-message-D53_fH2w.js → chat-message-ASgGtj-L.js} +30 -39
- package/dist/_chunks/{contact-profile-card-BA6fgS45.js → contact-profile-card-DHyuAPXM.js} +14 -13
- package/dist/_chunks/cycle-calculator-B5Uj9QeT.js +185 -0
- package/dist/_chunks/{date-picker-B94HAV4A.js → date-picker-CvQfs6Xh.js} +2 -2
- package/dist/_chunks/{date-range-picker-D8CHNYQT.js → date-range-picker-U9fn1g9d.js} +3 -3
- package/dist/_chunks/{date-time-picker-D1GEzf8p.js → date-time-picker-Cva0ZCWw.js} +2 -2
- package/dist/_chunks/{de-Dfbeau59.js → de-BMM2H7Bs.js} +2 -2
- package/dist/_chunks/dependent-selector-CRWgieHm.js +324 -0
- package/dist/_chunks/document-scanner-CdHQ6lTN.js +702 -0
- package/dist/_chunks/due-date-calculator-CUspKSTw.js +171 -0
- package/dist/_chunks/{editable-currency-cell-renderer-CZcVWBPo.js → editable-currency-cell-renderer-DGKuRNVG.js} +2 -2
- package/dist/_chunks/{el-Dro3J7CP.js → el-BYPonAaK.js} +2 -2
- package/dist/_chunks/{es-Dvg8u70B.js → es-CMkVCQ4F.js} +2 -2
- package/dist/_chunks/{file-upload-CdozCPct.js → file-upload-CnzRcErt.js} +2 -1
- package/dist/_chunks/fiscal-code-input-BZ0FxwUl.js +540 -0
- package/dist/_chunks/{fr-VOGjBSPP.js → fr-BcuWxqft.js} +2 -2
- package/dist/_chunks/gestation-BXEgDGmP.js +50 -0
- package/dist/_chunks/gestational-age-calculator-CsQ05qDy.js +165 -0
- package/dist/_chunks/heart-C0faivFf.js +20 -0
- package/dist/_chunks/{hi-BSDxWU_y.js → hi-wkq_rQAh.js} +2 -2
- package/dist/_chunks/image-C6RM5hfF.js +16 -0
- package/dist/_chunks/insert-result-yJ0QavoN.js +133 -0
- package/dist/_chunks/{isSameWeek-Dfzu29cW.js → isSameWeek-Bim5ftRd.js} +2 -2
- package/dist/_chunks/{it-CuonvcI_.js → it-GiQrQ9p4.js} +3 -3
- package/dist/_chunks/{ja-DO57gIOT.js → ja-qfYg3Rua.js} +2 -2
- package/dist/_chunks/{logo-_Z-jLq80.js → logo-yituK7sE.js} +42 -91
- package/dist/_chunks/{marketplace-app-shell-DXHxy9dj.js → marketplace-app-shell-BnClrL2B.js} +2 -2
- package/dist/_chunks/{nl-DjPaaWaW.js → nl-xOogO4sZ.js} +2 -2
- package/dist/_chunks/{patient-shell-CDvMw_Nk.js → patient-shell-Bz3CdO84.js} +2 -2
- package/dist/_chunks/{pl-Cl4lOx2N.js → pl-GnOW6eGK.js} +3 -3
- package/dist/_chunks/{practice-results-BFM_lyUs.js → practice-results-C8ciLQap.js} +3 -2
- package/dist/_chunks/pregnancy-weight-gain-BCdi-JSv.js +209 -0
- package/dist/_chunks/{privacy-lock-DD-wHxBg.js → privacy-lock-BmX_gkvt.js} +2 -2
- package/dist/_chunks/{pt-D7qO5CzD.js → pt-_bV5b5RW.js} +2 -2
- package/dist/_chunks/{public-footer.agent-Cjfe5jus.js → public-footer.agent-zw1vFin_.js} +2 -2
- package/dist/_chunks/qr-code-DNXhi6se.js +568 -0
- package/dist/_chunks/{react-day-picker-DsjfS7uI.js → react-day-picker-CdtIiKjx.js} +27 -27
- package/dist/_chunks/{rich-text-editor-CHmr9Bz8.js → rich-text-editor-DLbg2852.js} +114 -124
- package/dist/_chunks/{ro-CP2-VJ_O.js → ro-BEcyh5Nj.js} +2 -2
- package/dist/_chunks/rotate-ccw-BWANpitO.js +15 -0
- package/dist/_chunks/{ru-RPn9_Lpq.js → ru-Bi86hqMf.js} +3 -3
- package/dist/_chunks/session-countdown-LPnhTHjn.js +214 -0
- package/dist/_chunks/{shield-check-BhHyReu8.js → shield-check-C73ma9Cs.js} +8 -24
- package/dist/_chunks/{sign-in-with-alfadocs-button-BI0fVonM.js → sign-in-with-alfadocs-button-DeHBFRNS.js} +2 -2
- package/dist/_chunks/social-sign-in-button-X54ySJr1.js +243 -0
- package/dist/_chunks/{sq-AQvefouo.js → sq-BujHSAWu.js} +2 -2
- package/dist/_chunks/subDays-_T9YeKPX.js +8 -0
- package/dist/_chunks/{sv-zkx9eBtD.js → sv-C8AeDrTA.js} +2 -2
- package/dist/_chunks/{tr-Dmr412Ac.js → tr-CMSs_Vgf.js} +2 -2
- package/dist/_chunks/unit-converter-EUwO6QYq.js +168 -0
- package/dist/_chunks/wallet-pay-button-DK4ESYge.js +250 -0
- package/dist/_chunks/{zh-CN-DxVt64Zk.js → zh-CN-eXB-PFu4.js} +3 -3
- package/dist/agent-catalog.json +203 -1
- package/dist/brand/provider-marks/apple-pay.d.ts +12 -0
- package/dist/brand/provider-marks/apple.d.ts +12 -0
- package/dist/brand/provider-marks/google-pay.d.ts +12 -0
- package/dist/brand/provider-marks/google.d.ts +13 -0
- package/dist/components/_shared/insert-result.d.ts +47 -0
- package/dist/components/bmi-calculator/bmi-calculator.d.ts +27 -0
- package/dist/components/bmi-calculator/bmi.d.ts +37 -0
- package/dist/components/bmi-calculator/index.d.ts +4 -0
- package/dist/components/bmi-calculator/index.js +15 -0
- package/dist/components/booking/index.js +1 -1
- package/dist/components/calculator-dialog/calculator-dialog.d.ts +26 -0
- package/dist/components/calculator-dialog/index.d.ts +3 -0
- package/dist/components/calculator-dialog/index.js +5 -0
- package/dist/components/chart/chart.d.ts +7 -0
- package/dist/components/chart/index.js +1 -1
- package/dist/components/chat-message/index.js +1 -1
- package/dist/components/contact-profile-card/index.js +1 -1
- package/dist/components/cycle-calculator/cycle-calculator.d.ts +21 -0
- package/dist/components/cycle-calculator/cycle.d.ts +37 -0
- package/dist/components/cycle-calculator/index.d.ts +4 -0
- package/dist/components/cycle-calculator/index.js +7 -0
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/date-range-picker/index.js +1 -1
- package/dist/components/date-time-picker/index.js +1 -1
- package/dist/components/dependent-selector/dependent-selector.agent.d.ts +4 -0
- package/dist/components/dependent-selector/dependent-selector.d.ts +72 -0
- package/dist/components/dependent-selector/index.d.ts +4 -0
- package/dist/components/dependent-selector/index.js +6 -0
- package/dist/components/document-scanner/document-scanner.agent.d.ts +4 -0
- package/dist/components/document-scanner/document-scanner.d.ts +93 -0
- package/dist/components/document-scanner/index.d.ts +4 -0
- package/dist/components/document-scanner/index.js +6 -0
- package/dist/components/due-date-calculator/due-date-calculator.d.ts +21 -0
- package/dist/components/due-date-calculator/gestation.d.ts +60 -0
- package/dist/components/due-date-calculator/index.d.ts +4 -0
- package/dist/components/due-date-calculator/index.js +13 -0
- package/dist/components/file-upload/index.js +1 -1
- package/dist/components/fiscal-code-input/calculate-codice-fiscale.d.ts +24 -0
- package/dist/components/fiscal-code-input/fiscal-code-input.agent.d.ts +4 -0
- package/dist/components/fiscal-code-input/fiscal-code-input.d.ts +61 -0
- package/dist/components/fiscal-code-input/index.d.ts +6 -0
- package/dist/components/fiscal-code-input/index.js +11 -0
- package/dist/components/fiscal-code-input/is-valid-codice-fiscale.d.ts +21 -0
- package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts +27 -0
- package/dist/components/gestational-age-calculator/index.d.ts +3 -0
- package/dist/components/gestational-age-calculator/index.js +5 -0
- package/dist/components/index.d.ts +15 -0
- package/dist/components/logo/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/index.d.ts +4 -0
- package/dist/components/pregnancy-weight-gain/index.js +9 -0
- package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts +19 -0
- package/dist/components/pregnancy-weight-gain/weight-gain.d.ts +41 -0
- package/dist/components/privacy-lock/index.js +1 -1
- package/dist/components/public-footer/index.js +1 -1
- package/dist/components/qr-code/index.d.ts +5 -0
- package/dist/components/qr-code/index.js +8 -0
- package/dist/components/qr-code/qr-code.agent.d.ts +3 -0
- package/dist/components/qr-code/qr-code.d.ts +59 -0
- package/dist/components/qr-code/qr-encode.d.ts +46 -0
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/components/session-countdown/index.d.ts +4 -0
- package/dist/components/session-countdown/index.js +6 -0
- package/dist/components/session-countdown/session-countdown.agent.d.ts +3 -0
- package/dist/components/session-countdown/session-countdown.d.ts +38 -0
- package/dist/components/sign-in-with-alfadocs-button/index.js +1 -1
- package/dist/components/skeleton/skeleton.d.ts +1 -1
- package/dist/components/social-sign-in-button/index.d.ts +3 -0
- package/dist/components/social-sign-in-button/index.js +5 -0
- package/dist/components/social-sign-in-button/social-sign-in-button.d.ts +56 -0
- package/dist/components/unit-converter/index.d.ts +4 -0
- package/dist/components/unit-converter/index.js +9 -0
- package/dist/components/unit-converter/unit-converter.d.ts +21 -0
- package/dist/components/unit-converter/units.d.ts +18 -0
- package/dist/components/wallet-pay-button/index.d.ts +3 -0
- package/dist/components/wallet-pay-button/index.js +5 -0
- package/dist/components/wallet-pay-button/wallet-pay-button.d.ts +63 -0
- package/dist/i18n/locales/ar.d.ts +316 -0
- package/dist/i18n/locales/ar.js +307 -0
- package/dist/i18n/locales/de.d.ts +316 -0
- package/dist/i18n/locales/de.js +307 -0
- package/dist/i18n/locales/el.d.ts +316 -0
- package/dist/i18n/locales/el.js +307 -0
- package/dist/i18n/locales/en.d.ts +316 -0
- package/dist/i18n/locales/en.js +310 -0
- package/dist/i18n/locales/es.d.ts +316 -0
- package/dist/i18n/locales/es.js +307 -0
- package/dist/i18n/locales/fr.d.ts +316 -0
- package/dist/i18n/locales/fr.js +307 -0
- package/dist/i18n/locales/hi.d.ts +316 -0
- package/dist/i18n/locales/hi.js +307 -0
- package/dist/i18n/locales/it.d.ts +316 -0
- package/dist/i18n/locales/it.js +307 -0
- package/dist/i18n/locales/ja.d.ts +316 -0
- package/dist/i18n/locales/ja.js +303 -0
- package/dist/i18n/locales/nl.d.ts +316 -0
- package/dist/i18n/locales/nl.js +307 -0
- package/dist/i18n/locales/pl.d.ts +316 -0
- package/dist/i18n/locales/pl.js +307 -0
- package/dist/i18n/locales/pt.d.ts +316 -0
- package/dist/i18n/locales/pt.js +310 -0
- package/dist/i18n/locales/ro.d.ts +316 -0
- package/dist/i18n/locales/ro.js +307 -0
- package/dist/i18n/locales/ru.d.ts +316 -0
- package/dist/i18n/locales/ru.js +307 -0
- package/dist/i18n/locales/sq.d.ts +316 -0
- package/dist/i18n/locales/sq.js +307 -0
- package/dist/i18n/locales/sv.d.ts +316 -0
- package/dist/i18n/locales/sv.js +307 -0
- package/dist/i18n/locales/tr.d.ts +316 -0
- package/dist/i18n/locales/tr.js +307 -0
- package/dist/i18n/locales/zh.d.ts +316 -0
- package/dist/i18n/locales/zh.js +303 -0
- package/dist/index.js +597 -527
- package/dist/locales/ar.json +316 -0
- package/dist/locales/de.json +316 -0
- package/dist/locales/el.json +316 -0
- package/dist/locales/en.json +316 -0
- package/dist/locales/es.json +316 -0
- package/dist/locales/fr.json +316 -0
- package/dist/locales/hi.json +316 -0
- package/dist/locales/it.json +316 -0
- package/dist/locales/ja.json +316 -0
- package/dist/locales/nl.json +316 -0
- package/dist/locales/pl.json +316 -0
- package/dist/locales/pt.json +316 -0
- package/dist/locales/ro.json +316 -0
- package/dist/locales/ru.json +316 -0
- package/dist/locales/sq.json +316 -0
- package/dist/locales/sv.json +316 -0
- package/dist/locales/tr.json +316 -0
- package/dist/locales/zh.json +316 -0
- package/dist/patterns/alia-assistant/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/patient-shell/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +57 -1
- package/dist/_chunks/chart-DLkVn_ex.js +0 -292
- package/dist/_chunks/subDays-CANHP9hz.js +0 -8
|
@@ -0,0 +1,702 @@
|
|
|
1
|
+
import { jsxs as p, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Fe, useId as Te, useRef as m, useState as Y, useEffect as k, useCallback as h, useMemo as We, useImperativeHandle as Ye } from "react";
|
|
3
|
+
import { c as z } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as $e } from "react-i18next";
|
|
5
|
+
import { B as H } from "./button-DD_0Xdmr.js";
|
|
6
|
+
import { A as ae } from "./alert-ywPR59NE.js";
|
|
7
|
+
import { L as he, F as Xe } from "./file-upload-CnzRcErt.js";
|
|
8
|
+
import { u as Ze } from "./use-controllable-state-BiY4xTzM.js";
|
|
9
|
+
import { u as Ge } from "./registry-nPAVE19X.js";
|
|
10
|
+
import { R as Je } from "./rotate-ccw-BWANpitO.js";
|
|
11
|
+
import { C as Qe } from "./check-DPdL_Sm7.js";
|
|
12
|
+
import { c as ze } from "./createLucideIcon-CrFbzy84.js";
|
|
13
|
+
/**
|
|
14
|
+
* @license lucide-react v1.8.0 - ISC
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the ISC license.
|
|
17
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/
|
|
19
|
+
const er = [
|
|
20
|
+
[
|
|
21
|
+
"path",
|
|
22
|
+
{
|
|
23
|
+
d: "M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",
|
|
24
|
+
key: "18u6gg"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
["circle", { cx: "12", cy: "13", r: "3", key: "1vg3eu" }]
|
|
28
|
+
], ye = ze("camera", er);
|
|
29
|
+
/**
|
|
30
|
+
* @license lucide-react v1.8.0 - ISC
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the ISC license.
|
|
33
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/
|
|
35
|
+
const rr = [
|
|
36
|
+
[
|
|
37
|
+
"path",
|
|
38
|
+
{
|
|
39
|
+
d: "M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",
|
|
40
|
+
key: "9csbqa"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
["path", { d: "m14 19.5 3-3 3 3", key: "9vmjn0" }],
|
|
44
|
+
["path", { d: "M17 22v-5.5", key: "1aa6fl" }],
|
|
45
|
+
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }]
|
|
46
|
+
], nr = ze("image-up", rr), tr = {
|
|
47
|
+
id: "document-scanner",
|
|
48
|
+
capabilities: ["submit"],
|
|
49
|
+
state: {
|
|
50
|
+
hasCapture: {
|
|
51
|
+
type: "boolean",
|
|
52
|
+
descriptionKey: "documentScanner.agent.state.hasCapture",
|
|
53
|
+
description: "True when a captured or uploaded image is available.",
|
|
54
|
+
read: (a) => a.hasCapture()
|
|
55
|
+
},
|
|
56
|
+
phase: {
|
|
57
|
+
type: "string",
|
|
58
|
+
descriptionKey: "documentScanner.agent.state.phase",
|
|
59
|
+
description: "Lifecycle phase: 'idle' | 'requesting' | 'streaming' | 'captured' | 'error'.",
|
|
60
|
+
read: (a) => a.getPhase()
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
actions: {
|
|
64
|
+
start_camera: {
|
|
65
|
+
safety: "write",
|
|
66
|
+
descriptionKey: "documentScanner.agent.actions.startCamera",
|
|
67
|
+
description: "Request camera permission and begin the live viewfinder.",
|
|
68
|
+
invoke: (a) => a.startCamera()
|
|
69
|
+
},
|
|
70
|
+
capture: {
|
|
71
|
+
safety: "write",
|
|
72
|
+
descriptionKey: "documentScanner.agent.actions.capture",
|
|
73
|
+
description: "Freeze the current viewfinder frame as a captured image.",
|
|
74
|
+
invoke: (a) => a.capture()
|
|
75
|
+
},
|
|
76
|
+
submit: {
|
|
77
|
+
safety: "write",
|
|
78
|
+
descriptionKey: "documentScanner.agent.actions.confirm",
|
|
79
|
+
description: "Confirm the current capture, emitting it via onConfirm.",
|
|
80
|
+
invoke: (a) => {
|
|
81
|
+
a.confirm();
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
retake: {
|
|
85
|
+
safety: "destructive",
|
|
86
|
+
descriptionKey: "documentScanner.agent.actions.retake",
|
|
87
|
+
description: "Discard the current capture and return to the capture path.",
|
|
88
|
+
invoke: (a) => {
|
|
89
|
+
a.retake();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
domHooks: {
|
|
94
|
+
root: {
|
|
95
|
+
attr: "data-component",
|
|
96
|
+
value: "document-scanner",
|
|
97
|
+
description: "Marks the DocumentScanner wrapper."
|
|
98
|
+
},
|
|
99
|
+
instanceId: {
|
|
100
|
+
attr: "data-component-id",
|
|
101
|
+
sourceProp: "id",
|
|
102
|
+
description: "Sourced from the id prop."
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, ar = z(
|
|
106
|
+
[
|
|
107
|
+
"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
|
|
108
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
109
|
+
"ds:bg-[var(--background)] ds:text-[var(--foreground)]",
|
|
110
|
+
"ds:p-[var(--spacing-md)]",
|
|
111
|
+
"ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed"
|
|
112
|
+
].join(" "),
|
|
113
|
+
{
|
|
114
|
+
variants: {
|
|
115
|
+
size: {
|
|
116
|
+
sm: "ds:max-inline-size-[20rem]",
|
|
117
|
+
md: "ds:max-inline-size-[28rem]",
|
|
118
|
+
lg: "ds:max-inline-size-[36rem]"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
defaultVariants: { size: "md" }
|
|
122
|
+
}
|
|
123
|
+
), be = z(
|
|
124
|
+
[
|
|
125
|
+
"ds:relative ds:block ds:inline-size-full ds:overflow-hidden",
|
|
126
|
+
"ds:rounded-[var(--radius-sm)]",
|
|
127
|
+
"ds:bg-[var(--muted)]"
|
|
128
|
+
].join(" "),
|
|
129
|
+
{
|
|
130
|
+
variants: {
|
|
131
|
+
// ID-1 cards (Tessera Sanitaria / CIE / id-card) are ~1.586:1; the
|
|
132
|
+
// generic frame is a slightly squarer neutral card.
|
|
133
|
+
frame: {
|
|
134
|
+
"tessera-sanitaria": "ds:aspect-[1.586/1]",
|
|
135
|
+
cie: "ds:aspect-[1.586/1]",
|
|
136
|
+
"id-card": "ds:aspect-[1.586/1]",
|
|
137
|
+
generic: "ds:aspect-[1.4/1]"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
defaultVariants: { frame: "tessera-sanitaria" }
|
|
141
|
+
}
|
|
142
|
+
), we = z(
|
|
143
|
+
[
|
|
144
|
+
"ds:absolute ds:inset-0 ds:block",
|
|
145
|
+
"ds:inline-size-full ds:block-size-full",
|
|
146
|
+
"ds:object-cover"
|
|
147
|
+
].join(" ")
|
|
148
|
+
), sr = z(
|
|
149
|
+
[
|
|
150
|
+
"ds:pointer-events-none ds:absolute",
|
|
151
|
+
"ds:inset-[12%]",
|
|
152
|
+
"ds:rounded-[var(--radius-sm)]",
|
|
153
|
+
"ds:border-2 ds:border-[color:var(--background)]",
|
|
154
|
+
"ds:shadow-[0_0_0_100vmax_color-mix(in_srgb,var(--foreground)_45%,transparent)]"
|
|
155
|
+
].join(" ")
|
|
156
|
+
), $ = z(
|
|
157
|
+
[
|
|
158
|
+
"ds:pointer-events-none ds:absolute ds:size-6",
|
|
159
|
+
"ds:border-[color:var(--background)]"
|
|
160
|
+
].join(" ")
|
|
161
|
+
), Se = z(
|
|
162
|
+
["ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]"].join(" ")
|
|
163
|
+
), ir = z(
|
|
164
|
+
["type-body-sm ds:text-center", "ds:text-[var(--muted-foreground)]"].join(
|
|
165
|
+
" "
|
|
166
|
+
)
|
|
167
|
+
);
|
|
168
|
+
function or(a) {
|
|
169
|
+
let o = "";
|
|
170
|
+
for (let f = 0; f < a.length; f += 1)
|
|
171
|
+
o += a[f].toString(16).padStart(2, "0");
|
|
172
|
+
return o;
|
|
173
|
+
}
|
|
174
|
+
async function xe(a) {
|
|
175
|
+
var f;
|
|
176
|
+
const o = globalThis;
|
|
177
|
+
if ((f = o.crypto) != null && f.subtle) {
|
|
178
|
+
const N = new Uint8Array(a.byteLength);
|
|
179
|
+
N.set(new Uint8Array(a));
|
|
180
|
+
const U = await o.crypto.subtle.digest("SHA-256", N.buffer);
|
|
181
|
+
return or(new Uint8Array(U));
|
|
182
|
+
}
|
|
183
|
+
return "";
|
|
184
|
+
}
|
|
185
|
+
function cr(a) {
|
|
186
|
+
const o = a instanceof Error ? a.name : "";
|
|
187
|
+
return o === "NotAllowedError" || o === "SecurityError" ? "permission-denied" : o === "NotFoundError" || o === "OverconstrainedError" ? "no-camera" : o === "NotReadableError" || o === "AbortError" ? "not-readable" : "capture-failed";
|
|
188
|
+
}
|
|
189
|
+
function dr() {
|
|
190
|
+
return typeof navigator < "u" && typeof navigator.mediaDevices < "u" && typeof navigator.mediaDevices.getUserMedia == "function";
|
|
191
|
+
}
|
|
192
|
+
const lr = {
|
|
193
|
+
"tessera-sanitaria": "documentScanner.hint.tesseraSanitaria",
|
|
194
|
+
cie: "documentScanner.hint.cie",
|
|
195
|
+
"id-card": "documentScanner.hint.idCard",
|
|
196
|
+
generic: "documentScanner.hint.generic"
|
|
197
|
+
}, ke = {
|
|
198
|
+
"permission-denied": "documentScanner.error.permissionDenied",
|
|
199
|
+
"no-camera": "documentScanner.error.noCamera",
|
|
200
|
+
"not-readable": "documentScanner.error.notReadable",
|
|
201
|
+
"insecure-context": "documentScanner.error.insecureContext",
|
|
202
|
+
"capture-failed": "documentScanner.error.captureFailed",
|
|
203
|
+
"file-invalid-type": "documentScanner.error.fileInvalidType",
|
|
204
|
+
"file-too-large": "documentScanner.error.fileTooLarge"
|
|
205
|
+
}, ur = Fe(
|
|
206
|
+
({
|
|
207
|
+
id: a,
|
|
208
|
+
value: o,
|
|
209
|
+
defaultValue: f = null,
|
|
210
|
+
onConfirm: N,
|
|
211
|
+
onRetake: U,
|
|
212
|
+
onError: X,
|
|
213
|
+
documentType: Z = "tessera-sanitaria",
|
|
214
|
+
captureMode: V = "auto",
|
|
215
|
+
accept: Ne = {
|
|
216
|
+
"image/jpeg": [".jpg", ".jpeg"],
|
|
217
|
+
"image/png": [".png"],
|
|
218
|
+
"image/webp": [".webp"]
|
|
219
|
+
},
|
|
220
|
+
maxSize: se = 10 * 1024 * 1024,
|
|
221
|
+
facingMode: ie = "environment",
|
|
222
|
+
outputType: y = "image/jpeg",
|
|
223
|
+
outputQuality: G = 0.92,
|
|
224
|
+
cropToFrame: oe = !0,
|
|
225
|
+
disabled: g = !1,
|
|
226
|
+
size: Ce = "md",
|
|
227
|
+
ariaLabel: je,
|
|
228
|
+
className: Re
|
|
229
|
+
}, Ee) => {
|
|
230
|
+
const { t: s } = $e(), ce = `ds-${Te().replace(/[^a-zA-Z0-9-_]/g, "")}-hint`, [b, C] = Ze({
|
|
231
|
+
value: o,
|
|
232
|
+
defaultValue: f
|
|
233
|
+
}), j = m(f != null || o != null), [n, v] = Y(
|
|
234
|
+
f != null || o != null ? "captured" : "idle"
|
|
235
|
+
), [S, q] = Y(
|
|
236
|
+
null
|
|
237
|
+
), [Ie, de] = Y(!1), [le, J] = Y(!1), A = m(null), Ue = m(null), R = m(null), ue = m(!1), me = m(null), Ae = m(null), pe = m(null), fe = m(null), K = m(X), M = m(N), x = m(U);
|
|
238
|
+
k(() => {
|
|
239
|
+
K.current = X, M.current = N, x.current = U;
|
|
240
|
+
}, [X, N, U]);
|
|
241
|
+
const P = o !== void 0, E = V === "upload-only", w = h(() => {
|
|
242
|
+
const e = R.current;
|
|
243
|
+
e && e.getTracks().forEach((i) => i.stop()), R.current = null;
|
|
244
|
+
const r = A.current;
|
|
245
|
+
r && (r.srcObject = null), de(!1);
|
|
246
|
+
}, []), u = h((e) => {
|
|
247
|
+
var r;
|
|
248
|
+
q(e), v("error"), (r = K.current) == null || r.call(K, { kind: e });
|
|
249
|
+
}, []), O = h(async () => {
|
|
250
|
+
var e;
|
|
251
|
+
if (!(g || E)) {
|
|
252
|
+
if (!dr()) {
|
|
253
|
+
u("insecure-context");
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
q(null), v("requesting");
|
|
257
|
+
try {
|
|
258
|
+
const r = await navigator.mediaDevices.getUserMedia({
|
|
259
|
+
video: { facingMode: ie },
|
|
260
|
+
audio: !1
|
|
261
|
+
});
|
|
262
|
+
if (ue.current) {
|
|
263
|
+
r.getTracks().forEach((d) => d.stop());
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
R.current = r;
|
|
267
|
+
const i = A.current;
|
|
268
|
+
if (i) {
|
|
269
|
+
try {
|
|
270
|
+
i.srcObject = r;
|
|
271
|
+
} catch {
|
|
272
|
+
}
|
|
273
|
+
const d = (e = i.play) == null ? void 0 : e.call(i);
|
|
274
|
+
d && typeof d.catch == "function" && d.catch(() => {
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
v("streaming");
|
|
278
|
+
} catch (r) {
|
|
279
|
+
w(), u(cr(r));
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}, [g, E, ie, w, u]), L = h(() => {
|
|
283
|
+
const e = A.current;
|
|
284
|
+
e && e.readyState >= 2 && de(!0);
|
|
285
|
+
}, []);
|
|
286
|
+
k(() => {
|
|
287
|
+
if (n !== "streaming") return;
|
|
288
|
+
L();
|
|
289
|
+
const e = window.setInterval(L, 100), r = window.setTimeout(
|
|
290
|
+
() => window.clearInterval(e),
|
|
291
|
+
4e3
|
|
292
|
+
);
|
|
293
|
+
return () => {
|
|
294
|
+
window.clearInterval(e), window.clearTimeout(r);
|
|
295
|
+
};
|
|
296
|
+
}, [n, L]);
|
|
297
|
+
const Q = h(async () => {
|
|
298
|
+
const e = A.current;
|
|
299
|
+
if (!e || e.readyState < 2) {
|
|
300
|
+
u("capture-failed");
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
const r = e.videoWidth || e.clientWidth, i = e.videoHeight || e.clientHeight;
|
|
304
|
+
if (r === 0 || i === 0) {
|
|
305
|
+
u("capture-failed");
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
let d = 0, T = 0, D = r, _ = i;
|
|
309
|
+
if (oe) {
|
|
310
|
+
const B = r * 0.12, W = i * 0.12;
|
|
311
|
+
d = B, T = W, D = r - B * 2, _ = i - W * 2;
|
|
312
|
+
}
|
|
313
|
+
const l = document.createElement("canvas");
|
|
314
|
+
l.width = Math.max(1, Math.round(D)), l.height = Math.max(1, Math.round(_));
|
|
315
|
+
const I = l.getContext("2d");
|
|
316
|
+
if (!I) {
|
|
317
|
+
u("capture-failed");
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
try {
|
|
321
|
+
I.drawImage(e, d, T, D, _, 0, 0, l.width, l.height);
|
|
322
|
+
} catch {
|
|
323
|
+
u("capture-failed");
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
w();
|
|
327
|
+
const c = await new Promise((B) => {
|
|
328
|
+
typeof l.toBlob == "function" ? l.toBlob(
|
|
329
|
+
(W) => B(W),
|
|
330
|
+
y,
|
|
331
|
+
y === "image/png" ? void 0 : G
|
|
332
|
+
) : B(null);
|
|
333
|
+
});
|
|
334
|
+
if (!c) {
|
|
335
|
+
u("capture-failed");
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
const Ke = l.toDataURL(
|
|
339
|
+
y,
|
|
340
|
+
y === "image/png" ? void 0 : G
|
|
341
|
+
), Me = await c.arrayBuffer(), Pe = await xe(Me);
|
|
342
|
+
j.current = !1;
|
|
343
|
+
const Oe = {
|
|
344
|
+
dataUrl: Ke,
|
|
345
|
+
blob: c,
|
|
346
|
+
source: "camera",
|
|
347
|
+
width: l.width,
|
|
348
|
+
height: l.height,
|
|
349
|
+
mimeType: y,
|
|
350
|
+
byteSize: c.size,
|
|
351
|
+
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
352
|
+
sha256: Pe
|
|
353
|
+
};
|
|
354
|
+
C(Oe), v("captured");
|
|
355
|
+
}, [
|
|
356
|
+
oe,
|
|
357
|
+
y,
|
|
358
|
+
G,
|
|
359
|
+
w,
|
|
360
|
+
u,
|
|
361
|
+
C
|
|
362
|
+
]), Le = h(
|
|
363
|
+
async (e) => {
|
|
364
|
+
const r = e[0];
|
|
365
|
+
if (r) {
|
|
366
|
+
J(!0);
|
|
367
|
+
try {
|
|
368
|
+
const i = URL.createObjectURL(r), d = await new Promise(
|
|
369
|
+
(l, I) => {
|
|
370
|
+
const c = new Image();
|
|
371
|
+
c.onload = () => l({ w: c.naturalWidth, h: c.naturalHeight }), c.onerror = () => I(new Error("decode-failed")), c.src = i;
|
|
372
|
+
}
|
|
373
|
+
).finally(() => {
|
|
374
|
+
URL.revokeObjectURL(i);
|
|
375
|
+
}), T = await new Promise((l, I) => {
|
|
376
|
+
const c = new FileReader();
|
|
377
|
+
c.onload = () => l(String(c.result)), c.onerror = () => I(new Error("read-failed")), c.readAsDataURL(r);
|
|
378
|
+
}), D = await r.arrayBuffer(), _ = await xe(D);
|
|
379
|
+
j.current = !1, q(null), C({
|
|
380
|
+
dataUrl: T,
|
|
381
|
+
blob: r,
|
|
382
|
+
source: "upload",
|
|
383
|
+
width: d.w,
|
|
384
|
+
height: d.h,
|
|
385
|
+
mimeType: r.type || y,
|
|
386
|
+
byteSize: r.size,
|
|
387
|
+
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
388
|
+
sha256: _
|
|
389
|
+
}), v("captured");
|
|
390
|
+
} catch {
|
|
391
|
+
u("capture-failed");
|
|
392
|
+
} finally {
|
|
393
|
+
J(!1);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
[y, u, C]
|
|
398
|
+
), De = h(
|
|
399
|
+
(e) => {
|
|
400
|
+
var d;
|
|
401
|
+
const i = ((d = e[0]) == null ? void 0 : d.reason) === "file-too-large" ? "file-too-large" : "file-invalid-type";
|
|
402
|
+
u(i);
|
|
403
|
+
},
|
|
404
|
+
[u]
|
|
405
|
+
), ee = h(() => {
|
|
406
|
+
var e;
|
|
407
|
+
b && ((e = M.current) == null || e.call(M, b));
|
|
408
|
+
}, [b]), re = m(!1), ne = h(() => {
|
|
409
|
+
var e, r;
|
|
410
|
+
if (P) {
|
|
411
|
+
(e = x.current) == null || e.call(x);
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
j.current = !1, re.current = !0, C(null), q(null), J(!1), v("idle"), (r = x.current) == null || r.call(x);
|
|
415
|
+
}, [P, C]);
|
|
416
|
+
k(() => {
|
|
417
|
+
var e, r, i;
|
|
418
|
+
n === "captured" && !j.current ? (e = me.current) == null || e.focus() : n === "error" ? (r = fe.current) == null || r.focus() : n === "idle" && re.current && (re.current = !1, (i = pe.current) == null || i.focus());
|
|
419
|
+
}, [n]), k(() => {
|
|
420
|
+
if (n !== "streaming") return;
|
|
421
|
+
const e = (r) => {
|
|
422
|
+
r.key === "Escape" && (w(), v("idle"));
|
|
423
|
+
};
|
|
424
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
425
|
+
}, [n, w]), k(() => {
|
|
426
|
+
const e = () => {
|
|
427
|
+
document.visibilityState === "hidden" && R.current && (w(), v("idle"));
|
|
428
|
+
};
|
|
429
|
+
return document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e);
|
|
430
|
+
}, [w]), k(() => () => {
|
|
431
|
+
ue.current = !0;
|
|
432
|
+
const e = R.current;
|
|
433
|
+
e && e.getTracks().forEach((r) => r.stop()), R.current = null;
|
|
434
|
+
}, []), k(() => {
|
|
435
|
+
P && (o != null ? v("captured") : n === "captured" && v("idle"));
|
|
436
|
+
}, [o, P]);
|
|
437
|
+
const te = We(
|
|
438
|
+
() => ({
|
|
439
|
+
hasCapture: () => b != null,
|
|
440
|
+
getPhase: () => n,
|
|
441
|
+
startCamera: () => O(),
|
|
442
|
+
capture: () => Q(),
|
|
443
|
+
confirm: () => ee(),
|
|
444
|
+
retake: () => ne()
|
|
445
|
+
}),
|
|
446
|
+
[b, n, O, Q, ee, ne]
|
|
447
|
+
);
|
|
448
|
+
Ye(Ee, () => te, [te]), Ge(tr, te, a);
|
|
449
|
+
const _e = je ?? s("documentScanner.regionLabel"), Be = s(lr[Z]), ge = Math.round(se / (1024 * 1024)), He = (() => {
|
|
450
|
+
if (le) return s("documentScanner.state.uploading");
|
|
451
|
+
switch (n) {
|
|
452
|
+
case "idle":
|
|
453
|
+
return s("documentScanner.state.idle");
|
|
454
|
+
case "requesting":
|
|
455
|
+
return s("documentScanner.state.requesting");
|
|
456
|
+
case "streaming":
|
|
457
|
+
return s("documentScanner.state.streaming");
|
|
458
|
+
case "captured":
|
|
459
|
+
return s("documentScanner.state.captured");
|
|
460
|
+
case "error":
|
|
461
|
+
return S ? s(ke[S], { maxSizeMb: ge }) : s("documentScanner.error.captureFailed");
|
|
462
|
+
}
|
|
463
|
+
})(), Ve = !E && S !== "file-invalid-type" && S !== "file-too-large" && S !== "insecure-context", ve = !g && (V === "auto" || V === "upload-only" || n === "error"), F = /* @__PURE__ */ t(
|
|
464
|
+
Xe,
|
|
465
|
+
{
|
|
466
|
+
variant: "button",
|
|
467
|
+
accept: Ne,
|
|
468
|
+
maxSize: se,
|
|
469
|
+
multiple: !1,
|
|
470
|
+
maxFiles: 1,
|
|
471
|
+
disabled: g,
|
|
472
|
+
showPreview: !1,
|
|
473
|
+
onDrop: (e) => {
|
|
474
|
+
Le(e);
|
|
475
|
+
},
|
|
476
|
+
onReject: De
|
|
477
|
+
}
|
|
478
|
+
), qe = n === "idle" || n === "requesting" || n === "streaming" || n === "error";
|
|
479
|
+
return /* @__PURE__ */ p(
|
|
480
|
+
"div",
|
|
481
|
+
{
|
|
482
|
+
role: "group",
|
|
483
|
+
"aria-label": _e,
|
|
484
|
+
"aria-disabled": g || void 0,
|
|
485
|
+
className: [ar({ size: Ce }), Re].filter(Boolean).join(" "),
|
|
486
|
+
"data-component": "document-scanner",
|
|
487
|
+
"data-component-id": a,
|
|
488
|
+
"data-phase": n,
|
|
489
|
+
children: [
|
|
490
|
+
/* @__PURE__ */ t(
|
|
491
|
+
"span",
|
|
492
|
+
{
|
|
493
|
+
role: "status",
|
|
494
|
+
"aria-live": "polite",
|
|
495
|
+
"aria-atomic": "true",
|
|
496
|
+
className: "ds:sr-only",
|
|
497
|
+
"data-testid": "document-scanner-live",
|
|
498
|
+
children: He
|
|
499
|
+
}
|
|
500
|
+
),
|
|
501
|
+
n === "captured" && b ? (
|
|
502
|
+
/* ---- Captured preview ---- */
|
|
503
|
+
/* @__PURE__ */ p("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
504
|
+
/* @__PURE__ */ p("div", { className: be({ frame: Z }), children: [
|
|
505
|
+
/* @__PURE__ */ t(
|
|
506
|
+
"img",
|
|
507
|
+
{
|
|
508
|
+
src: b.dataUrl,
|
|
509
|
+
alt: s("documentScanner.previewAlt"),
|
|
510
|
+
className: we(),
|
|
511
|
+
"data-testid": "document-scanner-preview"
|
|
512
|
+
}
|
|
513
|
+
),
|
|
514
|
+
j.current ? /* @__PURE__ */ t("span", { className: "ds:absolute ds:top-[var(--spacing-sm)] ds:start-[var(--spacing-sm)] ds:rounded-[var(--radius-full)] ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:py-[var(--spacing-2xs)] type-meta", children: s("documentScanner.onFileBadge") }) : null
|
|
515
|
+
] }),
|
|
516
|
+
/* @__PURE__ */ p("div", { className: Se(), children: [
|
|
517
|
+
/* @__PURE__ */ t(
|
|
518
|
+
H,
|
|
519
|
+
{
|
|
520
|
+
intent: "secondary",
|
|
521
|
+
size: "md",
|
|
522
|
+
className: "ds:min-block-size-[var(--min-target-size)] ds:min-inline-size-[var(--min-target-size)]",
|
|
523
|
+
startIcon: /* @__PURE__ */ t(Je, { "aria-hidden": "true" }),
|
|
524
|
+
onClick: ne,
|
|
525
|
+
disabled: g,
|
|
526
|
+
children: s("documentScanner.retake")
|
|
527
|
+
}
|
|
528
|
+
),
|
|
529
|
+
j.current ? null : /* @__PURE__ */ t(
|
|
530
|
+
H,
|
|
531
|
+
{
|
|
532
|
+
ref: me,
|
|
533
|
+
intent: "primary",
|
|
534
|
+
size: "md",
|
|
535
|
+
className: "ds:min-block-size-[var(--min-target-size)] ds:min-inline-size-[var(--min-target-size)]",
|
|
536
|
+
startIcon: /* @__PURE__ */ t(Qe, { "aria-hidden": "true" }),
|
|
537
|
+
onClick: ee,
|
|
538
|
+
disabled: g || b == null,
|
|
539
|
+
children: s("documentScanner.confirm")
|
|
540
|
+
}
|
|
541
|
+
)
|
|
542
|
+
] })
|
|
543
|
+
] })
|
|
544
|
+
) : null,
|
|
545
|
+
qe ? /* @__PURE__ */ p("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
546
|
+
!E && n !== "error" ? /* @__PURE__ */ p(
|
|
547
|
+
"div",
|
|
548
|
+
{
|
|
549
|
+
ref: Ue,
|
|
550
|
+
className: be({ frame: Z }),
|
|
551
|
+
"aria-busy": n === "requesting" || void 0,
|
|
552
|
+
children: [
|
|
553
|
+
/* @__PURE__ */ t(
|
|
554
|
+
"video",
|
|
555
|
+
{
|
|
556
|
+
ref: A,
|
|
557
|
+
autoPlay: !0,
|
|
558
|
+
playsInline: !0,
|
|
559
|
+
muted: !0,
|
|
560
|
+
"aria-label": s("documentScanner.videoLabel"),
|
|
561
|
+
className: we(),
|
|
562
|
+
onLoadedMetadata: L,
|
|
563
|
+
onCanPlay: L,
|
|
564
|
+
"data-testid": "document-scanner-video"
|
|
565
|
+
}
|
|
566
|
+
),
|
|
567
|
+
n === "requesting" ? /* @__PURE__ */ t("div", { className: "ds:absolute ds:inset-0 ds:flex ds:items-center ds:justify-center ds:bg-[color-mix(in_srgb,var(--foreground)_20%,transparent)]", children: /* @__PURE__ */ t(
|
|
568
|
+
he,
|
|
569
|
+
{
|
|
570
|
+
"aria-hidden": "true",
|
|
571
|
+
className: "ds:size-8 ds:animate-spin ds:text-[var(--background)] ds:motion-reduce:animate-none"
|
|
572
|
+
}
|
|
573
|
+
) }) : null,
|
|
574
|
+
/* @__PURE__ */ p(
|
|
575
|
+
"div",
|
|
576
|
+
{
|
|
577
|
+
"aria-hidden": "true",
|
|
578
|
+
className: sr(),
|
|
579
|
+
"data-testid": "document-scanner-frame",
|
|
580
|
+
children: [
|
|
581
|
+
/* @__PURE__ */ t(
|
|
582
|
+
"span",
|
|
583
|
+
{
|
|
584
|
+
className: [
|
|
585
|
+
$(),
|
|
586
|
+
"ds:top-0 ds:start-0 ds:border-t-2 ds:border-s-2 ds:rounded-ss-[var(--radius-sm)]"
|
|
587
|
+
].join(" ")
|
|
588
|
+
}
|
|
589
|
+
),
|
|
590
|
+
/* @__PURE__ */ t(
|
|
591
|
+
"span",
|
|
592
|
+
{
|
|
593
|
+
className: [
|
|
594
|
+
$(),
|
|
595
|
+
"ds:top-0 ds:end-0 ds:border-t-2 ds:border-e-2 ds:rounded-se-[var(--radius-sm)]"
|
|
596
|
+
].join(" ")
|
|
597
|
+
}
|
|
598
|
+
),
|
|
599
|
+
/* @__PURE__ */ t(
|
|
600
|
+
"span",
|
|
601
|
+
{
|
|
602
|
+
className: [
|
|
603
|
+
$(),
|
|
604
|
+
"ds:bottom-0 ds:start-0 ds:border-b-2 ds:border-s-2 ds:rounded-es-[var(--radius-sm)]"
|
|
605
|
+
].join(" ")
|
|
606
|
+
}
|
|
607
|
+
),
|
|
608
|
+
/* @__PURE__ */ t(
|
|
609
|
+
"span",
|
|
610
|
+
{
|
|
611
|
+
className: [
|
|
612
|
+
$(),
|
|
613
|
+
"ds:bottom-0 ds:end-0 ds:border-b-2 ds:border-e-2 ds:rounded-ee-[var(--radius-sm)]"
|
|
614
|
+
].join(" ")
|
|
615
|
+
}
|
|
616
|
+
)
|
|
617
|
+
]
|
|
618
|
+
}
|
|
619
|
+
)
|
|
620
|
+
]
|
|
621
|
+
}
|
|
622
|
+
) : null,
|
|
623
|
+
n === "streaming" ? /* @__PURE__ */ t("p", { id: ce, className: ir(), children: Be }) : null,
|
|
624
|
+
n === "error" && S ? /* @__PURE__ */ p(ae, { variant: "error", live: "assertive", children: [
|
|
625
|
+
/* @__PURE__ */ t(ae.Description, { children: s(ke[S], { maxSizeMb: ge }) }),
|
|
626
|
+
/* @__PURE__ */ p(ae.Action, { children: [
|
|
627
|
+
Ve ? /* @__PURE__ */ t(
|
|
628
|
+
H,
|
|
629
|
+
{
|
|
630
|
+
ref: fe,
|
|
631
|
+
intent: "secondary",
|
|
632
|
+
size: "sm",
|
|
633
|
+
onClick: () => {
|
|
634
|
+
O();
|
|
635
|
+
},
|
|
636
|
+
disabled: g,
|
|
637
|
+
children: s("documentScanner.retry")
|
|
638
|
+
}
|
|
639
|
+
) : null,
|
|
640
|
+
ve ? F : null
|
|
641
|
+
] })
|
|
642
|
+
] }) : null,
|
|
643
|
+
n !== "error" ? /* @__PURE__ */ p("div", { className: Se(), children: [
|
|
644
|
+
n === "streaming" ? /* @__PURE__ */ t(
|
|
645
|
+
H,
|
|
646
|
+
{
|
|
647
|
+
ref: Ae,
|
|
648
|
+
intent: "primary",
|
|
649
|
+
size: "lg",
|
|
650
|
+
startIcon: /* @__PURE__ */ t(ye, { "aria-hidden": "true" }),
|
|
651
|
+
onClick: () => {
|
|
652
|
+
Q();
|
|
653
|
+
},
|
|
654
|
+
disabled: g || !Ie,
|
|
655
|
+
"aria-describedby": ce,
|
|
656
|
+
"aria-label": s("documentScanner.capture"),
|
|
657
|
+
children: s("documentScanner.capture")
|
|
658
|
+
}
|
|
659
|
+
) : null,
|
|
660
|
+
(n === "idle" || n === "requesting") && !E ? /* @__PURE__ */ t(
|
|
661
|
+
H,
|
|
662
|
+
{
|
|
663
|
+
ref: pe,
|
|
664
|
+
intent: "primary",
|
|
665
|
+
size: "md",
|
|
666
|
+
className: "ds:min-block-size-[var(--min-target-size)] ds:min-inline-size-[var(--min-target-size)]",
|
|
667
|
+
loading: n === "requesting",
|
|
668
|
+
startIcon: /* @__PURE__ */ t(ye, { "aria-hidden": "true" }),
|
|
669
|
+
onClick: () => {
|
|
670
|
+
O();
|
|
671
|
+
},
|
|
672
|
+
disabled: g,
|
|
673
|
+
children: s("documentScanner.useCamera")
|
|
674
|
+
}
|
|
675
|
+
) : null,
|
|
676
|
+
le ? /* @__PURE__ */ p("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-body-sm ds:text-[var(--muted-foreground)]", children: [
|
|
677
|
+
/* @__PURE__ */ t(
|
|
678
|
+
he,
|
|
679
|
+
{
|
|
680
|
+
"aria-hidden": "true",
|
|
681
|
+
className: "ds:size-4 ds:animate-spin ds:motion-reduce:animate-none"
|
|
682
|
+
}
|
|
683
|
+
),
|
|
684
|
+
s("documentScanner.state.uploading")
|
|
685
|
+
] }) : ve && n !== "streaming" ? E ? F : /* @__PURE__ */ p("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] type-body-sm ds:text-[var(--muted-foreground)]", children: [
|
|
686
|
+
/* @__PURE__ */ t(nr, { "aria-hidden": "true", className: "ds:size-4" }),
|
|
687
|
+
F
|
|
688
|
+
] }) : null,
|
|
689
|
+
n === "streaming" && V !== "camera-only" ? F : null
|
|
690
|
+
] }) : null
|
|
691
|
+
] }) : null
|
|
692
|
+
]
|
|
693
|
+
}
|
|
694
|
+
);
|
|
695
|
+
}
|
|
696
|
+
);
|
|
697
|
+
ur.displayName = "DocumentScanner";
|
|
698
|
+
export {
|
|
699
|
+
ur as D,
|
|
700
|
+
tr as d
|
|
701
|
+
};
|
|
702
|
+
//# sourceMappingURL=document-scanner-CdHQ6lTN.js.map
|