1"use strict";(self.webpackChunkkokuai_portal=self.webpackChunkkokuai_portal||[]).push([[6433],{19815:function(t,e,n){n.d(e,{f2:function(){return f},sB:function(){return h},uc:function(){return p}});var r=n(15671),a=n(43144),o=n(11752),i=n(61120),u=n(60136),c=n(27277),s=n(99241),d=n(39962),l=n(86580),p=function(t){(0,u.Z)(n,t);var e=(0,c.Z)(n);function n(t){var a;return(0,r.Z)(this,n),(a=e.call(this,t)).id=void 0,a.agenda=void 0,a.box=void 0,a.date=void 0,a.duration=void 0,a.phoneNumber=void 0,a.contactId=void 0,a.centre=void 0,a.procedure=void 0,a.email=void 0,a.title=void 0,a.type=void 0,a.notes=void 0,a.sourceStatus=void 0,a.id=t.id,a.agenda=t.agenda,a.box=t.box,a.date=t.date,a.duration=t.duration,a.phoneNumber=t.phoneNumber,a.contactId=t.contactId,a.procedure=t.procedure,a.centre=t.centre,a.email=t.email,a.notes=t.notes,a.title=t.title,a.type=t.type,a.sourceStatus=t.sourceStatus,a}return(0,a.Z)(n,[{key:"belongsToContact",value:function(t){if(this.contactId&&t.id)return this.isLinkedByContactId(t);if(this.phoneNumber!==t.phoneNumber)return!1;var e=v(this.getFullName()),n=v(t.fullName);return!e||!n||e===n}},{key:"isPhoneFallbackMatchFor",value:function(t){return this.belongsToContact(t)&&!this.isLinkedByContactId(t)}},{key:"isLinkedByContactId",value:function(t){return!!this.contactId&&!!t.id&&this.contactId===t.id}},{key:"getContactId",value:function(){return this.contactId}},{key:"getFullName",value:function(){return this.fullName?""===(0,o.Z)((0,i.Z)(n.prototype),"getLastName",this).call(this)?(0,o.Z)((0,i.Z)(n.prototype),"getFirstName",this).call(this):[(0,o.Z)((0,i.Z)(n.prototype),"getLastName",this).call(this),(0,o.Z)((0,i.Z)(n.prototype),"getFirstName",this).call(this)].join(", ").trim().replace(/,$/,""):""}},{key:"getProcedureName",value:function(){var t,e;return null===(t=this.procedure)||void 0===t||null===(e=t.name)||void 0===e?void 0:e.trim()}},{key:"getProcedureLabel",value:function(){var t;return null!==(t=this.getProcedureName())&&void 0!==t?t:f}},{key:"hasProcedure",value:function(){return!!this.procedure}},{key:"getSourceStatus",value:function(){return this.sourceStatus}},{key:"hasNotes",value:function(){return!!this.notes&&""!==this.notes.trim()}},{key:"getEndDate",value:function(){return new Date(this.date.getTime()+1e3*this.duration)}},{key:"isBlockedSlot",value:function(){return d.E_.BLOCKED_SLOT===this.type}},{key:"isAppointment",value:function(){return!this.isBlockedSlot()}},{key:"getNotes",value:function(){return this.notes||void 0}},{key:"getAgendaName",value:function(){return this.agenda}},{key:"getBox",value:function(){return this.box||void 0}},{key:"getType",value:function(){return this.type||d.E_.APPOINTMENT}},{key:"getTitle",value:function(){return this.isBlockedSlot()?this.title||"Bloqueo":this.title||this.getProcedureName()||"Sin tratamiento"}}]),n}(s.Appointment),f="Sin tratamiento",h="Sin box asignado";function v(t){return(0,l.Jo)(t).replace(/,/g," ").split(/\s+/).filter(Boolean).sort().join(" ")}},63600:function(t,e,n){n.d(e,{e:function(){return u}});var r=n(86580),a=n(19815),o=n(99241),i=n(39962),u={toFirestore:function(t){throw new Error("Not allowed to convert appointmens to firestore")},fromFirestore:function(t){var e,n,u,c,s,d,l,p=t.data(),f=p.procedure?{id:(0,r.Jo)(p.procedure.toLowerCase()),name:p.procedure}:void 0;return new a.uc({id:t.id,agenda:null!==(e=p.agenda)&&void 0!==e?e:"",box:p.box,date:p.date.toDate(),duration:p.duration,phoneNumber:p.phoneNumber,contactId:p.contactId,fullName:p.fullName,confirmedAt:null===(n=p.confirmedAt)||void 0===n?void 0:n.toDate(),canceledAt:null===(u=p.canceledAt)||void 0===u?void 0:u.toDate(),absenceAt:null===(c=p.absenceAt)||void 0===c?void 0:c.toDate(),finishedAt:null===(s=p.finishedAt)||void 0===s?void 0:s.toDate(),pendingAt:null===(d=p.pendingAt)||void 0===d?void 0:d.toDate(),rescheduledAt:null===(l=p.rescheduledAt)||void 0===l?void 0:l.toDate(),email:p.email,procedure:f,centre:p.centre,notes:p.notes,title:p.title,type:p.type===o.BLOCKED_SLOT_TYPE?i.E_.BLOCKED_SLOT:i.E_.APPOINTMENT,sourceStatus:p.sourceStatus})}}},56433:function(t,e,n){n.d(e,{j:function(){return k}});var r=n(4942),a=n(29439),o=n(37762),i=n(74165),u=n(15861),c=n(15671),s=n(43144),d=n(60136),l=n(27277),p=n(84854),f=n(85172),h=n(99241),v=n(14978),m=n(63600),g=n(92988),y=n(39251),k=function(t){(0,d.Z)(n,t);var e=(0,l.Z)(n);function n(t){var r,a=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2?arguments[2]:void 0;return(0,c.Z)(this,n),(r=e.call(this,t,o)).accountId=t,r.ignoreFix=a,r}return(0,s.Z)(n,[{key:"getById",value:function(){var t=(0,u.Z)((0,i.Z)().mark((function t(e){var n;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,f.QT)((0,f.JU)(this.getCollection(),e));case 2:return n=t.sent,t.abrupt("return",n.exists()?m.e.fromFirestore(n):void 0);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"getContactScheduledAppointments",value:function(t,e,n){var r=(0,f.IO)(this.getCollection(),(0,f.ar)("date",">=",new Date),(0,f.ar)("phoneNumber","==",t),(0,f.Xo)("date","asc")).withConverter(m.e);return(0,f.cf)(r,function(){var t=(0,u.Z)((0,i.Z)().mark((function t(n){return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e(n.docs.map((function(t){return t.data()})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),n)}},{key:"getNextScheduledAppointments",value:function(t,e,n){var r=(0,f.IO)(this.getCollection(),(0,f.ar)("date",">=",new Date),(0,f.ar)("phoneNumber","==",t),(0,f.Xo)("date","asc")).withConverter(m.e);return(0,f.cf)(r,function(){var t=(0,u.Z)((0,i.Z)().mark((function t(n){return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e(n.docs.map((function(t){return t.data()})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),n)}},{key:"getNextScheduledAppointmentsByPhoneNumbers",value:function(){var t=(0,u.Z)((0,i.Z)().mark((function t(e){var n,r,a,u,c,s,d,l,p,h;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n={},15,r=[],a=0;a<e.length;a+=15)r.push(e.slice(a,a+15));case 4:if(!(r.length>=1)){t.next=14;break}return u=r.shift(),c=(0,f.IO)(this.getCollection(),(0,f.ar)("date",">=",new Date),(0,f.ar)("phoneNumber","in",u),(0,f.Xo)("date","asc")).withConverter(m.e),t.next=9,(0,f.PL)(c);case 9:s=t.sent,d=(0,o.Z)(s.docs);try{for(d.s();!(l=d.n()).done;)p=l.value,h=p.data(),Object.hasOwn(n,h.phoneNumber)||(n[h.phoneNumber]=h.getProcedureLabel())}catch(i){d.e(i)}finally{d.f()}t.next=4;break;case 14:return t.abrupt("return",n);case 15:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"getPastScheduledAppointmentsByPhoneNumbers",value:function(){var t=(0,u.Z)((0,i.Z)().mark((function t(e){var n,r,a,u,c,s,d,l,p,h;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n={},15,r=[],a=0;a<e.length;a+=15)r.push(e.slice(a,a+15));case 4:if(!(r.length>=1)){t.next=14;break}return u=r.shift(),c=(0,f.IO)(this.getCollection(),(0,f.ar)("date","<",new Date),(0,f.ar)("phoneNumber","in",u),(0,f.Xo)("date","desc")).withConverter(m.e),t.next=9,(0,f.PL)(c);case 9:s=t.sent,d=(0,o.Z)(s.docs);try{for(d.s();!(l=d.n()).done;)p=l.value,h=p.data(),Object.hasOwn(n,h.phoneNumber)||(n[h.phoneNumber]=h.getProcedureLabel())}catch(i){d.e(i)}finally{d.f()}t.next=4;break;case 14:return t.abrupt("return",n);case 15:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()},{key:"getContactPastAppointments",value:function(t,e,n){var r=(0,f.IO)(this.getCollection(),(0,f.ar)("date","<=",new Date),(0,f.ar)("phoneNumber","==",t),(0,f.Xo)("date","desc"),(0,f.b9)(25)).withConverter(m.e);return(0,f.cf)(r,function(){var t=(0,u.Z)((0,i.Z)().mark((function t(n){return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e(n.docs.map((function(t){return t.data()})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),n)}},{key:"getAppointmentsFromWithListener",value:function(t,e,n,r){var a=(0,f.IO)(this.getCollection(),(0,f.ar)("date",">=",e),(0,f.ar)("phoneNumber","==",t),(0,f.Xo)("date","asc")).withConverter(m.e);return(0,f.cf)(a,function(){var t=(0,u.Z)((0,i.Z)().mark((function t(e){return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n(e.docs.map((function(t){return t.data()})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),r)}},{key:"getAppointmentsFrom",value:function(){var t=(0,u.Z)((0,i.Z)().mark((function t(e,n){var r,a;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=(0,f.IO)(this.getCollection(),(0,f.ar)("date",">=",n),(0,f.ar)("phoneNumber","==",e),(0,f.Xo)("date","asc")).withConverter(m.e),t.next=3,(0,f.PL)(r);case 3:return a=t.sent,t.abrupt("return",a.docs.map((function(t){return t.data()})));case 5:case"end":return t.stop()}}),t,this)})));return function(e,n){return t.apply(this,arguments)}}()},{key:"getAppointmentsBefore",value:function(){var t=(0,u.Z)((0,i.Z)().mark((function t(e,n){var r,a;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=(0,f.IO)(this.getCollection(),(0,f.ar)("date","<",n),(0,f.ar)("phoneNumber","==",e),(0,f.Xo)("date","desc")).withConverter(m.e),t.next=3,(0,f.PL)(r);case 3:return a=t.sent,t.abrupt("return",a.docs.map((function(t){return t.data()})));case 5:case"end":return t.stop()}}),t,this)})));return function(e,n){return t.apply(this,arguments)}}()},{key:"getDailyAppointmentRegistrationCheck",value:function(){var t=(0,u.Z)((0,i.Z)().mark((function t(e,n){var r,o,u,c,s,d,l,p,m,k,w;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=new Date(n,e,1),o=new Date(n,e+1,0),u={};case 3:return c=(0,g.b)(r),s=(0,y.i)(r),d=(0,f.IO)(this.getCollection(),(0,f.ar)("date",">=",c),(0,f.ar)("date","<",s)),l=(0,f.IO)(this.getCollection(),(0,f.ar)("date",">=",c),(0,f.ar)("date","<",s),(0,f.ar)("type","==",h.BLOCKED_SLOT_TYPE)),t.next=9,Promise.all([(0,v.s)(d),(0,v.s)(l)]);case 9:p=t.sent,m=(0,a.Z)(p,2),k=m[0],w=m[1],u[r.getDate()]=k>w,r.setDate(r.getDate()+1);case 15:if(r<=o){t.next=3;break}case 16:return t.abrupt("return",u);case 17:case"end":return t.stop()}}),t,this)})));return function(e,n){return t.apply(this,arguments)}}()},{key:"getDailyAppointmentRegistrationCheckWithListener",value:function(t,e,n,a){var c=(0,f.IO)(this.getCollection(),(0,f.ar)("date",">=",new Date(e,t,1)),(0,f.ar)("date","<",new Date(e,t+1,1)),(0,f.Xo)("date","asc"));return(0,f.cf)(c,function(){var t=(0,u.Z)((0,i.Z)().mark((function t(e){var a,u,c,s,d,l;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a=void 0,u=(0,o.Z)(e.docs);try{for(u.s();!(c=u.n()).done;)s=c.value,d=s.data(),l=d.date.toDate().getDate(),a||(a=(0,r.Z)({},l,!0)),void 0===a[l]&&(a[l]=!0)}catch(i){u.e(i)}finally{u.f()}n(a);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),a)}},{key:"getMonthAppointmentsAndContiguousWithListener",value:function(t,e,n,r){var a=11===t?e+1:e,o=new Date(0===t?e-1:e,t-1,22),c=new Date(a,t+1,8),s=(0,f.IO)(this.getCollection(),(0,f.ar)("date",">=",o),(0,f.ar)("date","<=",c),(0,f.Xo)("date","asc")).withConverter(m.e);return(0,f.cf)(s,function(){var t=(0,u.Z)((0,i.Z)().mark((function t(e){return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n(e.docs.map((function(t){return t.data()})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),r)}},{key:"getMonthAppointmentsAndContiguous",value:function(){var t=(0,u.Z)((0,i.Z)().mark((function t(e,n){var r,a,o,u,c;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=11===e?n+1:n,a=new Date(0===e?n-1:n,e-1,22),o=new Date(r,e+1,8),u=(0,f.IO)(this.getCollection(),(0,f.ar)("date",">=",a),(0,f.ar)("date","<=",o),(0,f.Xo)("date","asc")).withConverter(m.e),c=(0,f.PL)(u),t.next=8,c;case 8:return t.abrupt("return",t.sent.docs.map((function(t){return t.data()})));case 9:case"end":return t.stop()}}),t,this)})));return function(e,n){return t.apply(this,arguments)}}()},{key:"getDayAppointmentsListener",value:function(t,e,n){var r=new Date(t.getFullYear(),t.getMonth(),t.getDate()),a=new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59),o=(0,f.IO)(this.getCollection(),(0,f.ar)("date",">=",r),(0,f.ar)("date","<",a),(0,f.Xo)("date","asc")).withConverter(m.e);return(0,f.cf)(o,function(){var t=(0,u.Z)((0,i.Z)().mark((function t(n){return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e(n.docs.map((function(t){return t.data()})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),n)}},{key:"getByIds",value:function(t,e,n){var r=(0,f.IO)(this.getCollection(),(0,f.ar)((0,f.Jm)(),"in",t)).withConverter(m.e);return(0,f.cf)(r,function(){var t=(0,u.Z)((0,i.Z)().mark((function t(n){var r;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:(r=n.docs.map((function(t){return t.data()}))).sort((function(t,e){return t.getDate().getTime()-e.getDate().getTime()})),e(r);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),n)}},{key:"getAppointmentsInRange",value:function(){var t=(0,u.Z)((0,i.Z)().mark((function t(e,n){var r,a;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=(0,f.IO)(this.getCollection(),(0,f.ar)("date",">=",e),(0,f.ar)("date","<=",n),(0,f.Xo)("date","asc")).withConverter(m.e),t.next=3,(0,f.PL)(r);case 3:return a=t.sent,t.abrupt("return",a.docs.map((function(t){return t.data()})).filter((function(t){return!t.isBlockedSlot()&&t.getStatus()!==h.Status.CANCELLED&&t.getStatus()!==h.Status.ABSENCE})));case 5:case"end":return t.stop()}}),t,this)})));return function(e,n){return t.apply(this,arguments)}}()},{key:"isEnabled",value:function(){return(0,f.PL)(this.getCollection()).then((function(t){return t.size>0}))}},{key:"getCollection",value:function(){return(0,f.hJ)(this.db,h.FirebaseCollections.ACCOUNTS,this.accountId,h.FirebaseCollections.APPOINTMENTS)}}]),n}(p.p)},39962:function(t,e,n){n.d(e,{EH:function(){return a},E_:function(){return o},Pv:function(){return u},Vz:function(){return i}});var r=n(88391),a=function(t){return t.SHOW="SHOW",t.EDIT="EDIT",t.CREATE="CREATE",t.NONE="NONE",t}({}),o=function(t){return t.APPOINTMENT="APPOINTMENT",t.BLOCKED_SLOT="BLOCKED_SLOT",t}({}),i=(0,r.createContext)(null),u=function(){var t=(0,r.useContext)(i);if(!t)throw new Error("useCalendarActionsContext must be used within a CalendarActionsContextProvider");return{closePreview:function(){t({name:"CLOSE_POPUP"})},closeModals:function(){t({name:"CLOSE_POPUP"})},showAppointmentPreview:function(e,n){t({name:"SHOW_APPOINTMENT",payload:{appointment:e,element:n}})},showBlockedSlotPreview:function(e,n){t({name:"SHOW_BLOCKED_SLOT",payload:{blockedSlot:e,element:n}})},editAppointment:function(e){t({name:"EDIT_APPOINTMENT",payload:e})},editBlockedSlot:function(e){t({name:"EDIT_BLOCKED_SLOT",payload:e})},createEvent:function(e){t({name:"CREATE_EVENT",payload:e})}
1,setInterval:function(e){t({name:"SET_INTERVAL",payload:e})}}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.