@alfadocs/ui-kit-debug 1.93.1 → 1.94.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 (200) hide show
  1. package/dist/_chunks/{ai-prompt-input-DH_rnV-F.js → ai-prompt-input-CG9BEggs.js} +2 -2
  2. package/dist/_chunks/{ai-prompt-input-DH_rnV-F.js.map → ai-prompt-input-CG9BEggs.js.map} +1 -1
  3. package/dist/_chunks/{anamnesis-summary-rows-EKPfVCmh.js → anamnesis-summary-rows-IMohuz0D.js} +3 -3
  4. package/dist/_chunks/{anamnesis-summary-rows-EKPfVCmh.js.map → anamnesis-summary-rows-IMohuz0D.js.map} +1 -1
  5. package/dist/_chunks/{audio-recorder-m7Jqvvcl.js → audio-recorder-BOm2FgEu.js} +2 -2
  6. package/dist/_chunks/{audio-recorder-m7Jqvvcl.js.map → audio-recorder-BOm2FgEu.js.map} +1 -1
  7. package/dist/_chunks/{balance-badge-cell-BtJvre1-.js → balance-badge-cell-vZxbOFgP.js} +4 -4
  8. package/dist/_chunks/{balance-badge-cell-BtJvre1-.js.map → balance-badge-cell-vZxbOFgP.js.map} +1 -1
  9. package/dist/_chunks/{bishop-score-C5di6oAV.js → bishop-score-BBYuyk2k.js} +2 -2
  10. package/dist/_chunks/{bishop-score-C5di6oAV.js.map → bishop-score-BBYuyk2k.js.map} +1 -1
  11. package/dist/_chunks/{calendar-appointment-editor-dialog-sJKLoVJ2.js → calendar-appointment-editor-dialog-CsVWoRcP.js} +5 -5
  12. package/dist/_chunks/{calendar-appointment-editor-dialog-sJKLoVJ2.js.map → calendar-appointment-editor-dialog-CsVWoRcP.js.map} +1 -1
  13. package/dist/_chunks/{data-table-CqQgoNsU.js → data-table-C_nnpJ-Q.js} +2 -2
  14. package/dist/_chunks/{data-table-CqQgoNsU.js.map → data-table-C_nnpJ-Q.js.map} +1 -1
  15. package/dist/_chunks/{document-preview-QEbr7jp1.js → document-preview-ytR1FcWA.js} +2 -2
  16. package/dist/_chunks/{document-preview-QEbr7jp1.js.map → document-preview-ytR1FcWA.js.map} +1 -1
  17. package/dist/_chunks/{file-manager-BnI1ZWZu.js → file-manager-CAIbuaSs.js} +2 -2
  18. package/dist/_chunks/{file-manager-BnI1ZWZu.js.map → file-manager-CAIbuaSs.js.map} +1 -1
  19. package/dist/_chunks/{gestational-age-calculator-Dr9hdDta.js → gestational-age-calculator-Dn8IOXHB.js} +2 -2
  20. package/dist/_chunks/{gestational-age-calculator-Dr9hdDta.js.map → gestational-age-calculator-Dn8IOXHB.js.map} +1 -1
  21. package/dist/_chunks/group-options-BvKhQ3xb.js.map +1 -1
  22. package/dist/_chunks/{heatmap-fCxwNz2o.js → heatmap-DdF8qTTV.js} +2 -2
  23. package/dist/_chunks/{heatmap-fCxwNz2o.js.map → heatmap-DdF8qTTV.js.map} +1 -1
  24. package/dist/_chunks/{kit-extensions-a0G4COFH.js → kit-extensions-44gudqqq.js} +3 -3
  25. package/dist/_chunks/{kit-extensions-a0G4COFH.js.map → kit-extensions-44gudqqq.js.map} +1 -1
  26. package/dist/_chunks/{link-cell-renderer-BS3V4LA6.js → link-cell-renderer-OmvrkUeN.js} +2 -2
  27. package/dist/_chunks/{link-cell-renderer-BS3V4LA6.js.map → link-cell-renderer-OmvrkUeN.js.map} +1 -1
  28. package/dist/_chunks/{muscle-scheme-C66WlCxG.js → muscle-scheme-B7qMW0ho.js} +2 -2
  29. package/dist/_chunks/{muscle-scheme-C66WlCxG.js.map → muscle-scheme-B7qMW0ho.js.map} +1 -1
  30. package/dist/_chunks/{operator-hero-C_5B-8Qp.js → operator-hero-D_0KoEuJ.js} +31 -31
  31. package/dist/_chunks/operator-hero-D_0KoEuJ.js.map +1 -0
  32. package/dist/_chunks/{optical-prescription-CMM1Y6Xg.js → optical-prescription-BGVeDVSP.js} +2 -2
  33. package/dist/_chunks/{optical-prescription-CMM1Y6Xg.js.map → optical-prescription-BGVeDVSP.js.map} +1 -1
  34. package/dist/_chunks/{patient-details-BjcUpD9S.js → patient-details-DTlpBYHJ.js} +2 -2
  35. package/dist/_chunks/{patient-details-BjcUpD9S.js.map → patient-details-DTlpBYHJ.js.map} +1 -1
  36. package/dist/_chunks/{patient-field-row-B0tdiaWi.js → patient-field-row-DWTKV1hF.js} +2 -2
  37. package/dist/_chunks/{patient-field-row-B0tdiaWi.js.map → patient-field-row-DWTKV1hF.js.map} +1 -1
  38. package/dist/_chunks/{patient-summary-card-Cvv6_Ugk.js → patient-summary-card-C61AR4Tn.js} +2 -2
  39. package/dist/_chunks/{patient-summary-card-Cvv6_Ugk.js.map → patient-summary-card-C61AR4Tn.js.map} +1 -1
  40. package/dist/_chunks/{pregnancy-dating-BHvfDxz4.js → pregnancy-dating-CuVj9KGR.js} +2 -2
  41. package/dist/_chunks/{pregnancy-dating-BHvfDxz4.js.map → pregnancy-dating-CuVj9KGR.js.map} +1 -1
  42. package/dist/_chunks/{registration-form-CRm6DaB9.js → registration-form-BygI73vG.js} +2 -2
  43. package/dist/_chunks/{registration-form-CRm6DaB9.js.map → registration-form-BygI73vG.js.map} +1 -1
  44. package/dist/_chunks/{reserved.agent-DnPwaa4u.js → reserved.agent-XU88crNW.js} +2 -2
  45. package/dist/_chunks/{reserved.agent-DnPwaa4u.js.map → reserved.agent-XU88crNW.js.map} +1 -1
  46. package/dist/_chunks/{select-4S-eYZUf.js → select-BBDRYxJl.js} +247 -241
  47. package/dist/_chunks/select-BBDRYxJl.js.map +1 -0
  48. package/dist/_chunks/signature-request-BVGeF0qB.js +2774 -0
  49. package/dist/_chunks/signature-request-BVGeF0qB.js.map +1 -0
  50. package/dist/_chunks/{tabs-BTj-2qMZ.js → tabs-BmxQu-TJ.js} +2 -2
  51. package/dist/_chunks/{tabs-BTj-2qMZ.js.map → tabs-BmxQu-TJ.js.map} +1 -1
  52. package/dist/_chunks/{task-editor-CI1SKUNc.js → task-editor-BZeSBxwU.js} +2 -2
  53. package/dist/_chunks/{task-editor-CI1SKUNc.js.map → task-editor-BZeSBxwU.js.map} +1 -1
  54. package/dist/_chunks/{tasks-panel-BkjtgjQ8.js → tasks-panel-BTCYGLGA.js} +2 -2
  55. package/dist/_chunks/{tasks-panel-BkjtgjQ8.js.map → tasks-panel-BTCYGLGA.js.map} +1 -1
  56. package/dist/_chunks/{unit-converter-BH5ueIhT.js → unit-converter-C95sa5y8.js} +2 -2
  57. package/dist/_chunks/{unit-converter-BH5ueIhT.js.map → unit-converter-C95sa5y8.js.map} +1 -1
  58. package/dist/_chunks/{use-appointment-details-read-D8vDg0sg.js → use-appointment-details-read-B6uhmNdV.js} +2 -2
  59. package/dist/_chunks/{use-appointment-details-read-D8vDg0sg.js.map → use-appointment-details-read-B6uhmNdV.js.map} +1 -1
  60. package/dist/_chunks/{voice-control-panel-BP0otrID.js → voice-control-panel-BGJjUwnY.js} +2 -2
  61. package/dist/_chunks/{voice-control-panel-BP0otrID.js.map → voice-control-panel-BGJjUwnY.js.map} +1 -1
  62. package/dist/agent-catalog.json +9 -5
  63. package/dist/agent-i18n/en.json +4 -4
  64. package/dist/components/_shared/group-options.d.ts +2 -2
  65. package/dist/components/_shared/group-options.d.ts.map +1 -1
  66. package/dist/components/ai-prompt-input/index.js +1 -1
  67. package/dist/components/appointment-details-panel/index.js +1 -1
  68. package/dist/components/audio-recorder/index.js +1 -1
  69. package/dist/components/bishop-score/index.js +1 -1
  70. package/dist/components/booking/index.js +1 -1
  71. package/dist/components/data-table/index.js +2 -2
  72. package/dist/components/document-preview/index.js +1 -1
  73. package/dist/components/file-manager/index.js +1 -1
  74. package/dist/components/gestational-age-calculator/index.js +1 -1
  75. package/dist/components/heatmap/index.js +1 -1
  76. package/dist/components/muscle-scheme/index.js +1 -1
  77. package/dist/components/operator-hero/index.js +1 -1
  78. package/dist/components/operator-hero/operator-hero.d.ts +3 -2
  79. package/dist/components/operator-hero/operator-hero.d.ts.map +1 -1
  80. package/dist/components/optical-prescription/index.js +1 -1
  81. package/dist/components/patient-details/index.js +1 -1
  82. package/dist/components/patient-summary-card/index.js +1 -1
  83. package/dist/components/patient-table/index.js +1 -1
  84. package/dist/components/pregnancy-dating/index.js +1 -1
  85. package/dist/components/rich-text-editor/index.js +1 -1
  86. package/dist/components/select/index.js +1 -1
  87. package/dist/components/select/select.d.ts +13 -1
  88. package/dist/components/select/select.d.ts.map +1 -1
  89. package/dist/components/skeleton-scheme/index.js +1 -1
  90. package/dist/components/tabs/index.js +1 -1
  91. package/dist/components/task-editor/index.js +1 -1
  92. package/dist/components/tasks-panel/index.js +1 -1
  93. package/dist/components/unit-converter/index.js +1 -1
  94. package/dist/components/voice-control-panel/index.js +1 -1
  95. package/dist/core.css +1 -1
  96. package/dist/i18n/locales/ar.d.ts +4 -0
  97. package/dist/i18n/locales/ar.d.ts.map +1 -1
  98. package/dist/i18n/locales/ar.js +4 -0
  99. package/dist/i18n/locales/ar.js.map +1 -1
  100. package/dist/i18n/locales/de.d.ts +4 -0
  101. package/dist/i18n/locales/de.d.ts.map +1 -1
  102. package/dist/i18n/locales/de.js +4 -0
  103. package/dist/i18n/locales/de.js.map +1 -1
  104. package/dist/i18n/locales/el.d.ts +4 -0
  105. package/dist/i18n/locales/el.d.ts.map +1 -1
  106. package/dist/i18n/locales/el.js +4 -0
  107. package/dist/i18n/locales/el.js.map +1 -1
  108. package/dist/i18n/locales/en.d.ts +4 -0
  109. package/dist/i18n/locales/en.d.ts.map +1 -1
  110. package/dist/i18n/locales/en.js +4 -0
  111. package/dist/i18n/locales/en.js.map +1 -1
  112. package/dist/i18n/locales/es.d.ts +4 -0
  113. package/dist/i18n/locales/es.d.ts.map +1 -1
  114. package/dist/i18n/locales/es.js +4 -0
  115. package/dist/i18n/locales/es.js.map +1 -1
  116. package/dist/i18n/locales/fr.d.ts +4 -0
  117. package/dist/i18n/locales/fr.d.ts.map +1 -1
  118. package/dist/i18n/locales/fr.js +4 -0
  119. package/dist/i18n/locales/fr.js.map +1 -1
  120. package/dist/i18n/locales/hi.d.ts +4 -0
  121. package/dist/i18n/locales/hi.d.ts.map +1 -1
  122. package/dist/i18n/locales/hi.js +4 -0
  123. package/dist/i18n/locales/hi.js.map +1 -1
  124. package/dist/i18n/locales/it.d.ts +4 -0
  125. package/dist/i18n/locales/it.d.ts.map +1 -1
  126. package/dist/i18n/locales/it.js +4 -0
  127. package/dist/i18n/locales/it.js.map +1 -1
  128. package/dist/i18n/locales/ja.d.ts +4 -0
  129. package/dist/i18n/locales/ja.d.ts.map +1 -1
  130. package/dist/i18n/locales/ja.js +4 -0
  131. package/dist/i18n/locales/ja.js.map +1 -1
  132. package/dist/i18n/locales/nl.d.ts +4 -0
  133. package/dist/i18n/locales/nl.d.ts.map +1 -1
  134. package/dist/i18n/locales/nl.js +4 -0
  135. package/dist/i18n/locales/nl.js.map +1 -1
  136. package/dist/i18n/locales/pl.d.ts +4 -0
  137. package/dist/i18n/locales/pl.d.ts.map +1 -1
  138. package/dist/i18n/locales/pl.js +4 -0
  139. package/dist/i18n/locales/pl.js.map +1 -1
  140. package/dist/i18n/locales/pt.d.ts +4 -0
  141. package/dist/i18n/locales/pt.d.ts.map +1 -1
  142. package/dist/i18n/locales/pt.js +4 -0
  143. package/dist/i18n/locales/pt.js.map +1 -1
  144. package/dist/i18n/locales/ro.d.ts +4 -0
  145. package/dist/i18n/locales/ro.d.ts.map +1 -1
  146. package/dist/i18n/locales/ro.js +4 -0
  147. package/dist/i18n/locales/ro.js.map +1 -1
  148. package/dist/i18n/locales/ru.d.ts +4 -0
  149. package/dist/i18n/locales/ru.d.ts.map +1 -1
  150. package/dist/i18n/locales/ru.js +4 -0
  151. package/dist/i18n/locales/ru.js.map +1 -1
  152. package/dist/i18n/locales/sq.d.ts +4 -0
  153. package/dist/i18n/locales/sq.d.ts.map +1 -1
  154. package/dist/i18n/locales/sq.js +4 -0
  155. package/dist/i18n/locales/sq.js.map +1 -1
  156. package/dist/i18n/locales/sv.d.ts +4 -0
  157. package/dist/i18n/locales/sv.d.ts.map +1 -1
  158. package/dist/i18n/locales/sv.js +4 -0
  159. package/dist/i18n/locales/sv.js.map +1 -1
  160. package/dist/i18n/locales/tr.d.ts +4 -0
  161. package/dist/i18n/locales/tr.d.ts.map +1 -1
  162. package/dist/i18n/locales/tr.js +4 -0
  163. package/dist/i18n/locales/tr.js.map +1 -1
  164. package/dist/i18n/locales/zh.d.ts +4 -0
  165. package/dist/i18n/locales/zh.d.ts.map +1 -1
  166. package/dist/i18n/locales/zh.js +4 -0
  167. package/dist/i18n/locales/zh.js.map +1 -1
  168. package/dist/index.js +29 -29
  169. package/dist/locales/ar.json +4 -0
  170. package/dist/locales/de.json +4 -0
  171. package/dist/locales/el.json +4 -0
  172. package/dist/locales/en.json +4 -0
  173. package/dist/locales/es.json +4 -0
  174. package/dist/locales/fr.json +4 -0
  175. package/dist/locales/hi.json +4 -0
  176. package/dist/locales/it.json +4 -0
  177. package/dist/locales/ja.json +4 -0
  178. package/dist/locales/nl.json +4 -0
  179. package/dist/locales/pl.json +4 -0
  180. package/dist/locales/pt.json +4 -0
  181. package/dist/locales/ro.json +4 -0
  182. package/dist/locales/ru.json +4 -0
  183. package/dist/locales/sq.json +4 -0
  184. package/dist/locales/sv.json +4 -0
  185. package/dist/locales/tr.json +4 -0
  186. package/dist/locales/zh.json +4 -0
  187. package/dist/patterns/anamnesis/index.js +1 -1
  188. package/dist/patterns/calendar/index.js +1 -1
  189. package/dist/patterns/registration-form/index.js +1 -1
  190. package/dist/patterns/signature-request/index.js +1 -1
  191. package/dist/patterns/signature-request/required-documents.d.ts +2 -1
  192. package/dist/patterns/signature-request/required-documents.d.ts.map +1 -1
  193. package/dist/patterns/signature-request/signature-request.d.ts +61 -0
  194. package/dist/patterns/signature-request/signature-request.d.ts.map +1 -1
  195. package/dist/tokens.css +1 -1
  196. package/package.json +1 -1
  197. package/dist/_chunks/operator-hero-C_5B-8Qp.js.map +0 -1
  198. package/dist/_chunks/select-4S-eYZUf.js.map +0 -1
  199. package/dist/_chunks/signature-request-DvhyrRpn.js +0 -2448
  200. package/dist/_chunks/signature-request-DvhyrRpn.js.map +0 -1
@@ -0,0 +1,2774 @@
1
+ import { jsx as n, jsxs as u, Fragment as me } from "react/jsx-runtime";
2
+ import { useState as _, useRef as ce, useEffect as Be, useId as B, forwardRef as Di, useLayoutEffect as Wt } from "react";
3
+ import { useTranslation as Mn } from "react-i18next";
4
+ import { D as C } from "./dialog-C7RWaH08.js";
5
+ import { Q as Pi } from "./qr-code-DHEma21c.js";
6
+ import { S as Li } from "./spinner-CoflYlEx.js";
7
+ import { S as qe } from "./skeleton-tTWJpvAq.js";
8
+ import { B as L } from "./button-DohK_Ak_.js";
9
+ import { I as vn } from "./icon-button-S8_weU3g.js";
10
+ import { s as _i, S as Ue } from "./select-BBDRYxJl.js";
11
+ import { S as ga } from "./switch-D--x7n6h.js";
12
+ import { A as U } from "./alert-9kEwDza3.js";
13
+ import { S as pa } from "./separator-CYU_bGFn.js";
14
+ import { A as Zn } from "./avatar-a6042Ox2.js";
15
+ import { L as Mi } from "./link-DtCfnLnF.js";
16
+ import { L as at } from "./list-CNnn7DOD.js";
17
+ import { a as Ea, T as Aa } from "./tooltip-uEBdD1-5.js";
18
+ import { a as Da } from "./whatsapp-button-DV9JFmtq.js";
19
+ import { c as rt } from "./createLucideIcon-DhHxpK9K.js";
20
+ import { M as Pa } from "./mail-BqXVF2zH.js";
21
+ import { M as $i } from "./message-square-Bye4ATvx.js";
22
+ import { D as fn } from "./dropdown-menu-D1we7oAY.js";
23
+ import { S as zi } from "./signature-status-chip-pIoQjvH8.js";
24
+ import { C as Hi } from "./chevron-down-DWE7GSq9.js";
25
+ import { E as Fi } from "./eye-BjhN2nYf.js";
26
+ import { D as fa } from "./download-CfYKJO_j.js";
27
+ import { S as Bi } from "./share-2-B49jcW2I.js";
28
+ import { T as va } from "./trash-2-uumy3fy1.js";
29
+ import { U as Xt } from "./user-plus-BtcOLgNU.js";
30
+ import { T as Ui } from "./triangle-alert-CBnO6nq_.js";
31
+ import { C as Wi } from "./circle-check-BN6rz4NV.js";
32
+ import { P as ba } from "./pen-line-D0De5zdl.js";
33
+ import { S as ji } from "./send-C5kDJ-Mz.js";
34
+ import { P as et } from "./plus-DzMQ_c6b.js";
35
+ import { X as Ra } from "./x-B5YnXwCz.js";
36
+ /**
37
+ * @license lucide-react v1.22.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */
42
+ const Gi = [
43
+ ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
44
+ ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
45
+ ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
46
+ ], Vi = rt("link-2", Gi);
47
+ /**
48
+ * @license lucide-react v1.22.0 - ISC
49
+ *
50
+ * This source code is licensed under the ISC license.
51
+ * See the LICENSE file in the root directory of this source tree.
52
+ */
53
+ const Qi = [
54
+ ["rect", { width: "5", height: "5", x: "3", y: "3", rx: "1", key: "1tu5fj" }],
55
+ ["rect", { width: "5", height: "5", x: "16", y: "3", rx: "1", key: "1v8r4q" }],
56
+ ["rect", { width: "5", height: "5", x: "3", y: "16", rx: "1", key: "1x03jg" }],
57
+ ["path", { d: "M21 16h-3a2 2 0 0 0-2 2v3", key: "177gqh" }],
58
+ ["path", { d: "M21 21v.01", key: "ents32" }],
59
+ ["path", { d: "M12 7v3a2 2 0 0 1-2 2H7", key: "8crl2c" }],
60
+ ["path", { d: "M3 12h.01", key: "nlz23k" }],
61
+ ["path", { d: "M12 3h.01", key: "n36tog" }],
62
+ ["path", { d: "M12 16v.01", key: "133mhm" }],
63
+ ["path", { d: "M16 12h1", key: "1slzba" }],
64
+ ["path", { d: "M21 12v.01", key: "1lwtk9" }],
65
+ ["path", { d: "M12 21v-1", key: "1880an" }]
66
+ ], Ki = rt("qr-code", Qi);
67
+ /**
68
+ * @license lucide-react v1.22.0 - ISC
69
+ *
70
+ * This source code is licensed under the ISC license.
71
+ * See the LICENSE file in the root directory of this source tree.
72
+ */
73
+ const Xi = [
74
+ ["circle", { cx: "8", cy: "21", r: "1", key: "jimo8o" }],
75
+ ["circle", { cx: "19", cy: "21", r: "1", key: "13723u" }],
76
+ [
77
+ "path",
78
+ {
79
+ d: "M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",
80
+ key: "9zh506"
81
+ }
82
+ ]
83
+ ], Yi = rt("shopping-cart", Xi);
84
+ /**
85
+ * @license lucide-react v1.22.0 - ISC
86
+ *
87
+ * This source code is licensed under the ISC license.
88
+ * See the LICENSE file in the root directory of this source tree.
89
+ */
90
+ const Ji = [
91
+ ["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
92
+ ["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
93
+ ], Zi = rt("tablet", Ji), it = [
94
+ "sms",
95
+ "email",
96
+ "on-device"
97
+ ], er = [
98
+ "sms",
99
+ "email",
100
+ "whatsapp",
101
+ "on-device"
102
+ ];
103
+ function Yt() {
104
+ const { t: i } = Mn("ui");
105
+ return {
106
+ sms: {
107
+ label: i("signatureRequest.viaSms"),
108
+ icon: /* @__PURE__ */ n($i, { className: "ds:size-4", "aria-hidden": !0 })
109
+ },
110
+ email: {
111
+ label: i("signatureRequest.viaEmail"),
112
+ icon: /* @__PURE__ */ n(Pa, { className: "ds:size-4", "aria-hidden": !0 })
113
+ },
114
+ whatsapp: {
115
+ label: i("signatureRequest.viaWhatsapp"),
116
+ icon: /* @__PURE__ */ n(Da, { className: "ds:size-4", "aria-hidden": !0 })
117
+ },
118
+ "on-device": {
119
+ label: i("signatureRequest.onThisDevice"),
120
+ icon: /* @__PURE__ */ n(Zi, { className: "ds:size-4", "aria-hidden": !0 })
121
+ },
122
+ qr: {
123
+ label: i("signatureRequest.viaQr"),
124
+ icon: /* @__PURE__ */ n(Ki, { className: "ds:size-4", "aria-hidden": !0 })
125
+ }
126
+ };
127
+ }
128
+ function La({
129
+ loading: i,
130
+ loadingText: o,
131
+ loadedText: m,
132
+ message: l
133
+ }) {
134
+ const [p, I] = _(""), k = ce(!1);
135
+ return Be(() => {
136
+ i ? I(o) : k.current && I(m), k.current = i;
137
+ }, [i, o, m]), /* @__PURE__ */ n("span", { role: "status", className: "ds:sr-only", children: l !== void 0 && !i ? l : p });
138
+ }
139
+ const ae = "ds:grid ds:grid-cols-[var(--spacing-xl)_minmax(0,1fr)_var(--min-target-size)] ds:@[512px]/person:grid-cols-[var(--spacing-xl)_minmax(0,1fr)_max-content_var(--min-target-size)] ds:items-center ds:gap-x-[var(--spacing-sm)] ds:gap-y-[var(--spacing-sm)]", nt = "ds:col-start-1 ds:row-start-1 ds:flex ds:items-center ds:justify-center", Na = "ds:col-start-2 ds:row-start-1 ds:min-w-0", jt = "ds:col-[2/-2] ds:row-start-1 ds:min-w-0", tt = "ds:col-[-3/-2] ds:row-start-2 ds:min-w-0 ds:@[512px]/person:row-start-1", xa = "ds:col-[-2/-1] ds:row-start-1 ds:flex ds:items-center ds:justify-center", F = "ds:col-[2/-2] ds:min-w-0 ds:text-start", _n = "ds:col-[1/-2] ds:row-start-1 ds:flex ds:flex-wrap ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", nr = "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", pn = "ds:@container/person";
140
+ function _a({ meta: i }) {
141
+ return /* @__PURE__ */ n(
142
+ "span",
143
+ {
144
+ "aria-hidden": "true",
145
+ "data-channel-sizer": "",
146
+ className: "ds:invisible ds:block ds:h-0 ds:overflow-hidden",
147
+ children: Object.entries(i).map(([o, { label: m, icon: l }]) => /* @__PURE__ */ n("span", { className: "ds:flex ds:w-max", children: /* @__PURE__ */ u("span", { className: _i({ size: "md" }), children: [
148
+ /* @__PURE__ */ u("span", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
149
+ /* @__PURE__ */ n("span", { className: "ds:inline-flex ds:shrink-0", children: l }),
150
+ /* @__PURE__ */ n("span", { className: "ds:whitespace-nowrap", children: m })
151
+ ] }),
152
+ /* @__PURE__ */ n(Hi, { className: "ds:size-4 ds:shrink-0" })
153
+ ] }) }, o))
154
+ }
155
+ );
156
+ }
157
+ const Ca = [
158
+ "link",
159
+ "email",
160
+ "whatsapp"
161
+ ], tr = [0, 1], sr = "ds:flex ds:flex-col ds:@[512px]/person:grid ds:@[512px]/person:grid-cols-[max-content_minmax(0,1fr)_max-content] ds:@[512px]/person:gap-x-[var(--spacing-md)]", qa = "ds:flex ds:flex-col ds:@[512px]/person:col-span-full ds:@[512px]/person:grid ds:@[512px]/person:grid-cols-subgrid", Gt = "ds:grid ds:grid-cols-[minmax(0,1fr)_max-content] ds:items-center ds:gap-x-[var(--spacing-sm)] ds:gap-y-[var(--spacing-xs)] ds:py-[var(--spacing-xs)] ds:@[512px]/person:col-span-full ds:@[512px]/person:grid-cols-subgrid ds:@[512px]/person:gap-x-[var(--spacing-md)]", Sa = "ds:col-start-1 ds:row-start-1 ds:min-w-0 ds:text-start ds:@[512px]/person:col-start-1 ds:@[512px]/person:whitespace-nowrap", wa = "ds:col-span-full ds:row-start-2 ds:min-w-0 ds:text-start ds:@[512px]/person:col-span-1 ds:@[512px]/person:col-start-2 ds:@[512px]/person:row-start-1", Ia = "ds:col-start-2 ds:row-start-1 ds:flex ds:justify-end ds:@[512px]/person:col-start-3";
162
+ function Ma(i) {
163
+ const o = (i instanceof Date ? i : new Date(i)).getTime();
164
+ return Number.isNaN(o) ? null : o;
165
+ }
166
+ function ar(i) {
167
+ return i.map((o, m) => ({ record: o, index: m, ms: Ma(o.createdAt) })).sort((o, m) => o.ms === m.ms ? o.index - m.index : o.ms === null ? 1 : m.ms === null ? -1 : m.ms - o.ms).map(({ record: o }) => o);
168
+ }
169
+ function ir({
170
+ signatures: i,
171
+ loading: o = !1,
172
+ showLegalLevel: m = !0,
173
+ onView: l,
174
+ onDownload: p,
175
+ onShare: I,
176
+ shareTargets: k = Ca,
177
+ onDelete: j
178
+ }) {
179
+ const { t: R, i18n: Z } = Mn("ui"), $ = Yt(), Se = B(), Ae = {
180
+ link: { label: R("signatureRequest.shareLink"), icon: /* @__PURE__ */ n(Vi, {}) },
181
+ email: { label: R("signatureRequest.viaEmail"), icon: /* @__PURE__ */ n(Pa, {}) },
182
+ whatsapp: {
183
+ label: R("signatureRequest.viaWhatsapp"),
184
+ icon: /* @__PURE__ */ n(Da, {})
185
+ }
186
+ }, Ye = Z.language || "en", De = Ye === "en" ? "en-GB" : Ye, y = new Intl.DateTimeFormat(De, {
187
+ weekday: "short"
188
+ }), ie = new Intl.DateTimeFormat(De, {
189
+ day: "2-digit",
190
+ month: "2-digit",
191
+ year: "numeric"
192
+ }), Je = new Intl.DateTimeFormat(De, {
193
+ hour: "2-digit",
194
+ minute: "2-digit"
195
+ }), We = (M) => {
196
+ const b = y.format(M);
197
+ return R("signatureRequest.signedAt", {
198
+ weekday: b.charAt(0).toLocaleUpperCase(De) + b.slice(1),
199
+ date: ie.format(M),
200
+ time: Je.format(M),
201
+ interpolation: { escapeValue: !1 }
202
+ });
203
+ }, we = ce(null), de = ce(null), je = ce(null), [Ie, Pe] = _();
204
+ Be(() => {
205
+ const M = je.current;
206
+ if (!M || o) return;
207
+ const b = new Set((i ?? []).map((z) => z.id));
208
+ if (b.has(M.id)) return;
209
+ je.current = null, Pe(R("signatureRequest.signatureDeleted"));
210
+ const E = M.order.indexOf(M.id), ee = M.order.slice(E + 1).find((z) => b.has(z)) ?? M.order.slice(0, E).reverse().find((z) => b.has(z));
211
+ window.setTimeout(() => {
212
+ var ge, ke, pe;
213
+ const z = document.activeElement;
214
+ if (!(!z || z === document.body || !z.isConnected || z.matches('[role="dialog"], [role="alertdialog"]'))) return;
215
+ if (ee === void 0) {
216
+ (ge = de.current) == null || ge.focus();
217
+ return;
218
+ }
219
+ const W = Array.from(
220
+ ((ke = we.current) == null ? void 0 : ke.querySelectorAll(
221
+ "[data-signature-id]"
222
+ )) ?? []
223
+ ).find((re) => re.dataset.signatureId === ee);
224
+ (pe = W == null ? void 0 : W.querySelector('[role="group"] button')) == null || pe.focus();
225
+ }, 0);
226
+ }, [i, o, R]);
227
+ const O = i ? ar(i) : [];
228
+ let ye;
229
+ if (o)
230
+ ye = /* @__PURE__ */ n(
231
+ "div",
232
+ {
233
+ "aria-busy": "true",
234
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
235
+ children: tr.map((M) => /* @__PURE__ */ u(
236
+ "div",
237
+ {
238
+ className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]",
239
+ children: [
240
+ /* @__PURE__ */ u("div", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
241
+ /* @__PURE__ */ n(qe, { size: "md", width: "40%" }),
242
+ /* @__PURE__ */ n(qe, { size: "sm", width: "70%" })
243
+ ] }),
244
+ /* @__PURE__ */ n(qe, { variant: "circular", size: "sm" }),
245
+ /* @__PURE__ */ n(qe, { variant: "circular", size: "sm" }),
246
+ /* @__PURE__ */ n(qe, { variant: "circular", size: "sm" })
247
+ ]
248
+ },
249
+ M
250
+ ))
251
+ }
252
+ );
253
+ else if (O.length === 0)
254
+ ye = /* @__PURE__ */ n(
255
+ "p",
256
+ {
257
+ ref: de,
258
+ tabIndex: -1,
259
+ "data-note": "no-signed-versions",
260
+ className: "type-body-sm ds:text-[color:var(--muted-foreground)] ds:outline-none",
261
+ children: R("signatureRequest.noSignedVersions")
262
+ }
263
+ );
264
+ else {
265
+ const M = "type-label ds:text-[color:var(--muted-foreground)] ds:pb-[var(--spacing-xs)]";
266
+ ye = // The chip's tooltip and the icon-button tooltips need a provider; the
267
+ // section brings its own so a host without one does not crash.
268
+ /* @__PURE__ */ n(Ea, { children: /* @__PURE__ */ u(
269
+ "div",
270
+ {
271
+ ref: we,
272
+ role: "table",
273
+ "aria-labelledby": Se,
274
+ className: sr,
275
+ children: [
276
+ /* @__PURE__ */ n(
277
+ "div",
278
+ {
279
+ role: "rowgroup",
280
+ className: `${qa} ds:sr-only ds:@[512px]/person:not-sr-only`,
281
+ children: /* @__PURE__ */ u(
282
+ "div",
283
+ {
284
+ role: "row",
285
+ className: `${Gt} ds:border-b ds:border-[color:var(--border)]`,
286
+ children: [
287
+ /* @__PURE__ */ n(
288
+ "span",
289
+ {
290
+ role: "columnheader",
291
+ className: `${Sa} ${M}`,
292
+ children: R("signatureRequest.columnDate")
293
+ }
294
+ ),
295
+ /* @__PURE__ */ n(
296
+ "span",
297
+ {
298
+ role: "columnheader",
299
+ className: `${wa} ${M}`,
300
+ children: R("signatureRequest.columnSignatureType")
301
+ }
302
+ ),
303
+ /* @__PURE__ */ n(
304
+ "span",
305
+ {
306
+ role: "columnheader",
307
+ className: `${Ia} ${M}`,
308
+ children: R("signatureRequest.columnActions")
309
+ }
310
+ )
311
+ ]
312
+ }
313
+ )
314
+ }
315
+ ),
316
+ /* @__PURE__ */ n("div", { role: "rowgroup", className: qa, children: O.map((b, E) => {
317
+ const ee = Ma(b.createdAt), z = ee === null ? String(b.createdAt) : We(ee), N = ee === null ? void 0 : new Date(ee).toISOString(), W = $[b.channel], ge = b.shareTargets ?? k, ke = I ? Ca.filter(
318
+ (re) => ge.includes(re)
319
+ ) : [], pe = l !== void 0 || p !== void 0 || ke.length > 0 || j !== void 0;
320
+ return /* @__PURE__ */ u(
321
+ "div",
322
+ {
323
+ role: "row",
324
+ "data-signature-id": b.id,
325
+ className: E === 0 ? Gt : `${Gt} ds:border-t ds:border-[color:var(--border)]`,
326
+ children: [
327
+ /* @__PURE__ */ n("div", { role: "cell", className: `${Sa} type-body`, children: /* @__PURE__ */ n("time", { dateTime: N, children: z }) }),
328
+ /* @__PURE__ */ n("div", { role: "cell", className: wa, children: /* @__PURE__ */ u("span", { className: "type-body-sm ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]", children: [
329
+ m && b.legalLevel ? /* @__PURE__ */ n("span", { children: b.legalLevel === "advanced" ? R("signatureRequest.legalLevelAdvanced") : R("signatureRequest.legalLevelSimple") }) : null,
330
+ /* @__PURE__ */ u("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
331
+ /* @__PURE__ */ n(
332
+ "span",
333
+ {
334
+ "aria-hidden": "true",
335
+ className: "ds:text-[var(--accent)]",
336
+ children: W.icon
337
+ }
338
+ ),
339
+ W.label
340
+ ] }),
341
+ /* @__PURE__ */ n(
342
+ zi,
343
+ {
344
+ size: "sm",
345
+ operator: b.operator,
346
+ patient: b.patient,
347
+ secondary: b.secondary,
348
+ names: b.names,
349
+ tooltip: !0
350
+ }
351
+ )
352
+ ] }) }),
353
+ /* @__PURE__ */ n("div", { role: "cell", className: Ia, children: pe ? /* @__PURE__ */ u(
354
+ "span",
355
+ {
356
+ role: "group",
357
+ "aria-label": R("signatureRequest.signatureActions", {
358
+ date: z,
359
+ interpolation: { escapeValue: !1 }
360
+ }),
361
+ className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]",
362
+ children: [
363
+ l ? /* @__PURE__ */ n(
364
+ vn,
365
+ {
366
+ intent: "ghost",
367
+ size: "sm",
368
+ icon: /* @__PURE__ */ n(Fi, {}),
369
+ "aria-label": R("signatureRequest.viewSignature"),
370
+ tooltip: R("signatureRequest.viewSignature"),
371
+ onClick: () => l(b.id)
372
+ }
373
+ ) : null,
374
+ p && b.hasAnonymisedVersion ? /* @__PURE__ */ u(
375
+ ya,
376
+ {
377
+ id: `signature-download-${b.id}`,
378
+ label: R("signatureRequest.downloadSignature"),
379
+ icon: /* @__PURE__ */ n(fa, {}),
380
+ children: [
381
+ /* @__PURE__ */ n(
382
+ fn.Item,
383
+ {
384
+ onSelect: () => p(b.id, "full"),
385
+ children: R("signatureRequest.downloadFull")
386
+ }
387
+ ),
388
+ /* @__PURE__ */ n(
389
+ fn.Item,
390
+ {
391
+ onSelect: () => p(b.id, "anonymised"),
392
+ children: R("signatureRequest.downloadAnonymised")
393
+ }
394
+ )
395
+ ]
396
+ }
397
+ ) : p ? (
398
+ // One file only: a menu with a single entry would
399
+ // be an extra click for nothing.
400
+ /* @__PURE__ */ n(
401
+ vn,
402
+ {
403
+ intent: "ghost",
404
+ size: "sm",
405
+ icon: /* @__PURE__ */ n(fa, {}),
406
+ "aria-label": R("signatureRequest.downloadSignature"),
407
+ tooltip: R("signatureRequest.downloadSignature"),
408
+ onClick: () => p(b.id, "full")
409
+ }
410
+ )
411
+ ) : null,
412
+ I && ke.length > 0 ? /* @__PURE__ */ n(
413
+ ya,
414
+ {
415
+ id: `signature-share-${b.id}`,
416
+ label: R("signatureRequest.shareSignature"),
417
+ icon: /* @__PURE__ */ n(Bi, {}),
418
+ children: ke.map((re) => /* @__PURE__ */ n(
419
+ fn.Item,
420
+ {
421
+ startIcon: Ae[re].icon,
422
+ onSelect: () => I(b.id, re),
423
+ children: Ae[re].label
424
+ },
425
+ re
426
+ ))
427
+ }
428
+ ) : null,
429
+ j ? /* @__PURE__ */ n(
430
+ rr,
431
+ {
432
+ id: `signature-delete-${b.id}`,
433
+ when: z,
434
+ dateTime: N,
435
+ onConfirm: () => {
436
+ je.current = {
437
+ id: b.id,
438
+ order: O.map((re) => re.id)
439
+ }, Pe(""), j(b.id);
440
+ }
441
+ }
442
+ ) : null
443
+ ]
444
+ }
445
+ ) : null })
446
+ ]
447
+ },
448
+ b.id
449
+ );
450
+ }) })
451
+ ]
452
+ }
453
+ ) });
454
+ }
455
+ return /* @__PURE__ */ u(
456
+ "section",
457
+ {
458
+ "aria-labelledby": Se,
459
+ "data-section": "signed-versions",
460
+ className: `${pn} ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:text-start`,
461
+ children: [
462
+ /* @__PURE__ */ n("div", { className: ae, children: /* @__PURE__ */ n("div", { className: _n, children: /* @__PURE__ */ n(
463
+ "h3",
464
+ {
465
+ id: Se,
466
+ className: "type-eyebrow ds:m-0 ds:text-[color:var(--muted-foreground)]",
467
+ children: R("signatureRequest.signedVersions")
468
+ }
469
+ ) }) }),
470
+ /* @__PURE__ */ n("div", { className: ae, children: /* @__PURE__ */ u("div", { className: "ds:col-[1/-2] ds:min-w-0", children: [
471
+ /* @__PURE__ */ n(
472
+ La,
473
+ {
474
+ loading: o,
475
+ loadingText: R("signatureRequest.signaturesLoading"),
476
+ loadedText: R("signatureRequest.signaturesLoaded"),
477
+ message: Ie
478
+ }
479
+ ),
480
+ ye
481
+ ] }) })
482
+ ]
483
+ }
484
+ );
485
+ }
486
+ function $a() {
487
+ const [i, o] = _(!1), m = ce(!1);
488
+ return {
489
+ tooltipProps: {
490
+ open: i,
491
+ onOpenChange: (l) => {
492
+ l && m.current || o(l);
493
+ }
494
+ },
495
+ triggerProps: {
496
+ onPointerMove: () => {
497
+ m.current = !1;
498
+ },
499
+ onBlur: () => {
500
+ m.current = !1;
501
+ }
502
+ },
503
+ hideTip: () => o(!1),
504
+ /** Call just before focus returns to the trigger. */
505
+ markReturning: () => {
506
+ m.current = !0;
507
+ }
508
+ };
509
+ }
510
+ function ya({ id: i, label: o, icon: m, children: l }) {
511
+ const p = $a();
512
+ return /* @__PURE__ */ u(
513
+ fn.Root,
514
+ {
515
+ id: i,
516
+ onOpenChange: (I) => {
517
+ I && p.hideTip();
518
+ },
519
+ children: [
520
+ /* @__PURE__ */ n(Aa, { label: o, ...p.tooltipProps, children: /* @__PURE__ */ n(fn.Trigger, { asChild: !0, children: /* @__PURE__ */ n(
521
+ vn,
522
+ {
523
+ intent: "ghost",
524
+ size: "sm",
525
+ icon: m,
526
+ "aria-label": o,
527
+ ...p.triggerProps
528
+ }
529
+ ) }) }),
530
+ /* @__PURE__ */ n(
531
+ fn.Content,
532
+ {
533
+ align: "end",
534
+ onCloseAutoFocus: p.markReturning,
535
+ children: l
536
+ }
537
+ )
538
+ ]
539
+ }
540
+ );
541
+ }
542
+ function rr({ id: i, when: o, dateTime: m, onConfirm: l }) {
543
+ const { t: p } = Mn("ui"), I = $a(), [k, j] = _(!1), R = p("signatureRequest.deleteSignature");
544
+ return /* @__PURE__ */ u(
545
+ C,
546
+ {
547
+ id: i,
548
+ open: k,
549
+ onOpenChange: (Z) => {
550
+ Z && I.hideTip(), j(Z);
551
+ },
552
+ children: [
553
+ /* @__PURE__ */ n(Aa, { label: R, ...I.tooltipProps, children: /* @__PURE__ */ n(C.Trigger, { asChild: !0, children: /* @__PURE__ */ n(
554
+ vn,
555
+ {
556
+ intent: "destructiveOutline",
557
+ size: "sm",
558
+ icon: /* @__PURE__ */ n(va, {}),
559
+ "aria-label": R,
560
+ ...I.triggerProps
561
+ }
562
+ ) }) }),
563
+ /* @__PURE__ */ u(
564
+ C.Content,
565
+ {
566
+ variant: "alert",
567
+ size: "sm",
568
+ onCloseAutoFocus: I.markReturning,
569
+ children: [
570
+ /* @__PURE__ */ u(C.Header, { children: [
571
+ /* @__PURE__ */ n(C.Title, { children: p("signatureRequest.deleteSignatureConfirm") }),
572
+ /* @__PURE__ */ n(C.Description, { children: /* @__PURE__ */ n("time", { dateTime: m, children: o }) })
573
+ ] }),
574
+ /* @__PURE__ */ u(C.Footer, { children: [
575
+ /* @__PURE__ */ n(C.Close, { asChild: !0, children: /* @__PURE__ */ n(L, { intent: "outline", children: p("common.cancel") }) }),
576
+ /* @__PURE__ */ n(
577
+ L,
578
+ {
579
+ intent: "destructive",
580
+ startIcon: /* @__PURE__ */ n(va, {}),
581
+ onClick: () => {
582
+ l(), j(!1);
583
+ },
584
+ children: R
585
+ }
586
+ )
587
+ ] })
588
+ ]
589
+ }
590
+ )
591
+ ]
592
+ }
593
+ );
594
+ }
595
+ const Q = "__assign-later__";
596
+ function lr(i) {
597
+ return i.filter((o) => o.signed !== !0);
598
+ }
599
+ function or(i) {
600
+ return i.length > 0 && i.every(
601
+ (o) => o.kind === "document" && o.canCarrySecondary === !0
602
+ );
603
+ }
604
+ function Xe(i) {
605
+ return i.requiresOperator;
606
+ }
607
+ function za(i, o) {
608
+ return i.filter((m) => m.deleted !== !0 || m.value === o).map(({ deleted: m, ...l }) => l);
609
+ }
610
+ function Ha(i, o) {
611
+ return i.some(
612
+ (m) => m.value === o && m.disabled !== !0 && m.deleted !== !0
613
+ );
614
+ }
615
+ function Fa(i, o) {
616
+ const m = i.filter((l) => l.disabled === !0 && l.deleted !== !0).map(
617
+ (l) => l.description ? `${l.label} (${l.description})` : l.label
618
+ );
619
+ if (m.length !== 0)
620
+ return new Intl.ListFormat(o || "en", { type: "unit" }).format(m);
621
+ }
622
+ function st({
623
+ items: i,
624
+ channel: o,
625
+ primaryIsPatient: m
626
+ }) {
627
+ return or(i) ? m ? "patient" : o !== "on-device" ? "channel" : null : i.some((l) => l.kind === "anamnesis") ? "anamnesis" : "documents";
628
+ }
629
+ function cr({
630
+ primaryId: i,
631
+ secondId: o,
632
+ channel: m,
633
+ options: l
634
+ }) {
635
+ if (o === i) return "sameAsPrimary";
636
+ const p = l.find((k) => k.value === o);
637
+ if (!p || p.isPatient === !0) return "unknownSignee";
638
+ const I = (k) => {
639
+ var j;
640
+ return (!p.availableChannels || p.availableChannels.length === 0 || p.availableChannels.includes(k)) && !((j = p.unavailableChannels) != null && j.some((R) => R.channel === k));
641
+ };
642
+ return m === "sms" && !I("sms") ? "missingPhone" : (m === "email" || m === "whatsapp") && !I("email") ? "missingEmail" : null;
643
+ }
644
+ const dr = [0, 1, 2], ur = "ds:grid ds:grid-cols-1 ds:@[512px]/person:grid-cols-2 ds:items-center ds:gap-[var(--spacing-sm)] ds:font-normal", hr = "ds:grid ds:grid-cols-1 ds:@[512px]/person:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_max-content] ds:items-center ds:gap-[var(--spacing-sm)] ds:font-normal", mr = "ds:min-w-0 ds:font-medium", gr = "ds:col-span-full ds:min-w-0 ds:font-medium", Vt = "ds:block ds:min-w-0", ka = "ds:!gap-[var(--spacing-sm)] ds:!p-[var(--spacing-sm)]";
645
+ function pr({
646
+ items: i,
647
+ loading: o = !1,
648
+ operatorOptions: m,
649
+ assignments: l,
650
+ onAssign: p,
651
+ onAssignAllToMe: I,
652
+ busy: k = !1,
653
+ showOperatorChannels: j = !1,
654
+ operatorChannels: R = {},
655
+ onOperatorChannel: Z
656
+ }) {
657
+ const { t: $, i18n: Se } = Mn("ui"), Ae = Yt(), Ye = it.map(
658
+ (O) => ({
659
+ value: O,
660
+ label: Ae[O].label,
661
+ startAdornment: Ae[O].icon
662
+ })
663
+ ), De = B(), y = B(), ie = B(), Je = /* @__PURE__ */ n(
664
+ La,
665
+ {
666
+ loading: o,
667
+ loadingText: $("signatureRequest.requiredLoading"),
668
+ loadedText: $("signatureRequest.requiredLoaded")
669
+ }
670
+ );
671
+ if (o)
672
+ return /* @__PURE__ */ u(me, { children: [
673
+ Je,
674
+ /* @__PURE__ */ n(
675
+ "div",
676
+ {
677
+ "aria-busy": "true",
678
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
679
+ children: dr.map((O) => /* @__PURE__ */ u(
680
+ "div",
681
+ {
682
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
683
+ children: [
684
+ /* @__PURE__ */ n(qe, { size: "md", width: "50%" }),
685
+ /* @__PURE__ */ n(qe, { size: "sm", width: "30%" })
686
+ ]
687
+ },
688
+ O
689
+ ))
690
+ }
691
+ )
692
+ ] });
693
+ const We = i.filter((O) => O.kind === "document"), we = i.filter((O) => O.kind === "anamnesis"), de = i.some(
694
+ (O) => Xe(O) && l[O.id] === Q
695
+ ), je = [We, we].find(
696
+ (O) => O.some(Xe)
697
+ ), Ie = Fa(m, Se.language), Pe = (O, ye, M) => {
698
+ if (O.length === 0) return null;
699
+ const b = O === je;
700
+ return /* @__PURE__ */ u(
701
+ "section",
702
+ {
703
+ className: `${pn} ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]`,
704
+ children: [
705
+ /* @__PURE__ */ u("div", { className: ae, children: [
706
+ /* @__PURE__ */ u("div", { className: _n, children: [
707
+ /* @__PURE__ */ n(
708
+ "p",
709
+ {
710
+ id: ye,
711
+ className: "type-eyebrow ds:text-[color:var(--muted-foreground)]",
712
+ children: M
713
+ }
714
+ ),
715
+ b && I ? /* @__PURE__ */ n(
716
+ L,
717
+ {
718
+ intent: "outline",
719
+ size: "sm",
720
+ startIcon: /* @__PURE__ */ n(Xt, {}),
721
+ disabled: k,
722
+ onClick: I,
723
+ children: $("signatureRequest.assignAllToMe")
724
+ }
725
+ ) : null
726
+ ] }),
727
+ b && de ? /* @__PURE__ */ n(
728
+ U,
729
+ {
730
+ variant: "info",
731
+ "data-note": "assign-later",
732
+ className: `${F} ${ka}`,
733
+ children: /* @__PURE__ */ n(U.Description, { children: $("signatureRequest.assignLaterNote") })
734
+ }
735
+ ) : null,
736
+ b && !j ? /* @__PURE__ */ n(
737
+ U,
738
+ {
739
+ variant: "info",
740
+ "data-note": "operator-channel",
741
+ className: `${F} ${ka}`,
742
+ children: /* @__PURE__ */ n(U.Description, { children: $("signatureRequest.operatorChannelNote") })
743
+ }
744
+ ) : null
745
+ ] }),
746
+ /* @__PURE__ */ n("div", { className: ae, children: /* @__PURE__ */ n(
747
+ at,
748
+ {
749
+ density: "relaxed",
750
+ "aria-labelledby": ye,
751
+ className: F,
752
+ children: O.map((E) => {
753
+ const ee = Xe(E), z = ee && j, N = ee && l[E.id] !== void 0 && l[E.id] !== Q && l[E.id] !== "";
754
+ return /* @__PURE__ */ n(
755
+ at.Item,
756
+ {
757
+ value: E.id,
758
+ "data-required-item-id": E.id,
759
+ className: "ds:!p-[var(--spacing-none)]",
760
+ title: /* @__PURE__ */ u(
761
+ "span",
762
+ {
763
+ className: z ? hr : ur,
764
+ children: [
765
+ /* @__PURE__ */ n("span", { className: ee ? mr : gr, children: E.name }),
766
+ ee ? /* @__PURE__ */ n("span", { className: Vt, children: /* @__PURE__ */ n(
767
+ Ue,
768
+ {
769
+ id: `signature-request-item-operator-${E.id}`,
770
+ options: za(
771
+ m,
772
+ l[E.id]
773
+ ),
774
+ value: l[E.id],
775
+ onValueChange: (W) => {
776
+ W && Ha(m, W) && p(E.id, W);
777
+ },
778
+ showDescriptions: !0,
779
+ "aria-describedby": Ie ? ie : void 0,
780
+ required: !0,
781
+ disabled: k,
782
+ placeholder: $(
783
+ "signatureRequest.operatorPlaceholder"
784
+ ),
785
+ "aria-label": $(
786
+ "signatureRequest.itemOperatorLabel",
787
+ { name: E.name }
788
+ )
789
+ }
790
+ ) }) : null,
791
+ z ? (
792
+ // The chosen operator's channel, from their settings
793
+ // unless changed here. Nobody to deliver to while
794
+ // unassigned, but the column keeps its width.
795
+ /* @__PURE__ */ u(
796
+ "span",
797
+ {
798
+ className: N ? Vt : `${Vt} ds:hidden ds:@[512px]/person:block`,
799
+ children: [
800
+ N ? /* @__PURE__ */ n(
801
+ Ue,
802
+ {
803
+ id: `signature-request-item-operator-channel-${E.id}`,
804
+ options: Ye,
805
+ value: R[E.id],
806
+ adornmentInTrigger: !0,
807
+ disabled: k,
808
+ "aria-label": $(
809
+ "signatureRequest.itemOperatorChannelLabel",
810
+ { name: E.name }
811
+ ),
812
+ onValueChange: (W) => {
813
+ it.includes(
814
+ W
815
+ ) && (Z == null || Z(
816
+ E.id,
817
+ W
818
+ ));
819
+ }
820
+ }
821
+ ) : null,
822
+ /* @__PURE__ */ n(_a, { meta: Ae })
823
+ ]
824
+ }
825
+ )
826
+ ) : null
827
+ ]
828
+ }
829
+ )
830
+ },
831
+ E.id
832
+ );
833
+ })
834
+ }
835
+ ) })
836
+ ]
837
+ }
838
+ );
839
+ };
840
+ return /* @__PURE__ */ u(me, { children: [
841
+ Je,
842
+ Ie ? /* @__PURE__ */ n("span", { id: ie, className: "ds:sr-only", children: Ie }) : null,
843
+ /* @__PURE__ */ u("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-lg)] ds:text-start", children: [
844
+ Pe(
845
+ We,
846
+ De,
847
+ $("signatureRequest.requiredDocumentsHeading", {
848
+ count: We.length
849
+ })
850
+ ),
851
+ Pe(
852
+ we,
853
+ y,
854
+ $("signatureRequest.requiredAnamnesisHeading", {
855
+ count: we.length
856
+ })
857
+ )
858
+ ] })
859
+ ] });
860
+ }
861
+ function fr(i, o, { required: m = !1 } = {}) {
862
+ switch (i) {
863
+ case "linkSent":
864
+ return m ? {
865
+ title: o("signatureRequest.requiredLinkSentTitle"),
866
+ description: o("signatureRequest.requiredLinkSentDescription")
867
+ } : {
868
+ title: o("signatureRequest.outcomeLinkSentTitle"),
869
+ description: o("signatureRequest.outcomeLinkSentDescription")
870
+ };
871
+ case "allSigned":
872
+ return {
873
+ title: o("signatureRequest.outcomeAllSignedTitle"),
874
+ description: o("signatureRequest.outcomeAllSignedDescription")
875
+ };
876
+ case "creditsExhausted":
877
+ return {
878
+ title: o("signatureRequest.outcomeCreditsTitle"),
879
+ description: o("signatureRequest.outcomeCreditsDescription")
880
+ };
881
+ }
882
+ }
883
+ function vr({
884
+ outcome: i
885
+ }) {
886
+ const o = i === "creditsExhausted";
887
+ return /* @__PURE__ */ n(
888
+ "div",
889
+ {
890
+ "data-outcome": i,
891
+ className: "ds:flex ds:justify-center ds:py-[var(--spacing-md)]",
892
+ children: /* @__PURE__ */ n(
893
+ "span",
894
+ {
895
+ "aria-hidden": "true",
896
+ className: o ? "ds:text-[color:var(--warning)]" : "ds:text-[color:var(--success)]",
897
+ children: o ? /* @__PURE__ */ n(Ui, { className: "ds:size-[var(--icon-size-lg)]" }) : /* @__PURE__ */ n(Wi, { className: "ds:size-[var(--icon-size-lg)]" })
898
+ }
899
+ )
900
+ }
901
+ );
902
+ }
903
+ function br(i) {
904
+ return i === "addSignee" || i === "addSecondSignee";
905
+ }
906
+ function Rr({
907
+ options: i,
908
+ rosterIds: o,
909
+ rosterCap: m
910
+ }) {
911
+ const l = i.find((k) => k.isPatient === !0);
912
+ if ((l == null ? void 0 : l.isMinor) !== !0) return null;
913
+ const p = i.filter((k) => k.isPatient !== !0), I = p.filter(
914
+ (k) => o.includes(k.value)
915
+ );
916
+ return I.length === 0 ? p.length === 0 ? "addSignee" : "selectSignee" : I.length > 1 || o.length >= m ? null : p.length > 1 ? "selectSecondSignee" : "addSecondSignee";
917
+ }
918
+ const gn = [
919
+ "sms",
920
+ "email",
921
+ "whatsapp",
922
+ "on-device",
923
+ "qr"
924
+ ], Oa = [
925
+ "sms",
926
+ "email",
927
+ "whatsapp"
928
+ ], Qt = "__create-signee__", Nr = ["operator", "signers"], Ta = "signature-request-batch-channel", Kt = {
929
+ anamnesis: "signatureRequest.secondSigneeUnavailableAnamnesis",
930
+ documents: "signatureRequest.secondSigneeUnavailableDocuments",
931
+ patient: "signatureRequest.secondSigneeUnavailablePatient",
932
+ channel: "signatureRequest.secondSigneeUnavailableChannel"
933
+ }, xr = {
934
+ sms: "signatureRequest.addMobileNumber",
935
+ whatsapp: "signatureRequest.addMobileNumber",
936
+ email: "signatureRequest.addEmailAddress",
937
+ "on-device": "signatureRequest.editContactDetails",
938
+ qr: "signatureRequest.editContactDetails"
939
+ }, Cr = {
940
+ addSignee: "signatureRequest.minorPatientAddSignee",
941
+ selectSignee: "signatureRequest.minorPatientSelectSignee",
942
+ selectSecondSignee: "signatureRequest.minorPatientSelectSecondSignee",
943
+ addSecondSignee: "signatureRequest.minorPatientAddSecondSignee"
944
+ }, qr = {
945
+ sameAsPrimary: "signatureRequest.secondSigneeSameAsPrimary",
946
+ unknownSignee: "signatureRequest.secondSigneeUnknown",
947
+ missingPhone: "signatureRequest.secondSigneeMissingPhone",
948
+ missingEmail: "signatureRequest.secondSigneeMissingEmail"
949
+ };
950
+ function Sr(i, o, m) {
951
+ const l = i instanceof Date ? i : new Date(i);
952
+ if (Number.isNaN(l.getTime())) return null;
953
+ const p = { hour: "2-digit", minute: "2-digit" };
954
+ return l.toDateString() === (/* @__PURE__ */ new Date()).toDateString() ? m("signatureRequest.qrExpiresAt", {
955
+ time: new Intl.DateTimeFormat(o, p).format(l)
956
+ }) : m("signatureRequest.qrExpiresOn", {
957
+ dateTime: new Intl.DateTimeFormat(o, {
958
+ day: "numeric",
959
+ month: "short",
960
+ year: "numeric",
961
+ ...p
962
+ }).format(l)
963
+ });
964
+ }
965
+ function Fe(i, o) {
966
+ var m;
967
+ return ((m = i.find((l) => l.value === o)) == null ? void 0 : m.label) ?? "";
968
+ }
969
+ const wr = Di(
970
+ ({
971
+ open: i,
972
+ onOpenChange: o,
973
+ operators: m,
974
+ signerOptions: l,
975
+ currentOperatorId: p,
976
+ allowAssignLater: I = !0,
977
+ requireOperator: k = !0,
978
+ requirePatient: j = !0,
979
+ initialOperatorId: R,
980
+ initialOperatorChannel: Z,
981
+ initialSigners: $,
982
+ maxSigners: Se = 2,
983
+ channelMode: Ae = "perSigner",
984
+ initialBatchChannel: Ye,
985
+ confirmRecipients: De = !1,
986
+ busy: y = !1,
987
+ error: ie,
988
+ title: Je,
989
+ description: We,
990
+ onRequestSignature: we,
991
+ qrCodes: de,
992
+ qrPending: je = !1,
993
+ onQrDone: Ie,
994
+ signatures: Pe,
995
+ signaturesLoading: O = !1,
996
+ showLegalLevel: ye = !0,
997
+ onViewSignature: M,
998
+ onDownloadSignature: b,
999
+ onShareSignature: E,
1000
+ signatureShareTargets: ee,
1001
+ onDeleteSignature: z,
1002
+ resolveChannels: N,
1003
+ requiredItems: W,
1004
+ requiredItemsLoading: ge = !1,
1005
+ showOperatorChannels: ke = !1,
1006
+ outcome: pe,
1007
+ onBuyMoreSignatures: re,
1008
+ onOutcomeCancel: Jt,
1009
+ onAddSignee: le,
1010
+ loading: Ze = !1,
1011
+ batchChannelPlacement: Ba = "below",
1012
+ signerAddAction: Zt = "addRow",
1013
+ secondSigneeSlot: lt = !1,
1014
+ linkOnDevice: Ua = !1,
1015
+ contentProps: Wa
1016
+ }, ja) => {
1017
+ var ia, ra, la, oa, ca, da;
1018
+ const { t: r, i18n: ot } = Mn("ui"), en = ce(0), bn = ce(null), es = ce(null), nn = ce(null), ns = ce(null), ne = ce(null), ct = B(), ts = B(), ss = B(), as = B(), dt = B(), is = B(), rs = B(), Ga = B(), ls = B(), Va = B(), os = B(), Qa = B(), cs = B(), $n = B(), f = W !== void 0 || ge, te = W ? lr(W) : [], K = k && !f, ue = j || f, v = Ae === "batch", Rn = v && Ba === "inline", G = lt && !f && ue && Se >= 2, Le = Ua && K && ue, Nn = (e) => {
1019
+ var t;
1020
+ return ((t = l.find((s) => s.value === e)) == null ? void 0 : t.isPatient) === !0;
1021
+ }, zn = (e, t) => {
1022
+ var a, c, d;
1023
+ return G ? Nn((a = e[0]) == null ? void 0 : a.signerId) ? 1 : 2 : f ? st({
1024
+ items: te,
1025
+ channel: v ? t : ((c = e[0]) == null ? void 0 : c.channel) ?? t,
1026
+ primaryIsPatient: Nn((d = e[0]) == null ? void 0 : d.signerId)
1027
+ }) === null ? Math.min(Se, 2) : 1 : Se;
1028
+ }, [ut, tn] = _(!1), [Ka, ht] = _(!1), [Xa, Ya] = _(pe);
1029
+ pe !== Xa && (Ya(pe), ht(!1), pe !== void 0 && tn(!1));
1030
+ const fe = (Ka ? void 0 : pe) ?? (W !== void 0 && !ge && te.length === 0 ? "allSigned" : void 0), xn = fe ? fr(fe, r, { required: f }) : null, Cn = (e) => {
1031
+ var t;
1032
+ return new Map(
1033
+ (((t = l.find((s) => s.value === e)) == null ? void 0 : t.unavailableChannels) ?? []).map(({ channel: s, reason: a }) => [s, a])
1034
+ );
1035
+ }, ds = (e, t) => {
1036
+ var c;
1037
+ const s = ((c = l.find((d) => d.value === e)) == null ? void 0 : c.unavailableChannels) ?? [], a = [];
1038
+ for (const d of t) {
1039
+ const h = s.find((w) => w.channel === d);
1040
+ if (!(h != null && h.actionHref) || /^\s*javascript:/i.test(h.actionHref))
1041
+ continue;
1042
+ const g = h.actionLabel ?? r(xr[d]);
1043
+ a.some(
1044
+ (w) => w.href === h.actionHref && w.label === g
1045
+ ) || a.push({ href: h.actionHref, label: g });
1046
+ }
1047
+ return a;
1048
+ }, mt = (e, t) => {
1049
+ var h;
1050
+ const s = (h = l.find(
1051
+ (g) => g.value === e
1052
+ )) == null ? void 0 : h.availableChannels, a = s && s.length > 0 ? gn.filter((g) => s.includes(g)) : gn;
1053
+ if (!t) return a;
1054
+ const c = Cn(e), d = a.filter((g) => t.includes(g));
1055
+ return d.some((g) => !c.has(g)) ? d : a;
1056
+ }, _e = (e, t) => {
1057
+ const s = Cn(e);
1058
+ return mt(e, t).filter(
1059
+ (a) => !s.has(a)
1060
+ );
1061
+ }, sn = (e) => {
1062
+ const t = e == null ? void 0 : e.operatorAvailableChannels;
1063
+ return t && t.length > 0 ? er.filter((s) => t.includes(s)) : it;
1064
+ }, qn = (e, t) => {
1065
+ const s = _e(e);
1066
+ return s.includes(t) ? t : s[0] ?? t;
1067
+ }, an = l.find(
1068
+ (e) => e.isPatient === !0
1069
+ ), us = (e) => e === void 0 ? [] : an && an.value !== e ? [e, an.value] : [e], gt = (e) => {
1070
+ const t = us(e), s = /* @__PURE__ */ new Map();
1071
+ for (const a of gn) {
1072
+ if (a === "on-device" || t.some((d) => _e(d).includes(a))) continue;
1073
+ const c = t.map((d) => Cn(d).get(a)).find((d) => d !== void 0);
1074
+ c !== void 0 && s.set(a, c);
1075
+ }
1076
+ return s;
1077
+ }, hs = (e, t) => {
1078
+ if (e === void 0) return gn;
1079
+ const s = us(e), a = gn.filter(
1080
+ (g) => s.some((T) => mt(T).includes(g))
1081
+ ), c = gt(e), d = t ? a.filter((g) => t.includes(g)) : a, h = d.some((g) => !c.has(g)) ? d : a;
1082
+ return gn.filter(
1083
+ (g) => g === "on-device" || h.includes(g)
1084
+ );
1085
+ }, Sn = (e, t) => {
1086
+ const s = gt(e);
1087
+ return hs(e, t).filter(
1088
+ (a) => !s.has(a)
1089
+ );
1090
+ }, ms = (e, t = !0) => {
1091
+ const s = Sn(e), a = (t ? Ye : void 0) ?? (Nn(e) && s.includes("sms") ? "sms" : "email");
1092
+ return s.includes(a) ? a : s[0];
1093
+ }, gs = (ia = m.find(
1094
+ (e) => e.disabled !== !0 && e.deleted !== !0
1095
+ )) == null ? void 0 : ia.value, ps = (e) => e === null ? I ? Q : gs ?? Q : e ?? gs ?? (I ? Q : ""), Ja = () => ps(R), Za = () => {
1096
+ const e = $ && $.length > 0 ? $ : l.length > 0 ? [
1097
+ {
1098
+ signerId: l[0].value,
1099
+ channel: qn(l[0].value, "on-device")
1100
+ }
1101
+ ] : [];
1102
+ return (G ? e.slice(0, 2) : e).map((t) => {
1103
+ const s = qn(t.signerId, t.channel), { skipOtp: a, ...c } = t;
1104
+ return {
1105
+ ...c,
1106
+ channel: s,
1107
+ ...s === "on-device" && a !== void 0 ? { skipOtp: a } : {},
1108
+ rowId: en.current++
1109
+ };
1110
+ });
1111
+ }, ei = N !== void 0 && !f, X = (e, t = !0) => {
1112
+ var a;
1113
+ const s = ((a = m.find((c) => c.value === e)) == null ? void 0 : a.defaultChannel) ?? "email";
1114
+ return s === "whatsapp" && !ei || s === "on-device" && !t ? "email" : s;
1115
+ }, fs = (e, t) => Z === "on-device" ? t ? "on-device" : X(e, !1) : Z === "whatsapp" ? X(e, t) : Z ?? X(e, t), vs = (e, t, s) => {
1116
+ const a = sn(e), c = e.operatorChannel ?? s, d = X(t), h = d === "whatsapp" && !a.includes("whatsapp") ? "email" : d;
1117
+ return a.includes(c) ? c : a.includes(h) ? h : a[0];
1118
+ }, wn = (e, t, s, a, c = "on-device") => {
1119
+ const d = K && e !== Q && e !== "", h = f || G ? s.slice(0, zn(s, c)) : s, g = {};
1120
+ if (ue)
1121
+ for (const T of h) {
1122
+ const w = [...Cn(T.signerId).keys()];
1123
+ w.length > 0 && (g[T.signerId] = w);
1124
+ }
1125
+ return {
1126
+ operatorId: d ? e : null,
1127
+ operatorChannel: d ? t : null,
1128
+ signers: ue ? h.map(
1129
+ ({ rowId: T, ...w }) => v ? { signerId: w.signerId, channel: c } : w
1130
+ ) : [],
1131
+ changed: a,
1132
+ ...Object.keys(g).length > 0 ? { signerUnavailableChannels: g } : {}
1133
+ };
1134
+ }, pt = (e, t, s, a, c) => {
1135
+ const d = wn(t, s, a, c), h = e(d), g = d.operatorChannel === null ? s : vs(h, t, s), T = d.signers.length, w = a.map((P, Ce) => {
1136
+ var Ne, xe;
1137
+ if (Ce >= T) return P;
1138
+ const J = _e(
1139
+ P.signerId,
1140
+ (Ne = h.signerAvailableChannels) == null ? void 0 : Ne[P.signerId]
1141
+ ), he = ((xe = h.signers.find((He) => He.signerId === P.signerId)) == null ? void 0 : xe.channel) ?? P.channel, Ee = J.includes(he) ? he : J[0] ?? P.channel;
1142
+ return Ee === P.channel ? P : { ...P, channel: Ee, skipOtp: void 0 };
1143
+ });
1144
+ return { operatorChannel: g, rows: w };
1145
+ }, bs = (e, t, s, a = "", c = "email") => {
1146
+ var P, Ce, J;
1147
+ const d = (P = e[0]) == null ? void 0 : P.signerId;
1148
+ if (!N) {
1149
+ const he = Sn(d);
1150
+ return {
1151
+ batch: he.includes(t) ? t : he[0],
1152
+ operatorChannel: c
1153
+ };
1154
+ }
1155
+ const h = wn(a, c, e, s, t), g = N(h), T = Sn(
1156
+ d,
1157
+ d === void 0 || (Ce = g.signerAvailableChannels) == null ? void 0 : Ce[d]
1158
+ ), w = ((J = g.signers.find((he) => he.signerId === d)) == null ? void 0 : J.channel) ?? t;
1159
+ return {
1160
+ batch: T.includes(w) ? w : T.includes(t) ? t : T[0],
1161
+ operatorChannel: h.operatorChannel === null ? c : vs(g, a, c)
1162
+ };
1163
+ }, ni = () => {
1164
+ var c, d;
1165
+ const e = Ja(), t = Za();
1166
+ if (v) {
1167
+ const h = bs(
1168
+ t,
1169
+ ms((c = t[0]) == null ? void 0 : c.signerId),
1170
+ null,
1171
+ e,
1172
+ Z ?? X(e)
1173
+ );
1174
+ return {
1175
+ operator: e,
1176
+ rows: t,
1177
+ // Required documents mode has no operator row: nothing reads it.
1178
+ operatorChannel: N ? h.operatorChannel : fs(
1179
+ e,
1180
+ t.length > 0 && h.batch === "on-device"
1181
+ ),
1182
+ batchChannel: h.batch,
1183
+ otpOverride: ((d = $ == null ? void 0 : $[0]) == null ? void 0 : d.skipOtp) ?? null
1184
+ };
1185
+ }
1186
+ const s = { batchChannel: "on-device", otpOverride: null };
1187
+ if (!N)
1188
+ return {
1189
+ operator: e,
1190
+ rows: t,
1191
+ operatorChannel: fs(
1192
+ e,
1193
+ t.some((h) => h.channel === "on-device")
1194
+ ),
1195
+ ...s
1196
+ };
1197
+ const a = pt(
1198
+ N,
1199
+ e,
1200
+ Z ?? X(e),
1201
+ t,
1202
+ null
1203
+ );
1204
+ return {
1205
+ operator: e,
1206
+ rows: a.rows,
1207
+ operatorChannel: a.operatorChannel,
1208
+ ...s
1209
+ };
1210
+ }, Rs = () => {
1211
+ const e = ni();
1212
+ if (!Le || e.operator === Q || e.operator === "")
1213
+ return e;
1214
+ const t = e.rows.slice(0, zn(e.rows, e.batchChannel));
1215
+ if (!(v ? t.length > 0 && e.batchChannel === "on-device" : t.some(
1216
+ (c) => c.channel === "on-device" && _e(c.signerId).length > 0
1217
+ ))) {
1218
+ if (e.operatorChannel !== "on-device") return e;
1219
+ const c = X(e.operator, !1);
1220
+ if (!N) return { ...e, operatorChannel: c };
1221
+ const d = sn(
1222
+ N(
1223
+ wn(
1224
+ e.operator,
1225
+ e.operatorChannel,
1226
+ e.rows,
1227
+ null,
1228
+ e.batchChannel
1229
+ )
1230
+ )
1231
+ ).filter((g) => g !== "on-device"), h = d.includes(c) ? c : d[0];
1232
+ return h === void 0 ? e : { ...e, operatorChannel: h };
1233
+ }
1234
+ return (N ? sn(
1235
+ N(
1236
+ wn(
1237
+ e.operator,
1238
+ e.operatorChannel,
1239
+ e.rows,
1240
+ null,
1241
+ e.batchChannel
1242
+ )
1243
+ )
1244
+ ).includes("on-device") : !0) ? { ...e, operatorChannel: "on-device" } : e;
1245
+ }, [In] = _(Rs), [A, ft] = _(In.operator), [q, ve] = _(In.rows), [H, be] = _(
1246
+ In.operatorChannel
1247
+ ), [S, Ns] = _(
1248
+ In.batchChannel
1249
+ ), [ti, vt] = _(
1250
+ In.otpOverride
1251
+ ), [si, yn] = _(!1), bt = zn(q, S), x = f || G ? q.slice(0, bt) : q, [ai, Rt] = _({}), rn = {};
1252
+ for (const e of te)
1253
+ Xe(e) && (rn[e.id] = ai[e.id] ?? ps(
1254
+ e.initialOperatorId !== void 0 ? e.initialOperatorId : R
1255
+ ));
1256
+ const [ii, Nt] = _({}), xt = {};
1257
+ for (const e of te) {
1258
+ const t = rn[e.id];
1259
+ t === void 0 || t === Q || t === "" || (xt[e.id] = ii[e.id] ?? X(t));
1260
+ }
1261
+ const xs = (e) => {
1262
+ e.length !== 0 && Nt(
1263
+ (t) => Object.fromEntries(
1264
+ Object.entries(t).filter(([s]) => !e.includes(s))
1265
+ )
1266
+ );
1267
+ }, ri = (e, t) => {
1268
+ rn[e] !== t && xs([e]), Rt((s) => ({ ...s, [e]: t }));
1269
+ }, li = () => {
1270
+ p !== void 0 && (xs(
1271
+ te.filter(
1272
+ (e) => Xe(e) && rn[e.id] !== p
1273
+ ).map((e) => e.id)
1274
+ ), Rt((e) => {
1275
+ const t = { ...e };
1276
+ for (const s of te)
1277
+ Xe(s) && (t[s.id] = p);
1278
+ return t;
1279
+ }));
1280
+ }, [Cs, oe] = _(null), [oi, Me] = _(
1281
+ null
1282
+ ), [ci, Hn] = _(!1), [di, kn] = _(0), Ct = !f && (Pe !== void 0 || O), [ui, hi] = _(i);
1283
+ i !== ui && (hi(i), i && (Hn(!1), kn(0), ht(!1), tn(!1)));
1284
+ const Fn = i && !Ze, qs = ce(Fn);
1285
+ Wt(() => {
1286
+ if (Fn && !qs.current) {
1287
+ const e = Rs();
1288
+ ft(e.operator), ve(e.rows), be(e.operatorChannel), Ns(e.batchChannel), vt(e.otpOverride), oe(null), Me(null), Rt({}), Nt({}), yn(!1), tn(!1), Hn(!1), kn(0);
1289
+ }
1290
+ qs.current = Fn;
1291
+ }, [Fn]);
1292
+ const qt = (e) => _e(e).length === 0, Re = v ? x.length > 0 && S === "on-device" : x.some(
1293
+ (e) => e.channel === "on-device" && !qt(e.signerId)
1294
+ ), ln = N !== void 0;
1295
+ Be(() => {
1296
+ if (!(ln || !K) && H === "on-device" && !Re) {
1297
+ const e = X(A, !1);
1298
+ be(e), oe(e);
1299
+ }
1300
+ }, [H, Re, A, ln, K]);
1301
+ const Ss = I ? [{ value: Q, label: r("signatureRequest.assignLater") }] : [], ws = m.map(
1302
+ ({ value: e, label: t, disabled: s, reason: a, deleted: c }) => ({
1303
+ value: e,
1304
+ label: t,
1305
+ ...s === !0 ? { disabled: !0, ...a ? { description: a } : {} } : {},
1306
+ ...c === !0 ? { deleted: !0 } : {}
1307
+ })
1308
+ ), Bn = f ? [...Ss, ...ws] : [...ws, ...Ss], St = Fa(Bn, ot.language), Is = B(), $e = A === Q, V = Yt(), Y = N ? N(
1309
+ wn(A, H, q, null, S)
1310
+ ) : void 0, Un = K && !$e && A !== "", ys = ln ? sn(Y).includes("on-device") : !0, ks = (e) => {
1311
+ var t;
1312
+ return _e(
1313
+ e.signerId,
1314
+ (t = Y == null ? void 0 : Y.signerAvailableChannels) == null ? void 0 : t[e.signerId]
1315
+ ).includes("on-device");
1316
+ }, Wn = v ? void 0 : x[0] && ks(x[0]) ? x[0] : x.find(ks), mi = Re || (v ? x.length > 0 : Wn !== void 0), wt = Le && Un && Re && ys, jn = (e) => Le && Re && ys ? "on-device" : e, Gn = (() => {
1317
+ if (!ln || !Un) return;
1318
+ const e = sn(
1319
+ Y
1320
+ ).filter((s) => s !== "on-device"), t = X(A, !1);
1321
+ return e.includes(t) ? t : e[0];
1322
+ })();
1323
+ Be(() => {
1324
+ if (!(!Le || !Un)) {
1325
+ if (wt && H !== "on-device") {
1326
+ be("on-device"), oe(null), Me(
1327
+ r("signatureRequest.operatorChannelChanged", {
1328
+ channel: V["on-device"].label
1329
+ })
1330
+ );
1331
+ return;
1332
+ }
1333
+ Gn !== void 0 && !Re && H === "on-device" && (be(Gn), oe(Gn));
1334
+ }
1335
+ }, [
1336
+ Le,
1337
+ Un,
1338
+ wt,
1339
+ Re,
1340
+ H,
1341
+ Gn
1342
+ ]);
1343
+ const Os = (e, t, s) => !Le || e === Q || e === "" ? t : s ? "on-device" : t === "on-device" ? X(e, !1) : t, gi = (e) => e.slice(0, zn(e, S)).some(
1344
+ (t) => t.channel === "on-device" && _e(t.signerId).length > 0
1345
+ ), Oe = (e, t, s, a, c = []) => {
1346
+ if (!N) return;
1347
+ if (v) {
1348
+ ze(s, S, {
1349
+ operatorId: e,
1350
+ opChannel: t,
1351
+ changed: a
1352
+ });
1353
+ return;
1354
+ }
1355
+ const d = pt(
1356
+ N,
1357
+ e,
1358
+ Os(e, t, gi(s)),
1359
+ s,
1360
+ a
1361
+ );
1362
+ be(d.operatorChannel), ve(d.rows), oe(null);
1363
+ const h = [];
1364
+ K && e !== Q && e !== "" && d.operatorChannel !== t && h.push(
1365
+ r("signatureRequest.operatorChannelChanged", {
1366
+ channel: V[d.operatorChannel].label
1367
+ })
1368
+ ), d.rows.forEach((T, w) => {
1369
+ T.channel !== s[w].channel && h.push(
1370
+ r("signatureRequest.signerChannelChanged", {
1371
+ name: Fe(l, T.signerId),
1372
+ channel: V[T.channel].label
1373
+ })
1374
+ );
1375
+ }), h.push(...c), Me(h.length > 0 ? h.join(" ") : null);
1376
+ }, ze = (e, t, {
1377
+ primaryChanged: s = !1,
1378
+ clearSecond: a = !1,
1379
+ userChannel: c = !1,
1380
+ operatorId: d = A,
1381
+ opChannel: h = H,
1382
+ changed: g = "signers"
1383
+ } = {}) => {
1384
+ var Ee, Ne, xe;
1385
+ const T = s ? ms((Ee = e[0]) == null ? void 0 : Ee.signerId, !1) : t, w = bs(
1386
+ e,
1387
+ T,
1388
+ g,
1389
+ d,
1390
+ Os(
1391
+ d,
1392
+ h,
1393
+ e.length > 0 && T === "on-device"
1394
+ )
1395
+ ), P = w.batch, Ce = e.length > 1 && (a || f && s), J = [];
1396
+ if (K && d !== Q && d !== "" && w.operatorChannel !== h && J.push(
1397
+ r("signatureRequest.operatorChannelChanged", {
1398
+ channel: V[w.operatorChannel].label
1399
+ })
1400
+ ), P !== (c ? t : S) && J.push(
1401
+ r("signatureRequest.signerChannelChanged", {
1402
+ name: Fe(l, ((Ne = e[0]) == null ? void 0 : Ne.signerId) ?? ""),
1403
+ channel: V[P].label
1404
+ })
1405
+ ), (f || G) && x.length > 1) {
1406
+ const He = f ? st({
1407
+ items: te,
1408
+ channel: P,
1409
+ primaryIsPatient: Nn((xe = e[0]) == null ? void 0 : xe.signerId)
1410
+ }) : null;
1411
+ Ce ? J.push(r("signatureRequest.secondSigneeCleared")) : He !== null && e.length > 1 && J.push(r(Kt[He]));
1412
+ }
1413
+ ve(Ce ? e.slice(0, 1) : e), K && be(w.operatorChannel), P !== S && vt(null), Ns(P), oe(null), Me(J.length > 0 ? J.join(" ") : null);
1414
+ }, Ts = Sn(
1415
+ (ra = q[0]) == null ? void 0 : ra.signerId,
1416
+ q[0] === void 0 || (la = Y == null ? void 0 : Y.signerAvailableChannels) == null ? void 0 : la[q[0].signerId]
1417
+ );
1418
+ v && !Ts.includes(S) && ze(q, Ts[0]);
1419
+ const It = v ? q : q.map((e) => {
1420
+ const t = _e(e.signerId);
1421
+ return t.length === 0 || t.includes(e.channel) ? e : { ...e, channel: t[0], skipOtp: void 0 };
1422
+ });
1423
+ if (It.some((e, t) => e !== q[t])) {
1424
+ const e = N ? pt(
1425
+ N,
1426
+ A,
1427
+ H,
1428
+ It,
1429
+ "signers"
1430
+ ) : { operatorChannel: H, rows: It };
1431
+ ve(e.rows), be(e.operatorChannel), oe(null);
1432
+ const t = e.rows.filter((s, a) => s.channel !== q[a].channel).map(
1433
+ (s) => r("signatureRequest.signerChannelChanged", {
1434
+ name: Fe(l, s.signerId),
1435
+ channel: V[s.channel].label
1436
+ })
1437
+ );
1438
+ Me(t.length > 0 ? t.join(" ") : null);
1439
+ }
1440
+ const yt = (e, t) => ({
1441
+ value: e,
1442
+ label: V[t].label,
1443
+ startAdornment: V[t].icon
1444
+ }), Es = Le ? !mi : !ln && !Re, As = Es ? r("signatureRequest.onDeviceUnavailableHint") : void 0, kt = wt ? r("signatureRequest.operatorOnDeviceLinked") : void 0, Ot = kt ?? As, Ds = (ln ? sn(Y) : it).map((e) => {
1445
+ const t = yt(e, e);
1446
+ return e === "on-device" ? Es ? { ...t, disabled: !0, description: As } : t : kt ? { ...t, disabled: !0, description: kt } : t;
1447
+ }), pi = () => {
1448
+ if (v) {
1449
+ ze(q, "on-device", {
1450
+ opChannel: "on-device",
1451
+ changed: "operator"
1452
+ });
1453
+ return;
1454
+ }
1455
+ if (!Wn) return;
1456
+ const e = q.map(
1457
+ (s) => s.rowId === Wn.rowId ? { ...s, channel: "on-device", skipOtp: void 0 } : s
1458
+ ), t = r("signatureRequest.signerChannelChanged", {
1459
+ name: Fe(l, Wn.signerId),
1460
+ channel: V["on-device"].label
1461
+ });
1462
+ if (N) {
1463
+ Oe(A, "on-device", e, "operator", [t]);
1464
+ return;
1465
+ }
1466
+ ve(e), be("on-device"), oe(null), Me(t);
1467
+ }, Tt = /* @__PURE__ */ n(_a, { meta: V }), Et = x.map((e) => e.signerId), on = l.find(
1468
+ (e) => !Et.includes(e.value) && !(f && e.isPatient === !0)
1469
+ ), fi = !y && x.length < bt && on !== void 0, Te = f || v || G ? (oa = x[0]) == null ? void 0 : oa.signerId : void 0, On = Nn(Te), vi = v ? S : ((ca = x[0]) == null ? void 0 : ca.channel) ?? S, Ps = f ? st({
1470
+ items: te,
1471
+ channel: vi,
1472
+ primaryIsPatient: On
1473
+ }) : null, At = f && !ge && te.length > 0 && Ps !== null && l.length > 1 ? r(Kt[Ps]) : null, Vn = (f || G) && x.length > 1 ? cr({
1474
+ primaryId: Te,
1475
+ secondId: x[1].signerId,
1476
+ channel: v ? S : x[1].channel,
1477
+ options: l
1478
+ }) : null, Ls = G && x.length < 2, Dt = l.filter(
1479
+ (e) => e.isPatient !== !0 && !Et.includes(e.value)
1480
+ ), bi = G && (x.length === 0 || On), _s = Ls && !bi && Dt.length > 0, Ms = _s && si, $s = Ls && On && l.some((e) => e.isPatient !== !0) ? r("signatureRequest.secondSigneeUnavailablePatient") : null, Ge = lt && !f ? _s && !Ms ? "openSlot" : null : Zt === "createSignee" ? le !== void 0 ? "createSignee" : null : l.length > 1 ? "addRow" : null, zs = Ge === "createSignee", Hs = le !== void 0 && !f && (lt || Zt === "createSignee"), Fs = (e) => Hs ? [
1481
+ ...e,
1482
+ {
1483
+ value: Qt,
1484
+ label: r("signatureRequest.newSignatory"),
1485
+ separatorBefore: !0,
1486
+ intent: "action"
1487
+ }
1488
+ ] : [...e], Pt = Sn(
1489
+ (an == null ? void 0 : an.value) ?? Te
1490
+ ).includes("sms"), cn = (f || v) && On && !Pt, Lt = v && S === "on-device" && (cn || (ti ?? !Pt)), Ri = v && x.length > 0 && (cn || Lt), _t = (e) => f && e === 0, Mt = (e, t) => e.channel === "on-device" && (_t(t) ? cn || (e.skipOtp ?? !Pt) : e.skipOtp === !0), Tn = ue && !(f && ge), En = Tn ? Rr({
1491
+ options: l,
1492
+ rosterIds: x.map((e) => e.signerId),
1493
+ rosterCap: bt
1494
+ }) : null, $t = En !== null && br(En) && le !== void 0 && !zs, Bs = f && le !== void 0 && !zs && !$t && !l.some((e) => e.isPatient !== !0), Qn = $t || Bs, Us = ce(Qn);
1495
+ Be(() => {
1496
+ var e;
1497
+ if (Us.current && !Qn) {
1498
+ const t = document.activeElement;
1499
+ if (t === null || t === document.body || t.getAttribute("role") === "dialog") {
1500
+ const a = bn.current;
1501
+ (e = a && !a.disabled ? a : ne.current) == null || e.focus();
1502
+ }
1503
+ }
1504
+ Us.current = Qn;
1505
+ }, [Qn]);
1506
+ const Ni = (e, t) => {
1507
+ ve(
1508
+ (s) => s.map(
1509
+ (a) => a.rowId === e ? { ...a, ...t } : a
1510
+ )
1511
+ );
1512
+ }, xi = () => {
1513
+ if (!on) return;
1514
+ if (v) {
1515
+ ze(
1516
+ [
1517
+ ...q,
1518
+ {
1519
+ signerId: on.value,
1520
+ channel: S,
1521
+ rowId: en.current++
1522
+ }
1523
+ ],
1524
+ S
1525
+ );
1526
+ return;
1527
+ }
1528
+ const e = qn(
1529
+ on.value,
1530
+ f ? "on-device" : "sms"
1531
+ );
1532
+ if (N) {
1533
+ Oe(
1534
+ A,
1535
+ H,
1536
+ [
1537
+ ...q,
1538
+ {
1539
+ signerId: on.value,
1540
+ channel: e,
1541
+ rowId: en.current++
1542
+ }
1543
+ ],
1544
+ "signers"
1545
+ );
1546
+ return;
1547
+ }
1548
+ ve((t) => [
1549
+ ...t,
1550
+ {
1551
+ signerId: on.value,
1552
+ channel: e,
1553
+ rowId: en.current++
1554
+ }
1555
+ ]);
1556
+ }, Ci = (e) => {
1557
+ var a, c;
1558
+ if (!Dt.some((d) => d.value === e)) return;
1559
+ (a = ne.current) == null || a.focus(), nn.current = "second";
1560
+ const t = q.slice(0, 1);
1561
+ if (v) {
1562
+ ze(
1563
+ [
1564
+ ...t,
1565
+ {
1566
+ signerId: e,
1567
+ channel: S,
1568
+ rowId: en.current++
1569
+ }
1570
+ ],
1571
+ S
1572
+ );
1573
+ return;
1574
+ }
1575
+ const s = [
1576
+ ...t,
1577
+ {
1578
+ signerId: e,
1579
+ channel: qn(e, ((c = t[0]) == null ? void 0 : c.channel) ?? "sms"),
1580
+ rowId: en.current++
1581
+ }
1582
+ ];
1583
+ if (N) {
1584
+ Oe(A, H, s, "signers");
1585
+ return;
1586
+ }
1587
+ ve(s);
1588
+ };
1589
+ Wt(() => {
1590
+ var s;
1591
+ const e = nn.current;
1592
+ if (e === null) return;
1593
+ nn.current = null, (s = (e === "slot" ? es : e === "second" ? ns : bn).current) == null || s.focus();
1594
+ });
1595
+ const qi = () => {
1596
+ nn.current = "slot", yn(!0);
1597
+ }, Si = () => {
1598
+ var e;
1599
+ (e = ne.current) == null || e.focus(), nn.current = "add", yn(!1);
1600
+ }, wi = (e) => {
1601
+ var t, s;
1602
+ if (G ? ((t = ne.current) == null || t.focus(), nn.current = "add", yn(!1)) : (s = bn.current) == null || s.focus(), v) {
1603
+ ze(
1604
+ q.filter((a) => a.rowId !== e),
1605
+ S
1606
+ );
1607
+ return;
1608
+ }
1609
+ if (N) {
1610
+ Oe(
1611
+ A,
1612
+ H,
1613
+ q.filter((a) => a.rowId !== e),
1614
+ "signers"
1615
+ );
1616
+ return;
1617
+ }
1618
+ ve(
1619
+ (a) => a.filter((c) => c.rowId !== e)
1620
+ );
1621
+ }, Ws = ue && !v && x.some((e) => qt(e.signerId)), js = ue && (v ? x.length > 0 && S === "qr" : x.some((e) => e.channel === "qr")), Gs = !v && x.some(
1622
+ (e, t) => Mt(e, t) && !qt(e.signerId)
1623
+ ), zt = (e) => new Intl.ListFormat(ot.language || "en", { type: "unit" }).format(
1624
+ e
1625
+ ), Vs = (e, t) => e.map((s) => {
1626
+ const a = t.get(s);
1627
+ return a === void 0 ? yt(s, s) : {
1628
+ ...yt(s, s),
1629
+ disabled: !0,
1630
+ description: a
1631
+ };
1632
+ }), Qs = (e, t, s) => {
1633
+ const a = /* @__PURE__ */ new Map();
1634
+ for (const c of e) {
1635
+ const d = t.get(c);
1636
+ d !== void 0 && a.set(d, [
1637
+ ...a.get(d) ?? [],
1638
+ V[c].label
1639
+ ]);
1640
+ }
1641
+ if (a.size !== 0)
1642
+ return zt(s ? [...a.keys()] : [...a].map(
1643
+ ([c, d]) => `${zt(d)} (${c})`
1644
+ ));
1645
+ }, Ht = hs(
1646
+ Te,
1647
+ Te === void 0 || (da = Y == null ? void 0 : Y.signerAvailableChannels) == null ? void 0 : da[Te]
1648
+ ), Ft = gt(Te), Ks = Vs(
1649
+ Ht,
1650
+ Ft
1651
+ ), Bt = Qs(
1652
+ Ht,
1653
+ Ft,
1654
+ !1
1655
+ ), Ii = v ? ds(
1656
+ Te,
1657
+ Ht.filter((e) => Ft.has(e))
1658
+ ) : [], Xs = (e, t) => e.length > 0 ? /* @__PURE__ */ n(
1659
+ "div",
1660
+ {
1661
+ "data-note": "contact-actions",
1662
+ role: t ? "group" : void 0,
1663
+ "aria-label": t,
1664
+ className: `${F} type-body-sm ds:flex ds:flex-wrap ds:gap-x-[var(--spacing-md)]`,
1665
+ children: e.map((s) => /* @__PURE__ */ n(
1666
+ Mi,
1667
+ {
1668
+ href: s.href,
1669
+ disabled: y,
1670
+ className: "ds:inline-flex ds:min-h-[var(--min-target-size)] ds:items-center",
1671
+ children: s.label
1672
+ },
1673
+ `${s.href} ${s.label}`
1674
+ ))
1675
+ }
1676
+ ) : null, Ys = (e, t) => {
1677
+ var s, a;
1678
+ return t === "email" ? (s = e == null ? void 0 : e.contact) == null ? void 0 : s.email : (a = e == null ? void 0 : e.contact) == null ? void 0 : a.phone;
1679
+ }, Kn = [];
1680
+ if (K && !$e && A !== "" && Oa.includes(H)) {
1681
+ const e = m.find((t) => t.value === A);
1682
+ Kn.push({
1683
+ key: "operator",
1684
+ role: "operator",
1685
+ name: (e == null ? void 0 : e.label) ?? A,
1686
+ channel: H,
1687
+ contact: Ys(e, H)
1688
+ });
1689
+ }
1690
+ if (ue)
1691
+ for (const e of x) {
1692
+ const t = v ? S : e.channel;
1693
+ if (!Oa.includes(t)) continue;
1694
+ const s = l.find(
1695
+ (a) => a.value === e.signerId
1696
+ );
1697
+ Kn.push({
1698
+ key: `signer-${e.rowId}`,
1699
+ role: "signer",
1700
+ name: (s == null ? void 0 : s.label) ?? e.signerId,
1701
+ channel: t,
1702
+ contact: Ys(s, t)
1703
+ });
1704
+ }
1705
+ const yi = () => {
1706
+ var e;
1707
+ if (!(Ws || Vn !== null)) {
1708
+ if (De && !ut && Kn.length > 0) {
1709
+ (e = ne.current) == null || e.focus(), tn(!0);
1710
+ return;
1711
+ }
1712
+ Js();
1713
+ }
1714
+ }, Js = () => {
1715
+ var s;
1716
+ Hn(js), js && ((s = ne.current) == null || s.focus(), kn(0));
1717
+ const e = x.map(
1718
+ ({ rowId: a, ...c }, d) => v ? {
1719
+ signerId: c.signerId,
1720
+ channel: S,
1721
+ // The batch's OTP waiver rides on the main signer.
1722
+ ...d === 0 && S === "on-device" ? { skipOtp: Lt } : {}
1723
+ } : _t(d) && c.channel === "on-device" ? { ...c, skipOtp: Mt(c, d) } : c
1724
+ ), t = v ? { signMode: S } : {};
1725
+ if (f) {
1726
+ const a = {};
1727
+ let c = null;
1728
+ for (const h of te) {
1729
+ if (!Xe(h)) continue;
1730
+ const g = rn[h.id], T = g === Q || g === "" || g === void 0 ? null : g;
1731
+ a[h.id] = T, c ?? (c = T);
1732
+ }
1733
+ const d = {};
1734
+ for (const [h, g] of Object.entries(
1735
+ a
1736
+ ))
1737
+ g !== null && (d[h] = xt[h]);
1738
+ we({
1739
+ operatorId: c,
1740
+ operatorChannel: null,
1741
+ signers: e,
1742
+ ...t,
1743
+ operatorAssignments: a,
1744
+ ...ke ? { operatorChannels: d } : {},
1745
+ requiredItemIds: te.map((h) => h.id)
1746
+ });
1747
+ return;
1748
+ }
1749
+ we({
1750
+ operatorId: !k || $e ? null : A,
1751
+ operatorChannel: !k || $e ? null : H,
1752
+ signers: j ? e : [],
1753
+ ...j ? t : {}
1754
+ });
1755
+ };
1756
+ Be(() => {
1757
+ var e;
1758
+ ie && (Hn(!1), ut && ((e = ne.current) == null || e.focus()), tn(!1));
1759
+ }, [ie]);
1760
+ const dn = ((de == null ? void 0 : de.length) ?? 0) > 0, Ve = dn || !ie && (je || ci), Xn = ue ? x.filter(
1761
+ (e) => (v ? S : e.channel) === "qr"
1762
+ ).map((e) => e.signerId) : [];
1763
+ for (const e of de ?? [])
1764
+ Xn.includes(e.signerId) || Xn.push(e.signerId);
1765
+ const An = Xn.length, Qe = Math.min(di, Math.max(An - 1, 0)), Ke = Xn[Qe], un = Ke === void 0 ? "" : Fe(l, Ke), Dn = de == null ? void 0 : de.find((e) => e.signerId === Ke), Zs = Dn ? Sr(Dn.expiresAt, ot.language || "en", r) : null, ki = Qe >= An - 1, ea = dn && An > 1, Yn = ut && !Ve, na = i && Ve && !fe ? `${dn}:${Qe}` : null;
1766
+ Be(() => {
1767
+ var e;
1768
+ na !== null && ((e = ne.current) == null || e.focus());
1769
+ }, [na]);
1770
+ const ta = i && fe ? fe : null;
1771
+ Be(() => {
1772
+ var e;
1773
+ ta !== null && ((e = ne.current) == null || e.focus());
1774
+ }, [ta]);
1775
+ const Jn = Ze && !fe;
1776
+ Wt(() => {
1777
+ var t;
1778
+ if (!i || !Ze) return;
1779
+ const e = document.activeElement;
1780
+ (e === null || e === document.body) && ((t = ne.current) == null || t.focus());
1781
+ }, [i, Ze]);
1782
+ const sa = v ? /* @__PURE__ */ u(me, { children: [
1783
+ /* @__PURE__ */ n(
1784
+ Ue,
1785
+ {
1786
+ id: Ta,
1787
+ options: Ks,
1788
+ value: S,
1789
+ adornmentInTrigger: !0,
1790
+ showDescriptions: !0,
1791
+ disabled: y,
1792
+ "aria-label": r("signatureRequest.channelLabel"),
1793
+ "aria-describedby": Bt ? ls : void 0,
1794
+ onValueChange: (e) => {
1795
+ Ks.some(
1796
+ (s) => s.value === e && !s.disabled
1797
+ ) && ze(q, e, {
1798
+ userChannel: !0
1799
+ });
1800
+ }
1801
+ }
1802
+ ),
1803
+ Bt ? /* @__PURE__ */ n("span", { id: ls, className: "ds:sr-only", children: Bt }) : null
1804
+ ] }) : null, aa = v ? /* @__PURE__ */ u(me, { children: [
1805
+ Xs(
1806
+ Ii,
1807
+ Fe(l, Te ?? "")
1808
+ ),
1809
+ S === "on-device" ? /* @__PURE__ */ n("div", { className: F, children: /* @__PURE__ */ n(
1810
+ ga,
1811
+ {
1812
+ label: r("signatureRequest.noOtp"),
1813
+ checked: Lt,
1814
+ disabled: y || cn,
1815
+ "aria-describedby": cn ? $n : void 0,
1816
+ onCheckedChange: (e) => vt(e)
1817
+ }
1818
+ ) }) : null,
1819
+ Ri ? /* @__PURE__ */ n(U, { variant: "warning", id: $n, className: F, children: /* @__PURE__ */ n(U.Description, { children: r("signatureRequest.noOtpWarning") }) }) : null
1820
+ ] }) : null, Oi = dn ? Dn ? un ? r("signatureRequest.qrCaptionNamed", { name: un }) : r("signatureRequest.qrCaption") : (
1821
+ // The error alert in the body carries the message (and announces
1822
+ // itself); the description only names whose slot this is.
1823
+ un || Ke
1824
+ ) : r("signatureRequest.qrPending");
1825
+ return /* @__PURE__ */ n("div", { ref: ja, className: "ds:contents", "data-component": "signature-request", children: /* @__PURE__ */ n(Ea, { children: /* @__PURE__ */ n(C, { open: i, onOpenChange: o, children: /* @__PURE__ */ u(
1826
+ C.Content,
1827
+ {
1828
+ size: "lg",
1829
+ scroll: "body",
1830
+ hideCloseButton: !0,
1831
+ onOpenAutoFocus: (e) => {
1832
+ var t;
1833
+ !Ve && !Ct && !fe && !Ze || (e.preventDefault(), (t = ne.current) == null || t.focus());
1834
+ },
1835
+ ...Wa,
1836
+ children: [
1837
+ /* @__PURE__ */ u(C.Header, { children: [
1838
+ /* @__PURE__ */ n(
1839
+ C.Title,
1840
+ {
1841
+ ref: ne,
1842
+ tabIndex: -1,
1843
+ "aria-describedby": xn ? ss : Jn ? as : Ve ? ea ? `${ct} ${ts}` : ct : Yn ? dt : void 0,
1844
+ className: "ds:outline-none",
1845
+ children: xn ? xn.title : !Jn && Ve ? r("signatureRequest.qrTitle") : !Jn && Yn ? r("signatureRequest.confirmTitle") : Je ?? r(
1846
+ f ? "signatureRequest.requiredTitle" : "signatureRequest.title"
1847
+ )
1848
+ }
1849
+ ),
1850
+ xn ? /* @__PURE__ */ n(C.Description, { asChild: !0, children: /* @__PURE__ */ n("div", { children: /* @__PURE__ */ n("p", { id: ss, children: xn.description }) }) }) : Jn ? /* @__PURE__ */ n(C.Description, { asChild: !0, children: /* @__PURE__ */ n("div", { children: /* @__PURE__ */ n("p", { id: as, children: r("signatureRequest.loading") }) }) }) : Ve ? /* @__PURE__ */ n(C.Description, { asChild: !0, children: /* @__PURE__ */ n("div", { children: /* @__PURE__ */ u(
1851
+ "div",
1852
+ {
1853
+ id: ct,
1854
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
1855
+ children: [
1856
+ /* @__PURE__ */ n("p", { children: Oi }),
1857
+ Zs ? /* @__PURE__ */ n("p", { children: Zs }) : null
1858
+ ]
1859
+ }
1860
+ ) }) }) : Yn ? /* @__PURE__ */ n(C.Description, { asChild: !0, children: /* @__PURE__ */ n("div", { children: /* @__PURE__ */ n("p", { id: dt, children: r("signatureRequest.confirmDescription") }) }) }) : /* @__PURE__ */ n(C.Description, { children: We ?? r(
1861
+ f ? "signatureRequest.requiredDescription" : Ct ? (
1862
+ // The table says whether there are signed
1863
+ // versions, so the header describes the form.
1864
+ "signatureRequest.requestDescription"
1865
+ ) : "signatureRequest.noSignedVersions"
1866
+ ) })
1867
+ ] }),
1868
+ fe ? /* @__PURE__ */ u(me, { children: [
1869
+ /* @__PURE__ */ n(C.Body, { children: /* @__PURE__ */ n(vr, { outcome: fe }) }),
1870
+ /* @__PURE__ */ u(C.Footer, { children: [
1871
+ fe === "creditsExhausted" && re ? /* @__PURE__ */ n(
1872
+ L,
1873
+ {
1874
+ intent: "primary",
1875
+ startIcon: /* @__PURE__ */ n(Yi, {}),
1876
+ onClick: re,
1877
+ children: r("signatureRequest.buyMoreSignatures")
1878
+ }
1879
+ ) : null,
1880
+ fe === "creditsExhausted" && pe === "creditsExhausted" && Jt ? /* @__PURE__ */ n(
1881
+ L,
1882
+ {
1883
+ intent: "ghost",
1884
+ onClick: () => {
1885
+ var e;
1886
+ (e = ne.current) == null || e.focus(), ht(!0), Jt();
1887
+ },
1888
+ children: r("signatureRequest.outcomeCancel")
1889
+ }
1890
+ ) : null,
1891
+ /* @__PURE__ */ n(C.Close, { asChild: !0, children: /* @__PURE__ */ n(L, { intent: "outline", children: r("signatureRequest.close") }) })
1892
+ ] })
1893
+ ] }) : Ze ? /* @__PURE__ */ u(me, { children: [
1894
+ /* @__PURE__ */ n(
1895
+ C.Body,
1896
+ {
1897
+ "aria-busy": "true",
1898
+ "data-note": "loading",
1899
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]",
1900
+ children: Nr.filter(
1901
+ (e) => e === "operator" && K || e === "signers" && ue
1902
+ ).map((e, t) => /* @__PURE__ */ u(
1903
+ "div",
1904
+ {
1905
+ className: `${pn} ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]`,
1906
+ children: [
1907
+ /* @__PURE__ */ n("div", { className: ae, children: /* @__PURE__ */ n("div", { className: _n, children: /* @__PURE__ */ n(qe, { size: "sm", width: "30%", stagger: t }) }) }),
1908
+ /* @__PURE__ */ u("div", { className: ae, children: [
1909
+ /* @__PURE__ */ n("div", { className: nt, children: /* @__PURE__ */ n(
1910
+ qe,
1911
+ {
1912
+ variant: "circular",
1913
+ size: "sm",
1914
+ stagger: t + 1
1915
+ }
1916
+ ) }),
1917
+ /* @__PURE__ */ n("div", { className: jt, children: /* @__PURE__ */ n(
1918
+ qe,
1919
+ {
1920
+ variant: "rounded",
1921
+ height: "var(--min-target-size)",
1922
+ stagger: t + 1
1923
+ }
1924
+ ) })
1925
+ ] })
1926
+ ]
1927
+ },
1928
+ e
1929
+ ))
1930
+ }
1931
+ ),
1932
+ /* @__PURE__ */ u(C.Footer, { children: [
1933
+ /* @__PURE__ */ n(L, { intent: "primary", startIcon: /* @__PURE__ */ n(ba, {}), disabled: !0, children: r("signatureRequest.requestSignature") }),
1934
+ /* @__PURE__ */ n(C.Close, { asChild: !0, children: /* @__PURE__ */ n(L, { intent: "outline", children: r("signatureRequest.close") }) })
1935
+ ] })
1936
+ ] }) : Ve ? /* @__PURE__ */ u(me, { children: [
1937
+ /* @__PURE__ */ n(C.Body, { className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-sm)] ds:text-center", children: dn ? /* @__PURE__ */ u(me, { children: [
1938
+ ea ? (
1939
+ // Also describes the heading, so screen readers hear
1940
+ // the position when Previous or Next moves focus there.
1941
+ /* @__PURE__ */ n(
1942
+ "p",
1943
+ {
1944
+ id: ts,
1945
+ className: "type-label ds:text-[var(--muted-foreground)]",
1946
+ children: r("signatureRequest.qrStepCount", {
1947
+ current: Qe + 1,
1948
+ total: An
1949
+ })
1950
+ }
1951
+ )
1952
+ ) : null,
1953
+ un ? /* @__PURE__ */ n("p", { className: "type-title-item ds:break-words", children: un }) : null,
1954
+ Dn ? (
1955
+ // The QrCode's own name speaks of check-in, so the
1956
+ // pattern names the code and hides the inner figure.
1957
+ // `lg` keeps a long signing link at a module size a
1958
+ // phone camera can read off a desk monitor.
1959
+ /* @__PURE__ */ n(
1960
+ "div",
1961
+ {
1962
+ role: "img",
1963
+ "aria-label": r("signatureRequest.qrCodeLabel"),
1964
+ "data-signer-id": Ke,
1965
+ children: /* @__PURE__ */ n(
1966
+ Pi,
1967
+ {
1968
+ value: Dn.url,
1969
+ variant: "framed",
1970
+ size: "lg",
1971
+ decorative: !0
1972
+ }
1973
+ )
1974
+ }
1975
+ )
1976
+ ) : /* @__PURE__ */ n(
1977
+ U,
1978
+ {
1979
+ variant: "error",
1980
+ className: "ds:text-start",
1981
+ "data-signer-id": Ke,
1982
+ children: /* @__PURE__ */ n(U.Description, { children: r("signatureRequest.qrMissing", {
1983
+ name: un || Ke
1984
+ }) })
1985
+ }
1986
+ )
1987
+ ] }) : (
1988
+ // Waiting for the server: the spinner's status role
1989
+ // announces the wait politely.
1990
+ /* @__PURE__ */ n("div", { className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-sm)] ds:py-[var(--spacing-xl)]", children: /* @__PURE__ */ n(
1991
+ Li,
1992
+ {
1993
+ size: "lg",
1994
+ label: r("signatureRequest.qrPending")
1995
+ }
1996
+ ) })
1997
+ ) }),
1998
+ /* @__PURE__ */ n(C.Footer, { children: dn ? /* @__PURE__ */ u(me, { children: [
1999
+ An > 1 ? /* @__PURE__ */ n(
2000
+ L,
2001
+ {
2002
+ intent: "outline",
2003
+ disabled: Qe === 0,
2004
+ onClick: () => kn(Qe - 1),
2005
+ children: r("signatureRequest.qrPrevious")
2006
+ }
2007
+ ) : null,
2008
+ ki ? /* @__PURE__ */ n(
2009
+ L,
2010
+ {
2011
+ intent: "primary",
2012
+ onClick: () => {
2013
+ Ie == null || Ie(), o(!1);
2014
+ },
2015
+ children: r("signatureRequest.qrDone")
2016
+ }
2017
+ ) : /* @__PURE__ */ n(
2018
+ L,
2019
+ {
2020
+ intent: "primary",
2021
+ onClick: () => kn(Qe + 1),
2022
+ children: r("signatureRequest.qrNext")
2023
+ }
2024
+ )
2025
+ ] }) : /* @__PURE__ */ n(C.Close, { asChild: !0, children: /* @__PURE__ */ n(L, { intent: "outline", children: r("signatureRequest.close") }) }) })
2026
+ ] }) : Yn ? /* @__PURE__ */ u(me, { children: [
2027
+ /* @__PURE__ */ u(C.Body, { children: [
2028
+ /* @__PURE__ */ n(at, { "aria-labelledby": dt, children: Kn.map((e) => /* @__PURE__ */ n(
2029
+ at.Item,
2030
+ {
2031
+ "data-recipient": e.role,
2032
+ leading: /* @__PURE__ */ n(
2033
+ Zn,
2034
+ {
2035
+ "aria-hidden": "true",
2036
+ name: e.name,
2037
+ size: "sm"
2038
+ }
2039
+ ),
2040
+ title: e.name,
2041
+ description: /* @__PURE__ */ u("span", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-sm)]", children: [
2042
+ /* @__PURE__ */ u("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
2043
+ V[e.channel].icon,
2044
+ V[e.channel].label
2045
+ ] }),
2046
+ e.contact ? (
2047
+ // A number or address reads left to right in
2048
+ // every locale.
2049
+ /* @__PURE__ */ n(
2050
+ "span",
2051
+ {
2052
+ dir: "ltr",
2053
+ className: "ds:break-all ds:text-foreground",
2054
+ children: e.contact
2055
+ }
2056
+ )
2057
+ ) : null
2058
+ ] })
2059
+ },
2060
+ e.key
2061
+ )) }),
2062
+ ie ? /* @__PURE__ */ n(
2063
+ U,
2064
+ {
2065
+ variant: "error",
2066
+ className: "ds:mt-[var(--spacing-md)]",
2067
+ children: /* @__PURE__ */ n(U.Description, { children: ie })
2068
+ }
2069
+ ) : null
2070
+ ] }),
2071
+ /* @__PURE__ */ u(C.Footer, { children: [
2072
+ /* @__PURE__ */ n(
2073
+ L,
2074
+ {
2075
+ intent: "primary",
2076
+ startIcon: /* @__PURE__ */ n(ji, {}),
2077
+ onClick: Js,
2078
+ loading: y,
2079
+ children: r("signatureRequest.confirmSend")
2080
+ }
2081
+ ),
2082
+ /* @__PURE__ */ n(
2083
+ L,
2084
+ {
2085
+ intent: "outline",
2086
+ disabled: y,
2087
+ onClick: () => {
2088
+ var e;
2089
+ (e = ne.current) == null || e.focus(), tn(!1);
2090
+ },
2091
+ children: r("signatureRequest.confirmBack")
2092
+ }
2093
+ )
2094
+ ] })
2095
+ ] }) : /* @__PURE__ */ u(me, { children: [
2096
+ /* @__PURE__ */ u(C.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", children: [
2097
+ Ct ? /* @__PURE__ */ u(me, { children: [
2098
+ /* @__PURE__ */ n(
2099
+ ir,
2100
+ {
2101
+ signatures: Pe,
2102
+ loading: O,
2103
+ showLegalLevel: ye,
2104
+ onView: M,
2105
+ onDownload: b,
2106
+ onShare: E,
2107
+ shareTargets: ee,
2108
+ onDelete: z
2109
+ }
2110
+ ),
2111
+ K || Tn ? /* @__PURE__ */ n(pa, { decorative: !0 }) : null
2112
+ ] }) : null,
2113
+ f ? /* @__PURE__ */ n(
2114
+ pr,
2115
+ {
2116
+ items: te,
2117
+ loading: ge,
2118
+ operatorOptions: Bn,
2119
+ assignments: rn,
2120
+ onAssign: ri,
2121
+ showOperatorChannels: ke,
2122
+ operatorChannels: xt,
2123
+ onOperatorChannel: (e, t) => Nt((s) => ({
2124
+ ...s,
2125
+ [e]: t
2126
+ })),
2127
+ onAssignAllToMe: p !== void 0 ? li : void 0,
2128
+ busy: y
2129
+ }
2130
+ ) : null,
2131
+ K ? /* @__PURE__ */ u(
2132
+ "section",
2133
+ {
2134
+ className: `${pn} ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:text-start`,
2135
+ children: [
2136
+ /* @__PURE__ */ n("div", { className: ae, children: /* @__PURE__ */ u("div", { className: _n, children: [
2137
+ /* @__PURE__ */ n("p", { className: "type-eyebrow ds:text-[color:var(--muted-foreground)]", children: r("signatureRequest.operatorSection") }),
2138
+ p !== void 0 ? /* @__PURE__ */ n(
2139
+ L,
2140
+ {
2141
+ intent: "outline",
2142
+ size: "sm",
2143
+ startIcon: /* @__PURE__ */ n(Xt, {}),
2144
+ disabled: y,
2145
+ onClick: () => {
2146
+ if (ft(p), N) {
2147
+ Oe(
2148
+ p,
2149
+ jn(
2150
+ X(
2151
+ p
2152
+ )
2153
+ ),
2154
+ q,
2155
+ "operator"
2156
+ );
2157
+ return;
2158
+ }
2159
+ be(
2160
+ jn(
2161
+ X(
2162
+ p,
2163
+ Re
2164
+ )
2165
+ )
2166
+ ), oe(null);
2167
+ },
2168
+ children: r("signatureRequest.assignToMe")
2169
+ }
2170
+ ) : null
2171
+ ] }) }),
2172
+ /* @__PURE__ */ u("div", { className: ae, "data-person-row": "operator", children: [
2173
+ /* @__PURE__ */ n("div", { className: nt, children: /* @__PURE__ */ n(
2174
+ Zn,
2175
+ {
2176
+ "aria-hidden": "true",
2177
+ name: $e ? void 0 : Fe(m, A),
2178
+ size: "sm"
2179
+ }
2180
+ ) }),
2181
+ /* @__PURE__ */ u("div", { className: Na, children: [
2182
+ /* @__PURE__ */ n(
2183
+ Ue,
2184
+ {
2185
+ options: za(
2186
+ Bn,
2187
+ A
2188
+ ),
2189
+ value: A,
2190
+ showDescriptions: !0,
2191
+ "aria-describedby": St ? Is : void 0,
2192
+ onValueChange: (e) => {
2193
+ if (!(!e || !Ha(Bn, e))) {
2194
+ if (ft(e), N) {
2195
+ Oe(
2196
+ e,
2197
+ e === Q ? "email" : jn(
2198
+ X(e)
2199
+ ),
2200
+ q,
2201
+ "operator"
2202
+ );
2203
+ return;
2204
+ }
2205
+ be(
2206
+ e === Q ? "email" : jn(
2207
+ X(
2208
+ e,
2209
+ Re
2210
+ )
2211
+ )
2212
+ ), oe(null);
2213
+ }
2214
+ },
2215
+ required: !0,
2216
+ disabled: y,
2217
+ placeholder: r(
2218
+ "signatureRequest.operatorPlaceholder"
2219
+ ),
2220
+ "aria-label": r("signatureRequest.operatorSection")
2221
+ }
2222
+ ),
2223
+ St ? /* @__PURE__ */ n(
2224
+ "span",
2225
+ {
2226
+ id: Is,
2227
+ className: "ds:sr-only",
2228
+ children: St
2229
+ }
2230
+ ) : null
2231
+ ] }),
2232
+ /* @__PURE__ */ u(
2233
+ "div",
2234
+ {
2235
+ className: $e ? `${tt} ds:hidden ds:@[512px]/person:block` : tt,
2236
+ children: [
2237
+ $e ? null : /* @__PURE__ */ n(
2238
+ Ue,
2239
+ {
2240
+ id: "signature-request-operator-channel",
2241
+ options: Ds,
2242
+ value: H,
2243
+ adornmentInTrigger: !0,
2244
+ showDescriptions: !0,
2245
+ disabled: y,
2246
+ "aria-label": r(
2247
+ "signatureRequest.operatorChannelLabel"
2248
+ ),
2249
+ "aria-describedby": Ot ? rs : void 0,
2250
+ onValueChange: (e) => {
2251
+ if (Ds.some(
2252
+ (s) => s.value === e && !s.disabled
2253
+ )) {
2254
+ if (Le && e === "on-device" && !Re) {
2255
+ pi();
2256
+ return;
2257
+ }
2258
+ if (N) {
2259
+ Oe(
2260
+ A,
2261
+ e,
2262
+ q,
2263
+ "operator"
2264
+ );
2265
+ return;
2266
+ }
2267
+ be(e), oe(null);
2268
+ }
2269
+ }
2270
+ }
2271
+ ),
2272
+ Tt
2273
+ ]
2274
+ }
2275
+ ),
2276
+ Ot && !$e ? /* @__PURE__ */ n("span", { id: rs, className: "ds:sr-only", children: Ot }) : null
2277
+ ] })
2278
+ ]
2279
+ }
2280
+ ) : null,
2281
+ K || Tn ? /* @__PURE__ */ n("span", { role: "status", className: "ds:sr-only", children: Cs ? r("signatureRequest.operatorChannelReverted", {
2282
+ channel: V[Cs].label
2283
+ }) : oi }) : null,
2284
+ (K || f) && Tn ? /* @__PURE__ */ n(pa, { decorative: !0 }) : null,
2285
+ Tn ? /* @__PURE__ */ u(
2286
+ "section",
2287
+ {
2288
+ className: `${pn} ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:text-start`,
2289
+ children: [
2290
+ /* @__PURE__ */ u("div", { className: ae, children: [
2291
+ /* @__PURE__ */ u("div", { className: _n, children: [
2292
+ /* @__PURE__ */ n("p", { className: "type-eyebrow ds:text-[color:var(--muted-foreground)]", children: r("signatureRequest.signersSection") }),
2293
+ Ge === "addRow" ? /* @__PURE__ */ n(
2294
+ L,
2295
+ {
2296
+ ref: bn,
2297
+ intent: "outline",
2298
+ size: "sm",
2299
+ startIcon: /* @__PURE__ */ n(et, {}),
2300
+ disabled: !fi,
2301
+ "aria-describedby": At ? is : void 0,
2302
+ onClick: xi,
2303
+ children: r("signatureRequest.addSigner")
2304
+ }
2305
+ ) : Ge !== null ? (
2306
+ // The second signee line, or the host's own
2307
+ // create-signee page, as platform's "Aggiungi
2308
+ // firmatario".
2309
+ /* @__PURE__ */ n(
2310
+ L,
2311
+ {
2312
+ ref: bn,
2313
+ intent: "outline",
2314
+ size: "sm",
2315
+ startIcon: Ge === "openSlot" ? /* @__PURE__ */ n(et, {}) : /* @__PURE__ */ n(Xt, {}),
2316
+ disabled: y,
2317
+ "data-action": Ge === "openSlot" ? "add-second-signee" : "create-signee",
2318
+ onClick: Ge === "openSlot" ? qi : le,
2319
+ children: r(
2320
+ Ge === "openSlot" ? "signatureRequest.addSigner" : "signatureRequest.addSignatory"
2321
+ )
2322
+ }
2323
+ )
2324
+ ) : null
2325
+ ] }),
2326
+ En ? /* @__PURE__ */ u(
2327
+ U,
2328
+ {
2329
+ variant: "warning",
2330
+ announce: "polite",
2331
+ "data-note": "minor-patient",
2332
+ "data-warning": En,
2333
+ className: F,
2334
+ children: [
2335
+ /* @__PURE__ */ n(U.Description, { children: r(Cr[En]) }),
2336
+ $t ? /* @__PURE__ */ n(U.Action, { children: /* @__PURE__ */ n(
2337
+ L,
2338
+ {
2339
+ intent: "tonal",
2340
+ size: "sm",
2341
+ startIcon: /* @__PURE__ */ n(et, {}),
2342
+ disabled: y,
2343
+ onClick: le,
2344
+ children: r("signatureRequest.addSignatory")
2345
+ }
2346
+ ) }) : null
2347
+ ]
2348
+ }
2349
+ ) : null,
2350
+ Bs ? /* @__PURE__ */ n("div", { className: F, children: /* @__PURE__ */ n(
2351
+ L,
2352
+ {
2353
+ intent: "link",
2354
+ size: "sm",
2355
+ startIcon: /* @__PURE__ */ n(et, {}),
2356
+ disabled: y,
2357
+ onClick: le,
2358
+ children: r("signatureRequest.addSignatory")
2359
+ }
2360
+ ) }) : null,
2361
+ v && !Rn ? /* @__PURE__ */ u(
2362
+ "div",
2363
+ {
2364
+ className: `${F} ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]`,
2365
+ children: [
2366
+ /* @__PURE__ */ n(
2367
+ "label",
2368
+ {
2369
+ htmlFor: Ta,
2370
+ className: "type-label ds:text-foreground",
2371
+ children: r("signatureRequest.channelLabel")
2372
+ }
2373
+ ),
2374
+ sa
2375
+ ]
2376
+ }
2377
+ ) : null,
2378
+ Rn ? null : aa,
2379
+ $s ? /* @__PURE__ */ n(
2380
+ "p",
2381
+ {
2382
+ id: Qa,
2383
+ "data-note": "second-signee-hint",
2384
+ className: `${F} type-body-sm ds:text-[color:var(--muted-foreground)]`,
2385
+ children: $s
2386
+ }
2387
+ ) : null,
2388
+ At ? /* @__PURE__ */ n(
2389
+ "p",
2390
+ {
2391
+ id: is,
2392
+ className: `${F} type-body-sm ds:text-[color:var(--muted-foreground)]`,
2393
+ children: At
2394
+ }
2395
+ ) : null
2396
+ ] }),
2397
+ /* @__PURE__ */ u("div", { className: nr, children: [
2398
+ x.map((e, t) => {
2399
+ var ma;
2400
+ const s = l.filter(
2401
+ (D) => D.value === e.signerId || !Et.includes(D.value)
2402
+ ), a = Fe(
2403
+ l,
2404
+ e.signerId
2405
+ ), c = l.find(
2406
+ (D) => D.value === e.signerId
2407
+ ), d = (c == null ? void 0 : c.isMinor) === !0 && c.isPatient !== !0, h = (f || G) && t > 0, g = h ? s.filter(
2408
+ (D) => D.isPatient !== !0
2409
+ ) : s, T = g.some(
2410
+ (D) => D.value === e.signerId
2411
+ ), w = h ? Vn : null, P = `${cs}-${e.rowId}`, Ce = `${Va}-${e.rowId}`, J = Cn(
2412
+ e.signerId
2413
+ ), he = mt(
2414
+ e.signerId,
2415
+ (ma = Y == null ? void 0 : Y.signerAvailableChannels) == null ? void 0 : ma[e.signerId]
2416
+ ), Ee = Vs(
2417
+ he,
2418
+ J
2419
+ ), Ne = !v && Ee.every(
2420
+ (D) => D.disabled
2421
+ ), xe = v ? void 0 : Qs(
2422
+ he,
2423
+ J,
2424
+ Ne
2425
+ ), He = `${Ga}-${e.rowId}`, ua = _t(t) && cn, Ti = f || G ? h : x.length > 1, Ei = (D) => {
2426
+ if (D === Qt) {
2427
+ Hs && (le == null || le());
2428
+ return;
2429
+ }
2430
+ if (!D || !g.some(
2431
+ (se) => se.value === D
2432
+ ))
2433
+ return;
2434
+ if (G && !h && yn(!1), v) {
2435
+ ze(
2436
+ q.map(
2437
+ (se) => se.rowId === e.rowId ? { ...se, signerId: D } : se
2438
+ ),
2439
+ S,
2440
+ {
2441
+ primaryChanged: f && !h,
2442
+ // A new main signer clears the slot.
2443
+ clearSecond: G && !h
2444
+ }
2445
+ );
2446
+ return;
2447
+ }
2448
+ const Ut = qn(
2449
+ D,
2450
+ e.channel
2451
+ ), Pn = (f || G) && !h && q.length > 1, Ln = (Pn ? q.slice(0, 1) : q).map(
2452
+ (se) => se.rowId === e.rowId ? {
2453
+ ...se,
2454
+ signerId: D,
2455
+ channel: Ut,
2456
+ skipOtp: Ut === "on-device" ? se.skipOtp : void 0
2457
+ } : se
2458
+ ), hn = Pn && x.length > 1 ? [r("signatureRequest.secondSigneeCleared")] : [];
2459
+ if (N) {
2460
+ Oe(
2461
+ A,
2462
+ H,
2463
+ Ln,
2464
+ "signers",
2465
+ hn
2466
+ );
2467
+ return;
2468
+ }
2469
+ ve(Ln), hn.length > 0 && (oe(null), Me(hn.join(" ")));
2470
+ }, Ai = (D) => {
2471
+ if (!Ee.some(
2472
+ (mn) => mn.value === D && !mn.disabled
2473
+ )) return;
2474
+ const Pn = D, Ln = q.map(
2475
+ (mn) => mn.rowId === e.rowId ? { ...mn, channel: Pn, skipOtp: void 0 } : mn
2476
+ ), hn = f && !h && x.length > 1 ? st({
2477
+ items: te,
2478
+ channel: Pn,
2479
+ primaryIsPatient: On
2480
+ }) : null, se = hn === null ? [] : [r(Kt[hn])];
2481
+ if (N) {
2482
+ Oe(
2483
+ A,
2484
+ H,
2485
+ Ln,
2486
+ "signers",
2487
+ se
2488
+ );
2489
+ return;
2490
+ }
2491
+ ve(Ln), se.length > 0 && (oe(null), Me(se.join(" ")));
2492
+ }, ha = /* @__PURE__ */ u(
2493
+ "div",
2494
+ {
2495
+ role: "group",
2496
+ "aria-label": h ? void 0 : a,
2497
+ "aria-labelledby": h ? Ce : void 0,
2498
+ "data-signer-id": e.signerId,
2499
+ "data-signer-role": f || G ? h ? "second" : "main" : void 0,
2500
+ className: ae,
2501
+ children: [
2502
+ /* @__PURE__ */ n("div", { className: nt, children: /* @__PURE__ */ n(
2503
+ Zn,
2504
+ {
2505
+ "aria-hidden": "true",
2506
+ name: f && !T ? void 0 : a,
2507
+ size: "sm"
2508
+ }
2509
+ ) }),
2510
+ /* @__PURE__ */ n(
2511
+ "div",
2512
+ {
2513
+ className: v && !Rn ? jt : Na,
2514
+ children: /* @__PURE__ */ n(
2515
+ Ue,
2516
+ {
2517
+ ref: h ? ns : void 0,
2518
+ options: Fs(g),
2519
+ value: f && !T ? "" : e.signerId,
2520
+ tone: w ? "error" : "default",
2521
+ "aria-describedby": w ? P : void 0,
2522
+ onValueChange: Ei,
2523
+ required: !0,
2524
+ disabled: y,
2525
+ placeholder: r(
2526
+ "signatureRequest.signerPlaceholder"
2527
+ ),
2528
+ "aria-label": r(
2529
+ "signatureRequest.signerPlaceholder"
2530
+ )
2531
+ }
2532
+ )
2533
+ }
2534
+ ),
2535
+ Rn ? /* @__PURE__ */ u("div", { className: tt, children: [
2536
+ t === 0 ? sa : /* @__PURE__ */ u(
2537
+ "span",
2538
+ {
2539
+ "data-note": "batch-channel",
2540
+ className: "type-body-sm ds:flex ds:min-h-[var(--min-target-size)] ds:items-center ds:gap-[var(--spacing-sm)] ds:px-[var(--spacing-sm)] ds:text-[color:var(--muted-foreground)]",
2541
+ children: [
2542
+ /* @__PURE__ */ n("span", { className: "ds:sr-only", children: `${r("signatureRequest.channelLabel")}: ` }),
2543
+ /* @__PURE__ */ n(
2544
+ "span",
2545
+ {
2546
+ "aria-hidden": "true",
2547
+ className: "ds:inline-flex ds:shrink-0",
2548
+ children: V[S].icon
2549
+ }
2550
+ ),
2551
+ V[S].label
2552
+ ]
2553
+ }
2554
+ ),
2555
+ Tt
2556
+ ] }) : null,
2557
+ v ? null : /* @__PURE__ */ u("div", { className: tt, children: [
2558
+ /* @__PURE__ */ n(
2559
+ Ue,
2560
+ {
2561
+ id: `signature-request-signer-channel-${e.rowId}`,
2562
+ options: Ee,
2563
+ value: Ne ? "" : e.channel,
2564
+ adornmentInTrigger: !0,
2565
+ showDescriptions: !0,
2566
+ disabled: y,
2567
+ "aria-label": r(
2568
+ "signatureRequest.channelLabel"
2569
+ ),
2570
+ "aria-describedby": xe ? He : void 0,
2571
+ onValueChange: Ai
2572
+ }
2573
+ ),
2574
+ Tt
2575
+ ] }),
2576
+ xe && !Ne ? /* @__PURE__ */ n(
2577
+ "span",
2578
+ {
2579
+ id: He,
2580
+ className: "ds:sr-only",
2581
+ children: xe
2582
+ }
2583
+ ) : null,
2584
+ Ti ? /* @__PURE__ */ n("div", { className: xa, children: /* @__PURE__ */ n(
2585
+ vn,
2586
+ {
2587
+ intent: "ghost",
2588
+ size: "sm",
2589
+ icon: /* @__PURE__ */ n(Ra, {}),
2590
+ disabled: y,
2591
+ "aria-label": r(
2592
+ "signatureRequest.removeSigner"
2593
+ ),
2594
+ onClick: () => wi(e.rowId)
2595
+ }
2596
+ ) }) : null,
2597
+ d ? /* @__PURE__ */ n(
2598
+ U,
2599
+ {
2600
+ variant: "warning",
2601
+ announce: "polite",
2602
+ "data-note": "minor-signer",
2603
+ className: F,
2604
+ children: /* @__PURE__ */ n(U.Description, { children: r("signatureRequest.minorSignerWarning") })
2605
+ }
2606
+ ) : null,
2607
+ w ? /* @__PURE__ */ n(
2608
+ "p",
2609
+ {
2610
+ id: P,
2611
+ role: "status",
2612
+ "data-note": "second-signee-issue",
2613
+ "data-issue": w,
2614
+ className: `${F} type-body-sm ds:text-[color:var(--destructive)]`,
2615
+ children: r(qr[w])
2616
+ }
2617
+ ) : null,
2618
+ Ne && xe ? /* @__PURE__ */ n(
2619
+ "p",
2620
+ {
2621
+ id: He,
2622
+ "data-note": "no-channel",
2623
+ className: `${F} type-body-sm ds:text-[color:var(--muted-foreground)]`,
2624
+ children: xe
2625
+ }
2626
+ ) : null,
2627
+ v ? null : Xs(
2628
+ ds(
2629
+ e.signerId,
2630
+ he
2631
+ )
2632
+ ),
2633
+ !v && e.channel === "on-device" && !Ne ? /* @__PURE__ */ n("div", { className: F, children: /* @__PURE__ */ n(
2634
+ ga,
2635
+ {
2636
+ label: r("signatureRequest.noOtp"),
2637
+ checked: Mt(e, t),
2638
+ disabled: y || ua,
2639
+ "aria-describedby": ua ? $n : void 0,
2640
+ onCheckedChange: (D) => Ni(e.rowId, {
2641
+ skipOtp: D
2642
+ })
2643
+ }
2644
+ ) }) : null,
2645
+ Rn && t === 0 ? aa : null
2646
+ ]
2647
+ },
2648
+ e.rowId
2649
+ );
2650
+ return h ? /* @__PURE__ */ u(
2651
+ "div",
2652
+ {
2653
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
2654
+ children: [
2655
+ /* @__PURE__ */ n("div", { className: ae, children: /* @__PURE__ */ n(
2656
+ "p",
2657
+ {
2658
+ id: Ce,
2659
+ className: `${F} type-label ds:text-[color:var(--muted-foreground)]`,
2660
+ children: r("signatureRequest.secondSigneeLabel")
2661
+ }
2662
+ ) }),
2663
+ ha
2664
+ ]
2665
+ },
2666
+ e.rowId
2667
+ ) : ha;
2668
+ }),
2669
+ Ms ? /* @__PURE__ */ u(
2670
+ "div",
2671
+ {
2672
+ "data-second-signee-slot": "",
2673
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
2674
+ children: [
2675
+ /* @__PURE__ */ n("div", { className: ae, children: /* @__PURE__ */ n(
2676
+ "p",
2677
+ {
2678
+ id: os,
2679
+ className: `${F} type-label ds:text-[color:var(--muted-foreground)]`,
2680
+ children: r("signatureRequest.secondSigneeLabel")
2681
+ }
2682
+ ) }),
2683
+ /* @__PURE__ */ u(
2684
+ "div",
2685
+ {
2686
+ role: "group",
2687
+ "aria-labelledby": os,
2688
+ className: ae,
2689
+ children: [
2690
+ /* @__PURE__ */ n("div", { className: nt, children: /* @__PURE__ */ n(Zn, { "aria-hidden": "true", size: "sm" }) }),
2691
+ /* @__PURE__ */ n("div", { className: jt, children: /* @__PURE__ */ n(
2692
+ Ue,
2693
+ {
2694
+ ref: es,
2695
+ options: Fs(Dt),
2696
+ value: "",
2697
+ onValueChange: (e) => {
2698
+ if (e === Qt) {
2699
+ le == null || le();
2700
+ return;
2701
+ }
2702
+ Ci(e);
2703
+ },
2704
+ disabled: y,
2705
+ placeholder: r(
2706
+ "signatureRequest.secondSigneePlaceholder"
2707
+ ),
2708
+ "aria-label": r(
2709
+ "signatureRequest.secondSigneeLabel"
2710
+ )
2711
+ }
2712
+ ) }),
2713
+ /* @__PURE__ */ n("div", { className: xa, children: /* @__PURE__ */ n(
2714
+ vn,
2715
+ {
2716
+ intent: "ghost",
2717
+ size: "sm",
2718
+ icon: /* @__PURE__ */ n(Ra, {}),
2719
+ disabled: y,
2720
+ "aria-label": r(
2721
+ "signatureRequest.removeSigner"
2722
+ ),
2723
+ onClick: Si
2724
+ }
2725
+ ) })
2726
+ ]
2727
+ }
2728
+ )
2729
+ ]
2730
+ }
2731
+ ) : null
2732
+ ] })
2733
+ ]
2734
+ }
2735
+ ) : null,
2736
+ Gs || ie ? /* @__PURE__ */ n("div", { className: pn, children: /* @__PURE__ */ u("div", { className: ae, children: [
2737
+ Gs ? /* @__PURE__ */ n(
2738
+ U,
2739
+ {
2740
+ variant: "warning",
2741
+ id: $n,
2742
+ className: F,
2743
+ children: /* @__PURE__ */ n(U.Description, { children: r("signatureRequest.noOtpWarning") })
2744
+ }
2745
+ ) : null,
2746
+ ie ? /* @__PURE__ */ n(U, { variant: "error", className: F, children: /* @__PURE__ */ n(U.Description, { children: ie }) }) : null
2747
+ ] }) }) : null
2748
+ ] }),
2749
+ /* @__PURE__ */ u(C.Footer, { children: [
2750
+ /* @__PURE__ */ n(
2751
+ L,
2752
+ {
2753
+ intent: "primary",
2754
+ startIcon: /* @__PURE__ */ n(ba, {}),
2755
+ onClick: yi,
2756
+ "aria-describedby": Vn !== null && x[1] ? `${cs}-${x[1].rowId}` : void 0,
2757
+ disabled: !y && (ue && x.length === 0 || Ws || Vn !== null || !ue && !K || f && (ge || te.length === 0)),
2758
+ loading: y,
2759
+ children: r("signatureRequest.requestSignature")
2760
+ }
2761
+ ),
2762
+ /* @__PURE__ */ n(C.Close, { asChild: !0, children: /* @__PURE__ */ n(L, { intent: "outline", disabled: y, children: r("signatureRequest.close") }) })
2763
+ ] })
2764
+ ] })
2765
+ ]
2766
+ }
2767
+ ) }) }) });
2768
+ }
2769
+ );
2770
+ wr.displayName = "SignatureRequestModal";
2771
+ export {
2772
+ wr as S
2773
+ };
2774
+ //# sourceMappingURL=signature-request-BVGeF0qB.js.map