@mediquo/elements 0.3.2 → 0.5.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 (138) hide show
  1. package/README.md +84 -1
  2. package/dist/chunks/api-chat-client-CqMn2JEn.js +1 -0
  3. package/dist/chunks/{apple-pay-outcomes-BlytM6W-.js → apple-pay-outcomes-CjCnBYOD.js} +1 -1
  4. package/dist/chunks/chunk-4FFT6DC2-CVWibomC.js +1 -0
  5. package/dist/chunks/chunk-GZF3YFSX-DM-GTqxg.js +1 -0
  6. package/dist/chunks/chunk-RCFIJTXZ-C6Ir0-sM.js +1 -0
  7. package/dist/chunks/chunk-S5RWG6G2-DPesx3Od.js +1 -0
  8. package/dist/chunks/chunk-YMQSBQHL-De_r7BNk.js +1 -0
  9. package/dist/chunks/chunk-YTQUGGS3-DmCGIoFy.js +1 -0
  10. package/dist/chunks/consume-CovVqBjI.js +1 -0
  11. package/dist/chunks/context-consumer-ESdICVAb.js +1 -0
  12. package/dist/chunks/context-provider--AKuwfs9.js +1 -0
  13. package/dist/chunks/create-component-BB-6Gu6l.js +1 -0
  14. package/dist/chunks/create-context-DqP79qjF.js +1 -0
  15. package/dist/chunks/documentation-view-fFbvjJqx.js +1 -0
  16. package/dist/chunks/external-CJj32K_p.js +1 -0
  17. package/dist/chunks/{format-Cm3B1GMy.js → format-CRFiCNHw.js} +1 -1
  18. package/dist/chunks/get-appointment-query-Ck68BEMg.js +1 -0
  19. package/dist/chunks/get-patient-profile-query-B0tUDJmT.js +1 -0
  20. package/dist/chunks/i18n-formats-DYS91YEa.js +1 -0
  21. package/dist/chunks/{index-B9iWdvW3.js → index-BJcdB5MT.js} +1 -1
  22. package/dist/chunks/index-CGnPsMVQ.js +1 -0
  23. package/dist/chunks/index-CLdWVaEs.js +1 -0
  24. package/dist/chunks/index-CvDnN2NR.js +1 -0
  25. package/dist/chunks/index-DNUbmrQl.d.ts +31 -0
  26. package/dist/chunks/index-Xcn-xs13.js +1 -0
  27. package/dist/chunks/index-czcKClL3.d.ts +47 -0
  28. package/dist/chunks/isBefore-CPpTogxo.js +1 -0
  29. package/dist/chunks/{isSameDay-DPfclwIL.js → isSameDay-CuhZMy1T.js} +1 -1
  30. package/dist/chunks/localized-decorator-BlOuLhym.js +1 -0
  31. package/dist/chunks/mq-layout-CGcdxGMQ.js +1 -0
  32. package/dist/chunks/mq-professional-presence-sync-cmg6CXhz.d.ts +22 -0
  33. package/dist/chunks/mq-unread-count-sync-DTn9dfR4.d.ts +22 -0
  34. package/dist/chunks/mutation-controller-CR2qcqhH.js +1 -0
  35. package/dist/chunks/parseISO-Dj3qSTG8.js +1 -0
  36. package/dist/chunks/price-BmA2Dl9f.js +1 -0
  37. package/dist/chunks/professional-overview-CfjgnTw4.js +1 -0
  38. package/dist/chunks/{provide-CfT7g_Zi.js → provide-D2fnEhT2.js} +1 -1
  39. package/dist/chunks/query-Cjvi4_dT.js +1 -0
  40. package/dist/chunks/query-controller-BlO1Ax65.js +1 -0
  41. package/dist/chunks/{refund-cancel-policy-Bm5djPds.js → refund-cancel-policy-D_tUYPyv.js} +1 -1
  42. package/dist/chunks/schemas.d-5LR6aN9I.d.ts +134 -0
  43. package/dist/chunks/telemetry-client-Ca71sobH.js +1 -0
  44. package/dist/env.js +1 -1
  45. package/dist/i18n.js +1 -1
  46. package/dist/mq-apple-pay-checkout.js +1 -1
  47. package/dist/mq-appointment-checkout.js +1 -1
  48. package/dist/mq-appointment-documentation.d.ts +48 -0
  49. package/dist/mq-appointment-documentation.js +1 -0
  50. package/dist/mq-chat-room.js +1 -1
  51. package/dist/mq-checkout.js +1 -1
  52. package/dist/mq-documents.d.ts +46 -0
  53. package/dist/mq-documents.js +1 -0
  54. package/dist/mq-google-pay-checkout.js +1 -1
  55. package/dist/mq-immediate-videocall-checkout.js +1 -1
  56. package/dist/mq-my-appointments.d.ts +48 -178
  57. package/dist/mq-my-appointments.js +1 -1
  58. package/dist/mq-professional-presence-sync.d.ts +30 -0
  59. package/dist/mq-professional-presence-sync.js +1 -0
  60. package/dist/mq-query-client-provider.js +1 -1
  61. package/dist/mq-schedule-success.d.ts +9 -0
  62. package/dist/mq-schedule-success.js +2 -2
  63. package/dist/mq-schedule.d.ts +24 -12
  64. package/dist/mq-schedule.js +1 -1
  65. package/dist/mq-session-provider.d.ts +28 -0
  66. package/dist/mq-session-provider.js +1 -0
  67. package/dist/mq-socket-provider.js +1 -1
  68. package/dist/mq-support-chat.js +1 -1
  69. package/dist/mq-terms-and-conditions.d.ts +23 -0
  70. package/dist/mq-terms-and-conditions.js +1 -0
  71. package/dist/mq-unread-count-sync.d.ts +21 -0
  72. package/dist/mq-unread-count-sync.js +1 -0
  73. package/dist/mq-videocall.d.ts +35 -26
  74. package/dist/mq-videocall.js +1 -1
  75. package/dist/react/mq-apple-pay-checkout.d.ts +15 -0
  76. package/dist/react/mq-apple-pay-checkout.js +2 -0
  77. package/dist/react/mq-appointment-checkout.d.ts +17 -0
  78. package/dist/react/mq-appointment-checkout.js +2 -0
  79. package/dist/react/mq-appointment-documentation.d.ts +28 -0
  80. package/dist/react/mq-appointment-documentation.js +2 -0
  81. package/dist/react/mq-chat-room.d.ts +21 -0
  82. package/dist/react/mq-chat-room.js +2 -0
  83. package/dist/react/mq-checkout.d.ts +18 -0
  84. package/dist/react/mq-checkout.js +2 -0
  85. package/dist/react/mq-documents.d.ts +13 -0
  86. package/dist/react/mq-documents.js +2 -0
  87. package/dist/react/mq-google-pay-checkout.d.ts +15 -0
  88. package/dist/react/mq-google-pay-checkout.js +2 -0
  89. package/dist/react/mq-immediate-videocall-checkout.d.ts +16 -0
  90. package/dist/react/mq-immediate-videocall-checkout.js +2 -0
  91. package/dist/react/mq-my-appointments.d.ts +30 -0
  92. package/dist/react/mq-my-appointments.js +2 -0
  93. package/dist/react/mq-professional-presence-sync.d.ts +7 -0
  94. package/dist/react/mq-professional-presence-sync.js +2 -0
  95. package/dist/react/mq-query-client-provider.d.ts +8 -0
  96. package/dist/react/mq-query-client-provider.js +2 -0
  97. package/dist/react/mq-schedule-success.d.ts +29 -0
  98. package/dist/react/mq-schedule-success.js +2 -0
  99. package/dist/react/mq-schedule.d.ts +33 -0
  100. package/dist/react/mq-schedule.js +2 -0
  101. package/dist/react/mq-session-provider.d.ts +10 -0
  102. package/dist/react/mq-session-provider.js +2 -0
  103. package/dist/react/mq-socket-provider.d.ts +9 -0
  104. package/dist/react/mq-socket-provider.js +2 -0
  105. package/dist/react/mq-support-chat.d.ts +15 -0
  106. package/dist/react/mq-support-chat.js +2 -0
  107. package/dist/react/mq-terms-and-conditions.d.ts +14 -0
  108. package/dist/react/mq-terms-and-conditions.js +2 -0
  109. package/dist/react/mq-theme-provider.d.ts +8 -0
  110. package/dist/react/mq-theme-provider.js +2 -0
  111. package/dist/react/mq-toast-container.d.ts +8 -0
  112. package/dist/react/mq-toast-container.js +2 -0
  113. package/dist/react/mq-unread-count-sync.d.ts +7 -0
  114. package/dist/react/mq-unread-count-sync.js +2 -0
  115. package/dist/react/mq-videocall.d.ts +37 -0
  116. package/dist/react/mq-videocall.js +2 -0
  117. package/dist/toast.d.ts +3 -0
  118. package/dist/toast.js +1 -0
  119. package/dist/ui/mq-calendar.js +1 -1
  120. package/dist/ui/mq-clamped-text.js +1 -1
  121. package/dist/ui/mq-time-slot-picker.js +1 -1
  122. package/package.json +53 -4
  123. package/dist/chunks/api-chat-client-BTBtu01T.js +0 -1
  124. package/dist/chunks/chunk-S5RWG6G2-oTcdgk2H.js +0 -1
  125. package/dist/chunks/chunk-YTQUGGS3-DN-JZpgG.js +0 -1
  126. package/dist/chunks/context-provider-CiMFpvDA.js +0 -1
  127. package/dist/chunks/exports-XZaVrMLd.js +0 -1
  128. package/dist/chunks/external-zAbuzxDj.js +0 -1
  129. package/dist/chunks/get-patient-profile-query-C8T8DJ7z.js +0 -1
  130. package/dist/chunks/index-BYHKNPG2.js +0 -1
  131. package/dist/chunks/index-Bxh8Qfwr.js +0 -1
  132. package/dist/chunks/isBefore-Cof0D841.js +0 -1
  133. package/dist/chunks/mq-layout-DpzeL9_i.js +0 -1
  134. package/dist/chunks/mutation-controller-OVT8NEt6.js +0 -1
  135. package/dist/chunks/parseISO-jT42c8Ob.js +0 -1
  136. package/dist/chunks/price-Dtdjx70D.js +0 -1
  137. package/dist/chunks/query-QJ1INUTG.js +0 -1
  138. package/dist/chunks/telemetry-client-CKCb9Gnf.js +0 -1
@@ -2,7 +2,8 @@ export { A as AppointmentDetails } from './chunks/appointment-details-DpzdYLjq.j
2
2
  import * as lit_html from 'lit-html';
3
3
  import * as lit from 'lit';
4
4
  import { LitElement } from 'lit';
5
- import z, { z as z$1 } from 'zod';
5
+ import { L as LoginTokenResponse } from './chunks/schemas.d-5LR6aN9I.js';
6
+ import { z } from 'zod';
6
7
  import { MqTabsSelectEvent } from './ui/mq-tabs.js';
7
8
  import './ui/mq-card.js';
8
9
  export { P as ProfessionalOverview } from './chunks/professional-overview-mO3tuMuH.js';
@@ -19,152 +20,21 @@ import './ui/mq-text-button.js';
19
20
  import './ui/mq-avatar.js';
20
21
  import './ui/mq-skeleton.js';
21
22
 
22
- declare const LoginTokenResponseSchema: z.ZodObject<{
23
- access_token: z.ZodString;
24
- patient: z.ZodObject<{
25
- hash: z.ZodString;
26
- country_code: z.ZodString;
27
- timezone: z.ZodString;
28
- first_name: z.ZodString;
29
- last_name: z.ZodString;
30
- name: z.ZodString;
31
- birth_date: z.ZodString;
32
- email: z.ZodString;
33
- language_code: z.ZodString;
34
- phone: z.ZodString;
35
- phone_prefix: z.ZodString;
36
- tax_id: z.ZodString;
37
- legal_consent: z.ZodObject<{
38
- accepted_at: z.ZodNullable<z.ZodString>;
39
- last_version_at: z.ZodNullable<z.ZodString>;
40
- terms_url: z.ZodString;
41
- privacy_url: z.ZodString;
42
- has_commercial_communications: z.ZodBoolean;
43
- organization_name: z.ZodString;
44
- }, "strip", z.ZodTypeAny, {
45
- accepted_at: string | null;
46
- last_version_at: string | null;
47
- terms_url: string;
48
- privacy_url: string;
49
- has_commercial_communications: boolean;
50
- organization_name: string;
51
- }, {
52
- accepted_at: string | null;
53
- last_version_at: string | null;
54
- terms_url: string;
55
- privacy_url: string;
56
- has_commercial_communications: boolean;
57
- organization_name: string;
58
- }>;
59
- }, "strip", z.ZodTypeAny, {
60
- hash: string;
61
- name: string;
62
- country_code: string;
63
- timezone: string;
64
- first_name: string;
65
- last_name: string;
66
- birth_date: string;
67
- email: string;
68
- language_code: string;
69
- phone: string;
70
- phone_prefix: string;
71
- tax_id: string;
72
- legal_consent: {
73
- accepted_at: string | null;
74
- last_version_at: string | null;
75
- terms_url: string;
76
- privacy_url: string;
77
- has_commercial_communications: boolean;
78
- organization_name: string;
79
- };
80
- }, {
81
- hash: string;
82
- name: string;
83
- country_code: string;
84
- timezone: string;
85
- first_name: string;
86
- last_name: string;
87
- birth_date: string;
88
- email: string;
89
- language_code: string;
90
- phone: string;
91
- phone_prefix: string;
92
- tax_id: string;
93
- legal_consent: {
94
- accepted_at: string | null;
95
- last_version_at: string | null;
96
- terms_url: string;
97
- privacy_url: string;
98
- has_commercial_communications: boolean;
99
- organization_name: string;
100
- };
101
- }>;
102
- }, "strip", z.ZodTypeAny, {
103
- patient: {
104
- hash: string;
105
- name: string;
106
- country_code: string;
107
- timezone: string;
108
- first_name: string;
109
- last_name: string;
110
- birth_date: string;
111
- email: string;
112
- language_code: string;
113
- phone: string;
114
- phone_prefix: string;
115
- tax_id: string;
116
- legal_consent: {
117
- accepted_at: string | null;
118
- last_version_at: string | null;
119
- terms_url: string;
120
- privacy_url: string;
121
- has_commercial_communications: boolean;
122
- organization_name: string;
123
- };
124
- };
125
- access_token: string;
126
- }, {
127
- patient: {
128
- hash: string;
129
- name: string;
130
- country_code: string;
131
- timezone: string;
132
- first_name: string;
133
- last_name: string;
134
- birth_date: string;
135
- email: string;
136
- language_code: string;
137
- phone: string;
138
- phone_prefix: string;
139
- tax_id: string;
140
- legal_consent: {
141
- accepted_at: string | null;
142
- last_version_at: string | null;
143
- terms_url: string;
144
- privacy_url: string;
145
- has_commercial_communications: boolean;
146
- organization_name: string;
147
- };
148
- };
149
- access_token: string;
150
- }>;
151
- type LoginTokenResponse = z.infer<typeof LoginTokenResponseSchema>;
152
-
153
- declare const MqMyAppointmentsTabsSchema: z$1.ZodEnum<["next", "history"]>;
154
- type MqMyAppointmentsTabs = z$1.infer<typeof MqMyAppointmentsTabsSchema>;
23
+ declare const MqMyAppointmentsTabsSchema: z.ZodEnum<["next", "history"]>;
24
+ type MqMyAppointmentsTabs = z.infer<typeof MqMyAppointmentsTabsSchema>;
155
25
 
156
- declare const GetAppointmentsResponseSchema: z$1.ZodObject<{
157
- data: z$1.ZodArray<z$1.ZodObject<{
158
- appointment: z$1.ZodObject<{
159
- id: z$1.ZodString;
160
- url: z$1.ZodString;
161
- starts_at: z$1.ZodString;
162
- duration: z$1.ZodNumber;
163
- status: z$1.ZodEnum<["pending", "expired", "accepted", "inCall", "declined", "cancelled", "finished", "free_of_charge", "owed", "unpaid", "reporting"]>;
164
- channel: z$1.ZodEnum<["videocall", "chat", "phonecall"]>;
165
- expires_at: z$1.ZodNullable<z$1.ZodString>;
166
- service_id: z$1.ZodNullable<z$1.ZodString>;
167
- }, "strip", z$1.ZodTypeAny, {
26
+ declare const GetAppointmentsResponseSchema: z.ZodObject<{
27
+ data: z.ZodArray<z.ZodObject<{
28
+ appointment: z.ZodObject<{
29
+ id: z.ZodString;
30
+ url: z.ZodString;
31
+ starts_at: z.ZodString;
32
+ duration: z.ZodNumber;
33
+ status: z.ZodEnum<["pending", "expired", "accepted", "inCall", "declined", "cancelled", "finished", "free_of_charge", "owed", "unpaid", "reporting"]>;
34
+ channel: z.ZodEnum<["videocall", "chat", "phonecall"]>;
35
+ expires_at: z.ZodNullable<z.ZodString>;
36
+ service_id: z.ZodNullable<z.ZodString>;
37
+ }, "strip", z.ZodTypeAny, {
168
38
  url: string;
169
39
  status: "pending" | "expired" | "accepted" | "inCall" | "declined" | "cancelled" | "finished" | "free_of_charge" | "owed" | "unpaid" | "reporting";
170
40
  id: string;
@@ -183,39 +53,39 @@ declare const GetAppointmentsResponseSchema: z$1.ZodObject<{
183
53
  service_id: string | null;
184
54
  starts_at: string;
185
55
  }>;
186
- room: z$1.ZodObject<{
187
- id: z$1.ZodNumber;
188
- }, "strip", z$1.ZodTypeAny, {
56
+ room: z.ZodObject<{
57
+ id: z.ZodNumber;
58
+ }, "strip", z.ZodTypeAny, {
189
59
  id: number;
190
60
  }, {
191
61
  id: number;
192
62
  }>;
193
- price: z$1.ZodNullable<z$1.ZodObject<{
194
- amount: z$1.ZodNumber;
195
- currency: z$1.ZodString;
196
- }, "strip", z$1.ZodTypeAny, {
63
+ price: z.ZodNullable<z.ZodObject<{
64
+ amount: z.ZodNumber;
65
+ currency: z.ZodString;
66
+ }, "strip", z.ZodTypeAny, {
197
67
  currency: string;
198
68
  amount: number;
199
69
  }, {
200
70
  currency: string;
201
71
  amount: number;
202
72
  }>>;
203
- patient: z$1.ZodObject<{
204
- hash: z$1.ZodString;
205
- }, "strip", z$1.ZodTypeAny, {
73
+ patient: z.ZodObject<{
74
+ hash: z.ZodString;
75
+ }, "strip", z.ZodTypeAny, {
206
76
  hash: string;
207
77
  }, {
208
78
  hash: string;
209
79
  }>;
210
- slots: z$1.ZodArray<z$1.ZodAny, "many">;
211
- professional: z$1.ZodObject<{
212
- hash: z$1.ZodString;
213
- name: z$1.ZodString;
214
- avatar: z$1.ZodOptional<z$1.ZodString>;
215
- description: z$1.ZodOptional<z$1.ZodString>;
216
- languages: z$1.ZodArray<z$1.ZodString, "many">;
217
- collegiate_number: z$1.ZodOptional<z$1.ZodString>;
218
- }, "strip", z$1.ZodTypeAny, {
80
+ slots: z.ZodArray<z.ZodAny, "many">;
81
+ professional: z.ZodObject<{
82
+ hash: z.ZodString;
83
+ name: z.ZodString;
84
+ avatar: z.ZodOptional<z.ZodString>;
85
+ description: z.ZodOptional<z.ZodString>;
86
+ languages: z.ZodArray<z.ZodString, "many">;
87
+ collegiate_number: z.ZodOptional<z.ZodString>;
88
+ }, "strip", z.ZodTypeAny, {
219
89
  hash: string;
220
90
  name: string;
221
91
  languages: string[];
@@ -230,17 +100,17 @@ declare const GetAppointmentsResponseSchema: z$1.ZodObject<{
230
100
  collegiate_number?: string | undefined;
231
101
  description?: string | undefined;
232
102
  }>;
233
- speciality: z$1.ZodObject<{
234
- id: z$1.ZodNumber;
235
- name: z$1.ZodString;
236
- }, "strip", z$1.ZodTypeAny, {
103
+ speciality: z.ZodObject<{
104
+ id: z.ZodNumber;
105
+ name: z.ZodString;
106
+ }, "strip", z.ZodTypeAny, {
237
107
  id: number;
238
108
  name: string;
239
109
  }, {
240
110
  id: number;
241
111
  name: string;
242
112
  }>;
243
- }, "strip", z$1.ZodTypeAny, {
113
+ }, "strip", z.ZodTypeAny, {
244
114
  speciality: {
245
115
  id: number;
246
116
  name: string;
@@ -309,12 +179,12 @@ declare const GetAppointmentsResponseSchema: z$1.ZodObject<{
309
179
  description?: string | undefined;
310
180
  };
311
181
  }>, "many">;
312
- meta: z$1.ZodObject<{
313
- current_page: z$1.ZodNumber;
314
- last_page: z$1.ZodNumber;
315
- per_page: z$1.ZodNumber;
316
- total: z$1.ZodNumber;
317
- }, "strip", z$1.ZodTypeAny, {
182
+ meta: z.ZodObject<{
183
+ current_page: z.ZodNumber;
184
+ last_page: z.ZodNumber;
185
+ per_page: z.ZodNumber;
186
+ total: z.ZodNumber;
187
+ }, "strip", z.ZodTypeAny, {
318
188
  current_page: number;
319
189
  last_page: number;
320
190
  per_page: number;
@@ -325,7 +195,7 @@ declare const GetAppointmentsResponseSchema: z$1.ZodObject<{
325
195
  per_page: number;
326
196
  total: number;
327
197
  }>;
328
- }, "strip", z$1.ZodTypeAny, {
198
+ }, "strip", z.ZodTypeAny, {
329
199
  data: {
330
200
  speciality: {
331
201
  id: number;
@@ -410,7 +280,7 @@ declare const GetAppointmentsResponseSchema: z$1.ZodObject<{
410
280
  total: number;
411
281
  };
412
282
  }>;
413
- type GetAppointmentsResponse = z$1.infer<typeof GetAppointmentsResponseSchema>;
283
+ type GetAppointmentsResponse = z.infer<typeof GetAppointmentsResponseSchema>;
414
284
 
415
285
  declare class CancelAppointmentConfirmationDialog extends LitElement {
416
286
  static styles: lit.CSSResult;
@@ -1 +1 @@
1
- import{h as t,f as e}from"./chunks/price-Dtdjx70D.js";export{A as AppointmentDetails}from"./chunks/price-Dtdjx70D.js";import{_ as i,t as n}from"./chunks/custom-element-DA9Fxvxd.js";import{M as a,c as o,Q as s}from"./chunks/mutation-controller-OVT8NEt6.js";import{m as r,s as p}from"./chunks/runtime-Bg1WXVCx.js";import{l}from"./chunks/parseISO-jT42c8Ob.js";import{l as c}from"./chunks/chunk-S5RWG6G2-oTcdgk2H.js";import{a as d,i as m,x as h,E as u}from"./chunks/lit-element-DiWJYFwC.js";import{n as v}from"./chunks/property-scuRaFcM.js";import{e as g}from"./chunks/external-zAbuzxDj.js";import{MqAppointmentRescheduleEvent as f,MqAppointmentBookEvent as b,MqAppointmentJoinVideocallEvent as y,MqAppointmentViewDocumentationEvent as x,MqHomeEvent as $}from"./events.js";import"./ui/mq-tabs.js";import{a as k,A as q,d as w,e as C}from"./chunks/api-chat-client-BTBtu01T.js";import{g as j}from"./chunks/get-organization-setup-query-BMbuRi6v.js";import{t as H,h as V,i as S,j as M,k as R,l as E,g as z,c as D,m as I}from"./chunks/telemetry-client-CKCb9Gnf.js";export{P as ProfessionalOverview}from"./chunks/telemetry-client-CKCb9Gnf.js";import{g as O,c as N}from"./chunks/refund-cancel-policy-Bm5djPds.js";import{a as _}from"./chunks/exports-XZaVrMLd.js";import{r as U}from"./chunks/state-LQivXIgA.js";import{getLocale as Q}from"./i18n.js";import"./ui/mq-card.js";import"./ui/mq-floating-bubble.js";import{Q as T}from"./chunks/query-QJ1INUTG.js";import"./ui/mq-button.js";import"./ui/mq-dialog.js";import{e as B}from"./chunks/class-map-Co76I6aw.js";import{messageBubbleIcon as Z}from"./ui/icons/message-bubble-icon.js";import{videoIcon as L}from"./ui/icons/video-icon.js";import"./ui/mq-unread-badge.js";import{toast as G}from"./ui/mq-toast.js";import"./ui/back-link.js";import"./ui/icons/briefcase-icon.js";import"./ui/icons/types.js";import"./ui/icons/calendar-icon.js";import"./ui/icons/clock-icon.js";import"./ui/icons/phone-icon.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/context-provider-CiMFpvDA.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";import"./env.js";import"./ui/icons/chevron-down-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/mq-text-button.js";import"./chunks/directive-2EDmOukv.js";import"./ui/mq-avatar.js";import"./chunks/provide-CfT7g_Zi.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./ui/icons/check-double-icon.js";import"./ui/icons/check-icon.js";import"./chunks/chunk-YTQUGGS3-DN-JZpgG.js";const F=g(["next","history"]).enum;class MqMyAppointmentsSelectEvent extends Event{static{this.eventName="ontabchange"}constructor(t){super(MqMyAppointmentsSelectEvent.eventName,{bubbles:!0,composed:!0}),this.value=t}}let W=class CancelAppointmentConfirmationDialog extends d{constructor(){super(...arguments),this.open=!1,this.cancelAppointmentMutation=new a(this,{mutationFn:async t=>k.appointments.cancelAppointment(t),onSuccess:()=>{this.queryClientContext?.invalidateQueries(),this.dispatchEvent(new CustomEvent("success",{bubbles:!0,composed:!0}))}}),this.handleClose=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))},this.handleDismissClick=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))},this.handleConfirmClick=()=>{this.cancelAppointmentMutation.run({id:this.appointmentId})}}static{this.styles=m`:host{display:contents}h2{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0}p{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);margin:0}.subheading-payable{font-size:var(--text-base);line-height:22px}.price-rows{display:flex;flex-direction:column;font-family:var(--font-body);font-size:var(--text-sm);font-weight:var(--font-weight-medium);line-height:var(--text-sm--line-height);color:var(--color-card-foreground);width:100%;margin-bottom:var(--sp-4)}.price-row{display:flex;align-items:center;justify-content:space-between;min-height:34px;gap:var(--sp-2)}.price-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-4);justify-content:flex-end;flex-wrap:wrap}`}render(){const i=Q(),n=this.price,a=t(n),o=this.cancelAppointmentMutation.isPending;if(a){const t=e(n,i),a=`-${t}`;return h`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${r("Confirmar cancelación")}</h2><p slot="subheading" class="subheading-payable">${r("¿Seguro que quieres cancelar esta cita? Se te devolverá el importe pagado en un plazo de 5-10 días hábiles.")}</p><div><div class="price-rows"><div class="price-row"><span>${r("Importe pagado")}</span> <span>${t}</span></div><div class="price-row"><span>${r("Importe a devolver")}</span> <span>${a}</span></div></div><div class="actions"><mq-button variant="outline" ?disabled="${o}" @click="${this.handleDismissClick}">${r("Volver")}</mq-button><mq-button variant="primary" ?disabled="${o}" @click="${this.handleConfirmClick}">${r("Confirmar")}</mq-button></div></div></mq-dialog>`}return h`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${r("Confirmar cancelación")}</h2><p slot="subheading">${r("¿Seguro que quieres cancelar esta cita?")}</p><div><div class="actions"><mq-button variant="outline" ?disabled="${o}" @click="${this.handleDismissClick}">${r("Cancelar")}</mq-button><mq-button variant="primary" ?disabled="${o}" @click="${this.handleConfirmClick}">${r("Confirmar")}</mq-button></div></div></mq-dialog>`}};i([v({type:Boolean,reflect:!0})],W.prototype,"open",void 0),i([o({context:T,subscribe:!0})],W.prototype,"queryClientContext",void 0),i([v({type:String})],W.prototype,"appointmentId",void 0),i([v({type:Object})],W.prototype,"price",void 0),W=i([l(),n("cancel-appointment-confirmation-dialog")],W);let K=class AppointmentActionUnavailableDialog extends d{constructor(){super(...arguments),this.open=!1,this.heading="",this.message="",this.handleClose=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}}static{this.styles=m`:host{display:contents}mq-dialog::part(dialog){max-width:343px;min-width:0}h2{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0}p{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);margin:0}.actions{display:flex;margin-top:var(--sp-4)}`}render(){return h`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${this.heading}</h2><p slot="subheading">${this.message}</p><div class="actions"><mq-button variant="primary" fullwidth @click="${this.handleClose}">${r("Volver")}</mq-button></div></mq-dialog>`}};i([v({type:Boolean,reflect:!0})],K.prototype,"open",void 0),i([v({type:String})],K.prototype,"heading",void 0),i([v({type:String})],K.prototype,"message",void 0),K=i([l(),n("appointment-action-unavailable-dialog")],K);let Y=class AppointmentCardActions extends d{constructor(){super(...arguments),this.variant="next",this.isVideocall=!1,this.hasChatSupport=!1,this.unreadCount=0,this.isModifyUnavailable=!1,this.isCancelUnavailable=!1,this.hasNoSlots=!1,this.modifyUnavailableMessage="",this.cancelUnavailableMessage="",this.repeatTarget=null,this.professionalHash="",this.openDialog=null,this.handleModifyClick=()=>{this.isModifyUnavailable?this.openDialog="modify":(H.track(V(this.patientHash,this.appointmentId)),this.dispatchEvent(new f({appointmentId:this.appointmentId})))},this.handleCancelClick=()=>{this.isCancelUnavailable?this.openDialog="cancel":(H.track(S(this.patientHash,this.appointmentId)),this.dispatchEvent(new CustomEvent("request-cancel",{bubbles:!0,composed:!0})))},this.handleRepeatClick=()=>{this.hasNoSlots?this.openDialog="repeat-no-slots":this.repeatTarget?(H.track(M(this.patientHash,this.appointmentId)),this.dispatchEvent(new b({specialty:this.repeatTarget.specialty,service:this.repeatTarget.service,professional:this.professionalHash}))):this.openDialog="repeat-error"},this.handleDialogClose=()=>{this.openDialog=null}}static{this.styles=m`:host{display:contents}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-2)}.actions.next{flex-direction:column}.actions-secondary{display:flex;gap:var(--sp-3)}.actions mq-button{flex:1}`}get patientHash(){return this.loginToken.patient.hash}renderChatButton(){return h`<mq-button variant="primary" fullwidth noPadding @click="${()=>{this.dispatchEvent(new CustomEvent("toggle-chat",{bubbles:!0,composed:!0}))}}">${Z({size:24})} ${r("Chat")} ${this.unreadCount>0?h`<mq-unread-badge></mq-unread-badge>`:u}</mq-button>`}renderNextActions(){return h`${this.isVideocall?h`<mq-button variant="outline" fullwidth noPadding @click="${()=>{H.track(R(this.patientHash,this.appointmentId)),this.dispatchEvent(new y({appointmentId:this.appointmentId}))}}">${L({size:24})} ${r("Ir a videollamada")}</mq-button>`:u}<div class="actions-secondary">${this.hasChatSupport?this.renderChatButton():u}<mq-button variant="outline" fullwidth noPadding @click="${this.handleModifyClick}">${r("Modificar")}</mq-button><mq-button variant="outline-negative" fullwidth noPadding @click="${this.handleCancelClick}">${r("Cancelar")}</mq-button></div>`}renderHistoryActions(){return h`${this.hasChatSupport?this.renderChatButton():u}<mq-button variant="outline" fullwidth noPadding @click="${()=>{H.track(E(this.patientHash,this.appointmentId)),this.dispatchEvent(new x({appointmentId:this.appointmentId}))}}">${r("Documentos")}</mq-button><mq-button variant="outline" fullwidth noPadding @click="${this.handleRepeatClick}">${r("Repetir")}</mq-button>`}render(){return h`<div class="${B({actions:!0,next:"next"===this.variant})}">${"next"===this.variant?this.renderNextActions():this.renderHistoryActions()}</div><appointment-action-unavailable-dialog .open="${"modify"===this.openDialog}" .heading="${r("Modificar cita")}" .message="${this.modifyUnavailableMessage}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"cancel"===this.openDialog}" .heading="${r("Anular cita")}" .message="${this.cancelUnavailableMessage}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"repeat-no-slots"===this.openDialog}" .heading="${r("Repetir cita")}" .message="${r("Este profesional no tiene horarios disponibles")}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"repeat-error"===this.openDialog}" .heading="${r("Repetir cita")}" .message="${r("Lo sentimos, no hemos podido repetir tu cita. Por favor, contacta con soporte.")}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog>`}};function J(t){const{action:e,refundPolicySeconds:i}=t,n=null!=i&&i<3600,a=Math.ceil((i??0)/60),o=Math.ceil((i??0)/3600);return r(0===(n?a:o)?"modify"===e?"Esta cita ya ha pasado, por lo que no se puede modificar.":"Esta cita ya ha pasado, por lo que no se puede anular.":"modify"===e?n?p`Lo sentimos, como faltan menos de ${a} minutos para tu cita no podemos modificarla.`:p`Lo sentimos, como faltan menos de ${o} horas para tu cita no podemos modificarla.`:n?p`Lo sentimos, como faltan menos de ${a} minutos para tu cita no podemos anularla.`:p`Lo sentimos, como faltan menos de ${o} horas para tu cita no podemos anularla.`)}i([o({context:c})],Y.prototype,"loginToken",void 0),i([v({type:String})],Y.prototype,"variant",void 0),i([v({type:String})],Y.prototype,"appointmentId",void 0),i([v({type:Boolean})],Y.prototype,"isVideocall",void 0),i([v({type:Boolean})],Y.prototype,"hasChatSupport",void 0),i([v({type:Number})],Y.prototype,"unreadCount",void 0),i([v({type:Boolean})],Y.prototype,"isModifyUnavailable",void 0),i([v({type:Boolean})],Y.prototype,"isCancelUnavailable",void 0),i([v({type:Boolean})],Y.prototype,"hasNoSlots",void 0),i([v({type:String})],Y.prototype,"modifyUnavailableMessage",void 0),i([v({type:String})],Y.prototype,"cancelUnavailableMessage",void 0),i([v({type:Object})],Y.prototype,"repeatTarget",void 0),i([v({type:String})],Y.prototype,"professionalHash",void 0),i([U()],Y.prototype,"openDialog",void 0),Y=i([l(),n("appointment-card-actions")],Y);let X=class AppointmentCard extends d{constructor(){super(...arguments),this.variant="next",this.detailsVariant="wide",this.isChatOpen=!1,this.isCancelDialogOpen=!1,this.unreadQuery=new s(this,()=>_(k,{roomId:this.appointmentResource?.room?.id})),this.getOrganizationSpecialtiesQuery=new s(this,()=>z(k,{enabled:!!this.appointmentResource?.speciality?.id})),this.getOrganizationSetupQuery=new s(this,()=>j(k)),this.getScheduleServicesQuery=new s(this,()=>O(k))}static{this.styles=m`:host{display:flex}.card{width:100%;padding:var(--sp-6);display:flex;flex-direction:column;gap:var(--sp-4);justify-content:space-between}.card-top-content{display:flex;flex-direction:column;gap:var(--sp-6)}.see-details{color:var(--color-primary-link-default);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-bold)}.see-details:hover{text-decoration:underline}.chevron-down{width:16px;height:16px;transition:transform .2s ease}.appointment-details{display:flex;flex-direction:column;gap:12px}.clock-icon-wrapper{width:24px;height:24px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.clock-icon-wrapper svg{width:100%;height:100%}.appointment-type{display:flex;align-items:center;gap:12px;font-size:18px;color:#2c3e50}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-2)}.actions.next{flex-direction:column}.actions-secondary{display:flex;gap:var(--sp-3)}.actions mq-button{flex:1}`}render(){const t=this.appointmentResource.appointment.channel===q.videocall,e=this.appointmentResource.appointment.channel===q.phonecall,i=!0===this.getOrganizationSetupQuery.result?.data?.appointments?.has_chat_in_appointment,n=(t||e)&&i,a=Q(),o=w(this.appointmentResource.appointment.expires_at),s=0===this.appointmentResource.slots.length,p=this.getOrganizationSetupQuery.result?.data?.appointments?.seconds_before_start_to_refund_on_cancel,l=N({startsAtIso:this.appointmentResource.appointment.starts_at,refundPolicySeconds:p}),c=o||s||!l,d=o||!l,m=J({action:"modify",refundPolicySeconds:p}),v=J({action:"cancel",refundPolicySeconds:p}),g=this.getOrganizationSpecialtiesQuery.result?.data?.find(t=>Number(t.id)===Number(this.appointmentResource.speciality.id)),f=D(g?.code??"",a,g?.name??this.appointmentResource.speciality.name),b=this.getScheduleServicesQuery.result?.data?.find(t=>t.id===this.appointmentResource.appointment.service_id)?.code,y=g?.code&&b?{specialty:g.code,service:b}:null;return h`<mq-card class="card" roundness="md"><div class="card-top-content"><professional-overview .specialtyName="${f??""}" .collegiateNumber="${this.appointmentResource.professional.collegiate_number??void 0}" .description="${this.appointmentResource.professional.description??""}" .languages="${this.appointmentResource.professional.languages}" .avatar="${this.appointmentResource.professional.avatar??""}" .name="${this.appointmentResource.professional.name}"></professional-overview><appointment-details .startsAt="${this.appointmentResource.appointment.starts_at}" .duration="${this.appointmentResource.appointment.duration}" .channel="${this.appointmentResource.appointment.channel}" .timezone="${this.loginToken?.patient?.timezone}" variant="${this.detailsVariant}"></appointment-details></div><appointment-card-actions .variant="${this.variant}" .appointmentId="${this.appointmentResource.appointment.id??""}" .isVideocall="${t}" .hasChatSupport="${n}" .unreadCount="${this.unreadQuery.result?.data?.unread_count??0}" .isModifyUnavailable="${c}" .isCancelUnavailable="${d}" .hasNoSlots="${s}" .modifyUnavailableMessage="${m}" .cancelUnavailableMessage="${v}" .repeatTarget="${y}" .professionalHash="${this.appointmentResource.professional.hash}" @toggle-chat="${()=>{this.isChatOpen=!this.isChatOpen,this.isChatOpen&&H.track(I(this.loginToken.patient.hash,this.appointmentResource.appointment.id??""))}}" @request-cancel="${()=>{this.isCancelDialogOpen=!0}}"></appointment-card-actions><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" @mq-close="${()=>{this.isChatOpen=!1}}" hideCloseButton>${this.isChatOpen?h`<mq-chat-room slot="content" .consultationId="${this.appointmentResource.appointment.id}" consultation-type="appointment" token="${this.loginToken.access_token}" .roomId="${this.appointmentResource.room.id}" .professionalHash="${this.appointmentResource.professional.hash}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}" ?readonly="${o}"></mq-chat-room>`:u}</mq-floating-bubble><cancel-appointment-confirmation-dialog .appointmentId="${this.appointmentResource.appointment.id}" .price="${this.appointmentResource.price??void 0}" .open="${this.isCancelDialogOpen}" @cancel="${()=>{this.isCancelDialogOpen=!1}}" @success="${()=>{this.isCancelDialogOpen=!1,G.success(r("Consulta anulada correctamente")),this.dispatchEvent(new CustomEvent("appointment-cancel-confirmed",{bubbles:!0,composed:!0,detail:{id:this.appointmentResource.appointment.id}}))}}"></cancel-appointment-confirmation-dialog></mq-card>`}};i([v({type:Object})],X.prototype,"appointmentResource",void 0),i([v({type:Number})],X.prototype,"specialtyId",void 0),i([v({type:String})],X.prototype,"variant",void 0),i([v({type:String})],X.prototype,"detailsVariant",void 0),i([o({context:c})],X.prototype,"loginToken",void 0),i([U()],X.prototype,"isChatOpen",void 0),i([U()],X.prototype,"isCancelDialogOpen",void 0),X=i([l(),n("appointment-card")],X);let tt=class AppointmentCardSkeleton extends d{static{this.styles=m`div{border-radius:var(--border-radius-md);background:color-mix(in srgb,var(--color-neutrals-background-disabled) 50%,#fff 50%);height:337px;width:100%}`}render(){return h`<div></div>`}};tt=i([n("appointment-card-skeleton")],tt);let et=class EmptyState extends d{static{this.styles=m`.container{border-radius:var(--border-radius-md);background-color:var(--color-neutrals-background-weak);padding:var(--sp-10) var(--sp-6)}.card{border-radius:var(--border-radius-md);max-width:512px;margin:0 auto;background-color:var(--color-neutrals-background-extraWeak);padding:var(--sp-6);display:flex;flex-direction:column;align-items:center;gap:var(--sp-3)}.card>*{max-width:323px;margin:0 auto}.title{font-family:var(--font-body);font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutrals-text-default);margin:0}.description{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-normal);text-align:center;color:var(--color-neutrals-text-default);margin:0}@media (min-width:768px){.container{padding:var(--sp-6)}mq-button{max-width:323px}}`}handleRequestAppointment(){this.dispatchEvent(new CustomEvent("request-appointment",{bubbles:!0,composed:!0}))}render(){return h`<div class="container"><div class="card">${function({color:t="currentColor"}){return h`<svg width="31" height="32" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M29.6 2.4H23.2V0H21.6V2.4H18.4V0H16.8V2.4H13.6V0H12V2.4H8.8V0H7.2V2.4H0.8C0.587827 2.4 0.384344 2.48429 0.234315 2.63431C0.0842855 2.78434 0 2.98783 0 3.2V31.2C0 31.4122 0.0842855 31.6157 0.234315 31.7657C0.384344 31.9157 0.587827 32 0.8 32H29.6C29.8122 32 30.0157 31.9157 30.1657 31.7657C30.3157 31.6157 30.4 31.4122 30.4 31.2V3.2C30.4 2.98783 30.3157 2.78434 30.1657 2.63431C30.0157 2.48429 29.8122 2.4 29.6 2.4ZM28.8 30.4H1.6V10.4H27.2V8.8H1.6V4H7.2V7.2H8.8V4H12V7.2H13.6V4H16.8V7.2H18.4V4H21.6V7.2H23.2V4H28.8V30.4ZM3.2 19.2H9.6V12.8H3.2V19.2ZM4.8 14.4H8V17.6H4.8V14.4ZM20.8 19.2H27.2V12.8H20.8V19.2ZM22.4 14.4H25.6V17.6H22.4V14.4ZM12 19.2H18.4V12.8H12V19.2ZM13.6 14.4H16.8V17.6H13.6V14.4ZM3.2 28H9.6V21.6H3.2V28ZM4.8 23.2H8V26.4H4.8V23.2ZM20.8 28H27.2V21.6H20.8V28ZM22.4 23.2H25.6V26.4H22.4V23.2ZM12 28H18.4V21.6H12V28ZM13.6 23.2H16.8V26.4H13.6V23.2Z" fill="${t}"/></svg>`}({color:"var(--color-primary)"})}<p class="title">${this.title}</p><p class="description">${this.description}</p><mq-button variant="primary" size="md" fullwidth @click="${this.handleRequestAppointment}">${r("Pedir cita")}</mq-button></div></div>`}};function it(t,e){return{queryKey:["appointments",e],queryFn:()=>t.appointments.getAppointments(e)}}i([v({type:String})],et.prototype,"title",void 0),i([v({type:String})],et.prototype,"description",void 0),et=i([n("empty-state")],et);const nt=[C.pending,C.accepted],at=m`.appointments-list{display:grid;grid-template-columns:1fr;gap:var(--sp-6);margin-bottom:var(--sp-6)}@media (min-width:768px){.appointments-list{grid-template-columns:repeat(2,1fr)}}`;let ot=class NextAppointmentsTab extends d{constructor(){super(...arguments),this.getAppointmentsQuery=new s(this,()=>it(k,{status:nt,order:{field:"starts_at",direction:"asc"}}))}static{this.styles=at}render(){return this.getAppointmentsQuery.render({complete:t=>h`${t.data.length>0?h`<div class="appointments-list">${t.data.map(t=>h`<appointment-card .appointmentResource="${t}" .specialtyId="${t.speciality?.id}"></appointment-card>`)}</div>`:h`<empty-state title="${r("No tienes próximas citas")}" description="${r("Agenda una consulta médica cuando la necesites. Aquí verás todos los detalles y podrás gestionar tus próximas citas.")}"></empty-state>`}`,pending:()=>h`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};ot=i([l(),n("next-appointments-tab")],ot);const st=[C.finished,C.reporting];let rt=class AppointmentsHistoryTab extends d{constructor(){super(...arguments),this.getAppointmentsQuery=new s(this,()=>it(k,{status:st,order:{field:"starts_at",direction:"desc"}}))}static{this.styles=m`.appointments-list{display:grid;grid-template-columns:1fr;gap:var(--sp-6);margin-bottom:var(--sp-6)}@media (min-width:768px){.appointments-list{grid-template-columns:repeat(2,1fr)}}`}render(){return this.getAppointmentsQuery.render({complete:t=>h`${t.data.length>0?h`<div class="appointments-list">${t.data.map(t=>h`<appointment-card .appointmentResource="${t}" .specialtyId="${t.speciality?.id}" variant="history"></appointment-card>`)}</div>`:h`<empty-state title="${r("No tienes citas en el historial")}" description="${r("Aquí verás todas las citas que has tenido. Puedes acceder a los documentos de cada consulta y reagendar una cita si es necesario.")}"></empty-state>`}`,pending:()=>h`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};rt=i([l(),n("appointments-history-tab")],rt);const pt=m`.container{display:flex;flex-direction:column;gap:var(--size-3)}h1{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutral-link-dark);margin:0}p{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutral-link-dark);margin:0}.user-info{display:flex;align-items:center;justify-content:space-between}@media (min-width:768px){h1{font-size:var(--text-3xl);line-height:var(--text-3xl--line-height)}mq-tabs-list{max-width:435px}}`;let lt=class MqMyAppointments extends d{constructor(){super(...arguments),this.tab=F.next}static{this.styles=pt}handleSelect(t){this.dispatchEvent(new MqMyAppointmentsSelectEvent(t.value))}render(){return h`<div class="container"><back-link @mq-back="${t=>{t.stopPropagation(),this.dispatchEvent(new $)}}">${r("Volver al inicio")}</back-link><h1>${r("Mis citas")}</h1><div class="user-info"><p>${r(p`Para: ${this.loginToken.patient.name}`)}</p></div><mq-tabs .value="${this.tab}" @onvaluechange="${this.handleSelect}"><mq-tabs-list><mq-tabs-trigger value="${F.next}">${r("Próximas citas")}</mq-tabs-trigger><mq-tabs-trigger value="${F.history}">${r("Histórico")}</mq-tabs-trigger></mq-tabs-list><mq-tabs-content value="${F.next}"><next-appointments-tab></next-appointments-tab></mq-tabs-content><mq-tabs-content value="${F.history}"><appointments-history-tab></appointments-history-tab></mq-tabs-content></mq-tabs></div>`}};i([o({context:c})],lt.prototype,"loginToken",void 0),i([v({type:String,reflect:!0})],lt.prototype,"tab",void 0),lt=i([l(),n("mq-my-appointments")],lt);const ct=m`:host{display:block}.request-appointment-cta{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:var(--sp-12) var(--sp-4);background:var(--color-card);gap:var(--sp-4)}.title-body{display:flex;flex-direction:column;gap:var(--sp-2);flex:1}.title{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutrals-text-default);margin:0;text-align:center}.subtitle{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default);margin:0;display:none}mq-button{width:100%}.button-text-desktop{display:none}.button-text-mobile{display:inline}@media (min-width:768px){.request-appointment-cta{flex-direction:row;padding:var(--sp-12) var(--sp-20);gap:var(--sp-2)}.title-body{align-items:flex-start;flex:1;max-width:843px}.title{font-size:var(--text-3xl);line-height:var(--text-3xl--line-height);font-weight:var(--font-weight-extrabold);text-align:left}.subtitle{display:block}mq-button{width:auto;flex-shrink:0;--button-height-md:var(--button-height-lg);--text-sm:var(--text-base);--text-sm--line-height:var(--text-base--line-height)}.button-text-desktop{display:inline}.button-text-mobile{display:none}}`;class RequestAppointmentEvent extends Event{static{this.eventName="request-appointment"}constructor(){super(RequestAppointmentEvent.eventName,{bubbles:!0,composed:!0})}}let dt=class RequestAppointmentCta extends d{static{this.styles=ct}handleRequestAppointment(){this.dispatchEvent(new RequestAppointmentEvent)}render(){return h`<div class="request-appointment-cta"><div class="title-body"><h2 class="title">${r("Nueva cita de especialidades digitales")}</h2><p class="subtitle">${r("Realiza la búsqueda en tu cuadro médico digital")}</p></div><mq-button variant="primary" size="md" fullwidth @click="${this.handleRequestAppointment}"><span class="button-text-mobile">${r("Pedir cita")}</span> <span class="button-text-desktop">${r("Pedir una nueva cita")}</span></mq-button></div>`}};dt=i([l(),n("request-appointment-cta")],dt);export{lt as MqMyAppointments,MqMyAppointmentsSelectEvent,dt as RequestAppointmentCta,RequestAppointmentEvent};
1
+ import{h as t,f as e}from"./chunks/price-BmA2Dl9f.js";export{A as AppointmentDetails}from"./chunks/price-BmA2Dl9f.js";import{_ as i,t as n}from"./chunks/custom-element-DA9Fxvxd.js";import{c as a}from"./chunks/consume-CovVqBjI.js";import{m as o,s}from"./chunks/runtime-Bg1WXVCx.js";import{l as r}from"./chunks/localized-decorator-BlOuLhym.js";import{l as p}from"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import{a as l,i as c,x as d,E as m}from"./chunks/lit-element-DiWJYFwC.js";import{n as h}from"./chunks/property-scuRaFcM.js";import{e as u}from"./chunks/external-CJj32K_p.js";import{MqAppointmentRescheduleEvent as v,MqAppointmentBookEvent as g,MqAppointmentJoinVideocallEvent as f,MqAppointmentViewDocumentationEvent as b,MqHomeEvent as y}from"./events.js";import"./ui/mq-tabs.js";import{a as x,A as $,i as k,d as q}from"./chunks/api-chat-client-CqMn2JEn.js";import{Q as w}from"./chunks/query-controller-BlO1Ax65.js";import{g as C}from"./chunks/get-organization-setup-query-BMbuRi6v.js";import{g as j,a as H}from"./chunks/i18n-formats-DYS91YEa.js";import{g as V,c as S}from"./chunks/refund-cancel-policy-D_tUYPyv.js";import{g as M}from"./chunks/chunk-GZF3YFSX-DM-GTqxg.js";import{r as R}from"./chunks/state-LQivXIgA.js";import{getLocale as E}from"./i18n.js";import"./ui/mq-card.js";export{P as ProfessionalOverview}from"./chunks/professional-overview-CfjgnTw4.js";import"./mq-chat-room.js";import"./ui/mq-floating-bubble.js";import{Q as z}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{M as D}from"./chunks/mutation-controller-CR2qcqhH.js";import"./ui/mq-button.js";import"./ui/mq-dialog.js";import{t as I,i as O,j as N,k as Q,l as T,m as _,n as U}from"./chunks/telemetry-client-Ca71sobH.js";import{e as Z}from"./chunks/class-map-Co76I6aw.js";import{messageBubbleIcon as B}from"./ui/icons/message-bubble-icon.js";import{videoIcon as F}from"./ui/icons/video-icon.js";import"./ui/mq-unread-badge.js";import{toast as L}from"./ui/mq-toast.js";import"./ui/back-link.js";import"./ui/icons/briefcase-icon.js";import"./ui/icons/types.js";import"./ui/icons/calendar-icon.js";import"./ui/icons/clock-icon.js";import"./ui/icons/phone-icon.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";import"./chunks/query-Cjvi4_dT.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./ui/icons/chevron-down-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/mq-text-button.js";import"./chunks/directive-2EDmOukv.js";import"./ui/mq-avatar.js";import"./chunks/provide-D2fnEhT2.js";import"./chunks/context-provider--AKuwfs9.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/chunk-YMQSBQHL-De_r7BNk.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./ui/icons/check-double-icon.js";import"./ui/icons/check-icon.js";import"./chunks/chunk-YTQUGGS3-DmCGIoFy.js";const G=u(["next","history"]).enum;class MqMyAppointmentsSelectEvent extends Event{static{this.eventName="ontabchange"}constructor(t){super(MqMyAppointmentsSelectEvent.eventName,{bubbles:!0,composed:!0}),this.value=t}}let J=class CancelAppointmentConfirmationDialog extends l{constructor(){super(...arguments),this.open=!1,this.cancelAppointmentMutation=new D(this,{mutationFn:async t=>x.appointments.cancelAppointment(t),onSuccess:()=>{this.queryClientContext?.invalidateQueries(),this.dispatchEvent(new CustomEvent("success",{bubbles:!0,composed:!0}))}}),this.handleClose=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))},this.handleDismissClick=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))},this.handleConfirmClick=()=>{this.cancelAppointmentMutation.run({id:this.appointmentId})}}static{this.styles=c`:host{display:contents}h2{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0}p{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);margin:0}.subheading-payable{font-size:var(--text-base);line-height:22px}.price-rows{display:flex;flex-direction:column;font-family:var(--font-body);font-size:var(--text-sm);font-weight:var(--font-weight-medium);line-height:var(--text-sm--line-height);color:var(--color-card-foreground);width:100%;margin-bottom:var(--sp-4)}.price-row{display:flex;align-items:center;justify-content:space-between;min-height:34px;gap:var(--sp-2)}.price-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-4);justify-content:flex-end;flex-wrap:wrap}`}render(){const i=E(),n=this.price,a=t(n),s=this.cancelAppointmentMutation.isPending;if(a){const t=e(n,i),a=`-${t}`;return d`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${o("Confirmar cancelación")}</h2><p slot="subheading" class="subheading-payable">${o("¿Seguro que quieres cancelar esta cita? Se te devolverá el importe pagado en un plazo de 5-10 días hábiles.")}</p><div><div class="price-rows"><div class="price-row"><span>${o("Importe pagado")}</span> <span>${t}</span></div><div class="price-row"><span>${o("Importe a devolver")}</span> <span>${a}</span></div></div><div class="actions"><mq-button variant="outline" ?disabled="${s}" @click="${this.handleDismissClick}">${o("Volver")}</mq-button><mq-button variant="primary" ?disabled="${s}" @click="${this.handleConfirmClick}">${o("Confirmar")}</mq-button></div></div></mq-dialog>`}return d`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${o("Confirmar cancelación")}</h2><p slot="subheading">${o("¿Seguro que quieres cancelar esta cita?")}</p><div><div class="actions"><mq-button variant="outline" ?disabled="${s}" @click="${this.handleDismissClick}">${o("Cancelar")}</mq-button><mq-button variant="primary" ?disabled="${s}" @click="${this.handleConfirmClick}">${o("Confirmar")}</mq-button></div></div></mq-dialog>`}};i([h({type:Boolean,reflect:!0})],J.prototype,"open",void 0),i([a({context:z,subscribe:!0})],J.prototype,"queryClientContext",void 0),i([h({type:String})],J.prototype,"appointmentId",void 0),i([h({type:Object})],J.prototype,"price",void 0),J=i([r(),n("cancel-appointment-confirmation-dialog")],J);let Y=class AppointmentActionUnavailableDialog extends l{constructor(){super(...arguments),this.open=!1,this.heading="",this.message="",this.handleClose=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}}static{this.styles=c`:host{display:contents}mq-dialog::part(dialog){max-width:343px;min-width:0}h2{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0}p{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);margin:0}.actions{display:flex;margin-top:var(--sp-4)}`}render(){return d`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${this.heading}</h2><p slot="subheading">${this.message}</p><div class="actions"><mq-button variant="primary" fullwidth @click="${this.handleClose}">${o("Volver")}</mq-button></div></mq-dialog>`}};i([h({type:Boolean,reflect:!0})],Y.prototype,"open",void 0),i([h({type:String})],Y.prototype,"heading",void 0),i([h({type:String})],Y.prototype,"message",void 0),Y=i([r(),n("appointment-action-unavailable-dialog")],Y);let K=class AppointmentCardActions extends l{constructor(){super(...arguments),this.variant="next",this.isVideocall=!1,this.hasChatSupport=!1,this.unreadCount=0,this.isModifyUnavailable=!1,this.isCancelUnavailable=!1,this.hasNoSlots=!1,this.modifyUnavailableMessage="",this.cancelUnavailableMessage="",this.repeatTarget=null,this.professionalHash="",this.openDialog=null,this.handleModifyClick=()=>{this.isModifyUnavailable?this.openDialog="modify":(I.track(O(this.patientHash,this.appointmentId)),this.dispatchEvent(new v({appointmentId:this.appointmentId})))},this.handleCancelClick=()=>{this.isCancelUnavailable?this.openDialog="cancel":(I.track(N(this.patientHash,this.appointmentId)),this.dispatchEvent(new CustomEvent("request-cancel",{bubbles:!0,composed:!0})))},this.handleRepeatClick=()=>{this.hasNoSlots?this.openDialog="repeat-no-slots":this.repeatTarget?(I.track(Q(this.patientHash,this.appointmentId)),this.dispatchEvent(new g({specialty:this.repeatTarget.specialty,service:this.repeatTarget.service,professional:this.professionalHash}))):this.openDialog="repeat-error"},this.handleDialogClose=()=>{this.openDialog=null}}static{this.styles=c`:host{display:contents}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-2)}.actions.next{flex-direction:column}.actions-secondary{display:flex;gap:var(--sp-3)}.actions mq-button{flex:1}`}get patientHash(){return this.loginToken.patient.hash}renderChatButton(){return d`<mq-button variant="primary" fullwidth noPadding @click="${()=>{this.dispatchEvent(new CustomEvent("toggle-chat",{bubbles:!0,composed:!0}))}}">${B({size:24})} ${o("Chat")} ${this.unreadCount>0?d`<mq-unread-badge></mq-unread-badge>`:m}</mq-button>`}renderNextActions(){return d`${this.isVideocall?d`<mq-button variant="outline" fullwidth noPadding @click="${()=>{I.track(T(this.patientHash,this.appointmentId)),this.dispatchEvent(new f({appointmentId:this.appointmentId}))}}">${F({size:24})} ${o("Ir a videollamada")}</mq-button>`:m}<div class="actions-secondary">${this.hasChatSupport?this.renderChatButton():m}<mq-button variant="outline" fullwidth noPadding @click="${this.handleModifyClick}">${o("Modificar")}</mq-button><mq-button variant="outline-negative" fullwidth noPadding @click="${this.handleCancelClick}">${o("Cancelar")}</mq-button></div>`}renderHistoryActions(){return d`${this.hasChatSupport?this.renderChatButton():m}<mq-button variant="outline" fullwidth noPadding @click="${()=>{I.track(_(this.patientHash,this.appointmentId)),this.dispatchEvent(new b({appointmentId:this.appointmentId}))}}">${o("Documentos")}</mq-button><mq-button variant="outline" fullwidth noPadding @click="${this.handleRepeatClick}">${o("Repetir")}</mq-button>`}render(){return d`<div class="${Z({actions:!0,next:"next"===this.variant})}">${"next"===this.variant?this.renderNextActions():this.renderHistoryActions()}</div><appointment-action-unavailable-dialog .open="${"modify"===this.openDialog}" .heading="${o("Modificar cita")}" .message="${this.modifyUnavailableMessage}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"cancel"===this.openDialog}" .heading="${o("Anular cita")}" .message="${this.cancelUnavailableMessage}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"repeat-no-slots"===this.openDialog}" .heading="${o("Repetir cita")}" .message="${o("Este profesional no tiene horarios disponibles")}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"repeat-error"===this.openDialog}" .heading="${o("Repetir cita")}" .message="${o("Lo sentimos, no hemos podido repetir tu cita. Por favor, contacta con soporte.")}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog>`}};function W(t){const{action:e,refundPolicySeconds:i}=t,n=null!=i&&i<3600,a=Math.ceil((i??0)/60),r=Math.ceil((i??0)/3600);return o(0===(n?a:r)?"modify"===e?"Esta cita ya ha pasado, por lo que no se puede modificar.":"Esta cita ya ha pasado, por lo que no se puede anular.":"modify"===e?n?s`Lo sentimos, como faltan menos de ${a} minutos para tu cita no podemos modificarla.`:s`Lo sentimos, como faltan menos de ${r} horas para tu cita no podemos modificarla.`:n?s`Lo sentimos, como faltan menos de ${a} minutos para tu cita no podemos anularla.`:s`Lo sentimos, como faltan menos de ${r} horas para tu cita no podemos anularla.`)}i([a({context:p})],K.prototype,"loginToken",void 0),i([h({type:String})],K.prototype,"variant",void 0),i([h({type:String})],K.prototype,"appointmentId",void 0),i([h({type:Boolean})],K.prototype,"isVideocall",void 0),i([h({type:Boolean})],K.prototype,"hasChatSupport",void 0),i([h({type:Number})],K.prototype,"unreadCount",void 0),i([h({type:Boolean})],K.prototype,"isModifyUnavailable",void 0),i([h({type:Boolean})],K.prototype,"isCancelUnavailable",void 0),i([h({type:Boolean})],K.prototype,"hasNoSlots",void 0),i([h({type:String})],K.prototype,"modifyUnavailableMessage",void 0),i([h({type:String})],K.prototype,"cancelUnavailableMessage",void 0),i([h({type:Object})],K.prototype,"repeatTarget",void 0),i([h({type:String})],K.prototype,"professionalHash",void 0),i([R()],K.prototype,"openDialog",void 0),K=i([r(),n("appointment-card-actions")],K);let X=class AppointmentCard extends l{constructor(){super(...arguments),this.variant="next",this.detailsVariant="wide",this.isChatOpen=!1,this.isCancelDialogOpen=!1,this.unreadQuery=new w(this,()=>M(x,{roomId:this.appointmentResource?.room?.id})),this.getOrganizationSpecialtiesQuery=new w(this,()=>j(x,{enabled:!!this.appointmentResource?.speciality?.id})),this.getOrganizationSetupQuery=new w(this,()=>C(x)),this.getScheduleServicesQuery=new w(this,()=>V(x))}static{this.styles=c`:host{display:flex}.card{width:100%;padding:var(--sp-6);display:flex;flex-direction:column;gap:var(--sp-4);justify-content:space-between}.card-top-content{display:flex;flex-direction:column;gap:var(--sp-6)}.see-details{color:var(--color-primary-link-default);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-bold)}.see-details:hover{text-decoration:underline}.chevron-down{width:16px;height:16px;transition:transform .2s ease}.appointment-details{display:flex;flex-direction:column;gap:12px}.clock-icon-wrapper{width:24px;height:24px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.clock-icon-wrapper svg{width:100%;height:100%}.appointment-type{display:flex;align-items:center;gap:12px;font-size:18px;color:#2c3e50}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-2)}.actions.next{flex-direction:column}.actions-secondary{display:flex;gap:var(--sp-3)}.actions mq-button{flex:1}`}render(){const t=this.appointmentResource.appointment.channel===$.videocall,e=this.appointmentResource.appointment.channel===$.phonecall,i=!0===this.getOrganizationSetupQuery.result?.data?.appointments?.has_chat_in_appointment,n=(t||e)&&i,a=E(),s=k(this.appointmentResource.appointment.expires_at),r=0===this.appointmentResource.slots.length,p=this.getOrganizationSetupQuery.result?.data?.appointments?.seconds_before_start_to_refund_on_cancel,l=S({startsAtIso:this.appointmentResource.appointment.starts_at,refundPolicySeconds:p}),c=s||r||!l,h=s||!l,u=W({action:"modify",refundPolicySeconds:p}),v=W({action:"cancel",refundPolicySeconds:p}),g=this.getOrganizationSpecialtiesQuery.result?.data?.find(t=>Number(t.id)===Number(this.appointmentResource.speciality.id)),f=H(g?.code??"",a,g?.name??this.appointmentResource.speciality.name),b=this.getScheduleServicesQuery.result?.data?.find(t=>t.id===this.appointmentResource.appointment.service_id)?.code,y=g?.code&&b?{specialty:g.code,service:b}:null;return d`<mq-card class="card" roundness="md"><div class="card-top-content"><professional-overview .specialtyName="${f??""}" .collegiateNumber="${this.appointmentResource.professional.collegiate_number??void 0}" .description="${this.appointmentResource.professional.description??""}" .languages="${this.appointmentResource.professional.languages}" .avatar="${this.appointmentResource.professional.avatar??""}" .name="${this.appointmentResource.professional.name}"></professional-overview><appointment-details .startsAt="${this.appointmentResource.appointment.starts_at}" .duration="${this.appointmentResource.appointment.duration}" .channel="${this.appointmentResource.appointment.channel}" .timezone="${this.loginToken?.patient?.timezone}" variant="${this.detailsVariant}"></appointment-details></div><appointment-card-actions .variant="${this.variant}" .appointmentId="${this.appointmentResource.appointment.id??""}" .isVideocall="${t}" .hasChatSupport="${n}" .unreadCount="${this.unreadQuery.result?.data?.unread_count??0}" .isModifyUnavailable="${c}" .isCancelUnavailable="${h}" .hasNoSlots="${r}" .modifyUnavailableMessage="${u}" .cancelUnavailableMessage="${v}" .repeatTarget="${y}" .professionalHash="${this.appointmentResource.professional.hash}" @toggle-chat="${()=>{this.isChatOpen=!this.isChatOpen,this.isChatOpen&&I.track(U(this.loginToken.patient.hash,this.appointmentResource.appointment.id??""))}}" @request-cancel="${()=>{this.isCancelDialogOpen=!0}}"></appointment-card-actions><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" @mq-close="${()=>{this.isChatOpen=!1}}" hideCloseButton>${this.isChatOpen?d`<mq-chat-room slot="content" .consultationId="${this.appointmentResource.appointment.id}" consultation-type="appointment" token="${this.loginToken.access_token}" .roomId="${this.appointmentResource.room.id}" .professionalHash="${this.appointmentResource.professional.hash}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}" ?readonly="${s}"></mq-chat-room>`:m}</mq-floating-bubble><cancel-appointment-confirmation-dialog .appointmentId="${this.appointmentResource.appointment.id}" .price="${this.appointmentResource.price??void 0}" .open="${this.isCancelDialogOpen}" @cancel="${()=>{this.isCancelDialogOpen=!1}}" @success="${()=>{this.isCancelDialogOpen=!1,L.success(o("Consulta anulada correctamente")),this.dispatchEvent(new CustomEvent("appointment-cancel-confirmed",{bubbles:!0,composed:!0,detail:{id:this.appointmentResource.appointment.id}}))}}"></cancel-appointment-confirmation-dialog></mq-card>`}};i([h({type:Object})],X.prototype,"appointmentResource",void 0),i([h({type:Number})],X.prototype,"specialtyId",void 0),i([h({type:String})],X.prototype,"variant",void 0),i([h({type:String})],X.prototype,"detailsVariant",void 0),i([a({context:p})],X.prototype,"loginToken",void 0),i([R()],X.prototype,"isChatOpen",void 0),i([R()],X.prototype,"isCancelDialogOpen",void 0),X=i([r(),n("appointment-card")],X);let tt=class AppointmentCardSkeleton extends l{static{this.styles=c`div{border-radius:var(--border-radius-md);background:color-mix(in srgb,var(--color-neutrals-background-disabled) 50%,#fff 50%);height:337px;width:100%}`}render(){return d`<div></div>`}};tt=i([n("appointment-card-skeleton")],tt);let et=class EmptyState extends l{static{this.styles=c`.container{border-radius:var(--border-radius-md);background-color:var(--color-neutrals-background-weak);padding:var(--sp-10) var(--sp-6)}.card{border-radius:var(--border-radius-md);max-width:512px;margin:0 auto;background-color:var(--color-neutrals-background-extraWeak);padding:var(--sp-6);display:flex;flex-direction:column;align-items:center;gap:var(--sp-3)}.card>*{max-width:323px;margin:0 auto}.title{font-family:var(--font-body);font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutrals-text-default);margin:0}.description{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-normal);text-align:center;color:var(--color-neutrals-text-default);margin:0}@media (min-width:768px){.container{padding:var(--sp-6)}mq-button{max-width:323px}}`}handleRequestAppointment(){this.dispatchEvent(new CustomEvent("request-appointment",{bubbles:!0,composed:!0}))}render(){return d`<div class="container"><div class="card">${function({color:t="currentColor"}){return d`<svg width="31" height="32" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M29.6 2.4H23.2V0H21.6V2.4H18.4V0H16.8V2.4H13.6V0H12V2.4H8.8V0H7.2V2.4H0.8C0.587827 2.4 0.384344 2.48429 0.234315 2.63431C0.0842855 2.78434 0 2.98783 0 3.2V31.2C0 31.4122 0.0842855 31.6157 0.234315 31.7657C0.384344 31.9157 0.587827 32 0.8 32H29.6C29.8122 32 30.0157 31.9157 30.1657 31.7657C30.3157 31.6157 30.4 31.4122 30.4 31.2V3.2C30.4 2.98783 30.3157 2.78434 30.1657 2.63431C30.0157 2.48429 29.8122 2.4 29.6 2.4ZM28.8 30.4H1.6V10.4H27.2V8.8H1.6V4H7.2V7.2H8.8V4H12V7.2H13.6V4H16.8V7.2H18.4V4H21.6V7.2H23.2V4H28.8V30.4ZM3.2 19.2H9.6V12.8H3.2V19.2ZM4.8 14.4H8V17.6H4.8V14.4ZM20.8 19.2H27.2V12.8H20.8V19.2ZM22.4 14.4H25.6V17.6H22.4V14.4ZM12 19.2H18.4V12.8H12V19.2ZM13.6 14.4H16.8V17.6H13.6V14.4ZM3.2 28H9.6V21.6H3.2V28ZM4.8 23.2H8V26.4H4.8V23.2ZM20.8 28H27.2V21.6H20.8V28ZM22.4 23.2H25.6V26.4H22.4V23.2ZM12 28H18.4V21.6H12V28ZM13.6 23.2H16.8V26.4H13.6V23.2Z" fill="${t}"/></svg>`}({color:"var(--color-primary)"})}<p class="title">${this.title}</p><p class="description">${this.description}</p><mq-button variant="primary" size="md" fullwidth @click="${this.handleRequestAppointment}">${o("Pedir cita")}</mq-button></div></div>`}};function it(t,e){return{queryKey:["appointments",e],queryFn:()=>t.appointments.getAppointments(e)}}i([h({type:String})],et.prototype,"title",void 0),i([h({type:String})],et.prototype,"description",void 0),et=i([n("empty-state")],et);const nt=[q.pending,q.accepted],at=c`.appointments-list{display:grid;grid-template-columns:1fr;gap:var(--sp-6);margin-bottom:var(--sp-6)}@media (min-width:768px){.appointments-list{grid-template-columns:repeat(2,1fr)}}`;let ot=class NextAppointmentsTab extends l{constructor(){super(...arguments),this.getAppointmentsQuery=new w(this,()=>it(x,{status:nt,order:{field:"starts_at",direction:"asc"}}))}static{this.styles=at}render(){return this.getAppointmentsQuery.render({complete:t=>d`${t.data.length>0?d`<div class="appointments-list">${t.data.map(t=>d`<appointment-card .appointmentResource="${t}" .specialtyId="${t.speciality?.id}"></appointment-card>`)}</div>`:d`<empty-state title="${o("No tienes próximas citas")}" description="${o("Agenda una consulta médica cuando la necesites. Aquí verás todos los detalles y podrás gestionar tus próximas citas.")}"></empty-state>`}`,pending:()=>d`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};ot=i([r(),n("next-appointments-tab")],ot);const st=[q.finished,q.reporting];let rt=class AppointmentsHistoryTab extends l{constructor(){super(...arguments),this.getAppointmentsQuery=new w(this,()=>it(x,{status:st,order:{field:"starts_at",direction:"desc"}}))}static{this.styles=c`.appointments-list{display:grid;grid-template-columns:1fr;gap:var(--sp-6);margin-bottom:var(--sp-6)}@media (min-width:768px){.appointments-list{grid-template-columns:repeat(2,1fr)}}`}render(){return this.getAppointmentsQuery.render({complete:t=>d`${t.data.length>0?d`<div class="appointments-list">${t.data.map(t=>d`<appointment-card .appointmentResource="${t}" .specialtyId="${t.speciality?.id}" variant="history"></appointment-card>`)}</div>`:d`<empty-state title="${o("No tienes citas en el historial")}" description="${o("Aquí verás todas las citas que has tenido. Puedes acceder a los documentos de cada consulta y reagendar una cita si es necesario.")}"></empty-state>`}`,pending:()=>d`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};rt=i([r(),n("appointments-history-tab")],rt);const pt=c`.container{display:flex;flex-direction:column;gap:var(--size-3)}h1{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutral-link-dark);margin:0}p{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutral-link-dark);margin:0}.user-info{display:flex;align-items:center;justify-content:space-between}@media (min-width:768px){h1{font-size:var(--text-3xl);line-height:var(--text-3xl--line-height)}mq-tabs-list{max-width:435px}}`;let lt=class MqMyAppointments extends l{constructor(){super(...arguments),this.tab=G.next}static{this.styles=pt}handleSelect(t){this.dispatchEvent(new MqMyAppointmentsSelectEvent(t.value))}render(){return d`<div class="container"><back-link @mq-back="${t=>{t.stopPropagation(),this.dispatchEvent(new y)}}">${o("Volver al inicio")}</back-link><h1>${o("Mis citas")}</h1><div class="user-info"><p>${o(s`Para: ${this.loginToken.patient.name}`)}</p></div><mq-tabs .value="${this.tab}" @onvaluechange="${this.handleSelect}"><mq-tabs-list><mq-tabs-trigger value="${G.next}">${o("Próximas citas")}</mq-tabs-trigger><mq-tabs-trigger value="${G.history}">${o("Histórico")}</mq-tabs-trigger></mq-tabs-list><mq-tabs-content value="${G.next}"><next-appointments-tab></next-appointments-tab></mq-tabs-content><mq-tabs-content value="${G.history}"><appointments-history-tab></appointments-history-tab></mq-tabs-content></mq-tabs></div>`}};i([a({context:p})],lt.prototype,"loginToken",void 0),i([h({type:String,reflect:!0})],lt.prototype,"tab",void 0),lt=i([r(),n("mq-my-appointments")],lt);const ct=c`:host{display:block}.request-appointment-cta{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:var(--sp-12) var(--sp-4);background:var(--color-card);gap:var(--sp-4)}.title-body{display:flex;flex-direction:column;gap:var(--sp-2);flex:1}.title{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutrals-text-default);margin:0;text-align:center}.subtitle{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default);margin:0;display:none}mq-button{width:100%}.button-text-desktop{display:none}.button-text-mobile{display:inline}@media (min-width:768px){.request-appointment-cta{flex-direction:row;padding:var(--sp-12) var(--sp-20);gap:var(--sp-2)}.title-body{align-items:flex-start;flex:1;max-width:843px}.title{font-size:var(--text-3xl);line-height:var(--text-3xl--line-height);font-weight:var(--font-weight-extrabold);text-align:left}.subtitle{display:block}mq-button{width:auto;flex-shrink:0;--button-height-md:var(--button-height-lg);--text-sm:var(--text-base);--text-sm--line-height:var(--text-base--line-height)}.button-text-desktop{display:inline}.button-text-mobile{display:none}}`;class RequestAppointmentEvent extends Event{static{this.eventName="request-appointment"}constructor(){super(RequestAppointmentEvent.eventName,{bubbles:!0,composed:!0})}}let dt=class RequestAppointmentCta extends l{static{this.styles=ct}handleRequestAppointment(){this.dispatchEvent(new RequestAppointmentEvent)}render(){return d`<div class="request-appointment-cta"><div class="title-body"><h2 class="title">${o("Nueva cita de especialidades digitales")}</h2><p class="subtitle">${o("Realiza la búsqueda en tu cuadro médico digital")}</p></div><mq-button variant="primary" size="md" fullwidth @click="${this.handleRequestAppointment}"><span class="button-text-mobile">${o("Pedir cita")}</span> <span class="button-text-desktop">${o("Pedir una nueva cita")}</span></mq-button></div>`}};dt=i([r(),n("request-appointment-cta")],dt);export{lt as MqMyAppointments,MqMyAppointmentsSelectEvent,dt as RequestAppointmentCta,RequestAppointmentEvent};
@@ -0,0 +1,30 @@
1
+ export { M as MqProfessionalPresenceSync } from './chunks/mq-professional-presence-sync-cmg6CXhz.js';
2
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
3
+
4
+ /**
5
+ * Keeps the cached professional's `active_absence` in sync with realtime socket
6
+ * events, so presence indicators flip to "absent" without a refetch:
7
+ *
8
+ * - `absence_created` → set `active_absence`, and schedule a timer to clear it
9
+ * when `finishes_at` is reached (natural expiry emits no event).
10
+ * - `absence_cancelled` → clear `active_absence`.
11
+ *
12
+ * Reads the socket and query client from context, so the host only has to mount
13
+ * it under the socket + query-client providers.
14
+ */
15
+ declare class ProfessionalPresenceSyncController implements ReactiveController {
16
+ private readonly host;
17
+ private socket;
18
+ private queryClient;
19
+ private readonly clearTimers;
20
+ constructor(host: ReactiveControllerHost);
21
+ private _queryKey;
22
+ private _setActiveAbsence;
23
+ private _onAbsenceCreated;
24
+ private _onAbsenceCancelled;
25
+ private _clearTimer;
26
+ hostConnected(): void;
27
+ hostDisconnected(): void;
28
+ }
29
+
30
+ export { ProfessionalPresenceSyncController };
@@ -0,0 +1 @@
1
+ import{_ as e,t as s}from"./chunks/custom-element-DA9Fxvxd.js";import{a as t,E as n}from"./chunks/lit-element-DiWJYFwC.js";import{s as r}from"./chunks/context-consumer-ESdICVAb.js";import{Q as c}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{S as o,a as i}from"./chunks/chunk-YTQUGGS3-DmCGIoFy.js";import{g as a}from"./chunks/chunk-YMQSBQHL-De_r7BNk.js";import{g as h,a as l}from"./chunks/api-chat-client-CqMn2JEn.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/external-CJj32K_p.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";class ProfessionalPresenceSyncController{constructor(e){this.host=e,this.clearTimers=new Map,this._onAbsenceCreated=e=>{if(!e?.professional_hash||!e.finishes_at)return;const{professional_hash:s,id:t,finishes_at:n}=e;this._setActiveAbsence(s,{id:t,finishes_at:n}),this._clearTimer(s);const r=h(n).getTime()-Date.now();r>0&&r<2147483647&&this.clearTimers.set(s,setTimeout(()=>{this.clearTimers.delete(s),this._setActiveAbsence(s,null)},r))},this._onAbsenceCancelled=e=>{e?.professional_hash&&(this._clearTimer(e.professional_hash),this._setActiveAbsence(e.professional_hash,null))},new r(this.host,{context:o,subscribe:!0,callback:e=>{e&&e!==this.socket&&(this.socket=e,this.socket.on(i.absence_created,this._onAbsenceCreated),this.socket.on(i.absence_cancelled,this._onAbsenceCancelled))}}),new r(this.host,{context:c,subscribe:!0,callback:e=>{e&&(this.queryClient=e)}}),this.host.addController(this)}_queryKey(e){return a(l,{hash:e}).queryKey}_setActiveAbsence(e,s){this.queryClient?.setQueryData(this._queryKey(e),e=>e?{...e,active_absence:s}:void 0)}_clearTimer(e){const s=this.clearTimers.get(e);s&&(clearTimeout(s),this.clearTimers.delete(e))}hostConnected(){}hostDisconnected(){this.socket?.off(i.absence_created,this._onAbsenceCreated),this.socket?.off(i.absence_cancelled,this._onAbsenceCancelled);for(const e of this.clearTimers.values())clearTimeout(e);this.clearTimers.clear()}}let m=class MqProfessionalPresenceSync extends t{constructor(){super(...arguments),this._controller=new ProfessionalPresenceSyncController(this)}createRenderRoot(){return this}render(){return n}};m=e([s("mq-professional-presence-sync")],m);export{m as MqProfessionalPresenceSync,ProfessionalPresenceSyncController};
@@ -1 +1 @@
1
- import{_ as t,t as e}from"./chunks/custom-element-DA9Fxvxd.js";import{h as s,j as i,k as a,R as r,l as n,g as o,S as u,m as h,n as c,o as l,q as d,u as f,f as y,v as p,a as m,w as g,x as v,y as b,z as C,Q as q}from"./chunks/query-QJ1INUTG.js";import{e as O}from"./chunks/provide-CfT7g_Zi.js";import{x as P,a as w}from"./chunks/lit-element-DiWJYFwC.js";import{r as Q}from"./chunks/state-LQivXIgA.js";import{e as x}from"./chunks/ensure-context-root-DbdqwnKB.js";import"./chunks/context-provider-CiMFpvDA.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/property-scuRaFcM.js";var D=Object.defineProperty;function M(t){return{onFetch:(e,r)=>{const n=e.options,o=e.fetchOptions?.meta?.fetchMore?.direction,u=e.state.data?.pages||[],h=e.state.data?.pageParams||[];let c={pages:[],pageParams:[]},l=0;const d=async()=>{let r=!1;const d=s(e.options,e.fetchOptions),f=async(t,s,n)=>{if(r)return Promise.reject();if(null==s&&t.pages.length)return Promise.resolve(t);const o=(()=>{const t={client:e.client,queryKey:e.queryKey,pageParam:s,direction:n?"backward":"forward",meta:e.options.meta};var i;return i=t,Object.defineProperty(i,"signal",{enumerable:!0,get:()=>(e.signal.aborted?r=!0:e.signal.addEventListener("abort",()=>{r=!0}),e.signal)}),t})(),u=await d(o),{maxPages:h}=e.options,c=n?i:a;return{pages:c(t.pages,u,h),pageParams:c(t.pageParams,s,h)}};if(o&&u.length){const t="backward"===o,e={pages:u,pageParams:h},s=(t?k:A)(n,e);c=await f(e,s,t)}else{const e=t??u.length;do{const t=0===l?h[0]??n.initialPageParam:A(n,c);if(l>0&&null==t)break;c=await f(c,t),l++}while(l<e)}return c};e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r):e.fetchFn=d}}}function A(t,{pages:e,pageParams:s}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,s[i],s):void 0}function k(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}var E=class extends r{#t;#e;#s;constructor(t){super(),this.mutationId=t.mutationId,this.#e=t.mutationCache,this.#t=[],this.state=t.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#e.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#e.remove(this))}continue(){return this.#s?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#i({type:"continue"})};this.#s=n({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(t,e)=>{this.#i({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#i({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const s="pending"===this.state.status,i=!this.#s.canStart();try{if(s)e();else{this.#i({type:"pending",variables:t,isPaused:i}),await(this.#e.config.onMutate?.(t,this));const e=await(this.options.onMutate?.(t));e!==this.state.context&&this.#i({type:"pending",context:e,variables:t,isPaused:i})}const a=await this.#s.start();return await(this.#e.config.onSuccess?.(a,t,this.state.context,this)),await(this.options.onSuccess?.(a,t,this.state.context)),await(this.#e.config.onSettled?.(a,null,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(a,null,t,this.state.context)),this.#i({type:"success",data:a}),a}catch(e){try{throw await(this.#e.config.onError?.(e,t,this.state.context,this)),await(this.options.onError?.(e,t,this.state.context)),await(this.#e.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(void 0,e,t,this.state.context)),e}finally{this.#i({type:"error",error:e})}}finally{this.#e.runNext(this)}}#i(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),o.batch(()=>{this.#t.forEach(e=>{e.onMutationUpdate(t)}),this.#e.notify({mutation:this,type:"updated",action:t})})}};var K=class extends u{constructor(t={}){super(),this.config=t,this.#a=new Set,this.#r=new Map,this.#n=0}#a;#r;#n;build(t,e,s){const i=new E({mutationCache:this,mutationId:++this.#n,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){this.#a.add(t);const e=j(t);if("string"==typeof e){const s=this.#r.get(e);s?s.push(t):this.#r.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#a.delete(t)){const e=j(t);if("string"==typeof e){const s=this.#r.get(e);if(s)if(s.length>1){const e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#r.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=j(t);if("string"==typeof e){const s=this.#r.get(e),i=s?.find(t=>"pending"===t.state.status);return!i||i===t}return!0}runNext(t){const e=j(t);if("string"==typeof e){const s=this.#r.get(e)?.find(e=>e!==t&&e.state.isPaused);return s?.continue()??Promise.resolve()}return Promise.resolve()}clear(){o.batch(()=>{this.#a.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#a.clear(),this.#r.clear()})}getAll(){return Array.from(this.#a)}find(t){const e={exact:!0,...t};return this.getAll().find(t=>h(e,t))}findAll(t={}){return this.getAll().filter(e=>h(t,e))}notify(t){o.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(t=>t.state.isPaused);return o.batch(()=>Promise.all(t.map(t=>t.continue().catch(c))))}};function j(t){return t.options.scope?.id}var F=class extends u{constructor(t={}){super(),this.config=t,this.#o=new Map}#o;build(t,e,s){const i=e.queryKey,a=e.queryHash??l(i,e);let r=this.get(a);return r||(r=new d({client:t,queryKey:i,queryHash:a,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(i)}),this.add(r)),r}add(t){this.#o.has(t.queryHash)||(this.#o.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#o.get(t.queryHash);e&&(t.destroy(),e===t&&this.#o.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){o.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#o.get(t)}getAll(){return[...this.#o.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(t=>f(e,t))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(e=>f(t,e)):e}notify(t){o.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){o.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){o.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},S=class{#u;#e;#h;#c;#l;#d;#f;#y;constructor(t={}){this.#u=t.queryCache||new F,this.#e=t.mutationCache||new K,this.#h=t.defaultOptions||{},this.#c=new Map,this.#l=new Map,this.#d=0}mount(){this.#d++,1===this.#d&&(this.#f=y.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#u.onFocus())}),this.#y=p.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#u.onOnline())}))}unmount(){this.#d--,0===this.#d&&(this.#f?.(),this.#f=void 0,this.#y?.(),this.#y=void 0)}isFetching(t){return this.#u.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#u.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=this.#u.build(this,e),i=s.state.data;return void 0===i?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(m(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return this.#u.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){const i=this.defaultQueryOptions({queryKey:t}),a=this.#u.get(i.queryHash),r=a?.state.data,n=g(e,r);if(void 0!==n)return this.#u.build(this,i).setData(n,{...s,manual:!0})}setQueriesData(t,e,s){return o.batch(()=>this.#u.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#u.get(e.queryHash)?.state}removeQueries(t){const e=this.#u;o.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){const s=this.#u;return o.batch(()=>(s.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const s={revert:!0,...e},i=o.batch(()=>this.#u.findAll(t).map(t=>t.cancel(s)));return Promise.all(i).then(c).catch(c)}invalidateQueries(t,e={}){return o.batch(()=>(this.#u.findAll(t).forEach(t=>{t.invalidate()}),"none"===t?.refetchType?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const s={...e,cancelRefetch:e.cancelRefetch??!0},i=o.batch(()=>this.#u.findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let e=t.fetch(void 0,s);return s.throwOnError||(e=e.catch(c)),"paused"===t.state.fetchStatus?Promise.resolve():e}));return Promise.all(i).then(c)}fetchQuery(t){const e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);const s=this.#u.build(this,e);return s.isStaleByTime(m(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(c).catch(c)}fetchInfiniteQuery(t){return t.behavior=M(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(c).catch(c)}ensureInfiniteQueryData(t){return t.behavior=M(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return p.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#u}getMutationCache(){return this.#e}getDefaultOptions(){return this.#h}setDefaultOptions(t){this.#h=t}setQueryDefaults(t,e){this.#c.set(v(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#c.values()],s={};return e.forEach(e=>{b(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#l.set(v(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#l.values()],s={};return e.forEach(e=>{b(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#h.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=l(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===C&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#h.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#u.clear(),this.#e.clear()}},R=t=>{class QueryClientMixinClass extends t{constructor(){super(...arguments),this.queryClient=new S({defaultOptions:{queries:{staleTime:6e4}}})}connectedCallback(){super.connectedCallback(),this.queryClient.mount()}disconnectedCallback(){super.disconnectedCallback(),this.queryClient.unmount()}}return((t,e,s)=>{for(var i,a=void 0,r=t.length-1;r>=0;r--)(i=t[r])&&(a=i(e,s,a)||a);a&&D(e,s,a)})([O({context:q}),Q()],QueryClientMixinClass.prototype,"queryClient"),QueryClientMixinClass};x();let H=class QueryClientProvider extends(R(w)){render(){return P`<slot></slot>`}};H=t([e("mq-query-client-provider")],H);export{H as QueryClientProvider};
1
+ import{_ as t,t as e}from"./chunks/custom-element-DA9Fxvxd.js";import{Q as s}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{e as i}from"./chunks/provide-D2fnEhT2.js";import{h as a,j as r,k as n,R as o,l as u,g as h,S as c,m as l,n as d,o as f,Q as y,q as p,f as m,u as g,a as v,v as b,w as C,x as q,y as O}from"./chunks/query-Cjvi4_dT.js";import{x as P,a as w}from"./chunks/lit-element-DiWJYFwC.js";import{r as Q}from"./chunks/state-LQivXIgA.js";import{e as x}from"./chunks/ensure-context-root-DbdqwnKB.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/context-provider--AKuwfs9.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/property-scuRaFcM.js";var D=Object.defineProperty;function M(t){return{onFetch:(e,s)=>{const i=e.options,o=e.fetchOptions?.meta?.fetchMore?.direction,u=e.state.data?.pages||[],h=e.state.data?.pageParams||[];let c={pages:[],pageParams:[]},l=0;const d=async()=>{let s=!1;const d=a(e.options,e.fetchOptions),f=async(t,i,a)=>{if(s)return Promise.reject();if(null==i&&t.pages.length)return Promise.resolve(t);const o=(()=>{const t={client:e.client,queryKey:e.queryKey,pageParam:i,direction:a?"backward":"forward",meta:e.options.meta};var r;return r=t,Object.defineProperty(r,"signal",{enumerable:!0,get:()=>(e.signal.aborted?s=!0:e.signal.addEventListener("abort",()=>{s=!0}),e.signal)}),t})(),u=await d(o),{maxPages:h}=e.options,c=a?r:n;return{pages:c(t.pages,u,h),pageParams:c(t.pageParams,i,h)}};if(o&&u.length){const t="backward"===o,e={pages:u,pageParams:h},s=(t?A:k)(i,e);c=await f(e,s,t)}else{const e=t??u.length;do{const t=0===l?h[0]??i.initialPageParam:k(i,c);if(l>0&&null==t)break;c=await f(c,t),l++}while(l<e)}return c};e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=d}}}function k(t,{pages:e,pageParams:s}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,s[i],s):void 0}function A(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}var j=class extends o{#t;#e;#s;constructor(t){super(),this.mutationId=t.mutationId,this.#e=t.mutationCache,this.#t=[],this.state=t.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#e.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#e.remove(this))}continue(){return this.#s?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#i({type:"continue"})};this.#s=u({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(t,e)=>{this.#i({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#i({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const s="pending"===this.state.status,i=!this.#s.canStart();try{if(s)e();else{this.#i({type:"pending",variables:t,isPaused:i}),await(this.#e.config.onMutate?.(t,this));const e=await(this.options.onMutate?.(t));e!==this.state.context&&this.#i({type:"pending",context:e,variables:t,isPaused:i})}const a=await this.#s.start();return await(this.#e.config.onSuccess?.(a,t,this.state.context,this)),await(this.options.onSuccess?.(a,t,this.state.context)),await(this.#e.config.onSettled?.(a,null,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(a,null,t,this.state.context)),this.#i({type:"success",data:a}),a}catch(e){try{throw await(this.#e.config.onError?.(e,t,this.state.context,this)),await(this.options.onError?.(e,t,this.state.context)),await(this.#e.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(void 0,e,t,this.state.context)),e}finally{this.#i({type:"error",error:e})}}finally{this.#e.runNext(this)}}#i(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),h.batch(()=>{this.#t.forEach(e=>{e.onMutationUpdate(t)}),this.#e.notify({mutation:this,type:"updated",action:t})})}};var E=class extends c{constructor(t={}){super(),this.config=t,this.#a=new Set,this.#r=new Map,this.#n=0}#a;#r;#n;build(t,e,s){const i=new j({mutationCache:this,mutationId:++this.#n,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){this.#a.add(t);const e=K(t);if("string"==typeof e){const s=this.#r.get(e);s?s.push(t):this.#r.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#a.delete(t)){const e=K(t);if("string"==typeof e){const s=this.#r.get(e);if(s)if(s.length>1){const e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#r.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=K(t);if("string"==typeof e){const s=this.#r.get(e),i=s?.find(t=>"pending"===t.state.status);return!i||i===t}return!0}runNext(t){const e=K(t);if("string"==typeof e){const s=this.#r.get(e)?.find(e=>e!==t&&e.state.isPaused);return s?.continue()??Promise.resolve()}return Promise.resolve()}clear(){h.batch(()=>{this.#a.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#a.clear(),this.#r.clear()})}getAll(){return Array.from(this.#a)}find(t){const e={exact:!0,...t};return this.getAll().find(t=>l(e,t))}findAll(t={}){return this.getAll().filter(e=>l(t,e))}notify(t){h.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(t=>t.state.isPaused);return h.batch(()=>Promise.all(t.map(t=>t.continue().catch(d))))}};function K(t){return t.options.scope?.id}var F=class extends c{constructor(t={}){super(),this.config=t,this.#o=new Map}#o;build(t,e,s){const i=e.queryKey,a=e.queryHash??f(i,e);let r=this.get(a);return r||(r=new y({client:t,queryKey:i,queryHash:a,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(i)}),this.add(r)),r}add(t){this.#o.has(t.queryHash)||(this.#o.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#o.get(t.queryHash);e&&(t.destroy(),e===t&&this.#o.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){h.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#o.get(t)}getAll(){return[...this.#o.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(t=>p(e,t))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(e=>p(t,e)):e}notify(t){h.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){h.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){h.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},R=class{#u;#e;#h;#c;#l;#d;#f;#y;constructor(t={}){this.#u=t.queryCache||new F,this.#e=t.mutationCache||new E,this.#h=t.defaultOptions||{},this.#c=new Map,this.#l=new Map,this.#d=0}mount(){this.#d++,1===this.#d&&(this.#f=m.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#u.onFocus())}),this.#y=g.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#u.onOnline())}))}unmount(){this.#d--,0===this.#d&&(this.#f?.(),this.#f=void 0,this.#y?.(),this.#y=void 0)}isFetching(t){return this.#u.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#u.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=this.#u.build(this,e),i=s.state.data;return void 0===i?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(v(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return this.#u.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){const i=this.defaultQueryOptions({queryKey:t}),a=this.#u.get(i.queryHash),r=a?.state.data,n=b(e,r);if(void 0!==n)return this.#u.build(this,i).setData(n,{...s,manual:!0})}setQueriesData(t,e,s){return h.batch(()=>this.#u.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#u.get(e.queryHash)?.state}removeQueries(t){const e=this.#u;h.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){const s=this.#u;return h.batch(()=>(s.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const s={revert:!0,...e},i=h.batch(()=>this.#u.findAll(t).map(t=>t.cancel(s)));return Promise.all(i).then(d).catch(d)}invalidateQueries(t,e={}){return h.batch(()=>(this.#u.findAll(t).forEach(t=>{t.invalidate()}),"none"===t?.refetchType?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const s={...e,cancelRefetch:e.cancelRefetch??!0},i=h.batch(()=>this.#u.findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let e=t.fetch(void 0,s);return s.throwOnError||(e=e.catch(d)),"paused"===t.state.fetchStatus?Promise.resolve():e}));return Promise.all(i).then(d)}fetchQuery(t){const e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);const s=this.#u.build(this,e);return s.isStaleByTime(v(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(d).catch(d)}fetchInfiniteQuery(t){return t.behavior=M(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(d).catch(d)}ensureInfiniteQueryData(t){return t.behavior=M(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return g.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#u}getMutationCache(){return this.#e}getDefaultOptions(){return this.#h}setDefaultOptions(t){this.#h=t}setQueryDefaults(t,e){this.#c.set(C(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#c.values()],s={};return e.forEach(e=>{q(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#l.set(C(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#l.values()],s={};return e.forEach(e=>{q(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#h.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=f(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===O&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#h.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#u.clear(),this.#e.clear()}},S=t=>{class QueryClientMixinClass extends t{constructor(){super(...arguments),this.queryClient=new R({defaultOptions:{queries:{staleTime:6e4}}})}connectedCallback(){super.connectedCallback(),this.queryClient.mount()}disconnectedCallback(){super.disconnectedCallback(),this.queryClient.unmount()}}return((t,e,s)=>{for(var i,a=void 0,r=t.length-1;r>=0;r--)(i=t[r])&&(a=i(e,s,a)||a);a&&D(e,s,a)})([i({context:s}),Q()],QueryClientMixinClass.prototype,"queryClient"),QueryClientMixinClass};x();let I=class QueryClientProvider extends(S(w)){render(){return P`<slot></slot>`}};I=t([e("mq-query-client-provider")],I);export{I as QueryClientProvider};
@@ -38,6 +38,8 @@ declare class OpenVideocallEvent extends Event {
38
38
  }
39
39
  /**
40
40
  * @fires open-videocall - Fired when the user wants to join the videocall
41
+ * @fires mq-view-appointments - Fired (when `show-nav-ctas`) to view the appointments list
42
+ * @fires mq-home - Fired (when `show-nav-ctas`) to return to the home screen
41
43
  */
42
44
  declare class MqScheduleSuccess extends LitElement {
43
45
  static styles: lit.CSSResult;
@@ -54,6 +56,13 @@ declare class MqScheduleSuccess extends LitElement {
54
56
  locale?: string;
55
57
  /** Environment override ("development" | "production"). Optional. */
56
58
  env?: Env;
59
+ /**
60
+ * Show the post-booking navigation CTAs ("view appointments" / "go home").
61
+ * Off by default: standalone hosts opt in when they own those destinations,
62
+ * and the component stays navigation-agnostic otherwise. When on, the CTAs
63
+ * emit `mq-view-appointments` (`{ tab: "next" }`) and `mq-home`.
64
+ */
65
+ showNavCtas: boolean;
57
66
  queryClientContext: QueryClient | undefined;
58
67
  /** Available when embedded in mq-router; standalone hosts pass `token` instead. */
59
68
  private loginToken?;