1var je=Object.defineProperty,Le=Object.defineProperties;var _e=Object.getOwnPropertyDescriptors;var se=Object.getOwnPropertySymbols;var Oe=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable;var ae=(t,e,i)=>e in t?je(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,at=(t,e)=>{for(var i in e||(e={}))Oe.call(e,i)&&ae(t,i,e[i]);if(se)for(var i of se(e))Ae.call(e,i)&&ae(t,i,e[i]);return t},$t=(t,e)=>Le(t,_e(e));var Rt=(t,e,i)=>new Promise((c,o)=>{var d=g=>{try{B(i.next(g))}catch(E){o(E)}},A=g=>{try{B(i.throw(g))}catch(E){o(E)}},B=g=>g.done?c(g.value):Promise.resolve(g.value).then(d,A);B((i=i.apply(t,e)).next())});import{j as n,Y as Ne,K as Te}from"./vendor-mui-BGS3mHwM.js";/* empty css */import{s as Yt,eD as Zt,dO as zt,eg as de,d$ as Wt,ea as Xt,eb as Pe,ed as m,ej as ue,ek as we,e0 as Dt,ec as te,c0 as me,bw as pe,A as Mt,T as J,e2 as be,h as he,eB as Be,L as gt,er as $e,eo as Re,j as re,e3 as G,es as He,I as We,oK as ge,bf as xe,jH as ke,eC as Kt,oL as Ht,oM as Se,m as Me,oN as Ue,eq as qe,oO as Ve,ee as Ge,V as Je,d8 as Qe,bY as Qt,fl as ce,eA as le,fm as Ke}from"./index-D5apbUK-.js";import{r as kt,j as I,u as Ut}from"./vendor-redux-FtDGt7Mz.js";import{D as fe,S as Ye}from"./index-CPbNxhle.js";import{g as yt}from"./appointment-CYEGyqsX.js";import{i as ye,b as Ze,a as ee,u as ne}from"./pehc-apis-CSywMsyQ.js";import{g as Ce,a as Ie}from"./utils-CL9bybOX.js";import{c as ht,p as ze,b as Xe,f as De}from"./utils-CsvBayAO.js";import{a as qt,u as Vt}from"./vendor-react-CUpnpRPD.js";import{g as Ee}from"./utils-VOpwwmTq.js";import{u as tn,A as en}from"./AppointmentRightCartItems-CevR-THx.js";import{H as nn}from"./index-BfRwpQwW.js";import"./vendor-stream-CynyArsg.js";import"./vendor-pdf-Ddbn4B6C.js";import"./vendor-graphql-CuoeCPzn.js";import"./vendor-media-BEZy7yMd.js";import"./vendor-radix-NiTG7895.js";import"./vendor-mui-pickers-BdXKbjEa.js";import"./vendor-forms-BcpGzS3-.js";import"./CommonProptypes-C73RDLw_.js";import"./NoSlots-DQgsenYe.js";import"./index-CwGRuT3T.js";import"./index-DgLVZ9lA.js";import"./red-dot-uXCUTUFz.js";import"./index-lpDw67fS.js";import"./SelfBookingDateTimePicker-Cul4ES3D.js";import"./successful-v-N8n_cb.js";import"./index-CphczCh9.js";import"./TotalTestIncluded-Disse9yb.js";import"./TotalTestPopup-BwgrTNn7.js";import"./x-CKhAT-Df.js";import"./createLucideIcon-D0CqTctp.js";import"./SearchV2-CUviX1hR.js";import"./forwardArrow-Co5nBZe9.js";import"./Clear-B7IRFENm.js";import"./ic-search-md-A2njoYGm.js";import"./SearchOffline-b_00nA9-.js";import"./CircularProgress-BKjAeELL.js";import"./Search-DLy_EBQP.js";import"./Arrow_Right-us4UcUac.js";import"./index-C21GwB1D.js";import"./success-q-y1n8Sf.js";const on=({flow:t,selectedHomeAddress:e,slots:i,selectedDate:c,handleHomeCollectionBooking:o,setSelectedDate:d,setHomeBooked:A,benefitWarning:B,selectedTime:g,setSelectedTime:E,getPreSelectedAdress:W,handleHomeCollectionAddressSelection:z,addresses:S})=>{var x,K,nt,it,P,v,l,St;const y=qt(),[b,k]=kt.useState(!1),[N,ut]=kt.useState(""),[$,et]=kt.useState(!1),rt=I(Yt),f=I(Zt),h=I(zt),C=I(de),j=localStorage.getItem("isPdFlowCheck")==="true",L=I(Wt),M=I(Xt),X=I(Pe),U=t===m?X:M,ct=Ut(),lt=Vt(),[mt]=t===m?ye():ue(),[xt]=t===m?Ze():we(),{data:_,isLoading:O,isError:dt}=Dt({userId:rt,xLatitude:(x=h==null?void 0:h.coords)==null?void 0:x.lat,xLongitude:(K=h==null?void 0:h.coords)==null?void 0:K.lng},{skip:!rt||t===m}),{data:Q,isFetching:D}=ee({userUuid:f,xLatitude:(nt=h==null?void 0:h.coords)==null?void 0:nt.lat,xLongitude:(it=h==null?void 0:h.coords)==null?void 0:it.lng},{skip:!f||t!==m}),T=t===m?(P=Q==null?void 0:Q.data)==null?void 0:P.cartItems:(v=_==null?void 0:_.data)==null?void 0:v.cartItems,F=T==null?void 0:T.map(p=>p.skuId),{data:q,isLoading:s,isError:u}=t===m?ne({ids:F},{skip:!F}):te({ids:F},{skip:!F});if(kt.useEffect(()=>{var p,Y,ot,tt,H,Z,w;t==="labs"&&((p=i==null?void 0:i.items)==null?void 0:p.length)>0&&me(pe.LAB_HOMECOLLECTION_SLOT_PAGELOAD,{total_slots_available_days:Ie((ot=(Y=i==null?void 0:i.items)==null?void 0:Y[0])==null?void 0:ot.dateWiseSlots),hours_to_first_slot:Math.floor(Ce((Z=(H=(tt=i==null?void 0:i.items)==null?void 0:tt[0])==null?void 0:H.dateWiseSlots)==null?void 0:Z[0])),slots_available:((w=i.items)==null?void 0:w.length)>0?"T":"F"})},[t,i]),O||D||s)return n.jsx(Mt,{});if(dt||u)return n.jsx(J,{customStyle:"common-error-text",children:"Something went wrong"});const a=p=>Rt(void 0,null,function*(){var Y,ot,tt;try{const H={xLatitude:(e==null?void 0:e.latitude)||h.coords.lat,xLongitude:(e==null?void 0:e.longitude)||h.coords.lng,body:{catalogueIds:p,filters:{availability_mode:G.HOME}}},Z=yield mt(H);if("error"in Z)throw Z.error;const w=(ot=(Y=Z==null?void 0:Z.data)==null?void 0:Y.data)==null?void 0:ot[0];if(!w)throw new Error("Service not available in selected location");if(w!=null&&w.notAvailableTests&&((tt=Object.keys(w==null?void 0:w.notAvailableTests))==null?void 0:tt.length)>0)throw new Error("Service not available in selected location");return w}catch(H){ut(re(H))}return null}),R=p=>Rt(void 0,null,function*(){var Y,ot,tt,H,Z,w,Et,Ft,Ct,pt,Lt,bt,_t,It,Ot,At,Nt,Tt;if(i.isError||!i.items)return!1;if(E(p),!p)return null;try{k(!0);
1const ft=(tt=(ot=(Y=i.items)==null?void 0:Y[0])==null?void 0:ot.dateWiseSlots)==null?void 0:tt[c].date,Pt=(Z=(H=i.items)==null?void 0:H[0])==null?void 0:Z.serviceType,wt=`${ft}T${p.start}+05:30`,vt=`${ft}T${p.end}+05:30`,Bt=T==null?void 0:T.map(jt=>({userId:jt.patientId,userType:"USER"})),ie=yield a(T==null?void 0:T.map(jt=>jt.skuId)),Gt={resourceId:ie.providerId,service:Pt,bookingUserType:"USER",locationType:"HOME",locationId:"1",startTime:wt,endTime:vt,participants:Bt};t===m?Gt.bookingUserUuid=f:Gt.bookingUserId=rt;let st;if(!j&&(st=yield xt({body:Gt}),st!=null&&st.error))throw(Et=(w=st==null?void 0:st.error)==null?void 0:w.data)==null?void 0:Et.data;const oe=t===m?(Ft=Q==null?void 0:Q.data)==null?void 0:Ft.patients:(Ct=_==null?void 0:_.data)==null?void 0:Ct.patients,ve=(pt=q==null?void 0:q.data)==null?void 0:pt.catalogueModes,Jt=yt(T,ve,"home_only",oe);if(Jt){ct(Be({cart:gt,data:{items:at({},Jt)},prescriptionId:(Lt=_==null?void 0:_.data)==null?void 0:Lt.prescriptionId}));const jt=[].concat({type:$e.HOME,data:{labId:ie.providerId,time:p,date:ft,patients:oe,serviceType:(_t=(bt=i.items)==null?void 0:bt[0])==null?void 0:_t.serviceType,address:e},packages:Jt,appointmentId:((Ot=(It=st==null?void 0:st.data)==null?void 0:It.data)==null?void 0:Ot.usersAppointmentId)||((Nt=(At=st==null?void 0:st.data)==null?void 0:At.data)==null?void 0:Nt.appointmentId),labDetail:{}});ct(Re({cart:gt,data:jt,prescriptionId:(Tt=_==null?void 0:_.data)==null?void 0:Tt.prescriptionId}))}else throw new Error("Home collection items not available");et(!0)}catch(ft){ut(re(ft))}finally{k(!1)}return!0}),r=()=>{var ot,tt,H,Z;if(t!==m&&e&&(e==null?void 0:e.locationReverificationRequired)!==!1)return z(e),null;const p=(tt=(ot=q==null?void 0:q.data)==null?void 0:ot.buckets)==null?void 0:tt.lab_only,Y=(H=L==null?void 0:L.bookedItems)==null?void 0:H.filter(w=>(w==null?void 0:w.type)===G.OFFSITE);
1if((p==null?void 0:p.length)>0&&!(Y!=null&&Y.length))A(!0);else{if(C!=null&&C.isPDFlow)return ct(He($t(at({},C),{isPDFlow:!1}))),ct(We.util.invalidateTags(["DIGITIZED_DATA"])),lt(`/prescription/${C==null?void 0:C.requestId}/digitised/preview`),null;lt(`/${t}/checkout`,{state:{serviceType:"CORPORATE",packageId:F,orderRequestId:(Z=y==null?void 0:y.state)==null?void 0:Z.orderRequestId}})}};kt.useEffect(()=>{const p=W();p&&z(p)},[S]);const V=()=>U!=null&&U.includes(ht.lab_only)||U!=null&&U.includes(ht.home_or_lab)?"Next":C!=null&&C.isPDFlow?"Schedule Visit":"Proceed to Checkout";return n.jsxs("div",{className:"camp-flow-container",children:[n.jsx(J,{customStyle:"bucket-type-header-text",children:"Home Sample Collection Details"}),e?n.jsx(fe,{isError:i.isError,error:i.error,timeSelectHandler:R,setSelectedDate:d,availableSlots:(St=(l=i.items)==null?void 0:l[0])==null?void 0:St.dateWiseSlots,isBookingAppointment:b,isLoading:i.isFetching,selectedDate:c,benefitWarning:B,selectedTime:g,collectionType:null,clickHandler:o,title:"Address",addressName:e==null?void 0:e.label,fullAddress:be(e),isLabSelectionFlow:b,notAvailable:[],isEarlyAppointmentEnable:void 0}):n.jsxs("div",{className:"bucket-card-container",children:[n.jsx(J,{customStyle:"bucket-card-select-text",children:"Address"}),n.jsx("button",{onClick:()=>o(),type:"button",className:"bucket-card-select-add-btn",children:"Select Address"})]}),n.jsx("div",{className:"booking-section-sub-container",children:n.jsx("button",{onClick:()=>r(),type:"button",className:`${$?"bg-[#0E63FF]":"bg-[#F0F0F0]"} h-[40px] ${$?"text-[#fff]":"text-[#bbb]"} font-medium rounded-xl`,disabled:!$,children:V()})}),N&&n.jsx(he,{variant:"error",message:N})]})},sn=({flow:t,isHomeBooked:e})=>{var mt,xt,_,O,dt,Q,D,T;const i=I(Yt),c=I(Zt),o=I(zt),d=I(Wt),A=I(ge),B=I(Xt),g=B==null?void 0:B.includes("home_or_lab"),E=Ut(),W=qt(),z=Vt(),S=I(xe),{data:y,isLoading:b,isError:k}=Dt({userId:i,xLatitude:(mt=o==null?void 0:o.coords)==null?void 0:mt.lat,xLongitude:(xt=o==null?void 0:o.coords)==null?void 0:xt.lng},{skip:!i||t===m}),{data:N,isFetching:ut}=ee({userUuid:c,xLatitude:(_=o==null?void 0:o.coords)==null?void 0:_.lat,xLongitude:(O=o==null?void 0:o.coords)==null?void 0:O.lng},{skip:!c||t!==m}),$=t===m?(dt=N==null?void 0:N.data)==null?void 0:dt.cartItems:(Q=y==null?void 0:y.data)==null?void 0:Q.cartItems,et=localStorage.getItem("isPdFlowCheck")==="true",rt=et?(T=(D=JSON.parse(localStorage.getItem("labDataForPD")||"{}"))==null?void 0:D.labSkusData)!=null?T:[]:[],f=et?rt.map(F=>F.skuId):$==null?void 0:$.map(F=>F.skuId),{data:h,isLoading:C,isError:j}=te({ids:f},{skip:!(f!=null&&f.length)||t===m}),{data:L,isLoading:M,isError:X}=ne({ids:f},{skip:!(f&&t===m)});if(b||C||ut||M)return n.jsx(Mt,{});if(k||j||X)return n.jsx(J,{customStyle:"common-error-text",children:"Something went wrong"});const U=t===m?L:h,ct=()=>{var V,x,K,nt,it,P;const F=t===m?(V=N==null?void 0:N.data)==null?void 0:V.patients:(x=y==null?void 0:y.data)==null?void 0:x.patients,q=(K=U==null?void 0:U.data)==null?void 0:K.catalogueModes,s=((nt=d==null?void 0:d.labCollection)==null?void 0:nt.items)||{},u=localStorage.getItem("isPdFlowCheck")==="true",a=u?JSON.parse(localStorage.getItem("labDataForPD")||"{}"):{},R=(it=a==null?void 0:a.labSkusData)!=null?it:[],r=u&&R.length>0?yt(R.map(v=>({skuId:v.skuId,skuDetail:{id:v.skuId,name:v.name},patientId:a==null?void 0:a.patientId})),q,"lab_only",[{id:a==null?void 0:a.patientId}]):yt($,q,"lab_only",F);r&&E(Kt({cart:gt,data:{items:at(at({},s),r)}})),E(Ht({cart:gt,data:!1})),E(Se(e)),z(`/${t}/booking/select-lab`,{state:{orderRequestId:(P=W==null?void 0:W.state)==null?void 0:P.orderRequestId,hybridCollection:e}})},lt=()=>{var F;E(Ht({cart:gt,data:!0})),z(`/${t}/checkout`,{state:{serviceType:"CORPORATE",packageId:f,orderRequestId:(F=W==null?void 0:W.state)==null?void 0:F.orderRequestId}})};return n.jsxs("div",{className:"camp-flow-container",children:[n.jsx(J,{customStyle:"bucket-type-header-text",children:"Centre Visit Details"}),n.jsxs("div",{className:"bucket-card-container",children:[n.jsx(J,{customStyle:"bucket-card-select-text",children:"Centre Address"}),n.jsx("button",{onClick:()=>ct(),type:"button",className:"bucket-card-select-add-btn",children:"Select Centre"}),n.jsxs("div",{className:"lab-required-info-text-common",children:[n.jsx("img",{alt:"info",src:ke,className:"h-[12px] w-[12px] mt-[2px]"}),n.jsx(J,{customStyle:"text-[#1F1F1F] text-xs",children:Ee(S)})]}),A!=null&&g&&n.jsxs("div",{className:"flex items-center gap-1 mt-2 text-xs",children:[n.jsx(J,{customStyle:"text-[#636363] text-[16px] font-medium",children:"Not sure yet?"}),n.jsx("button",{type:"button",onClick:lt,className:"text-[#0E63FF] font-medium underline cursor-pointer bg-transparent border-none p-0",children:"Skip for now"})]})]}),n.jsx("div",{className:"booking-section-sub-container",children:n.jsx("button",{type:"button",className:"bg-[#F0F0F0] h-[40p
1x] text-[#bbb] font-medium rounded-xl",children:"Proceed to Checkout"})})]})},an=({flow:t,isHomeBooked:e,isCampAndLabFlow:i})=>{var dt,Q,D,T,F,q,s,u,a,R;const c=I(Yt),o=I(Zt),d=I(zt),A=I(Wt),B=Ut(),g=qt(),E=Vt(),[W,{isLoading:z}]=t===m?ye():ue(),{data:S,isLoading:y,isError:b}=Dt({userId:c,xLatitude:(dt=d==null?void 0:d.coords)==null?void 0:dt.lat,xLongitude:(Q=d==null?void 0:d.coords)==null?void 0:Q.lng},{skip:!c||t===m}),{data:k,isFetching:N,isError:ut}=ee({userUuid:o,xLatitude:(D=d==null?void 0:d.coords)==null?void 0:D.lat,xLongitude:(T=d==null?void 0:d.coords)==null?void 0:T.lng},{skip:!o||t!==m}),$=t===m?(F=k==null?void 0:k.data)==null?void 0:F.cartItems:(q=S==null?void 0:S.data)==null?void 0:q.cartItems,et=$==null?void 0:$.map(r=>r.skuId),{data:rt,isLoading:f,isError:h}=te({ids:et},{skip:!(et||t!==m)}),{data:C,isLoading:j,isError:L}=ne({ids:et},{skip:!(et&&t===m)}),M=t===m?C:rt,X=t===m?(s=k==null?void 0:k.data)==null?void 0:s.patients:(u=S==null?void 0:S.data)==null?void 0:u.patients,U=(a=M==null?void 0:M.data)==null?void 0:a.catalogueModes,ct=((R=A==null?void 0:A.campCollection)==null?void 0:R.items)||{},lt=yt($,U,"camp_only",X),mt=()=>{lt&&B(Ue({cart:gt,data:{items:at(at({},ct),lt)}})),B(qe({cart:gt,data:{isCampAndLabFlow:i}}))},xt={distance:50,availability_mode:"ONSITE"},_=r=>Rt(void 0,null,function*(){var V,x,K,nt,it,P;try{const v=yield W({xLatitude:(V=d==null?void 0:d.coords)==null?void 0:V.lat,xLongitude:(x=d==null?void 0:d.coords)==null?void 0:x.lng,body:{filters:xt,catalogueIds:Object.keys(r)}});if("error"in v)throw v.error;if(((nt=(K=v==null?void 0:v.data)==null?void 0:K.data)==null?void 0:nt.length)===1){const l=(P=(it=v==null?void 0:v.data)==null?void 0:it.data)==null?void 0:P[0];mt(),E(`/${t}/booking/select-lab/${l==null?void 0:l.providerId}`,{state:{orderRequestId:null,serviceType:G.CAMP,labDetail:{id:l==null?void 0:l.providerId,url:l==null?void 0:l.url,name:l==null?void 0:l.name,address:l==null?void 0:l.address,distance:l==null?void 0:l.distanceFromUser,notAvailableItems:l==null?void 0:l.notAvailableTests,availableTests:l==null?void 0:l.availableTests}}})}}catch(v){B(errorOccured({msg:Me(v),autoVanish:!0,timeout:3e3}))}});kt.useEffect(()=>{var r;(r=A==null?void 0:A.campCollection)!=null&&r.items||_(lt)},[U]);const O=()=>{var r;mt(),E(`/${t}/booking/select-lab`,{state:{orderRequestId:(r=g==null?void 0:g.state)==null?void 0:r.orderRequestId,hybridCollection:e,isCampFlow:!0}})};return y||f||N||j||z?n.jsx(Mt,{}):(L||ut)&&t===m?n.jsx(J,{customStyle:"common-error-text",children:"Something went wrong"}):(b||h)&&t!==m?n.jsx(J,{customStyle:"common-error-text",children:"Something went wrong"}):n.jsxs("div",{className:"camp-flow-container",children:[n.jsx(J,{customStyle:"bucket-type-header-text",children:"Camp Details"}),n.jsxs("div",{className:"bucket-card-container",children:[n.jsx(J,{customStyle:"bucket-card-select-text",children:"Camp Address"}),n.jsx("button",{onClick:()=>O(),type:"button",className:"bucket-card-select-add-btn",children:"Select Camp"})]}),n.jsx("div",{className:"booking-section-sub-container",children:n.jsx("button",{type:"button",className:"bg-[#F0F0F0] h-[40px] text-[#bbb] font-medium rounded-xl",children:"Proceed to Checkout"})})]})},rn=({isBookingAppointment:t,slots:e,selectedDate:i,selectedAddress:c,hybridCollectionMode:o,setSelectedDate:d,handleHybridCollectionBooking:A,handleHybridCollectionTimeSelection:B,benefitWarning:g,selectedTime:E,flow:W,isHomeBooked:z,cartItems:S,patients:y,availabilityBuckets:b,cartData:k,pehcData:N,nextClickHandle:ut,handleHybridCollectionAddressSelection:$,getPreSelectedAdress:et,isProviderUnavailable:rt})=>{var F,q,s;const f=Ut(),h=qt(),C=Vt(),j=I(Wt),L=I(de),M=I(ge),X=I(Xt),U=X==null?void 0:X.includes("home_or_lab"),ct=I(xe),lt=()=>{var u,a,R,r;if(o===G.OFFSITE){const V=(u=b==null?void 0:b.data)==null?void 0:u.catalogueModes;if((S==null?void 0:S.length)>0){const x=yt(S,V,"home_or_lab",y);((a=k==null?void 0:k.data)!=null&&a.cartItems||(R=N==null?void 0:N.data)!=null&&R.cartItems)&&f(Kt({cart:gt,data:{items:at({},x)},prescriptionId:(r=k==null?void 0:k.data)==null?void 0:r.prescriptionId}))}}};kt.useEffect(()=>{o===G.OFFSITE&<()},[o]);const mt=()=>{var it,P,v,l,St;const u=(it=b==null?void 0:b.data)==null?void 0:it.catalogueModes,a=Object.values(u).some(p=>p==null?void 0:p.includes("lab_only")),R=((P=j==null?void 0:j.labCollection)==null?void 0:P.items)||{},r=a?"lab_only":"home_or_lab",V=localStorage.getItem("isPdFlowCheck")==="true",x=V?JSON.parse(localStorage.getItem("labDataForPD")||"{}"):{},K=(v=x==null?void 0:x.labSkusData)!=null?v:[],nt=V&&K.length>0?yt(K.map(p=>({skuId:p.skuId,skuDetail:{id:p.skuId,name:p.name},patientId:x==null?void 0:x.patientId})),u,r,[{id:x==null?void 0:x.patientId}]):yt(S,u,r,y);nt&&f(Kt({cart:gt,data:{items:at(at({},R),nt)},prescriptionId:(l=k==null?void 0:k.data)==null?void 0:l.prescriptionId})),f(Ht({cart:gt,data:!1})),f(Se(z)),C(`/${W}/booking/select-lab`,{state:{orderRequestId:(St=h==null?void 0:h.state)==null?void 0:St.orderRequestId,hybridCollection:z}})},xt=S==null?void 0:S.map(u=>u.skuId),_=()=>{var u;f(Ht({cart:gt,data:!0}
1)),C(`/${W}/checkout`,{state:{serviceType:"CORPORATE",packageId:xt,orderRequestId:(u=h==null?void 0:h.state)==null?void 0:u.orderRequestId}})};kt.useEffect(()=>{var u,a,R,r,V,x,K;o===G.HOME_COLLECTION_OR_OFFSITE&&((u=e==null?void 0:e.items)==null?void 0:u.length)>0&&me(pe.LAB_HOMECOLLECTION_SLOT_PAGELOAD,{total_slots_available_days:Ie((R=(a=e==null?void 0:e.items)==null?void 0:a[0])==null?void 0:R.dateWiseSlots),hours_to_first_slot:Math.floor(Ce((x=(V=(r=e==null?void 0:e.items)==null?void 0:r[0])==null?void 0:V.dateWiseSlots)==null?void 0:x[0])),slots_available:((K=e.items)==null?void 0:K.length)>0?"T":"F"})},[e]);const O=()=>!!(o===G.OFFSITE||o===G.HOME_COLLECTION_OR_OFFSITE&&t),dt=(F=j==null?void 0:j.bookedItems)==null?void 0:F.find(u=>(u==null?void 0:u.type)==="OFFSITE"),Q=()=>L!=null&&L.isPDFlow?"Schedule Visit":o===G.OFFSITE||o===G.HOME_COLLECTION_OR_OFFSITE&&t||o===G.HOME||o===G.HOME_COLLECTION_OR_OFFSITE&&dt?"Proceed to Checkout":"Next";kt.useEffect(()=>{if(o===G.OFFSITE||c)return;const u=et();u&&$(u)},[o]);const D=o===G.HOME_COLLECTION_OR_OFFSITE||o===G.HOME,T=!c&&D;return n.jsxs("div",{className:"camp-flow-container",children:[n.jsx(J,{customStyle:"bucket-type-header-text",children:`${t||o===G.OFFSITE?"Centre Visit Details":"Home Sample Collection Details"}`}),c&&!t&&o!==G.OFFSITE&&n.jsx(fe,{isError:e.isError,error:e.error,timeSelectHandler:B,setSelectedDate:d,availableSlots:(s=(q=e.items)==null?void 0:q[0])==null?void 0:s.dateWiseSlots,isBookingAppointment:t,isLoading:e.isFetching,selectedDate:i,benefitWarning:g,selectedTime:E,collectionType:o,clickHandler:A,title:"Address",addressName:c==null?void 0:c.label,fullAddress:be(c),isLabSelectionFlow:t,notAvailable:[],isEarlyAppointmentEnable:void 0}),T&&n.jsxs("div",{className:"bucket-card-container",children:[n.jsx(J,{customStyle:"bucket-card-select-text",children:"Home Address"}),n.jsx("button",{onClick:A,type:"button",className:"bucket-card-select-add-btn",children:"Select Address"})]}),O()&&n.jsxs("div",{className:"bucket-card-container",children:[n.jsx(J,{customStyle:"bucket-card-select-text",children:"Centre Address"}),n.jsx("button",{onClick:mt,type:"button",className:"bucket-card-select-add-btn",children:"Select Centre"}),n.jsxs("div",{className:"lab-required-info-text-common",children:[n.jsx("img",{alt:"info",src:ke,className:"h-[12px] w-[12px] mt-[2px]"}),n.jsx(J,{customStyle:"text-[#1F1F1F] text-xs",children:Ee(ct)})]}),M!=null&&U&&n.jsxs("div",{className:"flex items-center gap-1 mt-2 text-xs",children:[n.jsx(J,{customStyle:"text-[#636363] text-[16px] font-medium",children:"Not sure yet?"}),n.jsx("button",{type:"button",onClick:_,className:"text-[#0E63FF] font-medium underline cursor-pointer bg-transparent border-none p-0",children:"Skip for now"})]})]}),!t&&(L!=null&&L.isPDFlow&&rt?n.jsx("button",{type:"button",onClick:()=>C(`/prescription/${L==null?void 0:L.requestId}/digitised/preview`,{state:{agentReview:!0}}),className:"bucket-card-next-btn bg-[#0E63FF] border text-[#fff]",children:"Confirm"}):n.jsx("button",{onClick:ut,type:"button",className:`bucket-card-next-btn ${E?"bg-[#0E63FF]":"bg-[#F0F0F0]"} border ${E?"text-[#fff]":"text-[#bbb]"}`,disabled:!E,children:Q()}))]})},cn=t=>({coords:{lat:t==null?void 0:t.latitude,lng:t==null?void 0:t.longitude},address:t==null?void 0:t.locality,addressLine1:t==null?void 0:t.addressLine1,addressLine2:t==null?void 0:t.addressLine2,landmark:t==null?void 0:t.landmark,locality:t==null?void 0:t.locality,label:t==null?void 0:t.label}),ln=t=>{const e={locality:"",addressLine1:"",addressLine2:"",landmark:""};return t==null||t.forEach(i=>{const c=(i==null?void 0:i.types)||[];c.includes("sublocality_level_1")&&(e.locality=i.long_name),c.includes("sublocality_level_3")&&(e.addressLine1=i.long_name),c.includes("sublocality_level_2")&&(e.addressLine2=i.long_name),(c.includes("landmark")||c.includes("route"))&&(e.landmark=i.long_name)}),e},dn=(t,e)=>{var i,c;return $t(at({},t),{latitude:(i=e==null?void 0:e.coords)==null?void 0:i.lat,longitude:(c=e==null?void 0:e.coords)==null?void 0:c.lng,city:(e==null?void 0:e.city)||(t==null?void 0:t.city),state:(e==null?void 0:e.state)||(t==null?void 0:t.state),country:(e==null?void 0:e.country)||(t==null?void 0:t.country),pinCode:(e==null?void 0:e.pinCode)||(t==null?void 0:t.pinCode),locality:(e==null?void 0:e.address)||(e==null?void 0:e.locality)||(t==null?void 0:t.locality),addressLine1:(e==null?void 0:e.addressLine1)||(t==null?void 0:t.addressLine1),addressLine2:(e==null?void 0:e.addressLine2)||(t==null?void 0:t.addressLine2),landmark:(e==null?void 0:e.landmark)||(t==null?void 0:t.landmark)})},un=(t,e,i)=>$t(at(at({},t),e),{locality:i.locality||t.locality,addressLine1:i.addressLine1||t.addressLine1,addressLine2:i.addressLine2||t.addressLine2,landmark:i.landmark||t.landmark}),mn=({address:t,onConfirm:e,onClose:i,pinLabelTitle:c,pinLabelDescription:o,showPinText:d=!1,pinInfoMessage:A,pinInfoVariant:B})=>{var S,y;const[g,E]=kt.useState(cn(t)),W=b=>e(dn(t,b)),z=b=>{const k=ln(b==null?void 0:b.components);E(N=>
1un(N,b,k))};return n.jsx("div",{className:"relative h-full",children:n.jsx(Ve,{setPinDropped:()=>{},submitHandler:W,selectedLocation:g,setShowMap:()=>{},addressSelectionType:void 0,pinLabelTitle:c,pinLabelDescription:o,pinInfoMessage:A,pinInfoVariant:B,backHandler:i,showPinText:d,inlineSearch:!0,onSearchSelect:z,isClickable:!0},`${(S=g==null?void 0:g.coords)==null?void 0:S.lat}-${(y=g==null?void 0:g.coords)==null?void 0:y.lng}`)})},Fe=({flow:t})=>{var Pt,wt;const{state:e,actions:i,config:{isTablet:c}}=tn(t),{errorMsg:o,isProviderUnavailable:d,isFetching:A,isBucketsLoading:B,isPehcFetching:g,isLoading:E,familyMembersDataFetching:W,isBucketsError:z,isPehcBucketsError:S,stepperData:y,isHomeBooked:b,selectedHomeAddress:k,slots:N,selectedDate:ut,benefitWarning:$,selectedAddress:et,selectedTime:rt,isHybridBooked:f,isCampBooked:h,homeOrLabTests:C,homeOnlyTests:j,labOnlyTests:L,campOnlyTests:M,isBookingAppointment:X,hybridCollectionMode:U,cartItems:ct,cartData:lt,patients:mt,availabilityBuckets:xt,isAddressesSuccess:_,addresses:O,isCorporateBooking:dt,showAddressSelector:Q,addNewAddress:D,showHomeCollectionAddressSelector:T,showDiscardInfo:F,pehcData:q,cartSelectedCollectionMode:s,catalogueModes:u,selctedPackageTests:a,showPinVerificationMap:R,pinVerificationAddress:r}=e,{handleHomeCollectionBooking:V,setSelectedDate:x,setHomeBooked:K,handleHybridCollectionBooking:nt,handleHybridCollectionTimeSelection:it,setShowDiscardInfo:P,setShowAddressSelector:v,handleHybridCollectionAddressSelection:l,setAddNewAddress:St,setHomeCollectionAddressSelector:p,handleHomeCollectionAddressSelection:Y,confirmPinVerification:ot,closePinVerificationMap:tt,closeAddAddressForm:H,nextClickHandle:Z,setSelectedTime:w,getPreSelectedAdress:Et,navigate:Ft}=i;if(A||B||g||t===Ge&&(E||W))return n.jsx(Mt,{variant:Je.TWO_ARCS});if(A||z||S)return n.jsx(Qe,{});const Ct=localStorage.getItem("isPdFlowCheck")==="true",pt=JSON.parse(localStorage.getItem("labDataForPD")||"{}"),Lt=(Pt=pt==null?void 0:pt.labSkusData)!=null?Pt:[],bt=Ct?Lt:ct;if(!(bt!=null&&bt.length)&&!Ct)return Ft(`/${t}/cart`);if(Ct&&!(s!=null&&s.length)&&(pt!=null&&pt.requestId))return Ft(`/prescription/${pt.requestId}/digitised/preview`);const _t=(s==null?void 0:s.includes(ht.lab_only))&&(M==null?void 0:M.length)>0||(f||C.length===0)&&(b||j.length===0)&&(h||M.length===0)&&(L==null?void 0:L.length)>0,It=(s==null?void 0:s.includes(ht.lab_only))&&!(s!=null&&s.includes(ht.home_only)),Ot=(j==null?void 0:j.length)>0&&!b&&!It,At=!h&&(M==null?void 0:M.length)>0&&["camp_or_lab","camp_only"].includes(s==null?void 0:s[0]),Nt=(b||j.length===0||It)&&!f&&((C==null?void 0:C.length)>0||It&&(j==null?void 0:j.length)>0),Tt=bt==null?void 0:bt.find(vt=>{var Bt;return((Bt=vt==null?void 0:vt.skuDetail)==null?void 0:Bt.catalogueIdentity)==="PACKAGE"}),ft=()=>Tt?s!=null&&s.includes(ht.home_or_lab)?X?a==null?void 0:a.labOnlyTests:a==null?void 0:a.homeOrLabTests:s!=null&&s.includes(ht.home_only)&&(s!=null&&s.includes(ht.lab_only))?X||b?a==null?void 0:a.labOnlyTests:a==null?void 0:a.homeOnlyTests:s!=null&&s.includes(ht.camp_or_lab)?a==null?void 0:a.labOnlyTests:s!=null&&s.includes(ht.lab_only)?a==null?void 0:a.homeOrLabTests.concat(a==null?void 0:a.labOnlyTests):null:null;return n.jsxs("div",{className:"min-h-[600px]",children:[o&&n.jsx(he,{variant:"error",message:o}),c&&n.jsx(nn,{title:"Appointment Details",flow:t,breadCrumbConfig:t===m?ze:Xe,endPoint:"Appointment Details"}),(y==null?void 0:y.length)>0&&n.jsx(Ye,{stepperData:y}),n.jsxs("div",{className:"appointment-home-container",children:[n.jsx("div",{children:n.jsx(en,{flow:t,filteredCartData:De(u,s,X,bt),subSkuDetails:ft(),labDataForPD:pt})}),n.jsxs(Ne,{sx:{maxWidth:c?"42% !important":"initial",display:"flex",flexDirection:"column",justifyContent:"normal"},children:[Ot&&n.jsx(on,{flow:t,selectedHomeAddress:k,slots:N,selectedDate:ut,handleHomeCollectionBooking:V,setSelectedDate:x,setHomeBooked:K,benefitWarning:$,selectedTime:rt,setSelectedTime:w,handleHomeCollectionAddressSelection:Y,getPreSelectedAdress:Et,addresses:O==null?void 0:O.data}),Nt&&n.jsx(rn,{isBookingAppointment:X,slots:N,selectedDate:ut,selectedAddress:et,hybridCollectionMode:U,setSelectedDate:x,handleHybridCollectionBooking:nt,handleHybridCollectionTimeSelection:it,benefitWarning:$,selectedTime:rt,flow:t,isHomeBooked:b,cartItems:bt,patients:mt,availabilityBuckets:xt,cartData:lt,pehcData:q,nextClickHandle:Z,handleHybridCollectionAddressSelection:l,getPreSelectedAdress:Et,isProviderUnavailable:d}),At&&n.jsx(an,{flow:t,isHomeBooked:b&&f&&dt,isCampAndLabFlow:s==null?void 0:s.includes(ht.camp_or_lab)}),_t&&n.jsx(sn,{flow:t,isHomeBooked:b&&f&&dt})]})]}),(_&&(O==null?void 0:O.data)||t===m)&&n.jsxs(n.Fragment,{children:[n.jsx(Qt,{drawerStatus:Q,drawerClose:()=>{D?P(!0):v(!1)},closeBtn:!0,enableClose:!1,styles:{width:c?"376px":"100%"},minWidth:void 0,maxWidth:void 0,customCloseBtnComponent:void 0,enableCustomCloseBtn:void 0,closeBtnStyle:void 0,children:D?n.jsx(ce,{setAddress:l,setShowAddressForm:P,onSubmitClick:H,saveAddress:t!==m,showBackButton:!0,showMapConfirmStep:!0,editMode:!!r,data:r,pinLabelTitle:"Phlebotomist will visit here",pinLabelDescription:"Drag map to place the pin accurately"}):n.jsx(le,{addressList:O==null?void 0:O.data,setSelectedAddress:l,showAddAddress:St,drawerClose:P,onSubmitClick:H})}),n.jsx(Qt,{drawerStatus:T,drawerClose:()=>{D?P(!0):p(!1)},closeBtn:!0,styles:{width:c?"376px":"100%"},minWidth:void 0,maxWidth:void 0,enableClose:void 0,customCloseBtnComponent:void 0,enableCustomCloseBtn:void 0,closeBtnStyle:void 0,children:D?n.jsx(ce,{setAddress:Y,setShowAddressForm:P,onSubmitClick:H,saveAddress:t!==m,showBackButton:!0,showMapConfirmStep:!0,editMode:!!r,data:r,pinLabelTitle:"Phlebotomist will visit here",pinLabelDescription:"Drag map to place the pin accurately"}):n.jsx(le,{addressList:O==null?void 0:O.data,setSelectedAddress:Y,showAddAddress:St,onSubmitClick:H,drawerClose:P})}),n.jsx(Qt,{drawerStatus:R,drawerClose:tt,closeBtn:!1,enableClose:!1,styles:{width:c?"376px":"100%"},minWidth:void 0,maxWidth:void 0,customCloseBtnComponent:void 0,enableCustomCloseBtn:void 0,closeBtnStyle:void 0,children:R&&n.jsx(mn,{address:r,onConfirm:ot,onClose:tt,showPinText:!0,pinLabelTitle:"Phlebotomist will visit here",pinLabelDescription:"Drag map to place the pin accurately"},(wt=r==null?void 0:r.id)!=null?wt:`${r==null?void 0:r.latitude}-${r==null?void 0:r.longitude}`)}),n.jsx(Ke,{showDiscardInfo:F,setShowDiscardInfo:P,setShowAddressForm:()=>{H(),P(!1)}})]})]})};Fe.propTypes={flow:Te.string};Fe.defaultProps={flow:"labs"};export{Fe as default};
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.