@mediquo/elements 0.11.0 → 0.12.0-rc.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 (121) hide show
  1. package/README.md +7 -18
  2. package/dist/chunks/appointment-details-BM8peAHH.js +1 -0
  3. package/dist/chunks/{appointment-details-CVEDe_k0.d.ts → appointment-details-KL9fK6vG.d.ts} +1 -2
  4. package/dist/chunks/ca_ES-DYhnenv6.js +1 -0
  5. package/dist/chunks/checkout-bridge-BFpVxNww.js +1 -0
  6. package/dist/chunks/de_DE-Dw0iVZNb.js +1 -0
  7. package/dist/chunks/{documentation-view-BSt0gtCR.js → documentation-view-CzCDvut1.js} +1 -1
  8. package/dist/chunks/en_US-DONnbI9l.js +1 -0
  9. package/dist/chunks/{index-CUirgiWh.d.ts → index-BEPyJrJL.d.ts} +1 -1
  10. package/dist/chunks/{index-B3rs7SlM.d.ts → index-BKjqWyIs.d.ts} +1 -1
  11. package/dist/chunks/{index-CCWMMqiq.js → index-DABvAuIz.js} +1 -1
  12. package/dist/chunks/index-Djkwyh_M.js +1 -0
  13. package/dist/chunks/{appointment.model.d-BWwBLaEL.d.ts → index-DwlJg2um.d.ts} +13 -0
  14. package/dist/chunks/{index-D2yqKnpP.js → index-VQqG1eyA.js} +1 -1
  15. package/dist/chunks/{index-DFaKhE7Q.d.ts → index-fut7tm1R.d.ts} +1 -1
  16. package/dist/chunks/{index.d-ByhRBSb1.d.ts → index.d-DHMNq1lu.d.ts} +2 -7
  17. package/dist/chunks/{login-token-task-Yib__6a9.js → login-token-task-NQJ77O_q.js} +1 -1
  18. package/dist/chunks/{mq-chat-room-C8wCADp2.d.ts → mq-chat-room-C0dJCvpV.d.ts} +2 -2
  19. package/dist/chunks/mq-chat-room-C2EALCSm.js +1 -0
  20. package/dist/chunks/{mq-next-appointments-CbjNpG1H.js → mq-next-appointments-DElOAaYx.js} +1 -1
  21. package/dist/chunks/{mq-recent-documents-DNqh_8J0.js → mq-recent-documents-DS5zUnH8.js} +1 -1
  22. package/dist/chunks/mq-schedule-CIb5mOTX.js +1 -0
  23. package/dist/chunks/{mq-support-chat-tdev5LC-.js → mq-support-chat-DYmvYk7b.js} +1 -1
  24. package/dist/chunks/{mq-videocall-CwYtlPu6.js → mq-videocall-CMPrGJK6.js} +1 -1
  25. package/dist/chunks/{next-appointment-card-DLU7-wIv.js → next-appointment-card-BOzfcwjD.js} +1 -1
  26. package/dist/chunks/{next-appointment-card-CPg9FuOI.d.ts → next-appointment-card-Z5G1jqtz.d.ts} +4 -4
  27. package/dist/chunks/professional-overview-Ck_SPivX.js +1 -0
  28. package/dist/chunks/{professional-overview-mO3tuMuH.d.ts → professional-overview-QVHl_ITk.d.ts} +1 -0
  29. package/dist/chunks/pt_PT-dELUeDqB.js +1 -0
  30. package/dist/chunks/task-CqjSKFwZ.js +1 -0
  31. package/dist/chunks/{telemetry-client-K37KMdy_.js → telemetry-client-DA2_SZBC.js} +1 -1
  32. package/dist/env.js +1 -1
  33. package/dist/events.d.ts +1 -22
  34. package/dist/events.js +1 -1
  35. package/dist/i18n.js +1 -1
  36. package/dist/index.d.ts +1 -1
  37. package/dist/index.js +1 -1
  38. package/dist/mq-api-client-provider.d.ts +1 -1
  39. package/dist/mq-apple-pay-checkout.d.ts +1 -1
  40. package/dist/mq-apple-pay-checkout.js +1 -1
  41. package/dist/mq-appointment-checkout.d.ts +20 -14
  42. package/dist/mq-appointment-checkout.js +1 -1
  43. package/dist/mq-appointment-documentation.d.ts +4 -4
  44. package/dist/mq-appointment-documentation.js +1 -1
  45. package/dist/mq-chat-room.d.ts +3 -3
  46. package/dist/mq-chat-room.js +1 -1
  47. package/dist/mq-checkout.d.ts +44 -61
  48. package/dist/mq-checkout.js +1 -1
  49. package/dist/mq-dashboard.d.ts +6 -6
  50. package/dist/mq-dashboard.js +1 -1
  51. package/dist/mq-documents.d.ts +2 -2
  52. package/dist/mq-documents.js +1 -1
  53. package/dist/mq-google-pay-checkout.d.ts +1 -1
  54. package/dist/mq-google-pay-checkout.js +1 -1
  55. package/dist/mq-immediate-videocall-checkout.d.ts +10 -9
  56. package/dist/mq-immediate-videocall-checkout.js +1 -1
  57. package/dist/mq-my-appointments.d.ts +6 -6
  58. package/dist/mq-my-appointments.js +1 -1
  59. package/dist/mq-next-appointments.d.ts +5 -5
  60. package/dist/mq-next-appointments.js +1 -1
  61. package/dist/mq-payment-poller.d.ts +2 -2
  62. package/dist/mq-recent-documents.d.ts +2 -2
  63. package/dist/mq-recent-documents.js +1 -1
  64. package/dist/mq-schedule-success.d.ts +5 -5
  65. package/dist/mq-schedule-success.js +2 -2
  66. package/dist/mq-schedule.d.ts +52 -98
  67. package/dist/mq-schedule.js +1 -1
  68. package/dist/mq-support-chat.d.ts +3 -3
  69. package/dist/mq-support-chat.js +1 -1
  70. package/dist/mq-terms-and-conditions.d.ts +2 -2
  71. package/dist/mq-videocall.d.ts +5 -5
  72. package/dist/mq-videocall.js +1 -1
  73. package/dist/react/mq-api-client-provider.d.ts +1 -1
  74. package/dist/react/mq-apple-pay-checkout.d.ts +1 -1
  75. package/dist/react/mq-apple-pay-checkout.js +1 -1
  76. package/dist/react/mq-appointment-checkout.d.ts +12 -8
  77. package/dist/react/mq-appointment-checkout.js +1 -1
  78. package/dist/react/mq-appointment-documentation.d.ts +4 -4
  79. package/dist/react/mq-appointment-documentation.js +1 -1
  80. package/dist/react/mq-chat-room.d.ts +3 -3
  81. package/dist/react/mq-chat-room.js +1 -1
  82. package/dist/react/mq-checkout.d.ts +11 -8
  83. package/dist/react/mq-checkout.js +1 -1
  84. package/dist/react/mq-dashboard.d.ts +6 -6
  85. package/dist/react/mq-dashboard.js +1 -1
  86. package/dist/react/mq-documents-page.d.ts +2 -2
  87. package/dist/react/mq-documents-page.js +1 -1
  88. package/dist/react/mq-documents.d.ts +2 -2
  89. package/dist/react/mq-documents.js +1 -1
  90. package/dist/react/mq-google-pay-checkout.d.ts +1 -1
  91. package/dist/react/mq-google-pay-checkout.js +1 -1
  92. package/dist/react/mq-immediate-videocall-checkout.d.ts +4 -2
  93. package/dist/react/mq-immediate-videocall-checkout.js +1 -1
  94. package/dist/react/mq-my-appointments.d.ts +6 -6
  95. package/dist/react/mq-my-appointments.js +1 -1
  96. package/dist/react/mq-next-appointments.d.ts +5 -5
  97. package/dist/react/mq-next-appointments.js +1 -1
  98. package/dist/react/mq-payment-poller.d.ts +1 -1
  99. package/dist/react/mq-recent-documents.d.ts +2 -2
  100. package/dist/react/mq-recent-documents.js +1 -1
  101. package/dist/react/mq-schedule-success.d.ts +5 -5
  102. package/dist/react/mq-schedule-success.js +1 -1
  103. package/dist/react/mq-schedule.d.ts +4 -14
  104. package/dist/react/mq-schedule.js +1 -1
  105. package/dist/react/mq-support-chat.d.ts +3 -3
  106. package/dist/react/mq-support-chat.js +1 -1
  107. package/dist/react/mq-terms-and-conditions.d.ts +2 -2
  108. package/dist/react/mq-videocall.d.ts +5 -5
  109. package/dist/react/mq-videocall.js +1 -1
  110. package/dist/ui/mq-calendar.js +1 -1
  111. package/dist/ui/mq-tabs.js +49 -22
  112. package/package.json +2 -2
  113. package/dist/chunks/appointment-details-BYGwLfww.js +0 -1
  114. package/dist/chunks/ca_ES-BOvS9ayb.js +0 -1
  115. package/dist/chunks/de_DE-B-4V4SgD.js +0 -1
  116. package/dist/chunks/en_US-CgxjeeCm.js +0 -1
  117. package/dist/chunks/mq-chat-room-B_WgeuXn.js +0 -1
  118. package/dist/chunks/mq-schedule-BfW7y8uG.js +0 -1
  119. package/dist/chunks/professional-overview-B4E05rLd.js +0 -1
  120. package/dist/chunks/pt_PT-Vb6hoo2l.js +0 -1
  121. package/dist/chunks/task-Bj8p7kJX.js +0 -1
@@ -1 +1 @@
1
- import{_ as t,c as e}from"./custom-element-D2ziPxYE.js";import{a as i,i as o,E as s,x as n}from"./lit-element-DiWJYFwC.js";import{n as r}from"./property-scuRaFcM.js";import{spinnerIcon as a}from"../ui/icons/spinner-icon.js";import{e as l}from"./provide-BwI4DDGF.js";import{c as d}from"./consume-CovVqBjI.js";import{h as c}from"./task-Bj8p7kJX.js";import{A as p}from"./api-client-context-BXGqBAlO.js";import{f as h,A as m,C as u,c as v,n as g,i as b}from"./api-chat-client-s45J7LKB.js";import{r as f}from"./state-LQivXIgA.js";import{n as y}from"./create-context-DqP79qjF.js";import{g as w,p as x,a as k}from"./chunk-NIAGR3ZC-BDlNUZa1.js";import{env as $}from"../env.js";import{m as C}from"./runtime-Bg1WXVCx.js";import{l as E}from"./localized-decorator-BlOuLhym.js";import{a as _}from"./addSeconds-fO5orJrt.js";import{getLocale as S}from"../i18n.js";import{calendarIcon as z}from"../ui/icons/calendar-icon.js";import"../ui/mq-page-title.js";import"./professional-overview-B4E05rLd.js";import{MqViewAppointmentsEvent as T}from"../events.js";import{clockIcon as O}from"../ui/icons/clock-icon.js";import"./documentation-view-BSt0gtCR.js";import{l as q}from"./chunk-S5RWG6G2-CQJ38pW6.js";import{t as I,u as j,w as R,x as V,y as A}from"./telemetry-client-K37KMdy_.js";import"./mq-chat-room-B_WgeuXn.js";import{chatbubbleIcon as N}from"../ui/icons/chat-bubble-icon.js";import{micIcon as U}from"../ui/icons/mic-icon.js";import{micOffIcon as P}from"../ui/icons/mic-off-icon.js";import{videoIcon as W}from"../ui/icons/video-icon.js";import{videoOffIcon as M}from"../ui/icons/video-off-icon.js";import"../ui/mq-unread-badge.js";import{Q as D}from"./query-controller-B1byDHlF.js";import{g as K}from"./chunk-Y4EKUX25-Bix9r5ry.js";import{l as L}from"./chunk-FUCSYDW7-Duj5hy8S.js";import"../ui/mq-floating-bubble.js";import{e as F}from"./query-CeeutdfT.js";import{M as B}from"./mutation-controller-CR2qcqhH.js";import{alertCircleIcon as H}from"../ui/icons/alert-circle-icon.js";import"../ui/mq-rating.js";import{toast as G}from"../ui/mq-toast.js";import{heartBeatIcon as Q}from"../ui/icons/heartbeat-icon.js";import{timeLeftIcon as Y}from"../ui/icons/time-left-icon.js";import"./mq-layout-BndHxkbb.js";class PermissionController{constructor(t){this.state="prompt",this.host=t,t.addController(this)}async hostConnected(){await this.requestPermissions()}async requestPermissions(){try{const t=await navigator.mediaDevices.getUserMedia({video:!0,audio:!0});for(const e of t.getTracks())e.stop();this.state="granted"}catch{this.state="denied"}finally{this.host.requestUpdate()}}}class InvalidTokenError extends Error{}function Z(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(t){return decodeURIComponent(atob(t).replace(/(.)/g,(t,e)=>{let i=e.charCodeAt(0).toString(16).toUpperCase();return i.length<2&&(i="0"+i),"%"+i}))}(e)}catch(t){return atob(e)}}InvalidTokenError.prototype.name="InvalidTokenError";const J=y(Symbol("opentok-service")),X=y(Symbol("params"));class OpenTokService{static{this.URL="https://static.opentok.com/v2/js/opentok.min.js"}_ensureLoaded(){if(!window.OT)throw new Error("OpenTok SDK is not loaded");return window.OT}load(){return new Promise((t,e)=>{if(window.OT)return void t();const i=document.createElement("script");i.src=OpenTokService.URL,i.onload=()=>{t()},i.onerror=e,document.head.appendChild(i)})}initSession(t,e){return this._ensureLoaded().initSession(t,e)}initPublisher(t,e,i){return this._ensureLoaded().initPublisher(t,e,i)}subscribe(t,e,i,o,s){return t.subscribe(e,i,o,s)}}const tt="waiting-room",et="videocall",it="documentation",ot="not-time-yet",st="review";class OpenTokController{constructor(t,e,i,o,s,n){this.isLoading=!0,this.isSessionReady=!1,this.isReconnecting=!1,this.errorMessage="",this.session=null,this.streams=[],this.destroyedStreamIds=new Set,this.openTokService=new OpenTokService,this.session_token=null,this.hasLeftWaitingRoom=!1,this.host=t,this.apiClient=e,t.addController(this),this.appointment=i,this.token=o,this.onCallStarted=s,this.onCallFinished=n,this._loadOpentok()}async _loadOpentok(){try{await this.openTokService.load(),this._initializeSession()}catch{this.isLoading=!1,this.errorMessage="Failed to load OpenTok script",this.host.requestUpdate()}}async _getSessionAndToken(){const t=await this.apiClient.flash.joinCall({callId:this.appointment.call_id});return this.session_token=t.session_token,[t.session_id,t.session_token]}async _initializeSession(){try{const[t,e]=await this._getSessionAndToken();this.session=this.openTokService.initSession($.OPENTOK_API_KEY,t),this.session.on("sessionConnected",()=>{this.isLoading=!1,this.isSessionReady=!0,this.host.requestUpdate()}),this.session.on("sessionDisconnected",()=>{this.isSessionReady=!1,this._leaveWaitingRoom(),setTimeout(()=>{this.onCallFinished(),this.host.requestUpdate()},1e3),this.host.requestUpdate()}),this.session.on("sessionReconnecting",()=>{this.isReconnecting=!0,this.host.requestUpdate()}),this.session.on("sessionReconnected",()=>{this.isReconnecting=!1;const t=this.streams.filter(t=>!this.destroyedStreamIds.has(t.streamId));this.streams=[],this.host.requestUpdate(),requestAnimationFrame(()=>{this.streams=t.filter(t=>!this.destroyedStreamIds.has(t.streamId)),this.host.requestUpdate()})}),this.session.on("streamCreated",t=>{this.streams=[...this.streams,t.stream],this.onCallStarted(),this.host.requestUpdate()}),this.session.on("streamDestroyed",t=>{t.stream?.streamId&&this.destroyedStreamIds.add(t.stream.streamId),setTimeout(()=>{this.streams=this.streams.filter(e=>e.streamId!==t.stream?.streamId),this._leaveWaitingRoom(),this.onCallFinished(),this.host.requestUpdate()},1e3)}),this.session.connect(e,t=>{t&&(this.isLoading=!1,this.errorMessage=`Failed to connect to session: ${t.message}`,this.host.requestUpdate())}),this.apiClient.flash.setReady({professional_hash:this.appointment.from.hash,consultation_id:this.appointment.id,consultation_type:"appointment"})}catch(t){this.isLoading=!1,this.errorMessage=`Error initializing session: ${t instanceof Error?t.message:"Unknown error"}`,this.host.requestUpdate()}}_leaveWaitingRoom(){this.hasLeftWaitingRoom||(this.hasLeftWaitingRoom=!0,this.apiClient.flash.leaveWaitingRoom({professional_hash:this.appointment.from.hash,consultation_id:this.appointment.id,consultation_type:"appointment"}))}hostDisconnected(){this._leaveWaitingRoom(),this.session&&(this.session.disconnect(),this.session.off("streamCreated"),this.session.off("streamDestroyed"),this.session.off("sessionConnected"),this.session.off("sessionDisconnected"),this.session.off("sessionReconnecting"),this.session.off("sessionReconnected"))}}let nt=class NotTimeYetView extends i{static{this.styles=[o`mq-page-title{margin-bottom:var(--size-3)}.description{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);color:var(--color-neutrals-text-default);font-weight:var(--font-weight-normal);margin:0;margin-bottom:var(--size-3)}.details-card{background-color:var(--color-background);border-radius:var(--border-radius-xl);padding:var(--size-6) var(--size-4);display:flex;min-width:0;flex-direction:column;gap:var(--size-6);margin-bottom:var(--size-6)}.details-card-title{padding:14px 0;font-size:var(--text-base);line-height:100%;font-weight:var(--font-weight-medium);color:var(--color-gray-darker);text-align:left}.details-rows{display:flex;flex-direction:column;gap:var(--size-3)}.details-row{display:flex;align-items:center;gap:var(--size-2);font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);color:var(--color-neutrals-text-default);font-weight:var(--font-weight-semibold)}.details-row span::first-letter{text-transform:uppercase}@media (min-width:768px){.description{font-size:var(--text-base);line-height:var(--text-base--line-height);margin-bottom:var(--sp-6)}}`]}firstUpdated(){I.track(j(this.loginToken.patient.hash,this.appointment.id??""))}render(){const t=S()?.replace("_","-")??"es-ES",e=w(this.loginToken.patient.timezone),i=new Intl.DateTimeFormat(t,{dateStyle:"full",...e?{timeZone:e}:{}}),o=new Intl.DateTimeFormat(t,{timeStyle:"short",...e?{timeZone:e}:{}}),r=x(this.appointment.start_date),a=_(r,this.appointment.duration),l=e?k(e,r):"";return n`<mq-page-title .title="${C("¡Aún no es la hora!")}" back-label="${C("Salir")}" @mq-back="${t=>{t.stopPropagation(),this.dispatchEvent(new T({tab:"next"}))}}"></mq-page-title><p class="description">${C("Cuando falten 10 minutos para tu consulta, podrás acceder a la videoconsulta")}</p><div class="details-card"><professional-overview .name="${this.appointment.from.name??""}" .specialtyName="${this.appointment.from.speciality??""}" .collegiateNumber="${this.appointment.from.collegiate_number??void 0}" .description="${this.appointment.from.description??""}" .languages="${this.appointment.from.languages}" .avatar="${this.appointment.from.avatar??""}"></professional-overview><div class="details-rows"><div class="details-row">${z({size:24})} <span>${i.format(r)}</span></div><div class="details-row">${O({size:24})} <span>${o.format(r)} - ${o.format(a)}${l?` (${l})`:""}</span></div></div></div>${!0===this.appointment.has_chat_in_appointment?n`<chat-cta .consultationId="${this.appointment.id}" .roomId="${Number(this.appointment.room_id)}" .professionalHash="${this.appointment.from.hash}" .text="${C("Utiliza el chat para enviar el motivo de consulta, documentos o imágenes")}" .onOpenChat="${()=>{I.track(R(this.loginToken.patient.hash,this.appointment.id??""))}}"></chat-cta>`:s}`}};t([r({type:Object})],nt.prototype,"appointment",void 0),t([d({context:q})],nt.prototype,"loginToken",void 0),nt=t([E(),e("not-time-yet-view")],nt);let rt=class PermissionStatusBanner extends i{static{this.styles=o`:host{display:block;padding:var(--size-5) var(--size-6);background-color:#ebf9ff;border-radius:var(--border-radius-lg);text-align:center}span{color:var(--color-neutrals-text-default);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal)}`}render(){return n`<span>${C("Espera a ser atendido sin salir de esta pantalla")}</span>`}};rt=t([E(),e("permission-status-banner")],rt);let at=class WaitingRoomLayout extends i{constructor(){super(...arguments),this.isWaitingRoom=!1}static{this.styles=o`.information-container{padding:var(--size-5) var(--size-4);background-color:var(--color-neutrals-background-disabled)}mq-page-title{margin-bottom:var(--size-4)}.content{max-width:560px;margin:0 auto}.information-container p{font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default);margin:0}.video-container{margin-left:auto;margin-right:auto;margin-bottom:var(--size-6);position:relative;max-height:301px;aspect-ratio:9/16;border-radius:16px;overflow:hidden}@media (min-width:768px){.information-container{background-color:transparent;padding:var(--size-6) 0}.video-container{max-height:454px;aspect-ratio:16/9}.information-container p{font-size:var(--text-base);line-height:var(--text-base--line-height)}}`}firstUpdated(){this.isWaitingRoom&&I.track(V(this.loginToken.patient.hash,this.appointment.id??""))}render(){if(!this.isWaitingRoom)return n`<slot></slot>`;const t=S()?.replace("_","-")??"es-ES",e=w(this.loginToken.patient.timezone),i=e?{timeZone:e}:{},o=new Intl.DateTimeFormat(t,{dateStyle:"short",...i}),r=new Intl.DateTimeFormat(t,{timeStyle:"short",...i}),a=x(this.appointment.start_date),l=_(a,this.appointment.duration),d=e?k(e,a):"",c=o.format(a),p=`${r.format(a)} - ${r.format(l)}${d?` (${d})`:""}`;return n`<permission-status-banner></permission-status-banner><div class="content"><div class="information-container"><mq-page-title .title="${C("Sala de espera")}" back-label="${C("Salir")}" @mq-back="${t=>{t.stopPropagation(),this.dispatchEvent(new T({tab:"next"}))}}"></mq-page-title><div class="doctor-info"><p>${this.appointment.from.name}</p><p>${c}</p><p>${p}</p></div></div><div class="video-container"><slot></slot></div>${!0===this.appointment.has_chat_in_appointment?n`<chat-cta .consultationId="${this.appointment.id}" .roomId="${Number(this.appointment.room_id)}" .professionalHash="${this.appointment.from.hash}" .text="${C("Utiliza el chat para enviar el motivo de consulta, documentos o imágenes")}" .onOpenChat="${()=>{I.track(R(this.loginToken.patient.hash,this.appointment.id??""))}}"></chat-cta>`:s}</div>`}};t([r({type:Object})],at.prototype,"appointment",void 0),t([r({type:Boolean,attribute:"is-waiting-room"})],at.prototype,"isWaitingRoom",void 0),t([d({context:q})],at.prototype,"loginToken",void 0),at=t([e("waiting-room-layout")],at);class AppointmentCounterController{constructor(t,e){this.startsAtGetter=e,this.formattedTime="--:--",this.interval=null,this.host=t,t.addController(this)}async hostConnected(){this.interval=setInterval(()=>{const t=new Date,e=this.startsAtGetter(),i=t.getTime()-e.getTime(),o=Math.floor(i/1e3),s=Math.floor(o/60),n=o%60;this.formattedTime=`${s.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`,this.host.requestUpdate()},1e3)}hostDisconnected(){this.interval&&clearInterval(this.interval)}}class ToggleAudioEvent extends Event{static{this.eventName="toggle-audio"}constructor(t){super(ToggleAudioEvent.eventName,{bubbles:!0,composed:!0}),this.isAudioOn=t}}class ToggleVideoEvent extends Event{static{this.eventName="toggle-video"}constructor(t){super(ToggleVideoEvent.eventName,{bubbles:!0,composed:!0}),this.isVideoOn=t}}class ToggleChatEvent extends Event{static{this.eventName="toggle-chat"}constructor(t){super(ToggleChatEvent.eventName,{bubbles:!0,composed:!0}),this.isChatOpen=t}}class ViewDocumentationEvent extends Event{static{this.eventName="view-documentation"}constructor(){super(ViewDocumentationEvent.eventName,{bubbles:!0,composed:!0})}}class DownloadFileEvent extends Event{static{this.eventName="download-file"}constructor(t,e){super(DownloadFileEvent.eventName,{bubbles:!0,composed:!0}),this.url=t,this.filename=e}}let lt=class PublisherControls extends i{constructor(){super(...arguments),this.isAudioOn=!1,this.isVideoOn=!0,this.isChatOpen=!1,this.chatEnabled=!1,this.isWaitingRoom=!1,this.unreadQuery=new D(this,()=>K(this.apiClient,{roomId:this.roomId}))}static{this.styles=o`:host{display:flex;justify-content:space-between;gap:var(--size-4)}:host([is-waiting-room]){justify-content:center}.left-controls{display:flex;gap:var(--size-4)}.control-button{border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;width:var(--size-10);height:var(--size-10);padding:var(--size-2);border-radius:12.5px;transition:all .2s ease-in-out}@media (min-width:768px){.control-button{width:var(--size-11);height:var(--size-11);padding:var(--size-2);border-radius:16px}}.control-button:hover{background-color:var(--color-gray-light)}.control-button:focus-visible{outline:0;box-shadow:0 0 0 2px var(--color-primary-light)}.control-button--on{background-color:var(--color-white);color:var(--color-primary)}.control-button--off{background-color:var(--color-white);color:var(--color-negative)}`}toggleAudio(){this.dispatchEvent(new ToggleAudioEvent(!this.isAudioOn))}toggleVideo(){this.dispatchEvent(new ToggleVideoEvent(!this.isVideoOn))}toggleChat(){this.dispatchEvent(new ToggleChatEvent(!this.isChatOpen))}render(){return n`<div class="left-controls">${this.isWaitingRoom||!this.chatEnabled?s:n`<button type="button" class="control-button control-button--on" @click="${this.toggleChat}">${N({size:20})} ${(this.unreadQuery.result?.data?.unread_count??0)>0?n`<mq-unread-badge></mq-unread-badge>`:s}</button>`} <button type="button" class="control-button ${this.isAudioOn?"control-button--on":"control-button--off"}" @click="${this.toggleAudio}">${this.isAudioOn?U({size:20}):P({size:20})}</button> <button type="button" class="control-button ${this.isVideoOn?"control-button--on":"control-button--off"}" @click="${this.toggleVideo}">${this.isVideoOn?W({size:20}):M({size:20})}</button></div>`}};t([d({context:p,subscribe:!0})],lt.prototype,"apiClient",void 0),t([r({type:Boolean})],lt.prototype,"isAudioOn",void 0),t([r({type:Boolean})],lt.prototype,"isVideoOn",void 0),t([r({type:Boolean})],lt.prototype,"isChatOpen",void 0),t([r({type:Boolean})],lt.prototype,"chatEnabled",void 0),t([r({type:Boolean,reflect:!0,attribute:"is-waiting-room"})],lt.prototype,"isWaitingRoom",void 0),t([r({type:Number})],lt.prototype,"roomId",void 0),lt=t([e("publisher-controls")],lt);let dt=class VideoPublisher extends i{constructor(){super(...arguments),this.isWaitingRoom=!1,this.hasChatInAppointment=!1,this.appointmentCounterController=new AppointmentCounterController(this,()=>x(this.startsAt)),this.isAudioOn=!0,this.isVideoOn=!0,this.isChatOpen=!1,this._handleVisibilityChange=()=>{"visible"===document.visibilityState&&this.publisher&&(this.publisher.publishAudio(!1),this.publisher.publishVideo(!1),setTimeout(()=>{this.publisher?.publishAudio(this.isAudioOn),this.publisher?.publishVideo(this.isVideoOn)},500))}}static{this.styles=o`:host{width:100%;height:100%;display:block}.OT_video-element{width:100%;height:100%;background:var(--color-black)}.OT_mute{display:none}video{border-radius:var(--border-radius-lg)}#video-publisher{width:100%;height:100%;transition:width .5s ease-in-out,height .5s ease-in-out;border-radius:var(--border-radius-lg)}:host(:not([is-waiting-room])) #video-publisher{width:121px;height:200px;z-index:50;border-radius:12px;overflow:hidden}:host([is-waiting-room]) .top-items{position:absolute;inset:0}:host(:not([is-waiting-room])) .top-items{position:absolute;z-index:50;top:var(--size-4);left:var(--size-4);right:var(--size-4);display:flex;justify-content:space-between;gap:var(--size-1)}.meta-container{display:flex;align-items:flex-start;gap:var(--size-1);min-width:0}.meta-item{background-color:var(--color-neutrals-text-default);padding:var(--size-2) var(--size-3);color:var(--color-white);font-size:var(--text-xs);line-height:var(--text-xs--line-height);flex-shrink:0}.meta-item:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-shrink:1;min-width:0}publisher-controls{position:absolute;z-index:50;bottom:var(--size-4);left:var(--size-4);right:var(--size-4)}mq-chat-room{height:100%}@media (min-width:768px){:host(:not([is-waiting-room])) #video-publisher{width:250px;height:auto;aspect-ratio:16/9}:host(:not([is-waiting-room])) .top-items{top:var(--size-6);left:var(--size-6);right:var(--size-6)}}`}firstUpdated(t){super.firstUpdated(t),this.publisher=this.openTokService.initPublisher(this.publisherEl,{fitMode:"contain",width:"100%",height:"100%",audioFallbackEnabled:!1,insertMode:"append",mirror:!1,publishAudio:this.isAudioOn,publishVideo:this.isVideoOn},t=>{t&&L.error("error initializing publisher",t),this.session.publish(this.publisher)}),document.addEventListener("visibilitychange",this._handleVisibilityChange)}disconnectedCallback(){document.removeEventListener("visibilitychange",this._handleVisibilityChange),super.disconnectedCallback(),this.publisher?.destroy()}async _handleToggleAudioEvent(t){this.isAudioOn=t.isAudioOn,this.publisher.publishAudio(t.isAudioOn)}async _handleToggleVideoEvent(t){this.isVideoOn=t.isVideoOn,this.publisher.publishVideo(t.isVideoOn)}async _handleToggleChatEvent(t){this.isChatOpen=t.isChatOpen}render(){return n`<div class="top-items">${this.isWaitingRoom?n`<div></div>`:n`<div class="meta-container"><span class="meta-item">${this.professionalName}</span> <span class="meta-item">${this.appointmentCounterController.formattedTime}</span></div>`}<div id="video-publisher"></div></div><publisher-controls .isAudioOn="${this.isAudioOn}" .isVideoOn="${this.isVideoOn}" .isChatOpen="${this.isChatOpen}" .chatEnabled="${this.hasChatInAppointment}" .roomId="${Number.parseInt(this.roomId,10)}" ?is-waiting-room="${this.isWaitingRoom}" @toggle-audio="${this._handleToggleAudioEvent}" @toggle-video="${this._handleToggleVideoEvent}" @toggle-chat="${this._handleToggleChatEvent}"></publisher-controls>${this.hasChatInAppointment?n`<mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" @mq-close="${()=>{this.isChatOpen=!1}}" hideCloseButton>${this.isChatOpen?n`<mq-chat-room slot="content" .consultationId="${this.consultationId}" .consultationType="${u.appointment}" token="${this.loginToken.access_token}" .roomId="${Number.parseInt(this.roomId,10)}" .professionalHash="${this.professionalHash}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}"></mq-chat-room>`:s}</mq-floating-bubble>`:s}`}};t([r({type:String})],dt.prototype,"consultationId",void 0),t([r({type:String})],dt.prototype,"apiKey",void 0),t([r({type:String})],dt.prototype,"token",void 0),t([r({type:String})],dt.prototype,"roomId",void 0),t([r({type:String})],dt.prototype,"professionalHash",void 0),t([r({type:Object})],dt.prototype,"session",void 0),t([r({type:String})],dt.prototype,"professionalName",void 0),t([r({type:String})],dt.prototype,"startsAt",void 0),t([r({type:Boolean,reflect:!0,attribute:"is-waiting-room"})],dt.prototype,"isWaitingRoom",void 0),t([r({type:Boolean})],dt.prototype,"hasChatInAppointment",void 0),t([d({context:J})],dt.prototype,"openTokService",void 0),t([d({context:q})],dt.prototype,"loginToken",void 0),t([F("#video-publisher")],dt.prototype,"publisherEl",void 0),t([f()],dt.prototype,"isAudioOn",void 0),t([f()],dt.prototype,"isVideoOn",void 0),t([f()],dt.prototype,"isChatOpen",void 0),dt=t([e("video-publisher")],dt);let ct=class VideoSubscriber extends i{constructor(){super(...arguments),this.isVideoOn=!0,this._subscriberProperties={fitMode:"contain",insertMode:"append",width:"100%",height:"100%"},this._handleVisibilityChange=()=>{"visible"===document.visibilityState&&this.subscriber&&(this.subscriber.subscribeToAudio(!1),this.subscriber.subscribeToVideo(!1),setTimeout(()=>{this.subscriber?.subscribeToAudio(!0),this.subscriber?.subscribeToVideo(!0)},500),setTimeout(()=>this._resubscribe(),600))}}static{this.styles=o`:host{position:absolute;inset:0}.OT_subscriber{width:100%;height:100%;position:absolute;inset:0;background:var(--color-neutrals-background-default)}video{width:100%;height:100%}.video-disabled{position:absolute;inset:0;background:var(--color-gray-dark)}.hidden{display:none}`}firstUpdated(){this._subscribe(),document.addEventListener("visibilitychange",this._handleVisibilityChange)}_subscribe(){this.subscriber=this.openTokService.subscribe(this.session,this.stream,this.subscriberEl,this._subscriberProperties,t=>{}),this._attachSubscriberEvents()}_attachSubscriberEvents(){this.subscriber.on("connected",t=>{this.isVideoOn=t.target.stream?.hasVideo??!0}),this.subscriber.on("videoDisabled",()=>{this.isVideoOn=!1}),this.subscriber.on("videoEnabled",()=>{this.isVideoOn=!0}),this.subscriber.on("disconnected",()=>{this.isVideoOn=!1})}_resubscribe(){if(this.subscriber&&this.session&&this.subscriberEl){try{this.session.unsubscribe(this.subscriber)}catch{}this.subscriberEl.innerHTML="",this._subscribe()}}disconnectedCallback(){if(document.removeEventListener("visibilitychange",this._handleVisibilityChange),this.subscriber&&this.session)try{this.session.unsubscribe(this.subscriber)}catch{}super.disconnectedCallback()}render(){return n`<div id="video-subscriber" class="${this.isVideoOn?"":"hidden"}"></div>${this.isVideoOn?n``:n`<div class="video-disabled"></div>`}`}};t([r({type:Object})],ct.prototype,"session",void 0),t([r({type:Object})],ct.prototype,"stream",void 0),t([f()],ct.prototype,"isVideoOn",void 0),t([d({context:J})],ct.prototype,"openTokService",void 0),t([F("#video-subscriber")],ct.prototype,"subscriberEl",void 0),ct=t([e("video-subscriber")],ct);let pt=class VideocallContent extends i{constructor(){super(...arguments),this.streams=[],this.isWaitingRoom=!1,this.isReconnecting=!1}static{this.styles=o`:host{display:block;position:relative;width:100%;height:100%;background:var(--color-gray-darkest);aspect-ratio:16/9}.reconnecting-overlay{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--size-3);background:rgba(0,0,0,.6);z-index:100}.reconnecting-overlay__text{color:var(--color-white);font-size:var(--text-sm);line-height:var(--text-sm--line-height)}.reconnecting-overlay__subtitle{color:var(--color-white);font-size:var(--text-xs);line-height:var(--text-xs--line-height);opacity:.85}`}firstUpdated(){this.isWaitingRoom||I.track(A(this.loginToken.patient.hash,this.appointment.id??""))}updated(t){t.has("isWaitingRoom")&&!0===t.get("isWaitingRoom")&&!this.isWaitingRoom&&I.track(A(this.loginToken.patient.hash,this.appointment.id??""))}render(){return n`<video-publisher .consultationId="${this.appointment.id}" .session="${this.session}" ?is-waiting-room="${this.isWaitingRoom}" .professionalName="${this.appointment.from.name??""}" .professionalHash="${this.appointment.from.hash}" .startsAt="${this.appointment.started_at??(new Date).toISOString()}" .apiKey="${this.apiKey}" .token="${this.token}" .roomId="${this.appointment.room_id}" .hasChatInAppointment="${!0===this.appointment.has_chat_in_appointment}"></video-publisher>${0===this.streams.length?n``:this.streams.map(t=>n`<video-subscriber .session="${this.session}" .stream="${t}"></video-subscriber>`)} ${this.isReconnecting?n`<div class="reconnecting-overlay">${a({color:"var(--color-white)"})} <span class="reconnecting-overlay__text">${C("Reconectando...")} </span><span class="reconnecting-overlay__subtitle">${C("Espere mientras se restablece la conexión")}</span></div>`:""}`}};t([r({type:Object})],pt.prototype,"session",void 0),t([r({type:Array})],pt.prototype,"streams",void 0),t([r({type:String})],pt.prototype,"apiKey",void 0),t([r({type:String})],pt.prototype,"token",void 0),t([r({type:Object})],pt.prototype,"appointment",void 0),t([r({type:Boolean,reflect:!0,attribute:"is-waiting-room"})],pt.prototype,"isWaitingRoom",void 0),t([r({type:Boolean,reflect:!0,attribute:"is-reconnecting"})],pt.prototype,"isReconnecting",void 0),t([d({context:q})],pt.prototype,"loginToken",void 0),pt=t([E(),e("mq-videocall-content")],pt);class ReviewSubmittedEvent extends Event{static{this.eventName="review-submitted"}constructor(){super(ReviewSubmittedEvent.eventName,{bubbles:!0,composed:!0})}}class ReviewSkippedEvent extends Event{static{this.eventName="review-skipped"}constructor(){super(ReviewSkippedEvent.eventName,{bubbles:!0,composed:!0})}}let ht=class ReviewView extends i{constructor(){super(...arguments),this.rating=0,this.comment="",this._reviewMutation=new B(this,{mutationFn:({rating:t,comment:e})=>this.apiClient.consultations.postReview({consultation_id:this.appointment.id??"",consultation_type:u.appointment,rating:t,comment:e.trim()?e.trim():null}),onSuccess:()=>{this.dispatchEvent(new ReviewSubmittedEvent)},onError:t=>{!function(t){const e=t,i=e?.response?.status;return 400===i&&/already exists/i.test(e?.response?.data?.message??"")}(t)?G.error(C("No se ha podido enviar el cuestionario")):this.dispatchEvent(new ReviewSubmittedEvent)}}),this._reconnectMutation=new B(this,{mutationFn:t=>this.apiClient.appointments.reconnectAppointment(t),onSuccess:()=>{this.dispatchEvent(new CustomEvent("review-reconnect",{bubbles:!0,composed:!0}))},onError:()=>{G.error(C("No se ha podido volver a la sala de espera"))}}),this.handleSkip=()=>{this.dispatchEvent(new ReviewSkippedEvent)},this.handleSubmit=()=>{this.rating<1||this.rating>5||this._reviewMutation.isPending||this._reviewMutation.run({rating:this.rating,comment:this.comment})}}static{this.styles=o`:host{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100%;background-color:var(--color-background);box-sizing:border-box}.container{width:100%;max-width:500px;padding:var(--sp-6);display:flex;flex-direction:column;gap:var(--sp-5);box-sizing:border-box}.title{margin:0;padding:0 var(--sp-6);font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-normal);color:var(--color-primary);text-align:center}.rating{display:flex;flex-direction:column;align-items:center;gap:var(--sp-2);padding:var(--sp-1) var(--sp-6)}.subtitle{margin:0;font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);color:var(--color-text-icons--secondary);text-align:center}.comment-card{background-color:var(--color-white);border:var(--action-border-width) solid var(--color-border);border-radius:var(--border-radius-lg);box-shadow:0 4px 4px rgba(0,0,0,.05);padding:var(--sp-5);display:flex;flex-direction:column;gap:var(--sp-5)}.comment-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--sp-3)}.comment-label{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm);font-weight:var(--font-weight-medium);color:var(--color-neutrals-text-default)}.comment-counter{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-text-icons--secondary);white-space:nowrap}.textarea{width:100%;box-sizing:border-box;height:var(--size-44);padding:var(--sp-3) var(--sp-4);background-color:var(--color-gray-lighter);border:var(--action-border-width) solid var(--color-border);border-radius:var(--border-radius-md);font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);color:var(--color-neutrals-text-default);resize:none}.textarea::placeholder{color:var(--color-text-icons--secondary);opacity:.6}.textarea:focus{outline:0;border-color:var(--color-primary)}.actions{display:flex;gap:var(--sp-4)}.btn{flex:1;height:var(--button-height-md);padding:var(--sp-2) var(--sp-4);border-radius:var(--border-radius-md);font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-medium);cursor:pointer;transition:opacity .15s ease-in-out}.btn:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}.btn:disabled{cursor:not-allowed}.btn-skip{background:var(--color-white);border:var(--action-border-width) solid var(--color-primary);color:var(--color-primary)}.btn-skip:hover:not(:disabled){background:var(--color-primary-background-extraWeak)}.btn-submit{background:var(--color-primary);border:var(--action-border-width) solid var(--color-primary);color:var(--color-white)}.btn-submit:hover:not(:disabled){background:var(--color-primary-dark)}.btn-submit:disabled{opacity:.5}.waiting-card{background-color:var(--color-background-primary-light);border-radius:var(--border-radius-lg);padding:var(--sp-4);display:flex;flex-direction:column;gap:var(--sp-2)}.waiting-header{display:flex;align-items:center;gap:var(--sp-2);color:var(--color-neutrals-text-default)}.waiting-title{font-family:var(--font-body);font-size:var(--text-xs);line-height:1;font-weight:var(--font-weight-medium);color:var(--color-neutrals-text-default)}.waiting-body{margin:0;font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);color:var(--color-text-icons--secondary)}.waiting-link{background:0 0;border:0;padding:0;cursor:pointer;color:#3c50ec;font:inherit;text-decoration:none}.waiting-link:hover{text-decoration:none}.waiting-link:disabled{cursor:not-allowed;opacity:.6}`}render(){return n`<div class="container"><h1 class="title">${C("¿Qué tal ha ido tu cita?")}</h1><div class="rating"><mq-rating .value="${this.rating}" .label="${C("Valoración de la consulta")}" @mq-rating-change="${t=>{this.rating=t.value}}"></mq-rating><p class="subtitle">${C("(1 es muy malo, 5 es excelente)")}</p></div><div class="comment-card"><div class="comment-header"><span class="comment-label">${C("¿Tienes comentarios sobre la consulta?")}</span> <span class="comment-counter">${this.comment.length}/${240}</span></div><textarea class="textarea" maxlength="${240}" placeholder="${C("Comparte cómo fue la atención o si tuviste algún problema con la videollamada…")}" .value="${this.comment}" @input="${t=>{this.comment=t.target.value}}"></textarea><div class="actions"><button type="button" class="btn btn-skip" ?disabled="${this._reviewMutation.isPending}" @click="${this.handleSkip}">${C("Omitir")}</button> <button type="button" class="btn btn-submit" ?disabled="${this.rating<1||this._reviewMutation.isPending}" @click="${this.handleSubmit}">${C("Enviar")}</button></div></div><div class="waiting-card"><div class="waiting-header">${H({color:"currentColor",size:18})} <span class="waiting-title">${C("¿Ocurrió algún problema?")}</span></div><p class="waiting-body">${C("Si la cita no se ha podido realizar, puedes")} <button type="button" class="waiting-link" ?disabled="${this._reconnectMutation.isPending}" @click="${()=>this._reconnectMutation.run({appointmentId:this.appointment.id})}">${C("volver a la sala de espera.")}</button></p></div></div>`}};t([d({context:p,subscribe:!0})],ht.prototype,"apiClient",void 0),t([r({type:Object})],ht.prototype,"appointment",void 0),t([f()],ht.prototype,"rating",void 0),t([f()],ht.prototype,"comment",void 0),ht=t([E(),e("review-view")],ht);let mt=class ErrorView extends i{static{this.styles=o`.container{display:grid;place-items:center;width:100%;max-width:447px;margin:0 auto}.card>:not(:first-child){margin-top:var(--size-8)}.title{font-family:var(--font-titles);color:var(--color-neutrals-text-default);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0;margin-bottom:var(--size-3)}.description{color:var(--color-neutrals-text-default);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:400}`}render(){return n`<div class="container"><div class="card"><slot name="icon"></slot><div class="content"><h1 class="title">${this.title}</h1><p class="description">${this.message}</p></div></div></div>`}};t([r({type:String})],mt.prototype,"title",void 0),t([r({type:String})],mt.prototype,"message",void 0),mt=t([e("error-view")],mt);let ut=class UnexpectedErrorView extends i{render(){return n`<error-view .title="${C("Error desconocido")}" .message="${C("Ha ocurrido un error al cargar la página. Por favor, intenta nuevamente o contacta al soporte.")}"><div slot="icon">${Q()}</div></error-view>`}};ut=t([E(),e("unexpected-error-view")],ut);let vt=class ExpiredAppointmentErrorView extends i{render(){return n`<error-view .title="${C("Consulta caducada")}" .message="${C("Parece que no te hemos encontrado a la hora de tu cita. Puedes programar otra consulta para resolver tus dudas.")}"><div slot="icon">${Y()}</div></error-view>`}};vt=t([E(),e("expired-appointment-error-view")],vt);let gt=class NotFoundErrorView extends i{static{this.styles=o`div{display:flex;flex-direction:column;gap:2px}span{font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:400;color:var(--color-gray-medium)}`}render(){return n`<error-view .title="${C("Página no encontrada")}" .message="${C("La página que estás buscando fue removida, renombrada o puede que no exista.")}"><div slot="icon"><span>404</span> ${Q()}</div></error-view>`}};function bt(t){try{return function(t,e){if("string"!=typeof t)throw new InvalidTokenError("Invalid token specified: must be a string");e||(e={});const i=!0===e.header?0:1,o=t.split(".")[i];if("string"!=typeof o)throw new InvalidTokenError(`Invalid token specified: missing part #${i+1}`);let s;try{s=Z(o)}catch(t){throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${i+1} (${t.message})`)}try{return JSON.parse(s)}catch(t){throw new InvalidTokenError(`Invalid token specified: invalid json for part #${i+1} (${t.message})`)}}(t)}catch{return null}}gt=t([E(),e("not-found-error-view")],gt);let ft=class MqVideocallProvider extends i{static{this.styles=o`*{box-sizing:border-box}:host{display:block;margin:0 auto;width:100%;height:100%}.centered{display:grid;place-items:center;height:100%;min-height:var(--mq-container-min-height)}documentation-view{display:block;padding:var(--sp-4)}`}constructor(){super(),this.apiClient=v(),this.opentokService=new OpenTokService,this.params={appointmentId:this.appointmentId,token:this.token,apiKey:this.apiKey},this.appointmentTask=new c(this,{task:async([t,,])=>{const[e,i,o]=await Promise.all([this.apiClient.flash.getAppointment({appointmentId:t}),this.apiClient.consultations.getReview(t).then(()=>!0).catch(()=>!1),this.apiClient.organizations.getOrganizationSetup().catch(()=>{})]);return{appointment:e,hasReview:i,hasNps:!0===o?.appointments?.has_nps}},args:()=>[this.appointmentId,this.apiKey,this.token]})}willUpdate(t){const e=g(t,{apiKey:this.apiKey,token:this.token},this.inheritedApiClient);if(e&&(this.apiClient=e),this.appointmentTask.value&&!this.opentokController){const{appointment:t,hasReview:e,hasNps:i}=this.appointmentTask.value,o=function(t,e){return h(t)?t.status===m.finished||t.status===m.reporting?e?st:it:tt:ot}(t,i);this.screen=o===st&&e?it:o,this.params={appointmentId:this.appointmentId,token:this.token,apiKey:this.apiKey},this.opentokController=new OpenTokController(this,this.apiClient,t,this.token,()=>{this.screen=et},()=>{this.screen=!i||e?it:st})}}render(){const t=n`<div class="centered">${a({color:"var(--color-primary)"})}</div>`,e=n`<mq-layout background="transparent"><not-found-error-view></not-found-error-view></mq-layout>`;return this.appointmentTask.render({pending:()=>t,error:t=>{const i=bt(this.token);return i?.exp&&i.exp<Date.now()/1e3?n`<mq-layout background="transparent"><expired-appointment-error-view></expired-appointment-error-view></mq-layout>`:b(t)&&t.response?.status&&t.response.status<500?e:n`<mq-layout background="transparent"><unexpected-error-view></unexpected-error-view></mq-layout>`},complete:({appointment:i,hasNps:o})=>{if(this.opentokController?.isLoading)return t;if(this.opentokController?.errorMessage||!this.opentokController)return e;if(this.screen===ot)return n`<mq-layout background="transparent"><not-time-yet-view .appointment="${i}"></not-time-yet-view></mq-layout>`;if(this.screen===st)return n`<mq-layout background="transparent"><review-view .appointment="${i}" @review-submitted="${()=>{this.screen=it}}" @review-skipped="${()=>{this.screen=it}}" @review-reconnect="${()=>{this.screen=tt}}"></review-view></mq-layout>`;if(this.screen===it)return n`<mq-layout background="transparent"><documentation-view .appointment="${i}" .token="${this.token}" ?can-reconnect="${!o}" @reconnect="${()=>{this.screen=tt}}"></documentation-view></mq-layout>`;if(this.screen===tt||this.screen===et){const e=this.opentokController.session;return e?n`<waiting-room-layout .appointment="${i}" ?is-waiting-room="${this.screen===tt}"><mq-videocall-content .apiKey="${this.apiKey}" .token="${this.token}" .session="${e}" .streams="${this.opentokController?.streams??[]}" ?is-waiting-room="${this.screen===tt}" ?is-reconnecting="${this.opentokController.isReconnecting}" .appointment="${i}"></mq-videocall-content></waiting-room-layout>`:t}return n`<mq-layout background="transparent"><unexpected-error-view></unexpected-error-view></mq-layout>`}})}};t([r({type:String,attribute:"appointment-id"})],ft.prototype,"appointmentId",void 0),t([r({type:String,attribute:"api-key"})],ft.prototype,"apiKey",void 0),t([r({type:String})],ft.prototype,"token",void 0),t([d({context:p,subscribe:!0}),f()],ft.prototype,"inheritedApiClient",void 0),t([l({context:p}),f()],ft.prototype,"apiClient",void 0),t([f()],ft.prototype,"screen",void 0),t([l({context:J})],ft.prototype,"opentokService",void 0),t([l({context:X})],ft.prototype,"params",void 0),ft=t([e("mq-videocall-provider")],ft);let yt=class PermissionsRequiredErrorView extends i{static{this.styles=o`.img-container{display:flex;justify-content:center}img{width:100%;height:auto;max-width:229px}`}render(){return n`<error-view .title="${C("Acepta los permisos de cámara y micrófono")}" .message="${C("Parece que has denegado los permisos necesarios para entrar a la videollamada. Edita los permisos en tu navegador para entrar. Una vez concedidos, debes refrescar esta pantalla.")}"><div class="img-container" slot="icon"><img src="${`${$.ASSETS_BASE_URL}/wc-videocall/Miccam_asset.png`}" alt="Miccam_asset" width="229" height="166.44"></div></error-view>`}};yt=t([E(),e("permissions-required-error-view")],yt);let wt=class MqVideocall extends i{constructor(){super(...arguments),this._permissionController=new PermissionController(this)}static{this.styles=o`:host{display:block;width:100%;height:100%}.loading-spinner-container{height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center}.permissions-required-error-view-container{height:100%;padding-left:var(--size-4);padding-right:var(--size-4);display:grid;place-items:center}`}render(){return"prompt"===this._permissionController.state?n`<div class="loading-spinner-container">${a({color:"var(--color-primary)"})}</div>`:"denied"===this._permissionController.state?n`<div class="permissions-required-error-view-container"><permissions-required-error-view></permissions-required-error-view></div>`:n`<mq-videocall-provider .appointmentId="${this.appointmentId}" .token="${this.token}" .apiKey="${this.apiKey}"></mq-videocall-provider>`}};t([r({type:String,attribute:"appointment-id"})],wt.prototype,"appointmentId",void 0),t([r({type:String,attribute:"api-key"})],wt.prototype,"apiKey",void 0),t([r({type:String})],wt.prototype,"token",void 0),wt=t([e("mq-videocall")],wt);export{DownloadFileEvent as D,wt as M,ReviewSkippedEvent as R,ToggleAudioEvent as T,ViewDocumentationEvent as V,ReviewSubmittedEvent as a,ToggleChatEvent as b,ToggleVideoEvent as c};
1
+ import{_ as t,c as e}from"./custom-element-D2ziPxYE.js";import{a as i,i as o,E as s,x as n}from"./lit-element-DiWJYFwC.js";import{n as r}from"./property-scuRaFcM.js";import{spinnerIcon as a}from"../ui/icons/spinner-icon.js";import{e as l}from"./provide-BwI4DDGF.js";import{c as d}from"./consume-CovVqBjI.js";import{h as c}from"./task-CqjSKFwZ.js";import{A as p}from"./api-client-context-BXGqBAlO.js";import{f as h,A as m,C as u,c as v,n as g,i as b}from"./api-chat-client-s45J7LKB.js";import{r as f}from"./state-LQivXIgA.js";import{n as y}from"./create-context-DqP79qjF.js";import{g as w,p as x,a as k}from"./chunk-NIAGR3ZC-BDlNUZa1.js";import{env as $}from"../env.js";import{m as C}from"./runtime-Bg1WXVCx.js";import{l as E}from"./localized-decorator-BlOuLhym.js";import{a as _}from"./addSeconds-fO5orJrt.js";import{getLocale as S}from"../i18n.js";import{calendarIcon as z}from"../ui/icons/calendar-icon.js";import"../ui/mq-page-title.js";import"./professional-overview-Ck_SPivX.js";import{MqViewAppointmentsEvent as T}from"../events.js";import{clockIcon as O}from"../ui/icons/clock-icon.js";import"./documentation-view-CzCDvut1.js";import{l as q}from"./chunk-S5RWG6G2-CQJ38pW6.js";import{t as I,u as j,w as R,x as V,y as A}from"./telemetry-client-DA2_SZBC.js";import"./mq-chat-room-C2EALCSm.js";import{chatbubbleIcon as N}from"../ui/icons/chat-bubble-icon.js";import{micIcon as U}from"../ui/icons/mic-icon.js";import{micOffIcon as W}from"../ui/icons/mic-off-icon.js";import{videoIcon as P}from"../ui/icons/video-icon.js";import{videoOffIcon as M}from"../ui/icons/video-off-icon.js";import"../ui/mq-unread-badge.js";import{Q as D}from"./query-controller-B1byDHlF.js";import{g as L}from"./chunk-Y4EKUX25-Bix9r5ry.js";import{l as K}from"./chunk-FUCSYDW7-Duj5hy8S.js";import"../ui/mq-floating-bubble.js";import{e as F}from"./query-CeeutdfT.js";import{M as B}from"./mutation-controller-CR2qcqhH.js";import{alertCircleIcon as H}from"../ui/icons/alert-circle-icon.js";import"../ui/mq-rating.js";import{toast as G}from"../ui/mq-toast.js";import{heartBeatIcon as Q}from"../ui/icons/heartbeat-icon.js";import{timeLeftIcon as Y}from"../ui/icons/time-left-icon.js";import"./mq-layout-BndHxkbb.js";class PermissionController{constructor(t){this.state="prompt",this.host=t,t.addController(this)}async hostConnected(){await this.requestPermissions()}async requestPermissions(){try{const t=await navigator.mediaDevices.getUserMedia({video:!0,audio:!0});for(const e of t.getTracks())e.stop();this.state="granted"}catch{this.state="denied"}finally{this.host.requestUpdate()}}}class InvalidTokenError extends Error{}function Z(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(t){return decodeURIComponent(atob(t).replace(/(.)/g,(t,e)=>{let i=e.charCodeAt(0).toString(16).toUpperCase();return i.length<2&&(i="0"+i),"%"+i}))}(e)}catch(t){return atob(e)}}InvalidTokenError.prototype.name="InvalidTokenError";const J=y(Symbol("opentok-service")),X=y(Symbol("params"));class OpenTokService{static{this.URL="https://static.opentok.com/v2/js/opentok.min.js"}_ensureLoaded(){if(!window.OT)throw new Error("OpenTok SDK is not loaded");return window.OT}load(){return new Promise((t,e)=>{if(window.OT)return void t();const i=document.createElement("script");i.src=OpenTokService.URL,i.onload=()=>{t()},i.onerror=e,document.head.appendChild(i)})}initSession(t,e){return this._ensureLoaded().initSession(t,e)}initPublisher(t,e,i){return this._ensureLoaded().initPublisher(t,e,i)}subscribe(t,e,i,o,s){return t.subscribe(e,i,o,s)}}const tt="waiting-room",et="videocall",it="documentation",ot="not-time-yet",st="review";class OpenTokController{constructor(t,e,i,o,s,n){this.isLoading=!0,this.isSessionReady=!1,this.isReconnecting=!1,this.errorMessage="",this.session=null,this.streams=[],this.destroyedStreamIds=new Set,this.openTokService=new OpenTokService,this.session_token=null,this.hasLeftWaitingRoom=!1,this.host=t,this.apiClient=e,t.addController(this),this.appointment=i,this.token=o,this.onCallStarted=s,this.onCallFinished=n,this._loadOpentok()}async _loadOpentok(){try{await this.openTokService.load(),this._initializeSession()}catch{this.isLoading=!1,this.errorMessage="Failed to load OpenTok script",this.host.requestUpdate()}}async _getSessionAndToken(){const t=await this.apiClient.flash.joinCall({callId:this.appointment.call_id});return this.session_token=t.session_token,[t.session_id,t.session_token]}async _initializeSession(){try{const[t,e]=await this._getSessionAndToken();this.session=this.openTokService.initSession($.OPENTOK_API_KEY,t),this.session.on("sessionConnected",()=>{this.isLoading=!1,this.isSessionReady=!0,this.host.requestUpdate()}),this.session.on("sessionDisconnected",()=>{this.isSessionReady=!1,this._leaveWaitingRoom(),setTimeout(()=>{this.onCallFinished(),this.host.requestUpdate()},1e3),this.host.requestUpdate()}),this.session.on("sessionReconnecting",()=>{this.isReconnecting=!0,this.host.requestUpdate()}),this.session.on("sessionReconnected",()=>{this.isReconnecting=!1;const t=this.streams.filter(t=>!this.destroyedStreamIds.has(t.streamId));this.streams=[],this.host.requestUpdate(),requestAnimationFrame(()=>{this.streams=t.filter(t=>!this.destroyedStreamIds.has(t.streamId)),this.host.requestUpdate()})}),this.session.on("streamCreated",t=>{this.streams=[...this.streams,t.stream],this.onCallStarted(),this.host.requestUpdate()}),this.session.on("streamDestroyed",t=>{t.stream?.streamId&&this.destroyedStreamIds.add(t.stream.streamId),setTimeout(()=>{this.streams=this.streams.filter(e=>e.streamId!==t.stream?.streamId),this._leaveWaitingRoom(),this.onCallFinished(),this.host.requestUpdate()},1e3)}),this.session.connect(e,t=>{t&&(this.isLoading=!1,this.errorMessage=`Failed to connect to session: ${t.message}`,this.host.requestUpdate())}),this.apiClient.flash.setReady({professional_hash:this.appointment.from.hash,consultation_id:this.appointment.id,consultation_type:"appointment"})}catch(t){this.isLoading=!1,this.errorMessage=`Error initializing session: ${t instanceof Error?t.message:"Unknown error"}`,this.host.requestUpdate()}}_leaveWaitingRoom(){this.hasLeftWaitingRoom||(this.hasLeftWaitingRoom=!0,this.apiClient.flash.leaveWaitingRoom({professional_hash:this.appointment.from.hash,consultation_id:this.appointment.id,consultation_type:"appointment"}))}hostDisconnected(){this._leaveWaitingRoom(),this.session&&(this.session.disconnect(),this.session.off("streamCreated"),this.session.off("streamDestroyed"),this.session.off("sessionConnected"),this.session.off("sessionDisconnected"),this.session.off("sessionReconnecting"),this.session.off("sessionReconnected"))}}let nt=class NotTimeYetView extends i{static{this.styles=[o`mq-page-title{margin-bottom:var(--size-3)}.description{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);color:var(--color-neutrals-text-default);font-weight:var(--font-weight-normal);margin:0;margin-bottom:var(--size-3)}.details-card{background-color:var(--color-background);border-radius:var(--border-radius-xl);padding:var(--size-6) var(--size-4);display:flex;min-width:0;flex-direction:column;gap:var(--size-6);margin-bottom:var(--size-6)}.details-card-title{padding:14px 0;font-size:var(--text-base);line-height:100%;font-weight:var(--font-weight-medium);color:var(--color-gray-darker);text-align:left}.details-rows{display:flex;flex-direction:column;gap:var(--size-3)}.details-row{display:flex;align-items:center;gap:var(--size-2);font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);color:var(--color-neutrals-text-default);font-weight:var(--font-weight-semibold)}.details-row span::first-letter{text-transform:uppercase}@media (min-width:768px){.description{font-size:var(--text-base);line-height:var(--text-base--line-height);margin-bottom:var(--sp-6)}}`]}firstUpdated(){I.track(j(this.loginToken.patient.hash,this.appointment.id??""))}render(){const t=S()?.replace("_","-")??"es-ES",e=w(this.loginToken.patient.timezone),i=new Intl.DateTimeFormat(t,{dateStyle:"full",...e?{timeZone:e}:{}}),o=new Intl.DateTimeFormat(t,{timeStyle:"short",...e?{timeZone:e}:{}}),r=x(this.appointment.start_date),a=_(r,this.appointment.duration),l=e?k(e,r):"";return n`<mq-page-title .title="${C("¡Aún no es la hora!")}" back-label="${C("Salir")}" @mq-back="${t=>{t.stopPropagation(),this.dispatchEvent(new T({tab:"next"}))}}"></mq-page-title><p class="description">${C("Cuando falten 10 minutos para tu consulta, podrás acceder a la videoconsulta")}</p><div class="details-card"><professional-overview .name="${this.appointment.from.name??""}" .specialtyName="${this.appointment.from.speciality??""}" .collegiateNumber="${this.appointment.from.collegiate_number??void 0}" .description="${this.appointment.from.description??""}" .languages="${this.appointment.from.languages}" .avatar="${this.appointment.from.avatar??""}"></professional-overview><div class="details-rows"><div class="details-row">${z({size:24})} <span>${i.format(r)}</span></div><div class="details-row">${O({size:24})} <span>${o.format(r)} - ${o.format(a)}${l?` (${l})`:""}</span></div></div></div>${!0===this.appointment.has_chat_in_appointment?n`<chat-cta .consultationId="${this.appointment.id}" .roomId="${Number(this.appointment.room_id)}" .professionalHash="${this.appointment.from.hash}" .text="${C("Utiliza el chat para enviar el motivo de consulta, documentos o imágenes")}" .onOpenChat="${()=>{I.track(R(this.loginToken.patient.hash,this.appointment.id??""))}}"></chat-cta>`:s}`}};t([r({type:Object})],nt.prototype,"appointment",void 0),t([d({context:q})],nt.prototype,"loginToken",void 0),nt=t([E(),e("not-time-yet-view")],nt);let rt=class PermissionStatusBanner extends i{static{this.styles=o`:host{display:block;padding:var(--size-5) var(--size-6);background-color:#ebf9ff;border-radius:var(--border-radius-lg);text-align:center}span{color:var(--color-neutrals-text-default);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal)}`}render(){return n`<span>${C("Espera a ser atendido sin salir de esta pantalla")}</span>`}};rt=t([E(),e("permission-status-banner")],rt);let at=class WaitingRoomLayout extends i{constructor(){super(...arguments),this.isWaitingRoom=!1}static{this.styles=o`.information-container{padding:var(--size-5) var(--size-4);background-color:var(--color-neutrals-background-disabled)}mq-page-title{margin-bottom:var(--size-4)}.content{max-width:560px;margin:0 auto}.information-container p{font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default);margin:0}.video-container{margin-left:auto;margin-right:auto;margin-bottom:var(--size-6);position:relative;max-height:301px;aspect-ratio:9/16;border-radius:16px;overflow:hidden}@media (min-width:768px){.information-container{background-color:transparent;padding:var(--size-6) 0}.video-container{max-height:454px;aspect-ratio:16/9}.information-container p{font-size:var(--text-base);line-height:var(--text-base--line-height)}}`}firstUpdated(){this.isWaitingRoom&&I.track(V(this.loginToken.patient.hash,this.appointment.id??""))}render(){if(!this.isWaitingRoom)return n`<slot></slot>`;const t=S()?.replace("_","-")??"es-ES",e=w(this.loginToken.patient.timezone),i=e?{timeZone:e}:{},o=new Intl.DateTimeFormat(t,{dateStyle:"short",...i}),r=new Intl.DateTimeFormat(t,{timeStyle:"short",...i}),a=x(this.appointment.start_date),l=_(a,this.appointment.duration),d=e?k(e,a):"",c=o.format(a),p=`${r.format(a)} - ${r.format(l)}${d?` (${d})`:""}`;return n`<permission-status-banner></permission-status-banner><div class="content"><div class="information-container"><mq-page-title .title="${C("Sala de espera")}" back-label="${C("Salir")}" @mq-back="${t=>{t.stopPropagation(),this.dispatchEvent(new T({tab:"next"}))}}"></mq-page-title><div class="doctor-info"><p>${this.appointment.from.name}</p><p>${c}</p><p>${p}</p></div></div><div class="video-container"><slot></slot></div>${!0===this.appointment.has_chat_in_appointment?n`<chat-cta .consultationId="${this.appointment.id}" .roomId="${Number(this.appointment.room_id)}" .professionalHash="${this.appointment.from.hash}" .text="${C("Utiliza el chat para enviar el motivo de consulta, documentos o imágenes")}" .onOpenChat="${()=>{I.track(R(this.loginToken.patient.hash,this.appointment.id??""))}}"></chat-cta>`:s}</div>`}};t([r({type:Object})],at.prototype,"appointment",void 0),t([r({type:Boolean,attribute:"is-waiting-room"})],at.prototype,"isWaitingRoom",void 0),t([d({context:q})],at.prototype,"loginToken",void 0),at=t([e("waiting-room-layout")],at);class AppointmentCounterController{constructor(t,e){this.startsAtGetter=e,this.formattedTime="--:--",this.interval=null,this.host=t,t.addController(this)}async hostConnected(){this.interval=setInterval(()=>{const t=new Date,e=this.startsAtGetter(),i=t.getTime()-e.getTime(),o=Math.floor(i/1e3),s=Math.floor(o/60),n=o%60;this.formattedTime=`${s.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`,this.host.requestUpdate()},1e3)}hostDisconnected(){this.interval&&clearInterval(this.interval)}}class ToggleAudioEvent extends Event{static{this.eventName="toggle-audio"}constructor(t){super(ToggleAudioEvent.eventName,{bubbles:!0,composed:!0}),this.isAudioOn=t}}class ToggleVideoEvent extends Event{static{this.eventName="toggle-video"}constructor(t){super(ToggleVideoEvent.eventName,{bubbles:!0,composed:!0}),this.isVideoOn=t}}class ToggleChatEvent extends Event{static{this.eventName="toggle-chat"}constructor(t){super(ToggleChatEvent.eventName,{bubbles:!0,composed:!0}),this.isChatOpen=t}}class ViewDocumentationEvent extends Event{static{this.eventName="view-documentation"}constructor(){super(ViewDocumentationEvent.eventName,{bubbles:!0,composed:!0})}}class DownloadFileEvent extends Event{static{this.eventName="download-file"}constructor(t,e){super(DownloadFileEvent.eventName,{bubbles:!0,composed:!0}),this.url=t,this.filename=e}}let lt=class PublisherControls extends i{constructor(){super(...arguments),this.isAudioOn=!1,this.isVideoOn=!0,this.isChatOpen=!1,this.chatEnabled=!1,this.isWaitingRoom=!1,this.unreadQuery=new D(this,()=>L(this.apiClient,{roomId:this.roomId}))}static{this.styles=o`:host{display:flex;justify-content:space-between;gap:var(--size-4)}:host([is-waiting-room]){justify-content:center}.left-controls{display:flex;gap:var(--size-4)}.control-button{border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;width:var(--size-10);height:var(--size-10);padding:var(--size-2);border-radius:12.5px;transition:all .2s ease-in-out}@media (min-width:768px){.control-button{width:var(--size-11);height:var(--size-11);padding:var(--size-2);border-radius:16px}}.control-button:hover{background-color:var(--color-gray-light)}.control-button:focus-visible{outline:0;box-shadow:0 0 0 2px var(--color-primary-light)}.control-button--on{background-color:var(--color-white);color:var(--color-primary)}.control-button--off{background-color:var(--color-white);color:var(--color-negative)}`}toggleAudio(){this.dispatchEvent(new ToggleAudioEvent(!this.isAudioOn))}toggleVideo(){this.dispatchEvent(new ToggleVideoEvent(!this.isVideoOn))}toggleChat(){this.dispatchEvent(new ToggleChatEvent(!this.isChatOpen))}render(){return n`<div class="left-controls">${this.isWaitingRoom||!this.chatEnabled?s:n`<button type="button" class="control-button control-button--on" @click="${this.toggleChat}">${N({size:20})} ${(this.unreadQuery.result?.data?.unread_count??0)>0?n`<mq-unread-badge></mq-unread-badge>`:s}</button>`} <button type="button" class="control-button ${this.isAudioOn?"control-button--on":"control-button--off"}" @click="${this.toggleAudio}">${this.isAudioOn?U({size:20}):W({size:20})}</button> <button type="button" class="control-button ${this.isVideoOn?"control-button--on":"control-button--off"}" @click="${this.toggleVideo}">${this.isVideoOn?P({size:20}):M({size:20})}</button></div>`}};t([d({context:p,subscribe:!0})],lt.prototype,"apiClient",void 0),t([r({type:Boolean})],lt.prototype,"isAudioOn",void 0),t([r({type:Boolean})],lt.prototype,"isVideoOn",void 0),t([r({type:Boolean})],lt.prototype,"isChatOpen",void 0),t([r({type:Boolean})],lt.prototype,"chatEnabled",void 0),t([r({type:Boolean,reflect:!0,attribute:"is-waiting-room"})],lt.prototype,"isWaitingRoom",void 0),t([r({type:Number})],lt.prototype,"roomId",void 0),lt=t([e("publisher-controls")],lt);let dt=class VideoPublisher extends i{constructor(){super(...arguments),this.isWaitingRoom=!1,this.hasChatInAppointment=!1,this.appointmentCounterController=new AppointmentCounterController(this,()=>x(this.startsAt)),this.isAudioOn=!0,this.isVideoOn=!0,this.isChatOpen=!1,this._handleVisibilityChange=()=>{"visible"===document.visibilityState&&this.publisher&&(this.publisher.publishAudio(!1),this.publisher.publishVideo(!1),setTimeout(()=>{this.publisher?.publishAudio(this.isAudioOn),this.publisher?.publishVideo(this.isVideoOn)},500))}}static{this.styles=o`:host{width:100%;height:100%;display:block}.OT_video-element{width:100%;height:100%;background:var(--color-black)}.OT_mute{display:none}video{border-radius:var(--border-radius-lg)}#video-publisher{width:100%;height:100%;transition:width .5s ease-in-out,height .5s ease-in-out;border-radius:var(--border-radius-lg)}:host(:not([is-waiting-room])) #video-publisher{width:121px;height:200px;z-index:50;border-radius:12px;overflow:hidden}:host([is-waiting-room]) .top-items{position:absolute;inset:0}:host(:not([is-waiting-room])) .top-items{position:absolute;z-index:50;top:var(--size-4);left:var(--size-4);right:var(--size-4);display:flex;justify-content:space-between;gap:var(--size-1)}.meta-container{display:flex;align-items:flex-start;gap:var(--size-1);min-width:0}.meta-item{background-color:var(--color-neutrals-text-default);padding:var(--size-2) var(--size-3);color:var(--color-white);font-size:var(--text-xs);line-height:var(--text-xs--line-height);flex-shrink:0}.meta-item:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-shrink:1;min-width:0}publisher-controls{position:absolute;z-index:50;bottom:var(--size-4);left:var(--size-4);right:var(--size-4)}mq-chat-room{height:100%}@media (min-width:768px){:host(:not([is-waiting-room])) #video-publisher{width:250px;height:auto;aspect-ratio:16/9}:host(:not([is-waiting-room])) .top-items{top:var(--size-6);left:var(--size-6);right:var(--size-6)}}`}firstUpdated(t){super.firstUpdated(t),this.publisher=this.openTokService.initPublisher(this.publisherEl,{fitMode:"contain",width:"100%",height:"100%",audioFallbackEnabled:!1,insertMode:"append",mirror:!1,publishAudio:this.isAudioOn,publishVideo:this.isVideoOn},t=>{t&&K.error("error initializing publisher",t),this.session.publish(this.publisher)}),document.addEventListener("visibilitychange",this._handleVisibilityChange)}disconnectedCallback(){document.removeEventListener("visibilitychange",this._handleVisibilityChange),super.disconnectedCallback(),this.publisher?.destroy()}async _handleToggleAudioEvent(t){this.isAudioOn=t.isAudioOn,this.publisher.publishAudio(t.isAudioOn)}async _handleToggleVideoEvent(t){this.isVideoOn=t.isVideoOn,this.publisher.publishVideo(t.isVideoOn)}async _handleToggleChatEvent(t){this.isChatOpen=t.isChatOpen}render(){return n`<div class="top-items">${this.isWaitingRoom?n`<div></div>`:n`<div class="meta-container"><span class="meta-item">${this.professionalName}</span> <span class="meta-item">${this.appointmentCounterController.formattedTime}</span></div>`}<div id="video-publisher"></div></div><publisher-controls .isAudioOn="${this.isAudioOn}" .isVideoOn="${this.isVideoOn}" .isChatOpen="${this.isChatOpen}" .chatEnabled="${this.hasChatInAppointment}" .roomId="${Number.parseInt(this.roomId,10)}" ?is-waiting-room="${this.isWaitingRoom}" @toggle-audio="${this._handleToggleAudioEvent}" @toggle-video="${this._handleToggleVideoEvent}" @toggle-chat="${this._handleToggleChatEvent}"></publisher-controls>${this.hasChatInAppointment?n`<mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" @mq-close="${()=>{this.isChatOpen=!1}}" hideCloseButton>${this.isChatOpen?n`<mq-chat-room slot="content" .consultationId="${this.consultationId}" .consultationType="${u.appointment}" token="${this.loginToken.access_token}" .roomId="${Number.parseInt(this.roomId,10)}" .professionalHash="${this.professionalHash}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}"></mq-chat-room>`:s}</mq-floating-bubble>`:s}`}};t([r({type:String})],dt.prototype,"consultationId",void 0),t([r({type:String})],dt.prototype,"apiKey",void 0),t([r({type:String})],dt.prototype,"token",void 0),t([r({type:String})],dt.prototype,"roomId",void 0),t([r({type:String})],dt.prototype,"professionalHash",void 0),t([r({type:Object})],dt.prototype,"session",void 0),t([r({type:String})],dt.prototype,"professionalName",void 0),t([r({type:String})],dt.prototype,"startsAt",void 0),t([r({type:Boolean,reflect:!0,attribute:"is-waiting-room"})],dt.prototype,"isWaitingRoom",void 0),t([r({type:Boolean})],dt.prototype,"hasChatInAppointment",void 0),t([d({context:J})],dt.prototype,"openTokService",void 0),t([d({context:q})],dt.prototype,"loginToken",void 0),t([F("#video-publisher")],dt.prototype,"publisherEl",void 0),t([f()],dt.prototype,"isAudioOn",void 0),t([f()],dt.prototype,"isVideoOn",void 0),t([f()],dt.prototype,"isChatOpen",void 0),dt=t([e("video-publisher")],dt);let ct=class VideoSubscriber extends i{constructor(){super(...arguments),this.isVideoOn=!0,this._subscriberProperties={fitMode:"contain",insertMode:"append",width:"100%",height:"100%"},this._handleVisibilityChange=()=>{"visible"===document.visibilityState&&this.subscriber&&(this.subscriber.subscribeToAudio(!1),this.subscriber.subscribeToVideo(!1),setTimeout(()=>{this.subscriber?.subscribeToAudio(!0),this.subscriber?.subscribeToVideo(!0)},500),setTimeout(()=>this._resubscribe(),600))}}static{this.styles=o`:host{position:absolute;inset:0}.OT_subscriber{width:100%;height:100%;position:absolute;inset:0;background:var(--color-neutrals-background-default)}video{width:100%;height:100%}.video-disabled{position:absolute;inset:0;background:var(--color-gray-dark)}.hidden{display:none}`}firstUpdated(){this._subscribe(),document.addEventListener("visibilitychange",this._handleVisibilityChange)}_subscribe(){this.subscriber=this.openTokService.subscribe(this.session,this.stream,this.subscriberEl,this._subscriberProperties,t=>{}),this._attachSubscriberEvents()}_attachSubscriberEvents(){this.subscriber.on("connected",t=>{this.isVideoOn=t.target.stream?.hasVideo??!0}),this.subscriber.on("videoDisabled",()=>{this.isVideoOn=!1}),this.subscriber.on("videoEnabled",()=>{this.isVideoOn=!0}),this.subscriber.on("disconnected",()=>{this.isVideoOn=!1})}_resubscribe(){if(this.subscriber&&this.session&&this.subscriberEl){try{this.session.unsubscribe(this.subscriber)}catch{}this.subscriberEl.innerHTML="",this._subscribe()}}disconnectedCallback(){if(document.removeEventListener("visibilitychange",this._handleVisibilityChange),this.subscriber&&this.session)try{this.session.unsubscribe(this.subscriber)}catch{}super.disconnectedCallback()}render(){return n`<div id="video-subscriber" class="${this.isVideoOn?"":"hidden"}"></div>${this.isVideoOn?n``:n`<div class="video-disabled"></div>`}`}};t([r({type:Object})],ct.prototype,"session",void 0),t([r({type:Object})],ct.prototype,"stream",void 0),t([f()],ct.prototype,"isVideoOn",void 0),t([d({context:J})],ct.prototype,"openTokService",void 0),t([F("#video-subscriber")],ct.prototype,"subscriberEl",void 0),ct=t([e("video-subscriber")],ct);let pt=class VideocallContent extends i{constructor(){super(...arguments),this.streams=[],this.isWaitingRoom=!1,this.isReconnecting=!1}static{this.styles=o`:host{display:block;position:relative;width:100%;height:100%;background:var(--color-gray-darkest);aspect-ratio:16/9}.reconnecting-overlay{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--size-3);background:rgba(0,0,0,.6);z-index:100}.reconnecting-overlay__text{color:var(--color-white);font-size:var(--text-sm);line-height:var(--text-sm--line-height)}.reconnecting-overlay__subtitle{color:var(--color-white);font-size:var(--text-xs);line-height:var(--text-xs--line-height);opacity:.85}`}firstUpdated(){this.isWaitingRoom||I.track(A(this.loginToken.patient.hash,this.appointment.id??""))}updated(t){t.has("isWaitingRoom")&&!0===t.get("isWaitingRoom")&&!this.isWaitingRoom&&I.track(A(this.loginToken.patient.hash,this.appointment.id??""))}render(){return n`<video-publisher .consultationId="${this.appointment.id}" .session="${this.session}" ?is-waiting-room="${this.isWaitingRoom}" .professionalName="${this.appointment.from.name??""}" .professionalHash="${this.appointment.from.hash}" .startsAt="${this.appointment.started_at??(new Date).toISOString()}" .apiKey="${this.apiKey}" .token="${this.token}" .roomId="${this.appointment.room_id}" .hasChatInAppointment="${!0===this.appointment.has_chat_in_appointment}"></video-publisher>${0===this.streams.length?n``:this.streams.map(t=>n`<video-subscriber .session="${this.session}" .stream="${t}"></video-subscriber>`)} ${this.isReconnecting?n`<div class="reconnecting-overlay">${a({color:"var(--color-white)"})} <span class="reconnecting-overlay__text">${C("Reconectando...")} </span><span class="reconnecting-overlay__subtitle">${C("Espere mientras se restablece la conexión")}</span></div>`:""}`}};t([r({type:Object})],pt.prototype,"session",void 0),t([r({type:Array})],pt.prototype,"streams",void 0),t([r({type:String})],pt.prototype,"apiKey",void 0),t([r({type:String})],pt.prototype,"token",void 0),t([r({type:Object})],pt.prototype,"appointment",void 0),t([r({type:Boolean,reflect:!0,attribute:"is-waiting-room"})],pt.prototype,"isWaitingRoom",void 0),t([r({type:Boolean,reflect:!0,attribute:"is-reconnecting"})],pt.prototype,"isReconnecting",void 0),t([d({context:q})],pt.prototype,"loginToken",void 0),pt=t([E(),e("mq-videocall-content")],pt);class ReviewSubmittedEvent extends Event{static{this.eventName="review-submitted"}constructor(){super(ReviewSubmittedEvent.eventName,{bubbles:!0,composed:!0})}}class ReviewSkippedEvent extends Event{static{this.eventName="review-skipped"}constructor(){super(ReviewSkippedEvent.eventName,{bubbles:!0,composed:!0})}}let ht=class ReviewView extends i{constructor(){super(...arguments),this.rating=0,this.comment="",this._reviewMutation=new B(this,{mutationFn:({rating:t,comment:e})=>this.apiClient.consultations.postReview({consultation_id:this.appointment.id??"",consultation_type:u.appointment,rating:t,comment:e.trim()?e.trim():null}),onSuccess:()=>{this.dispatchEvent(new ReviewSubmittedEvent)},onError:t=>{!function(t){const e=t,i=e?.response?.status;return 400===i&&/already exists/i.test(e?.response?.data?.message??"")}(t)?G.error(C("No se ha podido enviar el cuestionario")):this.dispatchEvent(new ReviewSubmittedEvent)}}),this._reconnectMutation=new B(this,{mutationFn:t=>this.apiClient.appointments.reconnectAppointment(t),onSuccess:()=>{this.dispatchEvent(new CustomEvent("review-reconnect",{bubbles:!0,composed:!0}))},onError:()=>{G.error(C("No se ha podido volver a la sala de espera"))}}),this.handleSkip=()=>{this.dispatchEvent(new ReviewSkippedEvent)},this.handleSubmit=()=>{this.rating<1||this.rating>5||this._reviewMutation.isPending||this._reviewMutation.run({rating:this.rating,comment:this.comment})}}static{this.styles=o`:host{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100%;background-color:var(--color-background);box-sizing:border-box}.container{width:100%;max-width:500px;padding:var(--sp-6);display:flex;flex-direction:column;gap:var(--sp-5);box-sizing:border-box}.title{margin:0;padding:0 var(--sp-6);font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-normal);color:var(--color-primary);text-align:center}.rating{display:flex;flex-direction:column;align-items:center;gap:var(--sp-2);padding:var(--sp-1) var(--sp-6)}.subtitle{margin:0;font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);color:var(--color-text-icons--secondary);text-align:center}.comment-card{background-color:var(--color-white);border:var(--action-border-width) solid var(--color-border);border-radius:var(--border-radius-lg);box-shadow:0 4px 4px rgba(0,0,0,.05);padding:var(--sp-5);display:flex;flex-direction:column;gap:var(--sp-5)}.comment-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--sp-3)}.comment-label{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm);font-weight:var(--font-weight-medium);color:var(--color-neutrals-text-default)}.comment-counter{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-text-icons--secondary);white-space:nowrap}.textarea{width:100%;box-sizing:border-box;height:var(--size-44);padding:var(--sp-3) var(--sp-4);background-color:var(--color-gray-lighter);border:var(--action-border-width) solid var(--color-border);border-radius:var(--border-radius-md);font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);color:var(--color-neutrals-text-default);resize:none}.textarea::placeholder{color:var(--color-text-icons--secondary);opacity:.6}.textarea:focus{outline:0;border-color:var(--color-primary)}.actions{display:flex;gap:var(--sp-4)}.btn{flex:1;height:var(--button-height-md);padding:var(--sp-2) var(--sp-4);border-radius:var(--border-radius-md);font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-medium);cursor:pointer;transition:opacity .15s ease-in-out}.btn:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}.btn:disabled{cursor:not-allowed}.btn-skip{background:var(--color-white);border:var(--action-border-width) solid var(--color-primary);color:var(--color-primary)}.btn-skip:hover:not(:disabled){background:var(--color-primary-background-extraWeak)}.btn-submit{background:var(--color-primary);border:var(--action-border-width) solid var(--color-primary);color:var(--color-white)}.btn-submit:hover:not(:disabled){background:var(--color-primary-dark)}.btn-submit:disabled{opacity:.5}.waiting-card{background-color:var(--color-background-primary-light);border-radius:var(--border-radius-lg);padding:var(--sp-4);display:flex;flex-direction:column;gap:var(--sp-2)}.waiting-header{display:flex;align-items:center;gap:var(--sp-2);color:var(--color-neutrals-text-default)}.waiting-title{font-family:var(--font-body);font-size:var(--text-xs);line-height:1;font-weight:var(--font-weight-medium);color:var(--color-neutrals-text-default)}.waiting-body{margin:0;font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);color:var(--color-text-icons--secondary)}.waiting-link{background:0 0;border:0;padding:0;cursor:pointer;color:#3c50ec;font:inherit;text-decoration:none}.waiting-link:hover{text-decoration:none}.waiting-link:disabled{cursor:not-allowed;opacity:.6}`}render(){return n`<div class="container"><h1 class="title">${C("¿Qué tal ha ido tu cita?")}</h1><div class="rating"><mq-rating .value="${this.rating}" .label="${C("Valoración de la consulta")}" @mq-rating-change="${t=>{this.rating=t.value}}"></mq-rating><p class="subtitle">${C("(1 es muy malo, 5 es excelente)")}</p></div><div class="comment-card"><div class="comment-header"><span class="comment-label">${C("¿Tienes comentarios sobre la consulta?")}</span> <span class="comment-counter">${this.comment.length}/${240}</span></div><textarea class="textarea" maxlength="${240}" placeholder="${C("Comparte cómo fue la atención o si tuviste algún problema con la videollamada…")}" .value="${this.comment}" @input="${t=>{this.comment=t.target.value}}"></textarea><div class="actions"><button type="button" class="btn btn-skip" ?disabled="${this._reviewMutation.isPending}" @click="${this.handleSkip}">${C("Omitir")}</button> <button type="button" class="btn btn-submit" ?disabled="${this.rating<1||this._reviewMutation.isPending}" @click="${this.handleSubmit}">${C("Enviar")}</button></div></div><div class="waiting-card"><div class="waiting-header">${H({color:"currentColor",size:18})} <span class="waiting-title">${C("¿Ocurrió algún problema?")}</span></div><p class="waiting-body">${C("Si la cita no se ha podido realizar, puedes")} <button type="button" class="waiting-link" ?disabled="${this._reconnectMutation.isPending}" @click="${()=>this._reconnectMutation.run({appointmentId:this.appointment.id})}">${C("volver a la sala de espera.")}</button></p></div></div>`}};t([d({context:p,subscribe:!0})],ht.prototype,"apiClient",void 0),t([r({type:Object})],ht.prototype,"appointment",void 0),t([f()],ht.prototype,"rating",void 0),t([f()],ht.prototype,"comment",void 0),ht=t([E(),e("review-view")],ht);let mt=class ErrorView extends i{static{this.styles=o`.container{display:grid;place-items:center;width:100%;max-width:447px;margin:0 auto}.card>:not(:first-child){margin-top:var(--size-8)}.title{font-family:var(--font-titles);color:var(--color-neutrals-text-default);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0;margin-bottom:var(--size-3)}.description{color:var(--color-neutrals-text-default);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:400}`}render(){return n`<div class="container"><div class="card"><slot name="icon"></slot><div class="content"><h1 class="title">${this.title}</h1><p class="description">${this.message}</p></div></div></div>`}};t([r({type:String})],mt.prototype,"title",void 0),t([r({type:String})],mt.prototype,"message",void 0),mt=t([e("error-view")],mt);let ut=class UnexpectedErrorView extends i{render(){return n`<error-view .title="${C("Error desconocido")}" .message="${C("Ha ocurrido un error al cargar la página. Por favor, intenta nuevamente o contacta al soporte.")}"><div slot="icon">${Q()}</div></error-view>`}};ut=t([E(),e("unexpected-error-view")],ut);let vt=class ExpiredAppointmentErrorView extends i{render(){return n`<error-view .title="${C("Consulta caducada")}" .message="${C("Parece que no te hemos encontrado a la hora de tu cita. Puedes programar otra consulta para resolver tus dudas.")}"><div slot="icon">${Y()}</div></error-view>`}};vt=t([E(),e("expired-appointment-error-view")],vt);let gt=class NotFoundErrorView extends i{static{this.styles=o`div{display:flex;flex-direction:column;gap:2px}span{font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:400;color:var(--color-gray-medium)}`}render(){return n`<error-view .title="${C("Página no encontrada")}" .message="${C("La página que estás buscando fue removida, renombrada o puede que no exista.")}"><div slot="icon"><span>404</span> ${Q()}</div></error-view>`}};function bt(t){try{return function(t,e){if("string"!=typeof t)throw new InvalidTokenError("Invalid token specified: must be a string");e||(e={});const i=!0===e.header?0:1,o=t.split(".")[i];if("string"!=typeof o)throw new InvalidTokenError(`Invalid token specified: missing part #${i+1}`);let s;try{s=Z(o)}catch(t){throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${i+1} (${t.message})`)}try{return JSON.parse(s)}catch(t){throw new InvalidTokenError(`Invalid token specified: invalid json for part #${i+1} (${t.message})`)}}(t)}catch{return null}}gt=t([E(),e("not-found-error-view")],gt);let ft=class MqVideocallProvider extends i{static{this.styles=o`*{box-sizing:border-box}:host{display:block;margin:0 auto;width:100%;height:100%}.centered{display:grid;place-items:center;height:100%;min-height:var(--mq-container-min-height)}documentation-view{display:block;padding:var(--sp-4)}`}constructor(){super(),this.apiClient=v(),this.opentokService=new OpenTokService,this.params={appointmentId:this.appointmentId,token:this.token,apiKey:this.apiKey},this.appointmentTask=new c(this,{task:async([t,,])=>{const[e,i,o]=await Promise.all([this.apiClient.flash.getAppointment({appointmentId:t}),this.apiClient.consultations.getReview(t).then(()=>!0).catch(()=>!1),this.apiClient.organizations.getOrganizationSetup().catch(()=>{})]);return{appointment:e,hasReview:i,hasNps:!0===o?.appointments?.has_nps}},args:()=>[this.appointmentId,this.apiKey,this.token]})}willUpdate(t){const e=g(t,{apiKey:this.apiKey,token:this.token},this.inheritedApiClient);if(e&&(this.apiClient=e),this.appointmentTask.value&&!this.opentokController){const{appointment:t,hasReview:e,hasNps:i}=this.appointmentTask.value,o=function(t,e){return h(t)?t.status===m.finished||t.status===m.reporting?e?st:it:tt:ot}(t,i);this.screen=o===st&&e?it:o,this.params={appointmentId:this.appointmentId,token:this.token,apiKey:this.apiKey},this.opentokController=new OpenTokController(this,this.apiClient,t,this.token,()=>{this.screen=et},()=>{this.screen=!i||e?it:st})}}render(){const t=n`<div class="centered">${a({color:"var(--color-primary)"})}</div>`,e=n`<mq-layout background="transparent"><not-found-error-view></not-found-error-view></mq-layout>`;return this.appointmentTask.render({pending:()=>t,error:t=>{const i=bt(this.token);return i?.exp&&i.exp<Date.now()/1e3?n`<mq-layout background="transparent"><expired-appointment-error-view></expired-appointment-error-view></mq-layout>`:b(t)&&t.response?.status&&t.response.status<500?e:n`<mq-layout background="transparent"><unexpected-error-view></unexpected-error-view></mq-layout>`},complete:({appointment:i,hasNps:o})=>{if(this.opentokController?.isLoading)return t;if(this.opentokController?.errorMessage||!this.opentokController)return e;if(this.screen===ot)return n`<mq-layout background="transparent"><not-time-yet-view .appointment="${i}"></not-time-yet-view></mq-layout>`;if(this.screen===st)return n`<mq-layout background="transparent"><review-view .appointment="${i}" @review-submitted="${()=>{this.screen=it}}" @review-skipped="${()=>{this.screen=it}}" @review-reconnect="${()=>{this.screen=tt}}"></review-view></mq-layout>`;if(this.screen===it)return n`<mq-layout background="transparent"><documentation-view .appointment="${i}" .token="${this.token}" ?can-reconnect="${!o}" @reconnect="${()=>{this.screen=tt}}"></documentation-view></mq-layout>`;if(this.screen===tt||this.screen===et){const e=this.opentokController.session;return e?n`<waiting-room-layout .appointment="${i}" ?is-waiting-room="${this.screen===tt}"><mq-videocall-content .apiKey="${this.apiKey}" .token="${this.token}" .session="${e}" .streams="${this.opentokController?.streams??[]}" ?is-waiting-room="${this.screen===tt}" ?is-reconnecting="${this.opentokController.isReconnecting}" .appointment="${i}"></mq-videocall-content></waiting-room-layout>`:t}return n`<mq-layout background="transparent"><unexpected-error-view></unexpected-error-view></mq-layout>`}})}};t([r({type:String,attribute:"appointment-id"})],ft.prototype,"appointmentId",void 0),t([r({type:String,attribute:"api-key"})],ft.prototype,"apiKey",void 0),t([r({type:String})],ft.prototype,"token",void 0),t([d({context:p,subscribe:!0}),f()],ft.prototype,"inheritedApiClient",void 0),t([l({context:p}),f()],ft.prototype,"apiClient",void 0),t([f()],ft.prototype,"screen",void 0),t([l({context:J})],ft.prototype,"opentokService",void 0),t([l({context:X})],ft.prototype,"params",void 0),ft=t([e("mq-videocall-provider")],ft);let yt=class PermissionsRequiredErrorView extends i{static{this.styles=o`.img-container{display:flex;justify-content:center}img{width:100%;height:auto;max-width:229px}`}render(){return n`<error-view .title="${C("Acepta los permisos de cámara y micrófono")}" .message="${C("Parece que has denegado los permisos necesarios para entrar a la videollamada. Edita los permisos en tu navegador para entrar. Una vez concedidos, debes refrescar esta pantalla.")}"><div class="img-container" slot="icon"><img src="${`${$.ASSETS_BASE_URL}/wc-videocall/Miccam_asset.png`}" alt="Miccam_asset" width="229" height="166.44"></div></error-view>`}};yt=t([E(),e("permissions-required-error-view")],yt);let wt=class MqVideocall extends i{constructor(){super(...arguments),this._permissionController=new PermissionController(this)}static{this.styles=o`:host{display:block;width:100%;height:100%}.loading-spinner-container{height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center}.permissions-required-error-view-container{height:100%;padding-left:var(--size-4);padding-right:var(--size-4);display:grid;place-items:center}`}render(){return"prompt"===this._permissionController.state?n`<div class="loading-spinner-container">${a({color:"var(--color-primary)"})}</div>`:"denied"===this._permissionController.state?n`<div class="permissions-required-error-view-container"><permissions-required-error-view></permissions-required-error-view></div>`:n`<mq-videocall-provider .appointmentId="${this.appointmentId}" .token="${this.token}" .apiKey="${this.apiKey}"></mq-videocall-provider>`}};t([r({type:String,attribute:"appointment-id"})],wt.prototype,"appointmentId",void 0),t([r({type:String,attribute:"api-key"})],wt.prototype,"apiKey",void 0),t([r({type:String})],wt.prototype,"token",void 0),wt=t([e("mq-videocall")],wt);export{DownloadFileEvent as D,wt as M,ReviewSkippedEvent as R,ToggleAudioEvent as T,ViewDocumentationEvent as V,ReviewSubmittedEvent as a,ToggleChatEvent as b,ToggleVideoEvent as c};
@@ -1 +1 @@
1
- import{s as e}from"./chunk-6CCJWPGL-TiaqZaPV.js";import{D as t}from"./chunk-5EJXDIGT-Bb4_pfDr.js";import{_ as i,c as n}from"./custom-element-D2ziPxYE.js";import{c as o}from"./consume-CovVqBjI.js";import{m as a,s}from"./runtime-Bg1WXVCx.js";import{l as r}from"./localized-decorator-BlOuLhym.js";import{Q as l}from"./query-controller-B1byDHlF.js";import{A as p}from"./api-client-context-BXGqBAlO.js";import{l as c}from"./chunk-S5RWG6G2-CQJ38pW6.js";import{e as d,i as m,d as h}from"./api-chat-client-s45J7LKB.js";import{g as u,p as g,a as f}from"./chunk-NIAGR3ZC-BDlNUZa1.js";import{g as v}from"./get-organization-setup-query-De7eM6V3.js";import{g as b,t as y,l as $,n as C,o as w,p as x,a as q}from"./telemetry-client-K37KMdy_.js";import{g as k}from"./chunk-Y4EKUX25-Bix9r5ry.js";import{c as j}from"./refund-cancel-policy-DoMzcLlL.js";import{a as O,i as M,x as z,E}from"./lit-element-DiWJYFwC.js";import{n as S}from"./property-scuRaFcM.js";import{r as D}from"./state-LQivXIgA.js";import{MqAppointmentJoinVideocallEvent as I,MqAppointmentRescheduleEvent as A}from"../events.js";import{getLocale as R}from"../i18n.js";import{dotsHorizontalIcon as _}from"../ui/icons/dots-horizontal-icon.js";import"./mq-chat-room-B_WgeuXn.js";import"../ui/mq-button.js";import"../ui/mq-dialog.js";import{calendarIcon as L}from"../ui/icons/calendar-icon.js";import{messageBubbleIcon as P}from"../ui/icons/message-bubble-icon.js";import{phoneIcon as T}from"../ui/icons/phone-icon.js";import{videoIcon as U}from"../ui/icons/video-icon.js";import{Q as N}from"./chunk-RCFIJTXZ-C6Ir0-sM.js";import{M as Q}from"./mutation-controller-CR2qcqhH.js";import{h as H,f as G}from"./price-DU3YLTpk.js";import"./professional-overview-B4E05rLd.js";import"../ui/mq-floating-bubble.js";import"../ui/mq-unread-badge.js";import{toast as F}from"../ui/mq-toast.js";function J(i,n){return{queryKey:e(i,"appointments",n),queryFn:()=>i.appointments.getAppointments(n),staleTime:t}}function V(e){const{action:t,refundPolicySeconds:i}=e,n=null!=i&&i<3600,o=Math.ceil((i??0)/60),r=Math.ceil((i??0)/3600);return a(0===(n?o:r)?"modify"===t?"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"===t?n?s`Lo sentimos, como faltan menos de ${o} 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 ${o} minutos para tu cita no podemos anularla.`:s`Lo sentimos, como faltan menos de ${r} horas para tu cita no podemos anularla.`)}let B=class AppointmentActionUnavailableDialog extends O{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}mq-button{flex:1}`}render(){return z`<mq-dialog .open="${this.open}" .closeLabel="${a("Cerrar")}" @mq-close="${this.handleClose}"><h2 slot="heading">${this.heading}</h2><p slot="subheading">${this.message}</p><mq-button slot="footer" variant="primary" fullwidth @click="${this.handleClose}">${a("Volver")}</mq-button></mq-dialog>`}};i([S({type:Boolean,reflect:!0})],B.prototype,"open",void 0),i([S({type:String})],B.prototype,"heading",void 0),i([S({type:String})],B.prototype,"message",void 0),B=i([r(),n("appointment-action-unavailable-dialog")],B);const K=M`:host{display:flex;flex-direction:column;align-items:flex-start;gap:var(--sp-3)}.detail-row{display:inline-flex;align-items:center;gap:var(--sp-2);font-family:var(--font-body);font-size:var(--text-sm);line-height:1.35;font-weight:var(--font-weight-normal)}.detail-row svg{flex-shrink:0}.detail-row span::first-letter{text-transform:uppercase}`;let W=class AppointmentCardDetails extends O{constructor(){super(...arguments),this.startsAt=""}static{this.styles=K}channelIcon(){switch(this.channel){case d.videocall:return U({size:20});case d.phonecall:return T({size:20});default:return P({size:20})}}channelLabel(){switch(this.channel){case d.videocall:return a("Videoconsulta");case d.phonecall:return a("Consulta telefónica");default:return a("Chat")}}formatWhen(){const e=R().replace("_","-"),t=u(this.timezone),i=t?{timeZone:t}:{},n=g(this.startsAt);if(Number.isNaN(n.getTime()))return"";const o=new Intl.DateTimeFormat(e,{weekday:"long",day:"numeric",month:"long",year:"numeric",...i}).format(n),r=new Intl.DateTimeFormat(e,{timeStyle:"short",hourCycle:"h23",...i}).format(n),l=t?f(t,n):"";return a(s`${o}, ${r} h${l?` (${l})`:""}`)}render(){const e=this.formatWhen();return z`${e?z`<div class="detail-row">${L({size:20})} <span>${e}</span></div>`:E}<div class="detail-row">${this.channelIcon()} <span>${this.channelLabel()}</span></div>`}};i([S({type:String})],W.prototype,"startsAt",void 0),i([S({type:String})],W.prototype,"channel",void 0),i([S({type:String})],W.prototype,"timezone",void 0),W=i([r(),n("appointment-card-details")],W);let X=class CancelAppointmentConfirmationDialog extends O{constructor(){super(...arguments),this.open=!1,this.cancelAppointmentMutation=new Q(this,{mutationFn:async e=>this.apiClient.appointments.cancelAppointment(e),onSuccess:()=>{this.queryClientContext?.invalidateQueries({queryKey:e(this.apiClient)}),this.dispatchEvent(new CustomEvent("success",{bubbles:!0,composed:!0}))},onError:t=>{const i=m(t)?t.response?.status:void 0,n=void 0!==i&&i>=400&&i<500&&401!==i;n&&this.queryClientContext?.invalidateQueries({queryKey:e(this.apiClient)}),this.dispatchEvent(new CustomEvent("cancel-failed",{bubbles:!0,composed:!0,detail:{rejected:n}}))}}),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}.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%}.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}`}render(){const e=R(),t=this.price,i=H(t),n=this.cancelAppointmentMutation.isPending;if(i){const i=G(t,e),o=`-${i}`;return z`<mq-dialog .open="${this.open}" .dismissable="${!n}" alert .closeLabel="${a("Cerrar")}" @mq-close="${this.handleClose}"><h2 slot="heading">${a("Confirmar cancelación")}</h2><p slot="subheading">${a("¿Seguro que quieres cancelar esta cita? Se te devolverá el importe pagado en un plazo de 5-10 días hábiles.")}</p><div class="price-rows"><div class="price-row"><span>${a("Importe pagado")}</span> <span>${i}</span></div><div class="price-row"><span>${a("Importe a devolver")}</span> <span>${o}</span></div></div><mq-button slot="footer" variant="outline" ?disabled="${n}" @click="${this.handleDismissClick}">${a("Volver")}</mq-button><mq-button slot="footer" variant="primary" ?disabled="${n}" @click="${this.handleConfirmClick}">${a("Confirmar")}</mq-button></mq-dialog>`}return z`<mq-dialog .open="${this.open}" .dismissable="${!n}" alert .closeLabel="${a("Cerrar")}" @mq-close="${this.handleClose}"><h2 slot="heading">${a("Confirmar cancelación")}</h2><p slot="subheading">${a("¿Seguro que quieres cancelar esta cita?")}</p><mq-button slot="footer" variant="outline" ?disabled="${n}" @click="${this.handleDismissClick}">${a("Cancelar")}</mq-button><mq-button slot="footer" variant="primary" ?disabled="${n}" @click="${this.handleConfirmClick}">${a("Confirmar")}</mq-button></mq-dialog>`}};i([o({context:p,subscribe:!0})],X.prototype,"apiClient",void 0),i([S({type:Boolean,reflect:!0})],X.prototype,"open",void 0),i([o({context:N,subscribe:!0})],X.prototype,"queryClientContext",void 0),i([S({type:String})],X.prototype,"appointmentId",void 0),i([S({type:Object})],X.prototype,"price",void 0),X=i([r(),n("cancel-appointment-confirmation-dialog")],X);const Z=M`:host{display:flex;flex-direction:column;justify-content:space-between;gap:var(--sp-6);flex:1;width:100%;min-width:0;box-sizing:border-box;color:var(--color-text-icons--primary,#0a0a22)}professional-overview{--avatar-size-lg:66px;--text-lg--line-height:1.35;display:block}.footer{display:flex;flex-direction:column;gap:var(--sp-4)}.reminder{font-family:var(--font-body);font-size:var(--text-sm);line-height:1.35;font-weight:var(--font-weight-normal);color:var(--color-text-icons--secondary,#6d658b);margin:0}.actions{--button-height-md:2.75rem;display:flex;align-items:stretch;gap:10px}.actions>mq-button{flex:1;min-width:0}.overflow{position:relative;flex:0 0 auto}.chat-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-badge{--mq-unread-badge-size:8px;flex-shrink:0}@media (max-width:767px){.actions{flex-wrap:wrap}.actions>mq-button.join{order:1;flex:1 0 100%}}.menu{position:absolute;right:0;bottom:calc(100% + var(--sp-2));z-index:2;display:flex;flex-direction:column;min-width:176px;padding:var(--sp-1);background-color:var(--color-card,#fff);border:1px solid var(--color-border-subtle,#edecf1);border-radius:var(--border-radius-lg);box-shadow:var(--shadow-lg)}.menu-item{display:block;width:100%;background:0 0;border:none;border-radius:var(--border-radius-sm);padding:var(--sp-2) var(--sp-3);cursor:pointer;text-align:left;font-family:var(--font-body);font-size:var(--text-sm);line-height:1.35;color:var(--color-text-icons--primary,#0a0a22)}.menu-item:hover{background-color:var(--color-muted)}.menu-item.negative{color:var(--color-negative)}`;let Y=class NextAppointmentCard extends O{constructor(){super(...arguments),this.token="",this.patientHash="",this.isChatOpen=!1,this.isMenuOpen=!1,this.isCancelDialogOpen=!1,this.openDialog=null,this.getUnreadMessagesQuery=new l(this,()=>({...k(this.apiClient,{roomId:this.appointmentResource?.room?.id}),enabled:!!this.appointmentResource?.room?.id})),this.getOrganizationSetupQuery=new l(this,()=>v(this.apiClient)),this.getOrganizationSpecialtiesQuery=new l(this,()=>b(this.apiClient,{enabled:!!this.appointmentResource?.speciality?.id})),this.closeMenuOnOutsideClick=e=>{e.composedPath().includes(this)||(this.isMenuOpen=!1)},this.closeMenuOnEscape=e=>{"Escape"===e.key&&(this.isMenuOpen=!1)},this.handleJoinVideocall=()=>{y.track($(this.sessionPatientHash,this.appointmentId)),this.dispatchEvent(new I({appointmentId:this.appointmentId}))},this.handleToggleChat=()=>{this.isChatOpen=!this.isChatOpen,this.isChatOpen&&y.track(C(this.sessionPatientHash,this.appointmentId))},this.handleModify=()=>{this.isMenuOpen=!1,this.isModifyUnavailable?this.openDialog="modify":(y.track(w(this.sessionPatientHash,this.appointmentId)),this.dispatchEvent(new A({appointmentId:this.appointmentId})))},this.handleCancel=()=>{this.isMenuOpen=!1,this.isCancelUnavailable?this.openDialog="cancel":(y.track(x(this.sessionPatientHash,this.appointmentId)),this.isCancelDialogOpen=!0)}}static{this.styles=Z}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.closeMenuOnOutsideClick),document.addEventListener("keydown",this.closeMenuOnEscape)}disconnectedCallback(){document.removeEventListener("click",this.closeMenuOnOutsideClick),document.removeEventListener("keydown",this.closeMenuOnEscape),super.disconnectedCallback()}get appointmentId(){return this.appointmentResource.appointment.id??""}get channel(){return this.appointmentResource.appointment.channel}get sessionToken(){return this.token||this.loginToken?.access_token||""}get sessionPatientHash(){return this.patientHash||this.loginToken?.patient?.hash||""}get sessionTimezone(){return this.timezone??this.loginToken?.patient?.timezone}get unreadCount(){return this.getUnreadMessagesQuery.result?.data?.unread_count??0}get specialtyName(){const e=this.getOrganizationSpecialtiesQuery.result?.data?.find(e=>Number(e.id)===Number(this.appointmentResource.speciality?.id));return q(e?.code??"",R(),e?.name??this.appointmentResource.speciality?.name)}get hasChatSupport(){return this.appointmentResource.appointment.has_chat_in_appointment??this.getOrganizationSetupQuery.result?.data?.appointments?.has_chat_in_appointment??!1}get isExpired(){return h(this.appointmentResource.appointment.expires_at)}get refundPolicySeconds(){return this.getOrganizationSetupQuery.result?.data?.appointments?.seconds_before_start_to_refund_on_cancel}get policyAllowsModifyOrCancel(){return j({startsAtIso:this.appointmentResource.appointment.starts_at,refundPolicySeconds:this.refundPolicySeconds})}get isModifyUnavailable(){return this.isExpired||0===this.appointmentResource.slots.length||!this.policyAllowsModifyOrCancel}get isCancelUnavailable(){return this.isExpired||!this.policyAllowsModifyOrCancel}get modifyUnavailableMessage(){return V({action:"modify",refundPolicySeconds:this.refundPolicySeconds})}get cancelUnavailableMessage(){return V({action:"cancel",refundPolicySeconds:this.refundPolicySeconds})}renderActions(){const e=this.channel===d.videocall;return z`<div class="actions">${this.hasChatSupport?z`<mq-button variant="outline" @click="${this.handleToggleChat}"><span class="chat-label">${a("Ir a chat")}</span> ${this.unreadCount>0?z`<mq-unread-badge class="chat-badge"></mq-unread-badge>`:E}</mq-button>`:E} ${e?z`<mq-button class="join" variant="primary" @click="${this.handleJoinVideocall}">${a("Unirse a la videoconsulta")}</mq-button>`:E}<div class="overflow"><mq-button variant="outline" size="icon-lg" aria-label="${a("Más opciones")}" aria-haspopup="menu" aria-expanded="${this.isMenuOpen}" @click="${()=>{this.isMenuOpen=!this.isMenuOpen}}">${_({size:16})}</mq-button>${this.isMenuOpen?z`<div class="menu" role="menu"><button class="menu-item" type="button" role="menuitem" @click="${this.handleModify}">${a("Modificar cita")}</button> <button class="menu-item negative" type="button" role="menuitem" @click="${this.handleCancel}">${a("Anular cita")}</button></div>`:E}</div></div>`}render(){const{professional:e}=this.appointmentResource;return z`<professional-overview .name="${e.name}" .specialtyName="${this.specialtyName}" .collegiateNumber="${e.collegiate_number??void 0}" .description="${e.description??""}" .languages="${e.languages??[]}" .avatar="${e.avatar??""}"></professional-overview><appointment-card-details .startsAt="${this.appointmentResource.appointment.starts_at}" .channel="${this.channel}" .timezone="${this.sessionTimezone}"></appointment-card-details><div class="footer"><p class="reminder">${a("Recibirás un recordatorio 15 minutos antes de la consulta")}</p>${this.renderActions()}</div><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" hideCloseButton @mq-close="${()=>{this.isChatOpen=!1}}">${this.isChatOpen?z`<mq-chat-room slot="content" .consultationId="${this.appointmentResource.appointment.id}" consultation-type="appointment" token="${this.sessionToken}" .roomId="${this.appointmentResource.room.id}" .professionalHash="${e.hash}" ?readonly="${this.isExpired}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}"></mq-chat-room>`:E}</mq-floating-bubble><appointment-action-unavailable-dialog .open="${"modify"===this.openDialog}" .heading="${a("Modificar cita")}" .message="${this.modifyUnavailableMessage}" @close="${()=>{this.openDialog=null}}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"cancel"===this.openDialog}" .heading="${a("Anular cita")}" .message="${this.cancelUnavailableMessage}" @close="${()=>{this.openDialog=null}}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"cancel-rejected"===this.openDialog}" .heading="${a("Anular cita")}" .message="${a("Lo sentimos, esta cita ya no se puede anular.")}" @close="${()=>{this.openDialog=null}}"></appointment-action-unavailable-dialog><cancel-appointment-confirmation-dialog .appointmentId="${this.appointmentResource.appointment.id}" .price="${this.appointmentResource.price??void 0}" .open="${this.isCancelDialogOpen}" @cancel="${()=>{this.isCancelDialogOpen=!1}}" @cancel-failed="${e=>{this.isCancelDialogOpen=!1,e.detail.rejected?this.openDialog="cancel-rejected":F.error(a("No hemos podido anular la cita. Inténtalo de nuevo."))}}" @success="${()=>{this.isCancelDialogOpen=!1,F.success(a("Consulta anulada correctamente")),this.dispatchEvent(new CustomEvent("appointment-cancel-confirmed",{bubbles:!0,composed:!0,detail:{id:this.appointmentId}}))}}"></cancel-appointment-confirmation-dialog>`}};i([o({context:p,subscribe:!0})],Y.prototype,"apiClient",void 0),i([o({context:c,subscribe:!0})],Y.prototype,"loginToken",void 0),i([S({type:Object})],Y.prototype,"appointmentResource",void 0),i([S({type:String})],Y.prototype,"token",void 0),i([S({type:String})],Y.prototype,"patientHash",void 0),i([S({type:String})],Y.prototype,"timezone",void 0),i([D()],Y.prototype,"isChatOpen",void 0),i([D()],Y.prototype,"isMenuOpen",void 0),i([D()],Y.prototype,"isCancelDialogOpen",void 0),i([D()],Y.prototype,"openDialog",void 0),Y=i([r(),n("next-appointment-card")],Y);export{V as a,J as g};
1
+ import{s as e}from"./chunk-6CCJWPGL-TiaqZaPV.js";import{D as t}from"./chunk-5EJXDIGT-Bb4_pfDr.js";import{_ as i,c as n}from"./custom-element-D2ziPxYE.js";import{c as o}from"./consume-CovVqBjI.js";import{m as a,s}from"./runtime-Bg1WXVCx.js";import{l as r}from"./localized-decorator-BlOuLhym.js";import{Q as l}from"./query-controller-B1byDHlF.js";import{A as p}from"./api-client-context-BXGqBAlO.js";import{l as c}from"./chunk-S5RWG6G2-CQJ38pW6.js";import{e as d,i as m,d as h}from"./api-chat-client-s45J7LKB.js";import{g as u,p as g,a as f}from"./chunk-NIAGR3ZC-BDlNUZa1.js";import{g as v}from"./get-organization-setup-query-De7eM6V3.js";import{g as b,t as y,l as $,n as C,o as w,p as x,a as q}from"./telemetry-client-DA2_SZBC.js";import{g as k}from"./chunk-Y4EKUX25-Bix9r5ry.js";import{c as j}from"./refund-cancel-policy-DoMzcLlL.js";import{a as O,i as M,x as z,E}from"./lit-element-DiWJYFwC.js";import{n as S}from"./property-scuRaFcM.js";import{r as D}from"./state-LQivXIgA.js";import{MqAppointmentJoinVideocallEvent as I,MqAppointmentRescheduleEvent as A}from"../events.js";import{getLocale as R}from"../i18n.js";import{dotsHorizontalIcon as _}from"../ui/icons/dots-horizontal-icon.js";import"./mq-chat-room-C2EALCSm.js";import"../ui/mq-button.js";import"../ui/mq-dialog.js";import{calendarIcon as P}from"../ui/icons/calendar-icon.js";import{messageBubbleIcon as T}from"../ui/icons/message-bubble-icon.js";import{phoneIcon as L}from"../ui/icons/phone-icon.js";import{videoIcon as U}from"../ui/icons/video-icon.js";import{Q as N}from"./chunk-RCFIJTXZ-C6Ir0-sM.js";import{M as Q}from"./mutation-controller-CR2qcqhH.js";import{h as H,f as J}from"./price-DU3YLTpk.js";import"./professional-overview-Ck_SPivX.js";import"../ui/mq-floating-bubble.js";import"../ui/mq-unread-badge.js";import{toast as F}from"../ui/mq-toast.js";function G(i,n){return{queryKey:e(i,"appointments",n),queryFn:()=>i.appointments.getAppointments(n),staleTime:t}}function V(e){const{action:t,refundPolicySeconds:i}=e,n=null!=i&&i<3600,o=Math.ceil((i??0)/60),r=Math.ceil((i??0)/3600);return a(0===(n?o:r)?"modify"===t?"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"===t?n?s`Lo sentimos, como faltan menos de ${o} 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 ${o} minutos para tu cita no podemos anularla.`:s`Lo sentimos, como faltan menos de ${r} horas para tu cita no podemos anularla.`)}let K=class AppointmentActionUnavailableDialog extends O{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}mq-button{flex:1}`}render(){return z`<mq-dialog .open="${this.open}" .closeLabel="${a("Cerrar")}" @mq-close="${this.handleClose}"><h2 slot="heading">${this.heading}</h2><p slot="subheading">${this.message}</p><mq-button slot="footer" variant="primary" fullwidth @click="${this.handleClose}">${a("Volver")}</mq-button></mq-dialog>`}};i([S({type:Boolean,reflect:!0})],K.prototype,"open",void 0),i([S({type:String})],K.prototype,"heading",void 0),i([S({type:String})],K.prototype,"message",void 0),K=i([r(),n("appointment-action-unavailable-dialog")],K);const W=M`:host{display:flex;flex-direction:column;align-items:flex-start;gap:var(--sp-3)}.detail-row{display:inline-flex;align-items:center;gap:var(--sp-2);font-family:var(--font-body);font-size:var(--text-sm);line-height:1.35;font-weight:var(--font-weight-normal)}.detail-row svg{flex-shrink:0}.detail-row span::first-letter{text-transform:uppercase}`;let B=class AppointmentCardDetails extends O{constructor(){super(...arguments),this.startsAt=""}static{this.styles=W}channelIcon(){switch(this.channel){case d.videocall:return U({size:20});case d.phonecall:return L({size:20});default:return T({size:20})}}channelLabel(){switch(this.channel){case d.videocall:return a("Videoconsulta");case d.phonecall:return a("Consulta telefónica");default:return a("Chat")}}formatWhen(){const e=R().replace("_","-"),t=u(this.timezone),i=t?{timeZone:t}:{},n=g(this.startsAt);if(Number.isNaN(n.getTime()))return"";const o=new Intl.DateTimeFormat(e,{weekday:"long",day:"numeric",month:"long",year:"numeric",...i}).format(n),r=new Intl.DateTimeFormat(e,{timeStyle:"short",hourCycle:"h23",...i}).format(n),l=t?f(t,n):"";return a(s`${o}, ${r} h${l?` (${l})`:""}`)}render(){const e=this.formatWhen();return z`${e?z`<div class="detail-row">${P({size:20})} <span>${e}</span></div>`:E}<div class="detail-row">${this.channelIcon()} <span>${this.channelLabel()}</span></div>`}};i([S({type:String})],B.prototype,"startsAt",void 0),i([S({type:String})],B.prototype,"channel",void 0),i([S({type:String})],B.prototype,"timezone",void 0),B=i([r(),n("appointment-card-details")],B);let X=class CancelAppointmentConfirmationDialog extends O{constructor(){super(...arguments),this.open=!1,this.cancelAppointmentMutation=new Q(this,{mutationFn:async e=>this.apiClient.appointments.cancelAppointment(e),onSuccess:()=>{this.queryClientContext?.invalidateQueries({queryKey:e(this.apiClient)}),this.dispatchEvent(new CustomEvent("success",{bubbles:!0,composed:!0}))},onError:t=>{const i=m(t)?t.response?.status:void 0,n=void 0!==i&&i>=400&&i<500&&401!==i;n&&this.queryClientContext?.invalidateQueries({queryKey:e(this.apiClient)}),this.dispatchEvent(new CustomEvent("cancel-failed",{bubbles:!0,composed:!0,detail:{rejected:n}}))}}),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}.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%}.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}`}render(){const e=R(),t=this.price,i=H(t),n=this.cancelAppointmentMutation.isPending;if(i){const i=J(t,e),o=`-${i}`;return z`<mq-dialog .open="${this.open}" .dismissable="${!n}" alert .closeLabel="${a("Cerrar")}" @mq-close="${this.handleClose}"><h2 slot="heading">${a("Confirmar cancelación")}</h2><p slot="subheading">${a("¿Seguro que quieres cancelar esta cita? Se te devolverá el importe pagado en un plazo de 5-10 días hábiles.")}</p><div class="price-rows"><div class="price-row"><span>${a("Importe pagado")}</span> <span>${i}</span></div><div class="price-row"><span>${a("Importe a devolver")}</span> <span>${o}</span></div></div><mq-button slot="footer" variant="outline" ?disabled="${n}" @click="${this.handleDismissClick}">${a("Volver")}</mq-button><mq-button slot="footer" variant="primary" ?disabled="${n}" @click="${this.handleConfirmClick}">${a("Confirmar")}</mq-button></mq-dialog>`}return z`<mq-dialog .open="${this.open}" .dismissable="${!n}" alert .closeLabel="${a("Cerrar")}" @mq-close="${this.handleClose}"><h2 slot="heading">${a("Confirmar cancelación")}</h2><p slot="subheading">${a("¿Seguro que quieres cancelar esta cita?")}</p><mq-button slot="footer" variant="outline" ?disabled="${n}" @click="${this.handleDismissClick}">${a("Cancelar")}</mq-button><mq-button slot="footer" variant="primary" ?disabled="${n}" @click="${this.handleConfirmClick}">${a("Confirmar")}</mq-button></mq-dialog>`}};i([o({context:p,subscribe:!0})],X.prototype,"apiClient",void 0),i([S({type:Boolean,reflect:!0})],X.prototype,"open",void 0),i([o({context:N,subscribe:!0})],X.prototype,"queryClientContext",void 0),i([S({type:String})],X.prototype,"appointmentId",void 0),i([S({type:Object})],X.prototype,"price",void 0),X=i([r(),n("cancel-appointment-confirmation-dialog")],X);const Z=M`:host{display:flex;flex-direction:column;justify-content:space-between;gap:var(--sp-6);flex:1;width:100%;min-width:0;box-sizing:border-box;color:var(--color-text-icons--primary,#0a0a22)}professional-overview{--avatar-size-lg:66px;--text-lg--line-height:1.35;display:block}.footer{display:flex;flex-direction:column;gap:var(--sp-4)}.reminder{font-family:var(--font-body);font-size:var(--text-sm);line-height:1.35;font-weight:var(--font-weight-normal);color:var(--color-text-icons--secondary,#6d658b);margin:0}.actions{--button-height-md:2.75rem;display:flex;align-items:stretch;gap:10px}.actions>mq-button{flex:1;min-width:0}.overflow{position:relative;flex:0 0 auto}.chat-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-badge{--mq-unread-badge-size:8px;flex-shrink:0}@media (max-width:767px){.actions{flex-wrap:wrap}.actions>mq-button.join{order:1;flex:1 0 100%}}.menu{position:absolute;right:0;bottom:calc(100% + var(--sp-2));z-index:2;display:flex;flex-direction:column;min-width:176px;padding:var(--sp-1);background-color:var(--color-card,#fff);border:1px solid var(--color-border-subtle,#edecf1);border-radius:var(--border-radius-lg);box-shadow:var(--shadow-lg)}.menu-item{display:block;width:100%;background:0 0;border:none;border-radius:var(--border-radius-sm);padding:var(--sp-2) var(--sp-3);cursor:pointer;text-align:left;font-family:var(--font-body);font-size:var(--text-sm);line-height:1.35;color:var(--color-text-icons--primary,#0a0a22)}.menu-item:hover{background-color:var(--color-muted)}.menu-item.negative{color:var(--color-negative)}`;let Y=class NextAppointmentCard extends O{constructor(){super(...arguments),this.token="",this.patientHash="",this.isChatOpen=!1,this.isMenuOpen=!1,this.isCancelDialogOpen=!1,this.openDialog=null,this.getUnreadMessagesQuery=new l(this,()=>({...k(this.apiClient,{roomId:this.appointmentResource?.room?.id}),enabled:!!this.appointmentResource?.room?.id})),this.getOrganizationSetupQuery=new l(this,()=>v(this.apiClient)),this.getOrganizationSpecialtiesQuery=new l(this,()=>b(this.apiClient,{enabled:!!this.appointmentResource?.speciality?.id})),this.closeMenuOnOutsideClick=e=>{e.composedPath().includes(this)||(this.isMenuOpen=!1)},this.closeMenuOnEscape=e=>{"Escape"===e.key&&(this.isMenuOpen=!1)},this.handleJoinVideocall=()=>{y.track($(this.sessionPatientHash,this.appointmentId)),this.dispatchEvent(new I({appointmentId:this.appointmentId}))},this.handleToggleChat=()=>{this.isChatOpen=!this.isChatOpen,this.isChatOpen&&y.track(C(this.sessionPatientHash,this.appointmentId))},this.handleModify=()=>{this.isMenuOpen=!1,this.isModifyUnavailable?this.openDialog="modify":(y.track(w(this.sessionPatientHash,this.appointmentId)),this.dispatchEvent(new A({appointmentId:this.appointmentId})))},this.handleCancel=()=>{this.isMenuOpen=!1,this.isCancelUnavailable?this.openDialog="cancel":(y.track(x(this.sessionPatientHash,this.appointmentId)),this.isCancelDialogOpen=!0)}}static{this.styles=Z}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.closeMenuOnOutsideClick),document.addEventListener("keydown",this.closeMenuOnEscape)}disconnectedCallback(){document.removeEventListener("click",this.closeMenuOnOutsideClick),document.removeEventListener("keydown",this.closeMenuOnEscape),super.disconnectedCallback()}get appointmentId(){return this.appointmentResource.appointment.id??""}get channel(){return this.appointmentResource.appointment.channel}get sessionToken(){return this.token||this.loginToken?.access_token||""}get sessionPatientHash(){return this.patientHash||this.loginToken?.patient?.hash||""}get sessionTimezone(){return this.timezone??this.loginToken?.patient?.timezone}get unreadCount(){return this.getUnreadMessagesQuery.result?.data?.unread_count??0}get specialtyName(){const e=this.getOrganizationSpecialtiesQuery.result?.data?.find(e=>Number(e.id)===Number(this.appointmentResource.speciality?.id));return q(e?.code??"",R(),e?.name??this.appointmentResource.speciality?.name)}get hasChatSupport(){return this.appointmentResource.appointment.has_chat_in_appointment??this.getOrganizationSetupQuery.result?.data?.appointments?.has_chat_in_appointment??!1}get isExpired(){return h(this.appointmentResource.appointment.expires_at)}get refundPolicySeconds(){return this.getOrganizationSetupQuery.result?.data?.appointments?.seconds_before_start_to_refund_on_cancel}get policyAllowsModifyOrCancel(){return j({startsAtIso:this.appointmentResource.appointment.starts_at,refundPolicySeconds:this.refundPolicySeconds})}get isModifyUnavailable(){return this.isExpired||0===this.appointmentResource.slots.length||!this.policyAllowsModifyOrCancel}get isCancelUnavailable(){return this.isExpired||!this.policyAllowsModifyOrCancel}get modifyUnavailableMessage(){return V({action:"modify",refundPolicySeconds:this.refundPolicySeconds})}get cancelUnavailableMessage(){return V({action:"cancel",refundPolicySeconds:this.refundPolicySeconds})}renderActions(){const e=this.channel===d.videocall;return z`<div class="actions">${this.hasChatSupport?z`<mq-button variant="outline" @click="${this.handleToggleChat}"><span class="chat-label">${a("Ir a chat")}</span> ${this.unreadCount>0?z`<mq-unread-badge class="chat-badge"></mq-unread-badge>`:E}</mq-button>`:E} ${e?z`<mq-button class="join" variant="primary" @click="${this.handleJoinVideocall}">${a("Unirse a la videoconsulta")}</mq-button>`:E}<div class="overflow"><mq-button variant="outline" size="icon-lg" aria-label="${a("Más opciones")}" aria-haspopup="menu" aria-expanded="${this.isMenuOpen}" @click="${()=>{this.isMenuOpen=!this.isMenuOpen}}">${_({size:16})}</mq-button>${this.isMenuOpen?z`<div class="menu" role="menu"><button class="menu-item" type="button" role="menuitem" @click="${this.handleModify}">${a("Modificar cita")}</button> <button class="menu-item negative" type="button" role="menuitem" @click="${this.handleCancel}">${a("Anular cita")}</button></div>`:E}</div></div>`}render(){const{professional:e}=this.appointmentResource;return z`<professional-overview .name="${e.name}" .specialtyName="${this.specialtyName}" .collegiateNumber="${e.collegiate_number??void 0}" .description="${e.description??""}" .languages="${e.languages??[]}" .avatar="${e.avatar??""}"></professional-overview><appointment-card-details .startsAt="${this.appointmentResource.appointment.starts_at}" .channel="${this.channel}" .timezone="${this.sessionTimezone}"></appointment-card-details><div class="footer"><p class="reminder">${a("Recibirás un recordatorio 15 minutos antes de la consulta")}</p>${this.renderActions()}</div><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" hideCloseButton @mq-close="${()=>{this.isChatOpen=!1}}">${this.isChatOpen?z`<mq-chat-room slot="content" .consultationId="${this.appointmentResource.appointment.id}" consultation-type="appointment" token="${this.sessionToken}" .roomId="${this.appointmentResource.room.id}" .professionalHash="${e.hash}" ?readonly="${this.isExpired}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}"></mq-chat-room>`:E}</mq-floating-bubble><appointment-action-unavailable-dialog .open="${"modify"===this.openDialog}" .heading="${a("Modificar cita")}" .message="${this.modifyUnavailableMessage}" @close="${()=>{this.openDialog=null}}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"cancel"===this.openDialog}" .heading="${a("Anular cita")}" .message="${this.cancelUnavailableMessage}" @close="${()=>{this.openDialog=null}}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"cancel-rejected"===this.openDialog}" .heading="${a("Anular cita")}" .message="${a("Lo sentimos, esta cita ya no se puede anular.")}" @close="${()=>{this.openDialog=null}}"></appointment-action-unavailable-dialog><cancel-appointment-confirmation-dialog .appointmentId="${this.appointmentResource.appointment.id}" .price="${this.appointmentResource.price??void 0}" .open="${this.isCancelDialogOpen}" @cancel="${()=>{this.isCancelDialogOpen=!1}}" @cancel-failed="${e=>{this.isCancelDialogOpen=!1,e.detail.rejected?this.openDialog="cancel-rejected":F.error(a("No hemos podido anular la cita. Inténtalo de nuevo."))}}" @success="${()=>{this.isCancelDialogOpen=!1,F.success(a("Consulta anulada correctamente")),this.dispatchEvent(new CustomEvent("appointment-cancel-confirmed",{bubbles:!0,composed:!0,detail:{id:this.appointmentId}}))}}"></cancel-appointment-confirmation-dialog>`}};i([o({context:p,subscribe:!0})],Y.prototype,"apiClient",void 0),i([o({context:c,subscribe:!0})],Y.prototype,"loginToken",void 0),i([S({type:Object})],Y.prototype,"appointmentResource",void 0),i([S({type:String})],Y.prototype,"token",void 0),i([S({type:String})],Y.prototype,"patientHash",void 0),i([S({type:String})],Y.prototype,"timezone",void 0),i([D()],Y.prototype,"isChatOpen",void 0),i([D()],Y.prototype,"isMenuOpen",void 0),i([D()],Y.prototype,"isCancelDialogOpen",void 0),i([D()],Y.prototype,"openDialog",void 0),Y=i([r(),n("next-appointment-card")],Y);export{V as a,G as g};
@@ -1,15 +1,15 @@
1
1
  import * as lit_html from 'lit-html';
2
2
  import * as lit from 'lit';
3
3
  import { LitElement } from 'lit';
4
- import { M as MediquoApiChatClient, G as GetAppointmentsResponse } from './index.d-ByhRBSb1.js';
4
+ import { M as MediquoApiChatClient, G as GetAppointmentsResponse } from './index.d-DHMNq1lu.js';
5
5
  import { L as LoginTokenResponse } from './schemas.d-b6_AekBb.js';
6
- import './mq-chat-room-C8wCADp2.js';
6
+ import './mq-chat-room-C0dJCvpV.js';
7
7
  import '../ui/mq-button.js';
8
8
  import '../ui/mq-dialog.js';
9
- import { A as AppointmentChannel } from './appointment.model.d-BWwBLaEL.js';
9
+ import { A as AppointmentChannel } from './index-DwlJg2um.js';
10
10
  import { P as PriceInCents } from './price.d-CwLosdAN.js';
11
11
  import { QueryClient } from '@tanstack/query-core';
12
- import './professional-overview-mO3tuMuH.js';
12
+ import './professional-overview-QVHl_ITk.js';
13
13
  import '../ui/mq-floating-bubble.js';
14
14
  import '../ui/mq-unread-badge.js';
15
15
 
@@ -0,0 +1 @@
1
+ import{_ as t,c as e}from"./custom-element-D2ziPxYE.js";import{m as a,s as i}from"./runtime-Bg1WXVCx.js";import{l as o}from"./localized-decorator-BlOuLhym.js";import{i as s,a as r,x as n,E as l}from"./lit-element-DiWJYFwC.js";import{n as d}from"./property-scuRaFcM.js";import{r as p}from"./state-LQivXIgA.js";import{getLocale as m}from"../i18n.js";import{chevronDownIcon as c}from"../ui/icons/chevron-down-icon.js";import"../ui/mq-text-button.js";import"../ui/mq-avatar.js";import"./index-Djkwyh_M.js";const f=s`.header{display:flex;align-items:center;gap:var(--sp-4);margin-bottom:0}.header.expanded{margin-bottom:var(--sp-4)}@media (max-width:768px){.header{--avatar-size-lg:var(--avatar-size-md)}}.professional-info{flex:1}.professional-name{font-family:var(--font-titles);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}.professional-specialty{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default);margin:0}.collegiate-number{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);color:var(--color-neutrals-text-medium);margin:0;text-transform:uppercase}.languages{display:flex;flex-wrap:wrap;gap:var(--sp-3)}.language-pill{display:inline-block;background-color:var(--color-background-light,#f8f7fa);color:var(--color-neutrals-text-medium);font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-medium);padding:var(--sp-1) var(--sp-2);min-width:64px;text-align:center;border-radius:26px;text-transform:capitalize;letter-spacing:1px}.description{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);margin-bottom:0;color:var(--color-neutrals-text-default)}.icon{transition:transform .1s ease-in-out}.rotate-180{transform:rotate(180deg)}.details{display:grid;grid-template-rows:0fr;transition:grid-template-rows .2s ease-out;overflow:hidden}.details[data-expanded=true]{grid-template-rows:1fr}.details-content{overflow:hidden}.details-content>:not(:first-child){margin-top:var(--sp-3)}@media (min-width:769px){:host([always-expanded-on-desktop]) .details{grid-template-rows:1fr}:host([always-expanded-on-desktop]) mq-text-button{display:none}:host([always-expanded-on-desktop]) .header{margin-bottom:var(--sp-4)}}`;let g=class ProfessionalOverview extends r{constructor(){super(...arguments),this.alwaysExpandedOnDesktop=!1,this.detailsExpanded=!1}static{this.styles=f}render(){const t=m().replace("_","-"),e=this.languages.map(e=>n`<span class="language-pill">${new Intl.DisplayNames(t,{type:"language"}).of(e)}</span>`);return n`<div class="header ${this.detailsExpanded?"expanded":""}"><mq-avatar src="${this.avatar}" fallback="${this.name}" alt="${this.name}" size="lg"></mq-avatar><div class="professional-info"><h2 class="professional-name">${this.name}</h2>${this.specialtyName?n`<p class="professional-specialty">${this.specialtyName}</p>`:l}<mq-text-button type="button" size="sm" fontWeight="bold" @click="${()=>{this.detailsExpanded=!this.detailsExpanded}}">${this.detailsExpanded?a("Ocultar detalles"):a("Ver detalles")} ${c({size:24,className:"icon "+(this.detailsExpanded?"rotate-180":"")})}</mq-text-button></div></div><div class="details" data-expanded="${this.detailsExpanded}"><div class="details-content"><div class="languages">${e}</div>${this.collegiateNumber?n`<p class="collegiate-number">${a(i`Nº COL. ${this.collegiateNumber}`)}</p>`:l}<p class="description"><professional-description .text="${this.description}"></professional-description></p></div></div>`}};t([d({type:String})],g.prototype,"name",void 0),t([d({type:String})],g.prototype,"specialtyName",void 0),t([d({type:String})],g.prototype,"collegiateNumber",void 0),t([d({type:String})],g.prototype,"description",void 0),t([d({type:Array})],g.prototype,"languages",void 0),t([d({type:String})],g.prototype,"avatar",void 0),t([d({type:Boolean,reflect:!0,attribute:"always-expanded-on-desktop"})],g.prototype,"alwaysExpandedOnDesktop",void 0),t([p()],g.prototype,"detailsExpanded",void 0),g=t([o(),e("professional-overview")],g);export{g as P};
@@ -3,6 +3,7 @@ import * as lit from 'lit';
3
3
  import { LitElement } from 'lit';
4
4
  import '../ui/mq-text-button.js';
5
5
  import '../ui/mq-avatar.js';
6
+ import './index-DwlJg2um.js';
6
7
 
7
8
  declare class ProfessionalOverview extends LitElement {
8
9
  static styles: lit.CSSResult;
@@ -0,0 +1 @@
1
+ import{s as a}from"./runtime-Bg1WXVCx.js";const e={s0043fc30b467bc43:"Ocultar detalhes",s00c8bf60a179e056:"O Google Pay não está disponível. Tente com cartão ou outro método de pagamento.",s035706a468d0c40b:"Viernes",s0520ac0a7da193d4:"Não foi possível validar o código. Tente novamente.",s071bd6bbf6c08f34:"Carregando",s08404262212123ef:"Como posso ajudar-te?",s08fe5307b5987c42:"De",s08fe5907b5988674:"Do",s09165307b5ad0e23:"Mi",s09165b07b5ad1bbb:"Ma",s09195307b5af43fa:"Lu",s092e4f07b5c19938:"Ju",s093b3307b5cbf400:"Vi",s09462f07b5d5f4b9:"Sa",s09528d5c26b62213:"Jueves",s0aaec824f7c6b501:"Enviar mensagem",s0b0085a15991b134:"Reconectando...",s0b0955208f737a86:"O arquivo excede o tamanho máximo permitido",s0eb69642cbc19745:"Esta consulta já passou, pelo que não pode ser modificada.",s0fc7c4bfd185800d:"Aqui vai ver as suas receitas e relatórios médicos.",s0fcbdef9dc977231:"Ocorreu um erro ao carregar a página. Por favor, tente novamente ou contacte o suporte.",s11605fc03de64e14:"Escreve aqui...",s12f171594a5379d2:"Tem certeza que deseja cancelar esta consulta?",s132e84f499a23985:"Não há horários disponíveis atualmente",s13317a76a9ed776e:"Repetir",s142eba34d93fe59e:"Descrição",s1513f3687bfcac96:"Domingo",s1a0efa6ac51e8a85:"Página anterior",s1a874fc38d0fcef0:"Ordem médica",s1d318e9d0ccba86b:"Chat",s1ee6d7e6d04932a4:"O email não é válido",s1fe8bb7f6ae07f9b:"Não tens consultas no histórico",s219b833c5ca095b3:"Aqui você verá todas as consultas que você teve. Pode acessar os documentos de cada consulta e reagendar uma consulta se necessário.",s22cf91a84fba4c4e:"Quando você agenda uma consulta, aparecerá aqui para que você possa consultá-la, modificá-la ou cancelá-la.",s238c3ed6d3ecc66a:"Fechar",s24b59d5a129dc0d0:"Não foi possível cancelar a consulta. Tenta novamente.",s255bf4de23c83482:"Condições de reserva:",s256189bafbcd2e34:"O telefone não é válido",s27e462e9f48eb3a6:"Documentação",s2a1d212b3cb5c1a1:"Pode chatear com o profissional até 48 horas após a sua consulta",s2aa2c19d07591438:"Vai receber um lembrete 15 minutos antes da consulta",s2aab27b26a86469f:"Motivo da consulta",s2b9fde9a5739d2a0:"Nome",s2bb20b2162a18938:"Por que precisa da consulta?",s2d6183fa992e10e9:"Este profissional não tem horários disponíveis",s2ebd846b5a30f9d1:"Lamentamos, não foi possível repetir a sua consulta. Por favor, contacte o suporte.",s30c9095a2e07d929:"Sala de espera",s31219c9bdeb7bc3e:"Continuar",s337e34cd11150eb6:"Ver as minhas consultas",s346d488070fe4cc8:"Pedir consulta",s3944638e633d719a:"Consulta",s3b77baf6a4864231:"Erro desconhecido",s3bd87e3e21b07900:"Espere enquanto a conexão é restabelecida",s3dc6584e403858df:"Não conseguimos carregar a sua documentação",s3f55bc3bfec41a5d:"Anexar arquivos",s4177fe7f5d70fd33:"Voltar",s41826ac201c3cd85:"Não foi possível abrir o chat com suporte",s4364d4be7641e15f:"Confirmar consulta",s43e5edcc8801e9a4:"Perfil de profesional",s47afb8f6895a937b:a`A procura de consultas em ${0} é elevada neste momento, pelo que os tempos de espera podem ser superiores ao habitual.`,s4813ee5d305442e5:"Parece que não encontramos-te na hora da sua consulta. Pode programar outra consulta para resolver as suas dúvidas.",s49683919cdaeca83:"Hoje",s4a061033615c8016:"Documentos",s4a8494821c987a17:"Relatório",s4a8f1fcd3f5e5952:"Ainda não é hora!",s4d20157b5a655e70:"Este horário não está disponível. Por favor, selecione outro.",s4de424f531892818:"Ir para videoconferência",s51c461d40f9fb865:"Seleciona o seu especialista",s536a0b4d3d4a5d9f:"Não conseguimos carregar a sua próxima consulta",s53d957dda6cc200b:"Serviço e plataforma prestados por",s53e2497bf900c7fd:"Não tens consultas próximas",s5558a2e389d04223:"Modificar",s55c5126e99bae190:"Buscar disponibilidade",s563dcbfd432eb18f:"Cancelar consulta",s57e65113a89160cf:"Modalidade da consulta",s59612eaa6993aa7e:a`${0} minutos`,s5b7cc3cc732206e2:"A reserva deste horário expirou. Por favor, selecione outro.",s5eef402d73eecbdc:"Anexar arquivo",s5f7956aacb5c6ca2:"A verificar Google Pay…",s5f817b8841b188d2:"Mais opções",s631f73a10d156b22:"Consulta expirada",s63f7af84683dd7c3:"Esta consulta já não pode ser modificada ou cancelada: o tempo mínimo requerido antes do início já passou.",s643155d1b6ee1684:"Tente novamente dentro de alguns minutos.",s64b78a5026d4ce8d:"Não há horários disponíveis",s65bedc0e516977d9:"Sábado",s679be6312356a21c:"Agende uma consulta médica quando você precisar. Aqui você verá todos os detalhes e poderá gerenciar as suas consultas próximas.",s67f30f9f4ea881f3:"Este código não é válido.",s6a50fd7f52263b04:"Não foi possível voltar à sala de espera",s6ab6fcd87fdbf217:"Olá",s6b1c4fb634461e7c:"Mês anterior",s6b6fa877ec1e6968:"Chatear com o profissional",s6c81d42670932f93:"Atualizar",s6e2423db05f36856:"Pedido de consulta",s6ecdc22accc55af7:"Videochamada",s70258a0040dd9e19:"Voltar à sala de espera",s705f4bd8bc8e04d8:"Faltam as credenciais de pagamento. Volte atrás e tente novamente.",s718177442a7447b2:"Consulta com um especialista em menos de 72 horas",s733b3bf647b7b0fa:"Aceita os permissões de câmara e microfone",s73cad78d8a3c39c2:"Prescrição",s74d7a739b6ab651d:"Histórico",s757fef148e0c94c6:"Disponibilidade",s77320b73fdd9cc40:"Sair",s775370fdb0af1546:"Data de nascimento",s77c2b712a9813175:"Pedir uma nova consulta",s77f8e4bee88d44aa:a`${0} de ${1}`,s7907902da8916212:"O profissional vai te ligar no número que indicas neste campo.",s7aa3cd94d51825fc:"Não há profissionais disponíveis para a especialidade selecionada. Por favor, tente novamente em outro momento ou selecione outra especialidade.",s7af26e861bb6f905:"Falta o identificador de gateway do Google Pay",s7fd8da9511b66dd4:"Pode anexar imagens ou documentação adicional (análises, resultados de testes, etc.) para que o médico avalie",s83c6ce869a2bbaa7:"(1 é muito mau, 5 é excelente)",s8447efe79d058943:"Valor pago",s8581adc786786298:"Formato de arquivo não suportado",s862ca980b16911d0:"Chatear com o profissional",s8c18dbf02590a72e:"Código promocional aplicado",s8cce15c931017937:"Voltar ao início",s8e7a6119525dc7c9:a`Lamentamos, como faltam menos de ${0} minutos para a sua consulta não a podemos modificar.`,s9005845c358db9da:"Não conseguimos descarregar o documento.",s92f34d487d1d0355:"Promoção",s94626d2ffd70f075:"Código promocional validado com sucesso",s9536695467bcf9c4:"Esta consulta já passou, pelo que não pode ser cancelada.",s96474eac63a69381:"Ir para o chat",s96ceb408923a7ab1:a`Nº COL. ${0}`,s970d59d6d88e7e6c:"Não é possível iniciar o pagamento",s979ee14368bf1505:"Fala comigo",s9802dd10b2c2f760:"Enviar",s99898f495319cd49:"Este mensagem foi eliminado",s9c309154722f8e06:"Carregando portal de pagamento",s9cabdaf42f04afee:"Introduza o código",s9cbf16425cadadb1:"Por favor, tente novamente mais tarde.",s9d22fa67943fdc4c:"Consulta telefónica",sa00e726e1e7e46a9:"Adicionar código promocional",sa27f38ad9db3bc4f:"Assistente comercial",sa2fe3f3b565f15f4:"Cancelar",sa4186d5e26cab4bb:"Página não encontrada",sa497ebaaeb251035:"Repetir consulta",sa7de4334479674c6:"Modificar consulta",sa82bc40dafbe3256:a`Consulta agendada de ${0}`,sa83d79734eb60ee3:"Aplicar",sa86d729f62b39f99:"Entrar na videochamada",sa87d2c48a52b2617:"Você não tem documentação",sab964c37a0934399:"Não foi possível carregar o Google Pay. Verifique a configuração do site e tente novamente.",sac2728ace11e5f4b:"Especialidade*",sadc5ede25dd6e126:"O profissional vai te enviar uma mensagem para que possamos协调ar a consulta. Certifique-se de ter boa cobertura e poder atender no horário escolhido.",sae8f7ac5552b2af1:"Quando faltarem 10 minutos para a sua consulta, poderás aceder à videoconferência",saf63dc4c8601ec8c:"a",safe333e385f371ff:"Verificando seu pagamento...",saff3019e8a8c5f98:"Lunes",sb01184796ad3832e:"Como correu a tua consulta?",sb410a3509b92a90c:"Tens algum comentário sobre a consulta?",sb49dc4c5edae9d4e:"Avaliação da consulta",sb5387e21dc21422b:"Consulta modificada",sb621415007181c43:"Mês seguinte",sb73394814d122852:"Se o seu médico gerou alguma documentação, poderás ver e descarregar aqui, na secção de documentação, o seu e-mail ou o chat.",sb882f28c9b20052e:"Consulta confirmada",sba98cf8b2a7dfca4:"Ontem",sbbee712c4900abc2:"Não conseguimos iniciar o pagamento",sbc0be90393c87447:a`Resumo da consulta para ${0}`,sbcf081de432a2172:"Ver detalhes",sbcfc05bdb868b383:"Prescrição",sbd07d1f779e482ae:"Não conseguimos confirmar seu pagamento",sbd9803cceb34513a:"Iniciar chat com assistente comercial",sbda1cf7b293e17d2:"Carregar arquivo",sc27e7c4850fc5a34:a`Lamentamos, como faltam menos de ${0} horas para a sua consulta não a podemos cancelar.`,sc3bb7ea72886e4d0:"Documentos recentes",sc3c7734c15d2a045:"Conta-nos como foi o atendimento ou se tiveste algum problema com a videochamada…",sc43929cc6582a185:"Ver agenda completa",sc4edf6a4e0157d4e:"Consultas próximas",sc6f816a96e8578ff:"Lamentamos, esta consulta já não pode ser cancelada.",sc7cf2be40c8614fa:a`Lamentamos, como faltam menos de ${0} minutos para a sua consulta não a podemos cancelar.`,sca0e87aae6bde276:"Ocorreu algum problema?",sca4bd395e3148194:"Confirmar cancelação",sca90bc30758f9082:"A página que estás a procurar foi removida, renomeada ou pode não existir.",scbe4c6673872bda5:"Telefone",sce29e337ebd75277:"Chat com suporte",scf469737e1670fd4:"Página seguinte",scfc7f5c5f41936dc:"Meus consultas",sd1f44f1a8bc20e67:"Email",sd24922a2783f286e:"Miércoles",sd2a8fc66c53c1a27:"Saltar",sd3f7579076c6611c:"Parece que rejeitou os permissões necessárias para entrar na videoconferência. Edita os permissões no seu navegador para entrar. Uma vez concedidos, deves atualizar esta tela.",sd4beaeb9a1b1fed5:"Datas anteriores",sd812eb30f385776d:"Completa o seu perfil",sd853d3bcf5341b59:"Ver mais",sda962b28e9110c82:"Realiza a busca no seu perfil médico digital",sdb7004e477873574:"Consulta cancelada com sucesso",sdd963b1b2ce9a1f5:a`O profissional vai te ligar no ${0} no horário selecionado. Certifique-se de ter boa cobertura e poder atender no horário escolhido.`,sde993da26c048f19:"Traumatologia, ginecologia, endocrinologia, digestivo ou psiquiatria",sdee32ae81ca0d6d8:"Adicionar ao calendário",se00b081edccfae39:"Datas seguintes",se07ea9607704c5ad:"Alterar código",se090f7226b372a4a:"Se a consulta não pôde ser realizada, podes",se0c7cc77f86aa8a0:"Apelidos",se17f2b402ecea2e1:"Valor a devolver",se18fa3ef98e155de:"A preparar Google Pay…",se1cce5af3e9bb6ee:"Ocorreu um erro ao enviar o arquivo",se1cf783f86c53031:"Martes",se45e6f6f3428ad50:a`Link para a consulta: ${0}`,se5a09223256f98db:"Este campo é obrigatório",se5f9264155b99909:"Ocorreu um problema ao verificar o estado do seu pagamento. Por favor, contate o suporte se o pagamento foi realizado.",se92e438da4e7099f:a`Lamentamos, como faltam menos de ${0} horas para a sua consulta não a podemos modificar.`,sea11fd8a12559bc5:"Consulta prévia:",seb6739450e8d9c8d:"Tem certeza que deseja cancelar esta consulta? Você receberá o valor pago em um prazo de 5-10 dias úteis.",seb850e89f9ff58e8:"Próxima consulta",sed750da423170d47:"Resultados para:",sed836a96c3b5d523:"Portal de pagamento",sed8ec5e3c64fa25d:"Total",sed97e90642983578:"Continuar ao pagamento",sedb2092dda465ea1:"DNI/NIE",sedbca9676f07a51f:"Modalidade da consulta*",see7c0a7b5b6ebbc5:"Utiliza o chat para enviar o motivo da consulta, documentos ou imagens",sefc0dd68776c9466:"Questionário pré-consulta",sf0638d3fc50964d2:"Escolhe outra data",sf0695a0a125ae748:"Confirmar",sf199b210440b7c5f:"Consulta finalizada",sf3457daf057bff15:"voltar à sala de espera.",sf484a0e20a7829ac:"Nós enviaremos um e-mail para o e-mail indicado quando for a hora de conectar-se à videoconferência. Certifique-se de ter uma boa conexão com a internet e um dispositivo com câmara e microfone.",sf48d12e7ae207023:"Especialidade",sf5258cfb2fa10bdc:"Aguarde ser atendido sem sair desta tela",sf63a72ff4116c6a9:"Descarregar documento",sf9705e1c4e82c017:"Não foi possível enviar o questionário",sfa6bc28a7faedc92:"Nova consulta de especialidades digitais",sfac5734d03595135:"Ver todas",sfc63af0362cfb78b:"Falta o identificador de comerciante do Google Pay",sfd51ca4e1b145054:"Não foi possível reservar este horário. Por favor, selecione outro.",sff337500b69abf7f:"O médico está a terminar a sua consulta. Atualiza em alguns minutos para ver se tem documentação.",sffbc330c8a19f838:"Ver menos",sc6a6d42245892254:"Falta el identificador de comercio de Apple Pay",s3da77e69fe62cb2a:"No se ha podido cargar Apple Pay. Comprueba la configuración del sitio e inténtalo de nuevo.",se1dd5d211b5b00e4:"Apple Pay no está disponible",s7e8b7a5acbdf83ed:"Preparando Apple Pay…",sc8271ba819299b59:"Comprobando Apple Pay…",s57e95bc3afddfeb0:"Para pagar con Apple Pay, escanea el código QR con tu iPhone (iOS 18 o posterior) y confirma el pago.",sf32cd04f9a848ee2:"Pagar con Apple Pay",sfbfb2a1dc8c3f636:"Esta consulta no se puede pagar aquí",s50247070c73385c2:"Por favor, contacta con soporte para poder continuar.",s6a796114fe45025d:a`${0}, ${1} h${2}`,s35d601992fe66fed:"Confirmando tu pago",s5370521b92483bf3:"No cierres, vuelvas atrás ni actualices la ventana; esto puede tardar unos momentos.",s77bf41039c589159:"Tu pago no se ha completado",s0e850d0fec6daf7d:"El pago ha sido rechazado y no hemos creado la cita. No se te ha cobrado nada: puedes volver a reservar desde el inicio.",s4007fa55a28f1f73:"Ese horario ya no está disponible",s0089e78f42dfd1a4:"Otro paciente ha reservado esa cita mientras completabas el pago, así que no hemos podido crearla.",saeefd0d6fb204a80:"Te hemos devuelto el importe automáticamente; puede tardar unos días en reflejarse en tu cuenta.",se478d6710916dadf:"No hemos podido devolverte el importe automáticamente. Escríbenos y lo resolvemos:",sf9e6fbadcce256d0:"Ha ocurrido un error",sa24acad3b1338788:"No hemos podido confirmar tu pago. Por favor, inténtalo de nuevo más tarde.",s8bbbd679ddb50d3b:"Si se te ha cobrado sin una cita confirmada, contacta con nuestro equipo en",s1dec877628213eef:"Tus citas",se0c593aac5e172e6:"Accede, modifica o anula tus citas.",s230b0bee447e61a5:"Ver mis citas"};export{e as templates};
@@ -0,0 +1 @@
1
+ import{f as t}from"./lit-element-DiWJYFwC.js";const i={PENDING:1,COMPLETE:2,ERROR:3},s=Symbol();class h{get taskComplete(){return this.t||(1===this.i?this.t=new Promise((t,i)=>{this.o=t,this.h=i}):3===this.i?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,i,s){this.p=0,this.i=0,(this._=t).addController(this);const r="object"==typeof i?i:{task:i,args:s};this.v=r.task,this.j=r.args,this.m=r.argsEqual??e,this.k=r.onComplete,this.A=r.onError,this.autoRun=r.autoRun??!0,"initialValue"in r&&(this.u=r.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){!0===this.autoRun&&this.S()}hostUpdated(){"afterUpdate"===this.autoRun&&this.S()}T(){if(void 0===this.j)return;const t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){const t=this.T(),i=this.O;this.O=t,t===i||void 0===t||void 0!==i&&this.m(i,t)||await this.run(t)}async run(t){let i,e;t??=this.T(),this.O=t,1===this.i?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,"afterUpdate"===this.autoRun?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();const r=++this.p;this.q=new AbortController;let a=!1;try{i=await this.v(t,{signal:this.q.signal})}catch(t){a=!0,e=t}if(this.p===r){if(i===s)this.i=0;else{if(!1===a){try{this.k?.(i)}catch{}this.i=2,this.o?.(i)}else{try{this.A?.(e)}catch{}this.i=3,this.h?.(e)}this.u=i,this.l=e}this._.requestUpdate()}}abort(t){1===this.i&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}}const e=(i,s)=>i===s||i.length===s.length&&i.every((i,e)=>!t(i,s[e]));export{h,i as s};
@@ -1 +1 @@
1
- import{s as t}from"./chunk-6CCJWPGL-TiaqZaPV.js";import{D as e}from"./chunk-5EJXDIGT-Bb4_pfDr.js";function n(n,i){return{queryKey:t(n,"organization-specialties"),queryFn:()=>n.organizations.getOrganizationSpecialties(),staleTime:e,...i}}function i(t,e){return{action_type:"event",event_type:"access to videocall button click",patient_hash:t,id_appointment:e}}function a(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function o(t,e){return{action_type:"event",event_type:"modify appoinment button click",patient_hash:t,id_appointment:e}}function p(t,e){return{action_type:"event",event_type:"cancel appoinment button click",patient_hash:t,id_appointment:e}}function s(t,e){return{action_type:"event",event_type:"view appointment document list button click",patient_hash:t,id_appointment:e}}function c(t,e){return{action_type:"event",event_type:"repeat appointment button click",patient_hash:t,id_appointment:e}}function _(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function r(t,e){return{action_type:"event",event_type:"access to videocall button click",patient_hash:t,id_appointment:e}}function l(t,e){return{action_type:"event",event_type:"add to calendar button click",patient_hash:t,id_appointment:e}}function u(t,e){return{action_type:"pageview",event_type:"appointment success page view",patient_hash:t,id_appointment:e}}function d(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function y(t,e){return{action_type:"event",event_type:"update documentation",patient_hash:t,id_appointment:e}}function h(t,e){return{action_type:"pageview",event_type:"documentation page view",patient_hash:t,id_appointment:e}}function v(t){return{action_type:"event",event_type:"view documentation list button click",patient_hash:t}}function g(t,e){return{action_type:"event",event_type:"download document button click",patient_hash:t,id_document:e}}function m(t){return{action_type:"event",event_type:"make an appointment button click",patient_hash:t}}function f(t){return{action_type:"event",event_type:"view appointment list button click",patient_hash:t}}function E(t){return{action_type:"pageview",event_type:"home page view",patient_hash:t}}function k(t,e,n){return{action_type:"event",event_type:"find availability button click",patient_hash:t,speciality_id:e,service_id:n}}function S(t,e,n,i,a,o,p){return{action_type:"debug",event_type:"find availability result",patient_hash:t,speciality_id:e,service_id:n,first_slot_date:i,first_slot_professional_hash:a,total_professionals:o,total_slots:p}}function b(t,e,n,i,a){return{action_type:"event",event_type:"professional schedule slot button click",patient_hash:t,professional_hash:e,start_date:n,speciality_id:i,service_id:a}}function T(t,e,n,i){return{action_type:"event",event_type:"professional availability button click",patient_hash:t,professional_hash:e,speciality_id:n,service_id:i}}function w(t,e,n,i,a){return{action_type:"event",event_type:"confirm appointment button click",patient_hash:t,professional_hash:e,start_date:n,speciality_id:i,service_id:a}}function P(t){return{action_type:"pageview",event_type:"select professional step page view",patient_hash:t}}function C(t,e){return{action_type:"pageview",event_type:"not time yet pageview",patient_hash:t,id_appointment:e}}function D(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function q(t,e){return{action_type:"pageview",event_type:"waiting room pageview",patient_hash:t,id_appointment:e}}function K(t,e){return{action_type:"pageview",event_type:"videocall pageview",patient_hash:t,id_appointment:e}}var G={digestive_system:{de_DE:"Verdauungssystem",en_US:"Digestive System",es_ES:"Aparato Digestivo",ca_ES:"Aparell Digestiu",pt_PT:"Aparelho Digestivo"},orthopedic_surgery_traumatology:{de_DE:"Traumatologie und Orthopädische Chirurgie",en_US:"Traumatology and Orthopedic Surgery",es_ES:"Traumatología y Cirugía Ortopédica",ca_ES:"Traumatologia i Cirurgia Ortopèdica",pt_PT:"Traumatologia e Cirurgia Ortopédica"},gynecology:{de_DE:"Gynäkologie",en_US:"Gynecology",es_ES:"Ginecología",ca_ES:"Ginecologia",pt_PT:"Ginecologia"},endocrinology:{de_DE:"Endokrinologie",en_US:"Endocrinology",es_ES:"Endocrinología",ca_ES:"Endocrinologia",pt_PT:"Endocrinologia"},psychiatry:{de_DE:"Psychiatrie",en_US:"Psychiatry",es_ES:"Psiquiatría",ca_ES:"Psiquiatria",pt_PT:"Psiquiatria"}},O={videocall:{de_DE:"Videosprechstunde",en_US:"Videocall",es_ES:"Videoconsulta",ca_ES:"Videoconsulta",pt_PT:"Videoconsulta"},phonecall:{de_DE:"Telefonische Behandlung",en_US:"Phone consultation",es_ES:"Consulta telefónica",ca_ES:"Consulta telefònica",pt_PT:"Consulta telefónica"}},U={de_DE:"Konsultationspreis",en_US:"Consultation price",es_ES:"Precio de consulta",ca_ES:"Preu de consulta",pt_PT:"Preço da consulta"},A={videocall:"videocall",phonecall:"phonecall",adeslas_videocall:"videocall",adeslas_prod_videocall:"videocall",adeslas_phonecall:"phonecall",adeslas_prod_phonecall:"phonecall"};function V(t,e,n){if(!t)return n??"";const i=A[t];return i?O[i][e]:n??U[e]}var j={consulta_telefonica:"phonecall",videoconsulta:"videocall"},x={"aparato-digestivo":"digestive_system","cirugia-ortopedica-y-traumatologia":"orthopedic_surgery_traumatology",ginecologia:"gynecology",endocrinologia:"endocrinology",psiquiatria:"psychiatry"};function z(t,e,n){const i=n?.trim();if(i)return i;const a=G[t]?.[e];return void 0!==a?a:t}class HttpTransport{endpoint;apiKey;constructor(t,e){this.endpoint=t,this.apiKey=e}send(t){fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":this.apiKey},body:JSON.stringify(t)}).catch(()=>{})}}class MediquoTelemetryClient{_apiKey=null;_transport=null;setApiKey(t){this._apiKey=t,this._buildTransport()}track(t){null!==this._transport&&this._transport.send(t)}_buildTransport(){null!==this._apiKey&&(this._transport=new HttpTransport("https://tracking.____.mediquo.com/sdk",this._apiKey))}}const B=new class AppTelemetryClient extends MediquoTelemetryClient{track(t){}};export{V as A,w as B,k as C,G as D,b as E,T as F,S as G,P as H,j as S,z as a,h as b,y as c,g as d,d as e,u as f,n as g,E as h,l as i,_ as j,r as k,i as l,m,a as n,o,p,c as q,v as r,s,B as t,C as u,f as v,D as w,q as x,K as y,x as z};
1
+ import{s as t}from"./chunk-6CCJWPGL-TiaqZaPV.js";import{D as e}from"./chunk-5EJXDIGT-Bb4_pfDr.js";function n(n,i){return{queryKey:t(n,"organization-specialties"),queryFn:()=>n.organizations.getOrganizationSpecialties(),staleTime:e,...i}}function i(t,e){return{action_type:"event",event_type:"access to videocall button click",patient_hash:t,id_appointment:e}}function a(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function o(t,e){return{action_type:"event",event_type:"modify appoinment button click",patient_hash:t,id_appointment:e}}function p(t,e){return{action_type:"event",event_type:"cancel appoinment button click",patient_hash:t,id_appointment:e}}function s(t,e){return{action_type:"event",event_type:"view appointment document list button click",patient_hash:t,id_appointment:e}}function c(t,e){return{action_type:"event",event_type:"repeat appointment button click",patient_hash:t,id_appointment:e}}function _(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function r(t,e){return{action_type:"event",event_type:"access to videocall button click",patient_hash:t,id_appointment:e}}function l(t,e){return{action_type:"event",event_type:"add to calendar button click",patient_hash:t,id_appointment:e}}function u(t,e){return{action_type:"pageview",event_type:"appointment success page view",patient_hash:t,id_appointment:e}}function d(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function y(t,e){return{action_type:"event",event_type:"update documentation",patient_hash:t,id_appointment:e}}function h(t,e){return{action_type:"pageview",event_type:"documentation page view",patient_hash:t,id_appointment:e}}function v(t){return{action_type:"event",event_type:"view documentation list button click",patient_hash:t}}function g(t,e){return{action_type:"event",event_type:"download document button click",patient_hash:t,id_document:e}}function m(t){return{action_type:"event",event_type:"make an appointment button click",patient_hash:t}}function f(t){return{action_type:"event",event_type:"view appointment list button click",patient_hash:t}}function E(t){return{action_type:"pageview",event_type:"home page view",patient_hash:t}}function k(t,e,n){return{action_type:"event",event_type:"find availability button click",patient_hash:t,speciality_id:e,service_id:n}}function S(t,e,n,i,a,o,p){return{action_type:"debug",event_type:"find availability result",patient_hash:t,speciality_id:e,service_id:n,first_slot_date:i,first_slot_professional_hash:a,total_professionals:o,total_slots:p}}function b(t,e,n,i,a){return{action_type:"event",event_type:"professional schedule slot button click",patient_hash:t,professional_hash:e,start_date:n,speciality_id:i,service_id:a}}function T(t,e,n,i){return{action_type:"event",event_type:"professional availability button click",patient_hash:t,professional_hash:e,speciality_id:n,service_id:i}}function w(t,e,n,i,a){return{action_type:"event",event_type:"confirm appointment button click",patient_hash:t,professional_hash:e,start_date:n,speciality_id:i,service_id:a}}function P(t){return{action_type:"pageview",event_type:"select professional step page view",patient_hash:t}}function C(t,e){return{action_type:"pageview",event_type:"not time yet pageview",patient_hash:t,id_appointment:e}}function D(t,e){return{action_type:"event",event_type:"open chat button click",patient_hash:t,id_appointment:e}}function q(t,e){return{action_type:"pageview",event_type:"waiting room pageview",patient_hash:t,id_appointment:e}}function K(t,e){return{action_type:"pageview",event_type:"videocall pageview",patient_hash:t,id_appointment:e}}var G={digestive_system:{de_DE:"Verdauungssystem",en_US:"Digestive System",es_ES:"Aparato Digestivo",ca_ES:"Aparell Digestiu",pt_PT:"Aparelho Digestivo"},orthopedic_surgery_traumatology:{de_DE:"Traumatologie und Orthopädische Chirurgie",en_US:"Traumatology and Orthopedic Surgery",es_ES:"Traumatología y Cirugía Ortopédica",ca_ES:"Traumatologia i Cirurgia Ortopèdica",pt_PT:"Traumatologia e Cirurgia Ortopédica"},gynecology:{de_DE:"Gynäkologie",en_US:"Gynecology",es_ES:"Ginecología",ca_ES:"Ginecologia",pt_PT:"Ginecologia"},endocrinology:{de_DE:"Endokrinologie",en_US:"Endocrinology",es_ES:"Endocrinología",ca_ES:"Endocrinologia",pt_PT:"Endocrinologia"},psychiatry:{de_DE:"Psychiatrie",en_US:"Psychiatry",es_ES:"Psiquiatría",ca_ES:"Psiquiatria",pt_PT:"Psiquiatria"}},O={videocall:{de_DE:"Videosprechstunde",en_US:"Videocall",es_ES:"Videoconsulta",ca_ES:"Videoconsulta",pt_PT:"Videoconsulta"},phonecall:{de_DE:"Telefonische Behandlung",en_US:"Phone consultation",es_ES:"Consulta telefónica",ca_ES:"Consulta telefònica",pt_PT:"Consulta telefónica"}},U={de_DE:"Konsultationspreis",en_US:"Consultation price",es_ES:"Precio de consulta",ca_ES:"Preu de consulta",pt_PT:"Preço da consulta"},A={videocall:"videocall",phonecall:"phonecall",adeslas_videocall:"videocall",adeslas_prod_videocall:"videocall",adeslas_phonecall:"phonecall",adeslas_prod_phonecall:"phonecall"};function V(t,e,n){if(!t)return n??"";const i=A[t];return i?O[i][e]:n??U[e]}var j={consulta_telefonica:"phonecall",videoconsulta:"videocall"},x={"aparato-digestivo":"digestive_system","cirugia-ortopedica-y-traumatologia":"orthopedic_surgery_traumatology",ginecologia:"gynecology",endocrinologia:"endocrinology",psiquiatria:"psychiatry"};function z(t,e,n){const i=n?.trim();if(i)return i;const a=G[t]?.[e];return void 0!==a?a:t}class HttpTransport{endpoint;apiKey;constructor(t,e){this.endpoint=t,this.apiKey=e}send(t){fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":this.apiKey},body:JSON.stringify(t)}).catch(()=>{})}}class MediquoTelemetryClient{_apiKey=null;_transport=null;setApiKey(t){this._apiKey=t,this._buildTransport()}track(t){null!==this._transport&&this._transport.send(t)}_buildTransport(){null!==this._apiKey&&(this._transport=new HttpTransport("https://tracking.____.mediquo.com/sdk",this._apiKey))}}const H=new class AppTelemetryClient extends MediquoTelemetryClient{track(t){}};export{V as A,w as B,k as C,G as D,b as E,T as F,S as G,P as H,j as S,z as a,h as b,y as c,g as d,d as e,u as f,n as g,E as h,l as i,_ as j,r as k,i as l,m,a as n,o,p,c as q,v as r,s,H as t,C as u,f as v,D as w,q as x,K as y,x as z};
package/dist/env.js CHANGED
@@ -1 +1 @@
1
- const E="https://mediquo-landing.s3.eu-central-1.amazonaws.com/sdk-web/elements",o="production",e="0.11.0",n={development:{MODE:"development",MQ_DEFAULT_ENV:o,MQ_ELEMENTS_VERSION:e,OPENTOK_API_KEY:"47836441",ASSETS_BASE_URL:E},production:{MODE:"production",MQ_DEFAULT_ENV:o,MQ_ELEMENTS_VERSION:e,OPENTOK_API_KEY:"46655102",ASSETS_BASE_URL:E}};let t=o;const _=new Proxy({},{get:(E,o)=>n[t??"production"][o]});function S(E){t=E}export{E as ASSETS_BASE_URL,_ as env,S as setEnv};
1
+ const E="https://mediquo-landing.s3.eu-central-1.amazonaws.com/sdk-web/elements",e="development",o="0.12.0-rc.0",n={development:{MODE:"development",MQ_DEFAULT_ENV:e,MQ_ELEMENTS_VERSION:o,OPENTOK_API_KEY:"47836441",ASSETS_BASE_URL:E},production:{MODE:"production",MQ_DEFAULT_ENV:e,MQ_ELEMENTS_VERSION:o,OPENTOK_API_KEY:"46655102",ASSETS_BASE_URL:E}};let t=e;const _=new Proxy({},{get:(E,e)=>n[t??"production"][e]});function S(E){t=E}export{E as ASSETS_BASE_URL,_ as env,S as setEnv};
package/dist/events.d.ts CHANGED
@@ -115,30 +115,9 @@ declare class MqPaymentSucceededEvent extends Event {
115
115
  consultationType: string;
116
116
  });
117
117
  }
118
- /**
119
- * Unlike the rest of the contract this event is **cancelable and has a default
120
- * action**: the emitting component navigates the top-level document to `url`
121
- * unless a listener calls `preventDefault()`. The escape hatch exists for
122
- * webviews and in-app shells that must open the gateway some other way.
123
- *
124
- * `url` is a single-use gateway checkout URL — treat it as a secret and do not
125
- * log it.
126
- */
127
- declare class MqPaymentRedirectEvent extends Event {
128
- readonly detail: {
129
- url: string;
130
- sessionId: string;
131
- };
132
- static eventName: string;
133
- constructor(detail: {
134
- url: string;
135
- sessionId: string;
136
- });
137
- }
138
118
  declare global {
139
119
  interface HTMLElementEventMap {
140
120
  "mq-payment-succeeded": MqPaymentSucceededEvent;
141
- "mq-payment-redirect": MqPaymentRedirectEvent;
142
121
  "mq-back": MqBackEvent;
143
122
  "mq-home": MqHomeEvent;
144
123
  "mq-view-appointments": MqViewAppointmentsEvent;
@@ -151,5 +130,5 @@ declare global {
151
130
  }
152
131
  }
153
132
 
154
- export { DownloadFileEvent, MqAppointmentBookEvent, MqAppointmentJoinVideocallEvent, MqAppointmentRescheduleEvent, MqAppointmentViewDocumentationEvent, MqBackEvent, MqHomeEvent, MqPaymentRedirectEvent, MqPaymentSucceededEvent, MqViewAppointmentsEvent, MqViewDocumentsEvent };
133
+ export { DownloadFileEvent, MqAppointmentBookEvent, MqAppointmentJoinVideocallEvent, MqAppointmentRescheduleEvent, MqAppointmentViewDocumentationEvent, MqBackEvent, MqHomeEvent, MqPaymentSucceededEvent, MqViewAppointmentsEvent, MqViewDocumentsEvent };
155
134
  export type { MqAppointmentsTab };
package/dist/events.js CHANGED
@@ -1 +1 @@
1
- class MqBackEvent extends Event{static{this.eventName="mq-back"}constructor(e={}){super(MqBackEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class MqHomeEvent extends Event{static{this.eventName="mq-home"}constructor(){super(MqHomeEvent.eventName,{bubbles:!0,composed:!0})}}class MqViewAppointmentsEvent extends Event{static{this.eventName="mq-view-appointments"}constructor(e){super(MqViewAppointmentsEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class MqAppointmentRescheduleEvent extends Event{static{this.eventName="mq-appointment-reschedule"}constructor(e){super(MqAppointmentRescheduleEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class MqAppointmentBookEvent extends Event{static{this.eventName="mq-appointment-book"}constructor(e={}){super(MqAppointmentBookEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class MqAppointmentJoinVideocallEvent extends Event{static{this.eventName="mq-appointment-join-videocall"}constructor(e){super(MqAppointmentJoinVideocallEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class MqAppointmentViewDocumentationEvent extends Event{static{this.eventName="mq-appointment-view-documentation"}constructor(e){super(MqAppointmentViewDocumentationEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class DownloadFileEvent extends Event{static{this.eventName="mq-download-file"}constructor(e){super(DownloadFileEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class MqViewDocumentsEvent extends Event{static{this.eventName="mq-view-documents"}constructor(){super(MqViewDocumentsEvent.eventName,{bubbles:!0,composed:!0})}}class MqPaymentSucceededEvent extends Event{static{this.eventName="mq-payment-succeeded"}constructor(e){super(MqPaymentSucceededEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class MqPaymentRedirectEvent extends Event{static{this.eventName="mq-payment-redirect"}constructor(e){super(MqPaymentRedirectEvent.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.detail=e}}export{DownloadFileEvent,MqAppointmentBookEvent,MqAppointmentJoinVideocallEvent,MqAppointmentRescheduleEvent,MqAppointmentViewDocumentationEvent,MqBackEvent,MqHomeEvent,MqPaymentRedirectEvent,MqPaymentSucceededEvent,MqViewAppointmentsEvent,MqViewDocumentsEvent};
1
+ class MqBackEvent extends Event{static{this.eventName="mq-back"}constructor(e={}){super(MqBackEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class MqHomeEvent extends Event{static{this.eventName="mq-home"}constructor(){super(MqHomeEvent.eventName,{bubbles:!0,composed:!0})}}class MqViewAppointmentsEvent extends Event{static{this.eventName="mq-view-appointments"}constructor(e){super(MqViewAppointmentsEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class MqAppointmentRescheduleEvent extends Event{static{this.eventName="mq-appointment-reschedule"}constructor(e){super(MqAppointmentRescheduleEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class MqAppointmentBookEvent extends Event{static{this.eventName="mq-appointment-book"}constructor(e={}){super(MqAppointmentBookEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class MqAppointmentJoinVideocallEvent extends Event{static{this.eventName="mq-appointment-join-videocall"}constructor(e){super(MqAppointmentJoinVideocallEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class MqAppointmentViewDocumentationEvent extends Event{static{this.eventName="mq-appointment-view-documentation"}constructor(e){super(MqAppointmentViewDocumentationEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class DownloadFileEvent extends Event{static{this.eventName="mq-download-file"}constructor(e){super(DownloadFileEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class MqViewDocumentsEvent extends Event{static{this.eventName="mq-view-documents"}constructor(){super(MqViewDocumentsEvent.eventName,{bubbles:!0,composed:!0})}}class MqPaymentSucceededEvent extends Event{static{this.eventName="mq-payment-succeeded"}constructor(e){super(MqPaymentSucceededEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}export{DownloadFileEvent,MqAppointmentBookEvent,MqAppointmentJoinVideocallEvent,MqAppointmentRescheduleEvent,MqAppointmentViewDocumentationEvent,MqBackEvent,MqHomeEvent,MqPaymentSucceededEvent,MqViewAppointmentsEvent,MqViewDocumentsEvent};
package/dist/i18n.js CHANGED
@@ -1 +1 @@
1
- import{c as e}from"./chunks/runtime-Bg1WXVCx.js";import{l as t}from"./chunks/chunk-FUCSYDW7-Duj5hy8S.js";import{z as n}from"./chunks/external-JLtsAfi6.js";const c=["ca_ES","de_DE","en_US","pt_PT"],s=n.enum(["en_US","pt_PT","de_DE","es_ES","ca_ES"]);function a(e){return s.safeParse(e).success}const o="__mqElementsLocalization__";function i(){const e=globalThis;return e[o]||(e[o]={initialized:!1}),e[o]}function r(){const n=i();if(!n.initialized){n.initialized=!0;try{const{setLocale:t,getLocale:s}=e({sourceLocale:"es_ES",targetLocales:c,loadLocale:async e=>{switch(e){case"en_US":default:return import("./chunks/en_US-CgxjeeCm.js");case"pt_PT":return import("./chunks/pt_PT-Vb6hoo2l.js");case"de_DE":return import("./chunks/de_DE-B-4V4SgD.js");case"ca_ES":return import("./chunks/ca_ES-BOvS9ayb.js")}}});n.setLocale=t,n.getLocale=s}catch(e){t.warn("Localization was already configured on this page.",e)}}}const u="Localization not initialized yet.";async function l(e){const{setLocale:n}=i();if(n)return n(e);t.warn(u)}function _(){const{getLocale:e}=i();return e?e():(t.warn(u),"es_ES")}export{_ as getLocale,r as initLocalization,a as isValidLocale,l as setLocale};
1
+ import{c as e}from"./chunks/runtime-Bg1WXVCx.js";import{l as t}from"./chunks/chunk-FUCSYDW7-Duj5hy8S.js";import{z as n}from"./chunks/external-JLtsAfi6.js";const c=["ca_ES","de_DE","en_US","pt_PT"],s=n.enum(["en_US","pt_PT","de_DE","es_ES","ca_ES"]);function a(e){return s.safeParse(e).success}const o="__mqElementsLocalization__";function i(){const e=globalThis;return e[o]||(e[o]={initialized:!1}),e[o]}function r(){const n=i();if(!n.initialized){n.initialized=!0;try{const{setLocale:t,getLocale:s}=e({sourceLocale:"es_ES",targetLocales:c,loadLocale:async e=>{switch(e){case"en_US":default:return import("./chunks/en_US-DONnbI9l.js");case"pt_PT":return import("./chunks/pt_PT-dELUeDqB.js");case"de_DE":return import("./chunks/de_DE-Dw0iVZNb.js");case"ca_ES":return import("./chunks/ca_ES-DYhnenv6.js")}}});n.setLocale=t,n.getLocale=s}catch(e){t.warn("Localization was already configured on this page.",e)}}}const u="Localization not initialized yet.";async function l(e){const{setLocale:n}=i();if(n)return n(e);t.warn(u)}function _(){const{getLocale:e}=i();return e?e():(t.warn(u),"es_ES")}export{_ as getLocale,r as initLocalization,a as isValidLocale,l as setLocale};
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { MqThemeProvider, ThemeName } from './mq-theme-provider.js';
2
- export { DownloadFileEvent, MqAppointmentBookEvent, MqAppointmentJoinVideocallEvent, MqAppointmentRescheduleEvent, MqAppointmentViewDocumentationEvent, MqAppointmentsTab, MqBackEvent, MqHomeEvent, MqPaymentRedirectEvent, MqPaymentSucceededEvent, MqViewAppointmentsEvent, MqViewDocumentsEvent } from './events.js';
2
+ export { DownloadFileEvent, MqAppointmentBookEvent, MqAppointmentJoinVideocallEvent, MqAppointmentRescheduleEvent, MqAppointmentViewDocumentationEvent, MqAppointmentsTab, MqBackEvent, MqHomeEvent, MqPaymentSucceededEvent, MqViewAppointmentsEvent, MqViewDocumentsEvent } from './events.js';
3
3
  export { d as defaultTheme } from './chunks/default-IpEn36CA.js';
4
4
  import 'lit-html';
5
5
  import 'lit';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{MqThemeProvider}from"./mq-theme-provider.js";export{DownloadFileEvent,MqAppointmentBookEvent,MqAppointmentJoinVideocallEvent,MqAppointmentRescheduleEvent,MqAppointmentViewDocumentationEvent,MqBackEvent,MqHomeEvent,MqPaymentRedirectEvent,MqPaymentSucceededEvent,MqViewAppointmentsEvent,MqViewDocumentsEvent}from"./events.js";export{defaultTheme}from"./theme.js";import"./chunks/custom-element-D2ziPxYE.js";import"./chunks/lit-element-DiWJYFwC.js";import"./chunks/property-scuRaFcM.js";import"./chunks/state-LQivXIgA.js";import"./chunks/ensure-context-root-DbdqwnKB.js";import"./chunks/context-request-event-Dfydf1ub.js";
1
+ export{MqThemeProvider}from"./mq-theme-provider.js";export{DownloadFileEvent,MqAppointmentBookEvent,MqAppointmentJoinVideocallEvent,MqAppointmentRescheduleEvent,MqAppointmentViewDocumentationEvent,MqBackEvent,MqHomeEvent,MqPaymentSucceededEvent,MqViewAppointmentsEvent,MqViewDocumentsEvent}from"./events.js";export{defaultTheme}from"./theme.js";import"./chunks/custom-element-D2ziPxYE.js";import"./chunks/lit-element-DiWJYFwC.js";import"./chunks/property-scuRaFcM.js";import"./chunks/state-LQivXIgA.js";import"./chunks/ensure-context-root-DbdqwnKB.js";import"./chunks/context-request-event-Dfydf1ub.js";
@@ -1,5 +1,5 @@
1
1
  import * as lit_html from 'lit-html';
2
- import { M as MediquoApiChatClient } from './chunks/index.d-ByhRBSb1.js';
2
+ import { M as MediquoApiChatClient } from './chunks/index.d-DHMNq1lu.js';
3
3
  import { LitElement, PropertyValues } from 'lit';
4
4
  import { Env } from './env.js';
5
5
  import 'axios';
@@ -1,6 +1,6 @@
1
1
  import * as lit from 'lit';
2
2
  import { LitElement, PropertyValues } from 'lit';
3
- import { M as MediquoApiChatClient } from './chunks/index.d-ByhRBSb1.js';
3
+ import { M as MediquoApiChatClient } from './chunks/index.d-DHMNq1lu.js';
4
4
  import { Env } from './env.js';
5
5
  import { Locale } from './i18n.js';
6
6
  import 'axios';