Files
dailygrubs_console_build/build/static/js/2912.fb4afa0c.chunk.js

1 line
50 KiB
JavaScript

"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[2912],{62912:function(e,t,n){n.r(t);var o=n(93433),a=n(74165),r=n(15861),i=n(29439),s=n(1413),c=n(47313),l=n(42832),d=n(48119),u=n(61113),p=n(9019),x=n(57829),f=n(76088),h=n(16783),g=n(69099),m=n(47131),Z=n(16429),b=n(83929),v=n(44758),j=n(66212),S=n(70024),y=n(19536),k=n(85281),_=n(33604),C=n(49914),w=n(96467),P=n(11198),A=n(37159),E=n(36528),I=n(12058),D=n(88960),R=n(23195),Y=n(58467),M=n(22539),W=n(66277),T=n(56573),z=n(19860),L=n(17530),H=n(11577),N=(n(46926),n(97316),n(29736)),B=n(23208),O=n(45904),F=n(94469),U=n(10658),K=n.n(U),q=n(90842),G=(n(83870),n(40765)),V=n(3745),X=n(70501),Q=n(46417),$=n(91635);K().extend($);var J=999,ee=16,te="0 14px 40px rgba(15, 23, 42, 0.10)",ne="0 8px 24px rgba(15, 23, 42, 0.08)",oe="0 18px 50px rgba(15, 23, 42, 0.18)",ae="#0f172a",re="#64748b",ie="#94a3b8",se="#e2e8f0",ce="#f1f5f9",le="#f8fafc",de=function(e,t){return"".concat(e).concat(t)},ue=function(e){return de(e,"08")},pe=function(e){return de(e,"18")},xe=function(e){return de(e,"26")},fe=function(e){return de(e,"55")},he="#662582",ge="#9255AB",me=function(e){var t=e.color,n=e.icon,o=e.title,a=e.subtitle,r=e.action;return(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,sx:{px:{xs:1.5,md:2},py:1.25,borderBottom:"1px solid ".concat(ce),background:"linear-gradient(90deg, ".concat(ue(t)," 0%, transparent 100%)")},children:[(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:1.25,children:[(0,Q.jsx)(d.Z,{sx:{width:32,height:32,bgcolor:t,color:"#fff",boxShadow:"0 6px 18px ".concat(xe(t))},children:n}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{sx:{fontWeight:800,color:ae,fontSize:14,lineHeight:1.1},children:o}),a&&(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:re,fontWeight:600},children:a})]})]}),r]})},Ze=function(e){var t=e.children,n=e.sx,o=void 0===n?{}:n;return(0,Q.jsx)(X.Z,{elevation:0,sx:(0,s.Z)({borderRadius:ee/8,border:"1px solid",borderColor:se,background:"#fff",overflow:"hidden",boxShadow:te,height:"100%"},o),children:t})},be=function(e){return(0,Q.jsx)(X.Z,(0,s.Z)((0,s.Z)({},e),{},{sx:{mt:.75,borderRadius:2,boxShadow:oe,border:"1px solid",borderColor:"divider",overflow:"hidden"}}))};t.default=function(){L.Z.setApiKey("AIzaSyCF4KatYCI3vqz1_H3kiHeyS3yCMfYToh8");var e=c.useState(null),t=(0,i.Z)(e,2),n=(t[0],t[1]),U=c.useState(null),$=(0,i.Z)(U,2),oe=($[0],$[1]),de=c.useState(""),ve=(0,i.Z)(de,2),je=(ve[0],ve[1],c.useState("")),Se=(0,i.Z)(je,2),ye=(Se[0],Se[1],c.useState("")),ke=(0,i.Z)(ye,2),_e=ke[0],Ce=ke[1],we=c.useState(""),Pe=(0,i.Z)(we,2),Ae=Pe[0],Ee=Pe[1],Ie=c.useState([]),De=(0,i.Z)(Ie,2),Re=(De[0],De[1],c.useState([])),Ye=(0,i.Z)(Re,2),Me=(Ye[0],Ye[1],c.useRef(!1)),We=(c.useRef(!1),(0,c.useState)("")),Te=(0,i.Z)(We,2),ze=(Te[0],Te[1],(0,c.useState)("")),Le=(0,i.Z)(ze,2),He=(Le[0],Le[1],(0,c.useState)("")),Ne=(0,i.Z)(He,2),Be=(Ne[0],Ne[1],(0,c.useState)("")),Oe=(0,i.Z)(Be,2),Fe=(Oe[0],Oe[1],(0,c.useState)("")),Ue=(0,i.Z)(Fe,2),Ke=(Ue[0],Ue[1],(0,c.useState)("")),qe=(0,i.Z)(Ke,2),Ge=(qe[0],qe[1],(0,c.useState)("")),Ve=(0,i.Z)(Ge,2),Xe=(Ve[0],Ve[1],(0,c.useState)("")),Qe=(0,i.Z)(Xe,2),$e=(Qe[0],Qe[1],(0,c.useState)("")),Je=(0,i.Z)($e,2),et=(Je[0],Je[1],(0,c.useState)("")),tt=(0,i.Z)(et,2),nt=(tt[0],tt[1],(0,c.useState)("")),ot=(0,i.Z)(nt,2),at=(ot[0],ot[1],(0,c.useState)("")),rt=(0,i.Z)(at,2),it=(rt[0],rt[1],(0,c.useState)("")),st=(0,i.Z)(it,2),ct=(st[0],st[1],(0,c.useState)("")),lt=(0,i.Z)(ct,2),dt=(lt[0],lt[1],(0,c.useState)("")),ut=(0,i.Z)(dt,2),pt=(ut[0],ut[1],(0,c.useState)("")),xt=(0,i.Z)(pt,2),ft=(xt[0],xt[1],(0,c.useState)("")),ht=(0,i.Z)(ft,2),gt=(ht[0],ht[1]),mt=(0,c.useState)(""),Zt=(0,i.Z)(mt,2),bt=(Zt[0],Zt[1]),vt=(0,c.useState)({}),jt=(0,i.Z)(vt,2),St=(jt[0],jt[1],(0,c.useState)({})),yt=(0,i.Z)(St,2),kt=(yt[0],yt[1],(0,c.useRef)(null),(0,c.useState)(localStorage.getItem("locationid"))),_t=(0,i.Z)(kt,2),Ct=_t[0],wt=_t[1],Pt=(0,c.useState)(!1),At=(0,i.Z)(Pt,2),Et=At[0],It=At[1],Dt=(0,c.useRef)(null),Rt=(0,c.useRef)(null),Yt=(0,c.useState)(0),Mt=(0,i.Z)(Yt,2),Wt=Mt[0],Tt=Mt[1],zt=(0,c.useState)(1),Lt=(0,i.Z)(zt,2),Ht=Lt[0],Nt=Lt[1];"undefined"===typeof window||Me.current||(document.querySelector("#google-maps")||function(e,t,n){if(t){var o=document.createElement("script");o.setAttribute("async",""),o.setAttribute("id",n),o.src=e,t.appendChild(o)}}("https://maps.googleapis.com/maps/api/js?key=".concat("AIzaSyCF4KatYCI3vqz1_H3kiHeyS3yCMfYToh8","&libraries=places&location=10.3656,77.9690&radius=50000&components=country:IN&strictbounds=true"),document.querySelector("head"),"google-maps"),Me.current=!0);var Bt=localStorage.getItem("applocationid"),Ot=(0,Y.s0)(),Ft=(0,c.useState)({}),Ut=(0,i.Z)(Ft,2),Kt=(Ut[0],Ut[1],(0,c.useState)("")),qt=(0,i.Z)(Kt,2),Gt=(qt[0],qt[1],(0,c.useState)(!1)),Vt=(0,i.Z)(Gt,2),Xt=(Vt[0],Vt[1],(0,c.useState)(!1)),Qt=(0,i.Z)(Xt,2),$t=(Qt[0],Qt[1],(0,c.useState)(!1)),Jt=(0,i.Z)($t,2),en=Jt[0],tn=Jt[1],nn=(0,c.useState)(1),on=(0,i.Z)(nn,2),an=(on[0],on[1],(0,c.useState)([])),rn=(0,i.Z)(an,2),sn=(rn[0],rn[1],(0,c.useState)([])),cn=(0,i.Z)(sn,2),ln=cn[0],dn=cn[1],un=(0,c.useState)(""),pn=(0,i.Z)(un,2),xn=(pn[0],pn[1],(0,c.useState)(K()().format("MM-DD-YYYY"))),fn=(0,i.Z)(xn,2),hn=fn[0],gn=fn[1],mn=(0,c.useState)(K()().add(1,"day").format("MM-DD-YYYY")),Zn=(0,i.Z)(mn,2),bn=(Zn[0],Zn[1]),vn=(0,c.useState)(),jn=(0,i.Z)(vn,2),Sn=jn[0],yn=jn[1],kn=(0,c.useState)(),_n=(0,i.Z)(kn,2),Cn=_n[0],wn=_n[1],Pn=(0,c.useState)([]),An=(0,i.Z)(Pn,2),En=An[0],In=An[1],Dn=(0,c.useState)(""),Rn=(0,i.Z)(Dn,2),Yn=(Rn[0],Rn[1],(0,c.useState)([])),Mn=(0,i.Z)(Yn,2),Wn=(Mn[0],Mn[1],(0,z.Z)()),Tn=(0,c.useState)(""),zn=(0,i.Z)(Tn,2),Ln=zn[0],Hn=zn[1],Nn=(0,c.useState)([]),Bn=(0,i.Z)(Nn,2),On=(Bn[0],Bn[1],(0,c.useState)([])),Fn=(0,i.Z)(On,2),Un=(Fn[0],Fn[1],(0,c.useState)([])),Kn=(0,i.Z)(Un,2),qn=(Kn[0],Kn[1],(0,c.useState)([])),Gn=(0,i.Z)(qn,2),Vn=(Gn[0],Gn[1],(0,c.useState)(!1)),Xn=(0,i.Z)(Vn,2),Qn=(Xn[0],Xn[1]),$n=(0,c.useState)(!1),Jn=(0,i.Z)($n,2),eo=Jn[0],to=Jn[1],no=(0,c.useState)(!1),oo=(0,i.Z)(no,2),ao=oo[0],ro=oo[1],io=(0,c.useState)([]),so=(0,i.Z)(io,2),co=so[0],lo=(so[1],(0,c.useState)([])),uo=(0,i.Z)(lo,2),po=(uo[0],uo[1],(0,c.useState)([])),xo=(0,i.Z)(po,2),fo=(xo[0],xo[1]),ho=(0,c.useState)(""),go=(0,i.Z)(ho,2),mo=go[0],Zo=go[1],bo=(0,c.useState)(""),vo=(0,i.Z)(bo,2),jo=(vo[0],vo[1],(0,c.useState)({})),So=(0,i.Z)(jo,2),yo=(So[0],So[1],(0,c.useState)("")),ko=(0,i.Z)(yo,2),_o=ko[0],Co=(ko[1],(0,c.useState)([])),wo=(0,i.Z)(Co,2),Po=(wo[0],wo[1]),Ao=(0,c.useState)([]),Eo=(0,i.Z)(Ao,2),Io=(Eo[0],Eo[1],(0,c.useState)()),Do=(0,i.Z)(Io,2),Ro=Do[0],Yo=Do[1],Mo=(0,c.useState)([]),Wo=(0,i.Z)(Mo,2),To=(Wo[0],Wo[1],(0,c.useState)({})),zo=(0,i.Z)(To,2),Lo=zo[0],Ho=zo[1],No=(0,c.useState)({}),Bo=(0,i.Z)(No,2),Oo=(Bo[0],Bo[1],(0,c.useState)("")),Fo=(0,i.Z)(Oo,2),Uo=Fo[0],Ko=Fo[1],qo=(0,c.useState)([]),Go=(0,i.Z)(qo,2),Vo=(Go[0],Go[1],(0,c.useState)()),Xo=(0,i.Z)(Vo,2),Qo=(Xo[0],Xo[1]),$o=(0,c.useState)(""),Jo=(0,i.Z)($o,2),ea=(Jo[0],Jo[1],(0,c.useState)(!0)),ta=(0,i.Z)(ea,2),na=(ta[0],ta[1],(0,c.useState)("B")),oa=(0,i.Z)(na,2),aa=(oa[0],oa[1],(0,c.useState)(!1)),ra=(0,i.Z)(aa,2),ia=(ra[0],ra[1],(0,c.useState)({latitude:0,longitude:0})),sa=(0,i.Z)(ia,2),ca=sa[0],la=sa[1],da=(0,c.useState)({latitude:0,longitude:0}),ua=(0,i.Z)(da,2),pa=ua[0],xa=ua[1],fa=(0,c.useState)(!1),ha=(0,i.Z)(fa,2),ga=ha[0],ma=ha[1],Za=(0,c.useState)(0),ba=(0,i.Z)(Za,2),va=ba[0],ja=ba[1],Sa=(0,c.useState)(0),ya=(0,i.Z)(Sa,2),ka=ya[0],_a=ya[1],Ca=(0,c.useState)(0),wa=(0,i.Z)(Ca,2),Pa=wa[0],Aa=wa[1],Ea=(0,c.useState)(0),Ia=(0,i.Z)(Ea,2),Da=Ia[0],Ra=Ia[1],Ya=(0,c.useState)(0),Ma=(0,i.Z)(Ya,2),Wa=Ma[0],Ta=Ma[1],za=(0,c.useState)([]),La=(0,i.Z)(za,2),Ha=La[0],Na=La[1],Ba=(0,c.useState)("Select "),Oa=(0,i.Z)(Ba,2),Fa=Oa[0],Ua=Oa[1],Ka=(0,c.useState)(),qa=(0,i.Z)(Ka,2),Ga=qa[0],Va=qa[1],Xa=(0,c.useState)(""),Qa=(0,i.Z)(Xa,2),$a=(Qa[0],Qa[1]),Ja=localStorage.getItem("tenantid"),er=(0,c.useState)(null),tr=(0,i.Z)(er,2),nr=tr[0],or=tr[1],ar=(0,c.useState)(!1),rr=(0,i.Z)(ar,2),ir=rr[0],sr=rr[1],cr=(0,c.useState)(""),lr=(0,i.Z)(cr,2),dr=lr[0],ur=lr[1],pr=(0,c.useState)([]),xr=(0,i.Z)(pr,2),fr=xr[0],hr=xr[1],gr=(0,c.useState)({}),mr=(0,i.Z)(gr,2),Zr=mr[0],br=mr[1],vr=(0,c.useState)({}),jr=(0,i.Z)(vr,2),Sr=jr[0],yr=jr[1],kr=(0,c.useState)(0),_r=(0,i.Z)(kr,2),Cr=_r[0],wr=_r[1],Pr=(0,c.useState)(0),Ar=(0,i.Z)(Pr,2),Er=Ar[0],Ir=Ar[1],Dr=(0,c.useState)(0),Rr=(0,i.Z)(Dr,2),Yr=Rr[0],Mr=Rr[1],Wr=(0,c.useState)([]),Tr=(0,i.Z)(Wr,2),zr=Tr[0],Lr=Tr[1],Hr=(0,c.useState)(),Nr=(0,i.Z)(Hr,2),Br=Nr[0],Or=Nr[1],Fr=(0,c.useState)(),Ur=(0,i.Z)(Fr,2),Kr=Ur[0],qr=Ur[1],Gr=(0,c.useState)(),Vr=(0,i.Z)(Gr,2),Xr=Vr[0],Qr=Vr[1],$r=(0,c.useState)(0),Jr=(0,i.Z)($r,2),ei=Jr[0],ti=Jr[1],ni=(0,c.useState)(0),oi=(0,i.Z)(ni,2),ai=oi[0],ri=oi[1],ii=(0,c.useState)(0),si=(0,i.Z)(ii,2),ci=si[0],li=si[1],di=(0,c.useState)(0),ui=(0,i.Z)(di,2),pi=ui[0],xi=ui[1],fi=(0,c.useState)(),hi=(0,i.Z)(fi,2),gi=hi[0],mi=hi[1],Zi=(0,c.useState)(),bi=(0,i.Z)(Zi,2),vi=bi[0],ji=bi[1],Si=(0,c.useState)(!1),yi=(0,i.Z)(Si,2),ki=yi[0],_i=yi[1],Ci=(0,c.useState)(!1),wi=(0,i.Z)(Ci,2),Pi=wi[0],Ai=wi[1],Ei=(0,c.useState)(0),Ii=(0,i.Z)(Ei,2),Di=Ii[0],Ri=Ii[1];(0,c.useEffect)((function(){console.log(Di)}),[Di]);var Yi=function(e){or(e)},Mi=function(e){return{cursor:"pointer",backgroundColor:nr===e?Wn.palette.primary.main:"default",color:nr===e?"#fff":"","&:hover":{backgroundColor:nr===e?Wn.palette.primary.main:Wn.palette.primary.light,color:"#fff"}}},Wi=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){var t;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,T.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantpricing/?tenantid=").concat(Ja));case 3:t=e.sent,console.log("pricingResponse",t.data.details),_a(t.data.details.baseprice),Aa(t.data.details.priceperkm),Ra(t.data.details.minkm),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),console.log("fetchTenantPricing error",e.t0);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){Wi()}),[]),(0,c.useEffect)((function(){console.log("startPoint",ca),console.log("endPoint",pa),0!=ca.latitude&&0!=ca.longitude&&0!=pa.latitude&&0!=pa.longitude&&Ti(ca,pa)}),[ca,pa]);var Ti=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(t,n){var o,r,i;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,A.v)(t,n);case 3:o=e.sent,console.log("calculated distance in km:",o),ja(o),r=(0,A.j)(o,ka,Pa,Da),console.log("total charge:",r),Ta(r),ma(!0),o>Xr&&(ma(!0),tn(!0)),40,i=Math.round(o/40*60),console.log("Distance: ".concat(o,", Duration: ").concat(i)),e.next=19;break;case 16:e.prev=16,e.t0=e.catch(0),console.error("Error calculating distance:",e.t0);case 19:case"end":return e.stop()}}),e,null,[[0,16]])})));return function(t,n){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){if(En[0]){var e=[];En.map((function(t){K()().diff(K()("".concat(K()(hn).format("MM-DD-YYYY")," ").concat(K()(t).format("HH:mm:ss"))),"m")<=0&&e.push(t)})),e[0]&&fo([{sno:1,address:"",customerid:"",deliverytime:K()(e[0])||"",deliverylocationid:"",clientname:"",contactno:"",latitude:"",longitude:""}])}}),[En]),(0,c.useEffect)((function(){if(_o){var e=ln.filter((function(e){return e.address.toLowerCase().includes(_o.toLowerCase())||e.firstname.toLowerCase().includes(_o.toLowerCase())||e.contactno.toLowerCase().includes(_o.toLowerCase())}));console.log(e),Po((0,o.Z)(e))}else Po((0,o.Z)(ln))}),[_o]);var zi=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return to(!0),console.log("tid",Ja),e.next=4,T.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantinfo/?tenantid=").concat(Ja)).then((function(e){console.log("fetchtenantinfo",e),e.data.status&&(Ho(e.data.details),Qo(e.data.details.tenantid),Ni(),Va(e.data.details.subcategoryid)),to(!1)})).catch((function(e){console.log(e),to(!1)}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){zi()}),[]);var Li=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getsubcategories/?moduleid=6")).then((function(e){console.log("subcateRes",e.data.details),e.data.status&&e.data.details?Na(e.data.details):Na([])})).catch((function(e){console.log(e),Na([])}));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){Li()}),[]);var Hi=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return to(!0),e.next=3,T.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocations/?applocationid=").concat(Bt)).then((function(e){console.log("fetchTiming",e);var t=e.data.details[0],n=t.opentime,o=t.closetime,a=t.latitude,r=t.longitude,i=t.radius;if(e.data.status){Or(a),qr(r),Qr(i),yn("".concat(K()().format("MM-DD-YYYY")," ").concat(n)),wn("".concat(K()().format("MM-DD-YYYY")," ").concat(o)),console.log("starttime","".concat(K()().format("MM-DD-YYYY")," ").concat(n)),console.log("endtime","".concat(K()().format("MM-DD-YYYY")," ").concat(o," "));for(var s=[],c="".concat(K()().format("MM-DD-YYYY")," ").concat(n);K()("".concat(K()().format("MM-DD-YYYY")," ").concat(o," ")).diff(c,"m")>=0;c=K()(c).add(30,"m"))s.push(c);console.log("setTimeslotarr",s),In(s)}to(!1)})).catch((function(e){console.log(e),to(!1)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){Hi()}),[]);var Ni=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return to(!0),e.next=3,T.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocationconfig/?applocationid=").concat(Bt)).then((function(e){var t=e.data.details.applocationadmins.map((function(e){return e.userfcmtokem}));console.log("fetchAppAdminTokens",e),console.log("userfcmtokemArray",t),e.data.status&&Yo(t),to(!1)})).catch((function(e){console.log(e),to(!1)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){Sn&&Cn&&Ni()}),[Sn,Cn]);var Bi=function(e,t,n){(0,q.yv)(e,{variant:t,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:n||2e3}),console.log(mo)};var Oi=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){var t,n;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},t={orders:{applocationid:Lo.applolcationid,cancellled:"",categoryid:+Lo.categoryid,configid:7,customerid:0==ei&&+Zr.customerid||0,deliveryaddress:Sr.address||"",deliverycharge:+Wa.toFixed(2)||0,deliverycity:Sr.city||"",deliverycontactno:Sr.contactno||"",deliverycustomer:Sr.firstname||"",deliveryid:0==ai&&+Sr.customerid||0,deliverylandmark:Sr.landmark||"",deliverylat:Sr.latitude.toString(),deliverylocation:Sr.suburb||"",deliverylocationid:Sr.deliverylocationid||0,deliverylong:Sr.longitude.toString(),deliverytime:"".concat(K()(hn).format("YYYY-MM-DD")," ").concat(K()(Uo.$d).format("HH:mm:ss")),deliverytype:0!==Zr.customerid||0!==Sr.customerid?"B":"C",delivered:"",itemcount:1,kms:va.toString()||0,locationid:+Ct,moduleid:+Lo.moduleid,orderamount:+Wa.toFixed(2)||0,ordercharges:0,orderdate:K()().format("YYYY-MM-DD HH:mm:ss"),orderheaderid:0,orderid:"",ordernotes:Ln,orderstatus:"created",ordervalue:+Wa.toFixed(2)||0,partnerid:Lo.partnerid,paymentstatus:1,paymenttype:42,pending:"",pickupaddress:Zr.address||"",pickupcity:Zr.city||"",pickupcontactno:Zr.contactno||"",pickupcustomer:Zr.firstname||"",pickuplandmark:Zr.landmark||"",pickuplat:Zr.latitude.toString(),pickuplocation:Zr.suburb||"",pickuplocationid:Zr.deliverylocationid||0,pickuplong:Zr.longitude.toString(),processing:"",ready:"",remarks:"",smsdelivery:Di,subcategoryid:+Ga,taxamount:0,tenantid:Lo.tenantid,tenantuserid:parseInt(localStorage.getItem("userid")),collectionamt:+Wt||0,quantity:+Ht||1},pickup:{address:Zr.address||"",applocationid:Lo.applolcationid,city:Zr.city||"",configid:7,contactno:Zr.contactno||"",customertoken:"",customerid:0==ei&&Zr.customerid||0,devicetype:"",deviceid:"",dialcode:"+91",doorno:Zr.doorno||"",email:Zr.email||"",firstname:Zr.firstname||"",landmark:Zr.landmark||"",latitude:Zr.latitude.toString()||"",longitude:Zr.longitude.toString()||"",locationid:Zr.deliverylocationid||0,postcode:Zr.postcode||"",primaryaddress:1,profileimage:"",state:Zr.state||"",suburb:Zr.suburb||"",tenantid:Lo.tenantid},drop:{address:Sr.address||"",applocationid:Lo.applolcationid,city:Sr.city||"",configid:7,contactno:Sr.contactno||"",customertoken:"",customerid:0==ai&&Sr.customerid||0,devicetype:"",deviceid:"",dialcode:"+91",doorno:Sr.doorno||"",email:Sr.email||"",firstname:Sr.firstname||"",landmark:Sr.landmark||"",latitude:Sr.latitude.toString(),longitude:Sr.longitude.toString(),locationid:Sr.deliverylocationid||0,postcode:Sr.postcode||"",primaryaddress:1,profileimage:"",state:Sr.state||"",suburb:Sr.suburb||"",tenantid:Lo.tenantid}},console.log("createsubmitobj2",t),Zr.firstname){e.next=7;break}Bi("Enter Pickup Contact Name ","warning",2e3),e.next=79;break;case 7:if(Zr.contactno){e.next=11;break}Bi("Enter Pickup Contact Number ","warning",2e3),e.next=79;break;case 11:if(10==Zr.contactno.length){e.next=15;break}Bi("Check Pickup Contact Number ","error",2e3),e.next=79;break;case 15:if(Zr.suburb){e.next=19;break}Bi("Enter Pickup Location ","warning",2e3),e.next=79;break;case 19:if(Zr.city){e.next=23;break}Bi("Enter Pickup City ","warning",2e3),e.next=79;break;case 23:if(Zr.postcode){e.next=27;break}Bi("Enter Pickup Postcode ","warning",2e3),e.next=79;break;case 27:if(Zr.landmark){e.next=31;break}Bi("Enter Pickup Landmark ","warning",2e3),e.next=79;break;case 31:if(Sr.firstname){e.next=35;break}Bi("Enter Drop Contact Name ","warning",2e3),e.next=79;break;case 35:if(Sr.contactno){e.next=39;break}Bi("Enter Drop Contact Number","warning",2e3),e.next=79;break;case 39:if(10===Sr.contactno.length){e.next=43;break}Bi("Check Drop Contact Number ","error",2e3),e.next=79;break;case 43:if(Sr.suburb){e.next=47;break}Bi("Enter Drop Suburb ","warning",2e3),e.next=79;break;case 47:if(Sr.city){e.next=51;break}Bi("Enter Drop City ","warning",2e3),e.next=79;break;case 51:if(Sr.postcode){e.next=55;break}Bi("Enter Drop postcode ","warning",2e3),e.next=79;break;case 55:if(Sr.landmark){e.next=59;break}Bi("Enter Drop Landmark ","warning",2e3),e.next=79;break;case 59:if(Uo){e.next=63;break}Bi("Choose deliverytime ","warning",2e3),e.next=79;break;case 63:if(Va){e.next=67;break}Bi("Choose SubCategory ","warning",2e3),e.next=79;break;case 67:return e.prev=67,e.next=70,T.Z.post("".concat("https://jupiter.nearle.app/live/api/v2","/orders/createorder"),t);case 70:(n=e.sent).data.status?(console.log("createRes",n),(0,q.yv)("Order Created Successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:1e3}),Ro&&notifyadmin(Ro),Ot("/nearle/orders")):Bi("Something went wrong, Cannot create order","warning"),to(!1),console.log(n),e.next=79;break;case 76:e.prev=76,e.t0=e.catch(67),console.log("createResErr",e.t0);case 79:case"end":return e.stop()}}),e,null,[[67,76]])})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){console.log("shiftarr"),console.log(co)}),[co]);var Fi=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){var t;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Qn(!0),e.prev=1,t=""==dr?"".concat("https://jupiter.nearle.app/live/api/v1","/customers/gettenantcustomers/?tenantid=").concat(Ja,"&pageno=1&pagesize=20"):"".concat("https://jupiter.nearle.app/live/api/v1","/customers/search/?tenantid=").concat(Ja,"&keyword=").concat(dr),e.next=5,T.Z.get(t).then((function(e){if(console.log("clientdetails",e.data.details),e.data.status&&e.data.details){dn(e.data.details||[]),hr(e.data.details||[]);var t=[];e.data.details.map((function(e){t.push((0,s.Z)({label:"".concat(e.firstname," | ").concat(e.contactno)},e))})),Po(t)}else dn([]),hr([]),Po([]);Qn(!1)})).catch((function(e){console.log(e),Qn(!1),Bi("server error","warning")}));case 5:e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.log(e.t0),Qn(!1);case 11:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){console.log("clientdetails, by search"),Fi()}),[dr.length>3,""==dr]);(0,c.useEffect)((function(){if(_e){var e=document.getElementById("addressAuto1"),t=new window.google.maps.places.Autocomplete(e,{strictBounds:!0,bounds:new window.google.maps.Circle({center:new window.google.maps.LatLng(Br,Kr),radius:1e3*Xr}).getBounds()});t.addListener("place_changed",(function(){var e=t.getPlace();Ce("".concat(e.name,", ").concat(e.formatted_address)),console.log("new place",e),console.log(" pick (new place) lat lng",{lat:e.geometry.location.lat(),lng:e.geometry.location.lng()}),la({latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}),n(e),gt("".concat(e.name," ").concat(e.formatted_address)),br((0,s.Z)((0,s.Z)({},Zr),{},{address:"".concat(e.name," ").concat(e.formatted_address)}));var o={address:"".concat(e.name," ").concat(e.formatted_address),street_number:"",route:"",locality:"",sublocality_level_1:"",administrative_area_level_3:"",administrative_area_level_1:"",country:"",postal_code:""};e.address_components.forEach((function(e){e.types.forEach((function(t){switch(t){case"street_number":o.street_number=e.long_name;break;case"route":o.route=e.long_name;break;case"locality":o.locality=e.long_name;break;case"sublocality_level_1":o.sublocality_level_1=e.long_name;break;case"administrative_area_level_3":o.administrative_area_level_3=e.long_name;break;case"administrative_area_level_1":o.administrative_area_level_1=e.long_name;break;case"country":o.country=e.long_name;break;case"postal_code":o.postal_code=e.long_name}}))})),br((0,s.Z)((0,s.Z)({},Zr),{},{address:o.address,doorno:"".concat(o.street_number," ").concat(o.route),suburb:o.sublocality_level_1,city:o.locality,postcode:o.postal_code,latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()})),console.log("Pick Address:",o)}))}}),[_e]),(0,c.useEffect)((function(){if(Ae){var e=document.getElementById("addressAuto2"),t=new window.google.maps.places.Autocomplete(e,{strictBounds:!0,bounds:new window.google.maps.Circle({center:new window.google.maps.LatLng(Br,Kr),radius:1e3*Xr}).getBounds()});t.addListener("place_changed",(function(){var e=t.getPlace();Ee("".concat(e.name,", ").concat(e.formatted_address)),console.log("new place",e),console.log("drop (new place) lat lng",{lat:e.geometry.location.lat(),lng:e.geometry.location.lng()}),xa({latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}),oe(e),bt("".concat(e.name," ").concat(e.formatted_address)),yr((0,s.Z)((0,s.Z)({},Sr),{},{address:"".concat(e.name," ").concat(e.formatted_address)}));var n={address:"".concat(e.name," ").concat(e.formatted_address),street_number:"",route:"",locality:"",sublocality_level_1:"",administrative_area_level_3:"",administrative_area_level_1:"",country:"",postal_code:""};e.address_components.forEach((function(e){e.types.forEach((function(t){switch(t){case"street_number":n.street_number=e.long_name;break;case"route":n.route=e.long_name;break;case"locality":n.locality=e.long_name;break;case"sublocality_level_1":n.sublocality_level_1=e.long_name;break;case"administrative_area_level_3":n.administrative_area_level_3=e.long_name;break;case"administrative_area_level_1":n.administrative_area_level_1=e.long_name;break;case"country":n.country=e.long_name;break;case"postal_code":n.postal_code=e.long_name}}))})),yr((0,s.Z)((0,s.Z)({},Sr),{},{address:n.address,doorno:"".concat(n.street_number," ").concat(n.route),suburb:n.sublocality_level_1,city:n.locality,postcode:n.postal_code,latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()})),console.log("Drop Address:",n)}))}}),[Ae]);var Ui=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){var t;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,T.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantlocations/?tenantid=").concat(Ja));case 3:t=e.sent,console.log("gettenantlocations",t.data.details),t.data&&t.data.details?(Lr(t.data.details),1==t.data.details.length&&(It(!0),wt(t.data.details[0].locationid))):Lr([]),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),console.log("gettenantlocations",e.t0),Lr([]);case 12:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}();return(0,c.useEffect)((function(){Ui()}),[]),(0,Q.jsxs)(Q.Fragment,{children:[eo&&(0,Q.jsx)(H.Z,{}),(0,Q.jsxs)(p.ZP,{container:!0,rowSpacing:2,columnSpacing:2.75,children:[(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(X.Z,{elevation:0,sx:{position:"sticky",top:"60px",zIndex:1e3,mb:1.5,p:{xs:1.5,sm:2,md:2.5},borderRadius:ee/8,border:"1px solid",borderColor:se,background:"linear-gradient(135deg, ".concat(ue(he)," 0%, ").concat(ue(ge)," 100%)"),boxShadow:ne},children:(0,Q.jsxs)(l.Z,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",spacing:{xs:1.5,sm:2},children:[(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:{xs:1.25,sm:1.75},children:[(0,Q.jsx)(d.Z,{sx:{width:{xs:40,sm:48},height:{xs:40,sm:48},bgcolor:he,color:"#fff",boxShadow:"0 6px 18px ".concat(xe(he))},children:(0,Q.jsx)(M.tX2,{size:22})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h3",sx:{fontWeight:800,color:ae,lineHeight:1.1,fontSize:{xs:"1.25rem",sm:"1.5rem",md:"1.75rem"}},children:"Create Order"}),(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:.75,sx:{mt:.5},children:[(0,Q.jsx)(x.Z,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:"#10b981",boxShadow:"0 0 0 4px rgba(16,185,129,0.18)"}}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:re,fontWeight:600},children:"Fill pickup, drop, schedule & pricing details"})]})]})]}),1===zr.length?(0,Q.jsxs)(x.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.75,px:1.5,py:.875,borderRadius:999,bgcolor:ue(he),border:"1.5px solid ".concat(fe(he)),color:he,fontWeight:800,fontSize:13},children:[(0,Q.jsx)(M.x$F,{size:14})," ",zr[0].locationname]}):(0,Q.jsx)(f.Z,{options:zr||[],getOptionLabel:function(e){return e&&e.locationname?"".concat(e.locationname," (").concat(e.suburb||"",")"):""},isOptionEqualToValue:function(e,t){return(null===e||void 0===e?void 0:e.locationid)===(null===t||void 0===t?void 0:t.locationid)},PaperComponent:be,sx:{width:{xs:"100%",sm:300}},size:"small",renderInput:function(e){return(0,Q.jsx)(h.Z,(0,s.Z)((0,s.Z)({},e),{},{placeholder:"Select Business Location",InputProps:(0,s.Z)((0,s.Z)({},e.InputProps),{},{startAdornment:(0,Q.jsx)(l.Z,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5},children:(0,Q.jsx)(d.Z,{sx:{width:22,height:22,bgcolor:he,color:"#fff"},children:(0,Q.jsx)(M.x$F,{size:13})})})}),sx:{"& .MuiOutlinedInput-root":{borderRadius:J+"px",bgcolor:"#fff",fontWeight:600,"& fieldset":{borderColor:fe(he),borderWidth:1.5},"&:hover fieldset":{borderColor:he},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(xe(he))},"&.Mui-focused fieldset":{borderColor:he,borderWidth:2}}}}))},onChange:function(e,t,n){t&&(wt(t.locationid),It(!0)),"clear"===n&&It(!1)}})]})})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(x.Z,{sx:{overflow:"visible"},children:[(0,Q.jsx)(p.ZP,{container:!0,spacing:2,children:(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(p.ZP,{container:!0,spacing:2,sx:{height:"100%"},children:[(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsxs)(Ze,{children:[(0,Q.jsx)(me,{color:"#0ea5e9",icon:(0,Q.jsx)(M.$0r,{size:16}),title:"Pickup Details",subtitle:"Where the order is picked up",action:(0,Q.jsx)(g.Z,{size:"small",variant:"outlined",startIcon:(0,Q.jsx)(M.Bjz,{size:14}),onClick:function(){Et?(sr(!0),wr(1),br({}),Ce(""),ur("")):Bi("Select Business Location","warning")},sx:{borderRadius:999,px:1.5,py:.375,fontSize:11.5,fontWeight:700,textTransform:"none",borderColor:fe("#0ea5e9"),color:"#0ea5e9","&:hover":{borderColor:"#0ea5e9",bgcolor:ue("#0ea5e9"),boxShadow:"0 0 0 3px ".concat(xe("#0ea5e9"))}},children:"Saved Locations"})}),(0,Q.jsx)(x.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsx)(p.ZP,{container:!0,spacing:2,children:(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(p.ZP,{container:!0,spacing:4,children:[(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{inputRef:Dt,disabled:!Et,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(m.Z,{children:(0,Q.jsx)(D.Xws,{})})},variant:"outlined",label:"Contact Name",value:Zr.firstname,onChange:function(e){br((0,s.Z)((0,s.Z)({},Zr),{},{firstname:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{error:ki,disabled:!Et,fullWidth:!0,type:"number",InputProps:{inputProps:{maxLength:10},startAdornment:(0,Q.jsx)(m.Z,{children:(0,Q.jsx)(E.DNl,{color:ki&&"red"})})},variant:"outlined",label:"Contact Number",value:Zr.contactno,onChange:function(e){e.target.value.length<=10&&br((0,s.Z)((0,s.Z)({},Zr),{},{contactno:e.target.value})),gi==e.target.value?li(0):li(1),e.target.value.length<10?_i(!0):_i(!1)}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(l.Z,{spacing:1.25,sx:{mt:0},children:0==Er?(0,Q.jsx)("div",{children:(0,Q.jsx)(h.Z,{variant:"outlined",label:"Address",disabled:!Et,id:"addressAuto1",fullWidth:!0,value:_e,onChange:function(e){return Ce(e.target.value)},InputProps:{endAdornment:(0,Q.jsx)(m.Z,{onClick:function(){Ce(""),br((0,s.Z)((0,s.Z)({},Zr),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),ma(!1),la({latitude:0,longitude:0})},size:"small",children:(0,Q.jsx)(P.Z,{})})}})}):(0,Q.jsx)(h.Z,{InputProps:{endAdornment:(0,Q.jsx)(m.Z,{onClick:function(){Ir(0),br((0,s.Z)((0,s.Z)({},Zr),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),ma(!1),la({latitude:0,longitude:0})},children:(0,Q.jsx)(R.Z,{})})},variant:"outlined",placeholder:"Select",value:Zr.address,onChange:function(e){br((0,s.Z)((0,s.Z)({},Zr),{},{address:e.target.value})),""==e.target.value&&(Ir(0),ma(!1),la({latitude:0,longitude:0}))}})})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!Et,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(m.Z,{children:(0,Q.jsx)(I.Lmk,{})})},variant:"outlined",label:"Door No / Street",value:Zr.doorno,onChange:function(e){br((0,s.Z)((0,s.Z)({},Zr),{},{doorno:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!Et,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(m.Z,{children:(0,Q.jsx)(D.GUT,{})})},variant:"outlined",label:"Location",value:Zr.suburb,onChange:function(e){br((0,s.Z)((0,s.Z)({},Zr),{},{suburb:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!Et,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(m.Z,{children:(0,Q.jsx)(M.Ys1,{})})},variant:"outlined",label:"City",value:Zr.city,onChange:function(e){br((0,s.Z)((0,s.Z)({},Zr),{},{city:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!Et,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(m.Z,{children:(0,Q.jsx)(W.kk8,{})})},variant:"outlined",label:"Postcode",value:Zr.postcode,onChange:function(e){br((0,s.Z)((0,s.Z)({},Zr),{},{postcode:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(h.Z,{disabled:!Et,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(m.Z,{children:(0,Q.jsx)(D.I2o,{})})},variant:"outlined",label:"Landmark",value:Zr.landmark,onChange:function(e){br((0,s.Z)((0,s.Z)({},Zr),{},{landmark:e.target.value}))}})}),1==ci&&(0,Q.jsx)(p.ZP,{item:!0,xs:12,sx:{display:"flex",justifyContent:"end"},children:(0,Q.jsx)(Z.Z,{children:(0,Q.jsx)(b.Z,{control:(0,Q.jsx)(v.Z,{checked:1===ei,onChange:function(e){ti(e.target.checked?1:0)}}),label:"Save For Later"})})})]})})})})]})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsxs)(Ze,{children:[(0,Q.jsx)(me,{color:he,icon:(0,Q.jsx)(M.ili,{size:16}),title:"Drop Details",subtitle:"Where the order is delivered",action:(0,Q.jsx)(g.Z,{size:"small",variant:"outlined",startIcon:(0,Q.jsx)(M.Bjz,{size:14}),onClick:function(){Et?(sr(!0),wr(2),Ee(""),ur("")):Bi("Select Business Location","warning")},sx:{borderRadius:999,px:1.5,py:.375,fontSize:11.5,fontWeight:700,textTransform:"none",borderColor:fe(he),color:he,"&:hover":{borderColor:he,bgcolor:ue(he),boxShadow:"0 0 0 3px ".concat(xe(he))}},children:"Saved Locations"})}),(0,Q.jsx)(x.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsxs)(p.ZP,{container:!0,spacing:2,sx:{height:"100%"},children:[(0,Q.jsx)(p.ZP,{item:!0,xs:12,sx:{height:"100%"},children:(0,Q.jsxs)(l.Z,{direction:"row",justifyContent:"space-between",sx:{display:"none"},children:[(0,Q.jsx)(u.Z,{variant:"h5",sx:{mb:2},children:"Drop Details"}),(0,Q.jsx)(l.Z,{direction:"row",alignItems:"center",children:(0,Q.jsx)(g.Z,{variant:"outlined",sx:{"&:hover":{bgcolor:Wn.palette.primary.main,color:"white"}},onClick:function(){Et?(sr(!0),wr(2),Ee(""),ur("")):Bi("Select Business Location","warning")},children:"Saved Locations"})})]})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(p.ZP,{container:!0,spacing:4,children:[(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{inputRef:Rt,disabled:!Et,fullWidth:!0,variant:"outlined",label:"Contact Name",InputProps:{startAdornment:(0,Q.jsx)(m.Z,{children:(0,Q.jsx)(D.Xws,{})})},value:Sr.firstname,onChange:function(e){yr((0,s.Z)((0,s.Z)({},Sr),{},{firstname:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!Et,error:Pi,fullWidth:!0,type:"number",variant:"outlined",label:"Contact Number",InputProps:{startAdornment:(0,Q.jsx)(m.Z,{children:(0,Q.jsx)(E.DNl,{color:Pi&&"red"})})},value:Sr.contactno,onChange:function(e){e.target.value.length<=10&&yr((0,s.Z)((0,s.Z)({},Sr),{},{contactno:e.target.value})),vi==e.target.value?xi(0):xi(1),e.target.value.length<10?Ai(!0):Ai(!1)}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(l.Z,{spacing:1.25,sx:{mt:0},children:0==Yr?(0,Q.jsx)("div",{children:(0,Q.jsx)(h.Z,{id:"addressAuto2",disabled:!Et,label:"Address",fullWidth:!0,value:Ae,onChange:function(e){return Ee(e.target.value)},InputProps:{endAdornment:(0,Q.jsx)(m.Z,{onClick:function(){Ee(""),yr((0,s.Z)((0,s.Z)({},Sr),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),ma(!1),xa({latitude:0,longitude:0})},size:"small",children:(0,Q.jsx)(P.Z,{})})}})}):(0,Q.jsx)(h.Z,{disabled:!Et,InputProps:{endAdornment:(0,Q.jsx)(m.Z,{onClick:function(){Mr(0),yr((0,s.Z)((0,s.Z)({},Sr),{},{firstname:"",contactno:"",doorno:"",suburb:"",city:"",postcode:"",landmark:""})),ma(!1),xa({latitude:0,longitude:0})},children:(0,Q.jsx)(R.Z,{})})},variant:"outlined",placeholder:"Select",value:Sr.address,onChange:function(e){br((0,s.Z)((0,s.Z)({},Sr),{},{address:e.target.value})),""==e.target.value&&(Mr(0),ma(!1),xa({latitude:0,longitude:0}))}})})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!Et,fullWidth:!0,variant:"outlined",label:"Door No / Street",InputProps:{startAdornment:(0,Q.jsx)(m.Z,{children:(0,Q.jsx)(I.Lmk,{})})},value:Sr.doorno,onChange:function(e){yr((0,s.Z)((0,s.Z)({},Sr),{},{doorno:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!Et,fullWidth:!0,variant:"outlined",label:"Location",InputProps:{startAdornment:(0,Q.jsx)(m.Z,{children:(0,Q.jsx)(D.GUT,{})})},value:Sr.suburb,onChange:function(e){yr((0,s.Z)((0,s.Z)({},Sr),{},{suburb:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!Et,fullWidth:!0,variant:"outlined",label:"City",InputProps:{startAdornment:(0,Q.jsx)(m.Z,{children:(0,Q.jsx)(M.Ys1,{})})},value:Sr.city,onChange:function(e){yr((0,s.Z)((0,s.Z)({},Sr),{},{city:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!Et,fullWidth:!0,variant:"outlined",label:"Postcode",InputProps:{startAdornment:(0,Q.jsx)(m.Z,{children:(0,Q.jsx)(W.kk8,{})})},value:Sr.postcode,onChange:function(e){yr((0,s.Z)((0,s.Z)({},Sr),{},{postcode:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(h.Z,{disabled:!Et,fullWidth:!0,variant:"outlined",label:"Landmark",InputProps:{startAdornment:(0,Q.jsx)(m.Z,{children:(0,Q.jsx)(D.I2o,{})})},value:Sr.landmark,onChange:function(e){yr((0,s.Z)((0,s.Z)({},Sr),{},{landmark:e.target.value}))}})}),1==pi&&(0,Q.jsx)(p.ZP,{item:!0,xs:12,sx:{display:"flex",justifyContent:"end"},children:(0,Q.jsx)(Z.Z,{children:(0,Q.jsx)(b.Z,{control:(0,Q.jsx)(v.Z,{checked:1===ai,onChange:function(e){ri(e.target.checked?1:0)}}),label:"Save For Later"})})})]})})]})})]})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsxs)(Ze,{sx:{mt:2,minHeight:390},children:[(0,Q.jsx)(me,{color:"#f59e0b",icon:(0,Q.jsx)(M.k71,{size:16}),title:"Schedule",subtitle:"Pickup date & time slot"}),(0,Q.jsx)(x.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsx)(p.ZP,{container:!0,children:(0,Q.jsxs)(p.ZP,{item:!0,xs:12,children:[(0,Q.jsx)(u.Z,{variant:"subtitle2",sx:{fontWeight:700,color:re,mb:1},children:"Date"}),(0,Q.jsx)(B._,{dateAdapter:O.y,sx:{},children:(0,Q.jsx)(N.M,{format:"DD-MM-YYYY",onChange:function(e){var t=K()().diff(K()("".concat(K()(e).format("YYYY-MM-DD"))),"d");if(console.log("dateres11"),console.log(t),Ko(""),t<=0){console.log("startdate",e),gn(e),bn(e);var n=[];En.map((function(t){K()().diff(K()("".concat(K()(e).format("MM-DD-YYYY")," ").concat(K()(t).format("HH:mm:ss"))),"m")<=0&&n.push(t)})),n[0]?fo([{sno:1,address:"",customerid:"",deliverytime:K()(n[0])||"",deliverylocationid:"",clientname:"",contactno:"",latitude:"",longitude:""}]):fo([])}else Zo("choose Upcoming Date"),Bi("choose Upcoming Date","warning"),gn(NaN)},value:K()(hn),sx:{width:"100%",mt:2},disablePast:!0})}),(0,Q.jsx)(u.Z,{variant:"subtitle2",sx:{fontWeight:700,color:re,mt:2,mb:1},children:"Time"}),(0,Q.jsx)(x.Z,{sx:{mt:.5,p:1.25,borderRadius:2,border:"1px solid",borderColor:ce,bgcolor:le,maxHeight:150,overflowY:"auto",scrollbarWidth:"thin","&::-webkit-scrollbar":{width:6},"&::-webkit-scrollbar-thumb":{backgroundColor:fe(he),borderRadius:6}},children:(0,Q.jsx)(l.Z,{direction:"row",flexWrap:"wrap",gap:.75,useFlexGap:!0,children:En.map((function(e,t){if(K()().diff(K()("".concat(K()(hn).format("MM-DD-YYYY")," ").concat(K()(e).format("HH:mm:ss"))),"m")<=0){var n=K()(Uo).format("HH:mm")==K()(e).format("HH:mm");return(0,Q.jsxs)(x.Z,{onClick:function(){va>Xr?tn(!0):ga?Ko(e):Bi("Select Pickup and Drop","error")},sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1.25,py:.5,cursor:"pointer",borderRadius:999,border:"1.5px solid ".concat(n?"#f59e0b":fe("#f59e0b")),bgcolor:n?"#f59e0b":ue("#f59e0b"),color:n?"#fff":"#f59e0b",fontSize:12,fontWeight:800,transition:"all 0.15s",boxShadow:n?"0 6px 18px ".concat(xe("#f59e0b")):"none","&:hover":{borderColor:"#f59e0b",boxShadow:n?"0 6px 18px ".concat(xe("#f59e0b")):"0 0 0 3px ".concat(xe("#f59e0b"))}},children:[(0,Q.jsx)(M.Y8K,{size:11})," ",K()(e).format("hh:mm A")]},t)}}))})})]})})})]})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,sx:{},children:(0,Q.jsxs)(Ze,{sx:{mt:2,minHeight:390},children:[(0,Q.jsx)(me,{color:"#10b981",icon:(0,Q.jsx)(M.sF1,{size:16}),title:"Distance & Pricing",subtitle:"Auto-calculated from pickup \u2192 drop"}),(0,Q.jsxs)(x.Z,{sx:{p:{xs:2,md:2.5}},children:[ga&&(0,Q.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",mb:3},children:[(0,Q.jsx)(l.Z,{spacing:1.5,children:(0,Q.jsx)(j.Z,{label:"Distance: ".concat(va," km"),size:"medium",variant:"contained",color:"primary"})}),(0,Q.jsx)(l.Z,{spacing:1.5,children:(0,Q.jsx)(j.Z,{label:"Charge: \u20b9".concat(Wa.toFixed(2)),size:"medium",variant:"contained",color:"primary"})})]}),(0,Q.jsxs)(l.Z,{direction:"column",justifyContent:"space-between",sx:{mb:2},children:[(0,Q.jsx)(u.Z,{variant:"h5",children:"Category"}),(0,Q.jsx)(f.Z,{disablePortal:!0,id:"combo-box-demo",options:Ha,getOptionLabel:function(e){return"".concat(e.subcategoryname)||""},sx:{my:2,zIndex:"100"},fullWidth:!0,renderInput:function(e){return(0,Q.jsx)(h.Z,(0,s.Z)((0,s.Z)({},e),{},{label:""==Fa?Lo.subcategoryname:Fa}))},onChange:function(e,t,n){t&&(console.log(t),Ua(t.subcategoryname),Va(t.subcategoryid))}})]}),(0,Q.jsx)(u.Z,{variant:"h5",children:"Weight"}),(0,Q.jsxs)(l.Z,{direction:"row",justifyContent:"space-evenly",sx:{border:"1px solid #eee",my:2,py:2},children:[(0,Q.jsx)(j.Z,{variant:"contained",color:"default",label:"1-10kgs",sx:Mi("1-10kgs"),onClick:function(){Yi("1-10kgs"),$a("1-10kgs")}}),(0,Q.jsx)(j.Z,{variant:"contained",color:"default",label:"11-20kgs",sx:Mi("11-20kgs"),onClick:function(){Yi("11-20kgs"),$a("11-20kgs")}}),(0,Q.jsx)(j.Z,{variant:"contained",color:"default",label:"21-30kgs",sx:Mi("21-30kgs"),onClick:function(){Yi("21-30kgs"),$a("21-30kgs")}})]}),(0,Q.jsxs)(l.Z,{direction:"row",justifyContent:"space-between",sx:{mt:4},children:[(0,Q.jsx)(u.Z,{variant:"h5",children:"SMS Delivery"}),(0,Q.jsx)(S.Z,{checked:1===Di,onChange:function(e){Ri(e.target.checked?1:0)}})]})]})]})})]})})}),(0,Q.jsxs)(Ze,{sx:{mt:2},children:[(0,Q.jsx)(me,{color:"#6366f1",icon:(0,Q.jsx)(M.ByW,{size:16}),title:"Collection & Quantity",subtitle:"Cash to collect on delivery, total items"}),(0,Q.jsx)(x.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsxs)(p.ZP,{container:!0,spacing:2,children:[(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsx)(h.Z,{type:"number",value:Wt,fullWidth:!0,label:"Cash Collect",onChange:function(e){return Tt(e.target.value)},inputProps:{min:0}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsx)(h.Z,{type:"number",value:Ht,fullWidth:!0,label:"Quantity",onChange:function(e){return Nt(e.target.value)},inputProps:{min:1}})})]})})]}),(0,Q.jsxs)(Ze,{sx:{mt:2},children:[(0,Q.jsx)(me,{color:re,icon:(0,Q.jsx)(M.hKf,{size:16}),title:"Notes",subtitle:"Add anything the rider should know"}),(0,Q.jsxs)(x.Z,{sx:{p:{xs:2,md:2.5}},children:[(0,Q.jsx)(h.Z,{focused:!0,variant:"outlined",sx:{width:"100%",mb:2},multiline:!0,rows:2,label:"Notes",placeholder:"Special instructions, gate code, etc.",value:Ln,onChange:function(e){return Hn(e.target.value)}}),(0,Q.jsx)(y.Z,{sx:{my:1.5}}),(0,Q.jsxs)(l.Z,{direction:"row",justifyContent:"flex-end",alignItems:"center",spacing:1.25,children:[!ga&&(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:ie,fontWeight:700},children:"Set pickup & drop to enable"}),(0,Q.jsx)(g.Z,{size:"medium",disabled:!ga,variant:"contained",startIcon:ao?null:(0,Q.jsx)(M.ZSR,{size:16}),onClick:function(){to(!0),ro(!0),Oi(),setTimeout((function(){to(!1),ro(!1)}),1e3)},sx:{borderRadius:999,px:3,py:1,fontWeight:800,textTransform:"none",fontSize:13,background:"linear-gradient(135deg, ".concat(he," 0%, ").concat(ge," 100%)"),color:"#fff",boxShadow:"0 8px 22px ".concat(xe(he)),transition:"all 0.18s","&:hover":{background:"linear-gradient(135deg, #4D1C61 0%, ".concat(he," 100%)"),transform:"translateY(-1px)",boxShadow:"0 10px 26px ".concat(xe(he))},"&.Mui-disabled":{background:ce,color:ie,boxShadow:"none"}},children:ao?(0,Q.jsx)(k.Z,{size:18,thickness:5,sx:{color:"#fff"}}):"Create Order"})]})]})]})]})}),(0,Q.jsxs)(F.Z,{open:ir,onClose:function(){return sr(!1)},fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:3}},children:[(0,Q.jsxs)(_.Z,{sx:{p:2.5,background:"linear-gradient(135deg, ".concat(ue(he)," 0%, ").concat(ue(ge)," 100%)"),borderBottom:"1px solid ".concat(se)},children:[(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:1.5,sx:{mb:1.5},children:[(0,Q.jsx)(d.Z,{sx:{bgcolor:he,color:"#fff",width:40,height:40,boxShadow:"0 6px 18px ".concat(xe(he))},children:(0,Q.jsx)(M.Bjz,{size:20})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h5",sx:{fontWeight:800,color:ae},children:"Saved Locations"}),(0,Q.jsxs)(u.Z,{variant:"caption",sx:{color:re,fontWeight:600},children:["Pick a saved customer for ",1===Cr?"Pickup":"Drop"]})]})]}),(0,Q.jsxs)(x.Z,{sx:{display:"flex",alignItems:"center",gap:.75,px:1.25,py:.5,borderRadius:999,bgcolor:"#fff",border:"1.5px solid ".concat(fe(he)),transition:"all 0.18s","&:focus-within":{borderColor:he,boxShadow:"0 0 0 3px ".concat(xe(he))}},children:[(0,Q.jsx)(G.Z,{style:{color:he,fontSize:14}}),(0,Q.jsx)(C.Z,{fullWidth:!0,placeholder:"Search saved customer",value:dr,onChange:function(e){return ur(e.target.value)},sx:{flex:1,"& .MuiOutlinedInput-input":{p:"6px 4px",fontSize:13,fontWeight:600},"& fieldset":{border:"none"}},endAdornment:dr&&(0,Q.jsx)(m.Z,{size:"small",onClick:function(){return ur("")},sx:{p:.25,color:he},children:(0,Q.jsx)(R.Z,{fontSize:"small"})}),autoComplete:"off"})]})]}),(0,Q.jsx)(w.Z,{sx:{p:2,bgcolor:le},children:0===fr.length?(0,Q.jsxs)(l.Z,{alignItems:"center",justifyContent:"center",spacing:1.5,sx:{minHeight:480,maxHeight:480},children:[(0,Q.jsx)(d.Z,{sx:{width:56,height:56,bgcolor:pe("#94a3b8"),color:ie},children:(0,Q.jsx)(M.Bjz,{size:26})}),(0,Q.jsx)(u.Z,{variant:"subtitle1",sx:{fontWeight:700,color:ae},children:"No saved locations"}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:re},children:dr?"Try a different keyword.":"Save a customer from the order form to reuse it later."})]}):(0,Q.jsx)(l.Z,{spacing:1,sx:{minHeight:480,maxHeight:480,overflow:"auto",pr:.5},children:fr.map((function(e,t){var n=Zr.customerid===e.customerid;return(0,Q.jsxs)(x.Z,{onClick:function(){n||(sr(!1),1===Cr?(Ir(1),la({latitude:e.latitude,longitude:e.longitude}),br(e),mi(e.contactno)):(Mr(1),xa({latitude:e.latitude,longitude:e.longitude}),yr(e),ji(e.contactno)))},sx:{display:"flex",alignItems:"flex-start",gap:1.25,p:1.5,borderRadius:2,border:"1px solid",borderColor:n?fe("#94a3b8"):se,bgcolor:n?le:"#fff",cursor:n?"not-allowed":"pointer",opacity:n?.6:1,transition:"all 0.15s","&:hover":n?{}:{borderColor:fe(he),bgcolor:ue(he),boxShadow:te}},children:[(0,Q.jsx)(d.Z,{sx:{width:36,height:36,bgcolor:pe(he),color:he,fontWeight:800},children:String(e.firstname||"?").charAt(0).toUpperCase()}),(0,Q.jsxs)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:.75,flexWrap:"wrap",useFlexGap:!0,children:[(0,Q.jsx)(u.Z,{sx:{fontWeight:800,color:ae,fontSize:13.5},noWrap:!0,children:e.firstname}),(0,Q.jsxs)(x.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.375,px:.75,py:.125,borderRadius:999,bgcolor:ue("#0ea5e9"),border:"1px solid ".concat(fe("#0ea5e9")),color:"#0ea5e9",fontSize:10.5,fontWeight:800},children:[(0,Q.jsx)(E.DNl,{size:9})," ",e.contactno]}),n&&(0,Q.jsx)(x.Z,{sx:{display:"inline-flex",alignItems:"center",px:.75,py:.125,borderRadius:999,bgcolor:ue("#94a3b8"),border:"1px solid ".concat(fe("#94a3b8")),color:re,fontSize:10.5,fontWeight:800},children:"Already used"})]}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:re,mt:.25},noWrap:!0,children:e.address})]})]},t)}))})}),(0,Q.jsx)(l.Z,{direction:"row",justifyContent:"flex-end",sx:{p:2,borderTop:"1px solid ".concat(ce)},children:(0,Q.jsx)(g.Z,{variant:"outlined",onClick:function(){return sr(!1)},sx:{borderRadius:999,px:2.5,borderColor:se,color:re,fontWeight:700,textTransform:"none","&:hover":{borderColor:re,bgcolor:le}},children:"Cancel"})})]}),(0,Q.jsxs)(F.Z,{open:en,onClose:function(){return tn(!1)},PaperProps:{sx:{borderRadius:3}},children:[(0,Q.jsx)(x.Z,{sx:{p:2.5,background:"linear-gradient(135deg, ".concat(ue("#ef4444")," 0%, ").concat(ue("#f59e0b")," 100%)"),borderBottom:"1px solid ".concat(se)},children:(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,Q.jsx)(d.Z,{sx:{bgcolor:"#ef4444",color:"#fff",width:40,height:40,boxShadow:"0 6px 18px ".concat(xe("#ef4444"))},children:(0,Q.jsx)(V.Z,{})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h5",sx:{fontWeight:800,color:ae},children:"Out of Service Area"}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:re,fontWeight:600},children:"This drop point is outside the supported radius"})]})]})}),(0,Q.jsx)(w.Z,{sx:{pt:2.5},children:(0,Q.jsx)(u.Z,{sx:{color:re,fontWeight:600},children:"Service is not available at this location. Try a different drop point within the coverage zone."})}),(0,Q.jsx)(l.Z,{direction:"row",justifyContent:"flex-end",sx:{p:2,borderTop:"1px solid ".concat(ce)},children:(0,Q.jsx)(g.Z,{variant:"contained",onClick:function(){return tn(!1)},sx:{borderRadius:999,px:3,bgcolor:"#ef4444",fontWeight:700,textTransform:"none",boxShadow:"0 6px 18px ".concat(xe("#ef4444")),"&:hover":{bgcolor:"#dc2626"}},children:"Close"})})]})]})]})}},37159:function(e,t,n){n.d(t,{j:function(){return i},v:function(){return r}});var o=n(74165),a=n(15861),r=function(){var e=(0,a.Z)((0,o.Z)().mark((function e(t,n){var a,r,i,s,c,l,d,u,p,x,f,h,g,m,Z,b;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=null===t||void 0===t?void 0:t.latitude,r=null===t||void 0===t?void 0:t.longitude,i=null===n||void 0===n?void 0:n.latitude,s=null===n||void 0===n?void 0:n.longitude,null!=a&&null!=r&&null!=i&&null!=s){e.next=6;break}throw new Error("Invalid coordinates");case 6:return c={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_API_URL:"https://mock-data-api-nextjs.vercel.app/",REACT_APP_AUTH0_CLIENT_ID:"",REACT_APP_AUTH0_DOMAIN:"",REACT_APP_AWS_APP_CLIENT_ID:"",REACT_APP_AWS_POOL_ID:"",REACT_APP_FIREBASE_API_KEY:"",REACT_APP_FIREBASE_APP_ID:"",REACT_APP_FIREBASE_AUTH_DOMAIN:"",REACT_APP_FIREBASE_MEASUREMENT_ID:"",REACT_APP_FIREBASE_MESSAGING_SENDER_ID:"",REACT_APP_FIREBASE_PROJECT_ID:"",REACT_APP_FIREBASE_STORAGE_BUCKET:"",REACT_APP_GOOGLE_MAPS_API_KEY:"AIzaSyCF4KatYCI3vqz1_H3kiHeyS3yCMfYToh8",REACT_APP_RIDER_ACCESS_ID:"AAAAILMpCEU:APA91bEavuOllBI6sFgYtxXAgNmAVwNA-MnCMHLGlR4_t7UqpLajAkdn3T0CZr_zaLBknLyim9ytFLMZgbeXmKqTad_PKCbqlYjHpaizVrLXtecxqyEy4UktIacK2UvHVUATHL-7VQQk",REACT_APP_STAFF_TOKEN:"",REACT_APP_URL:"https://jupiter.nearle.app/live/api/v1",REACT_APP_URL2:"https://jupiter.nearle.app/live/api/v2",REACT_APP_VERSION:"v2.1.0"}.REACT_APP_OSRM_URL||"https://router.project-osrm.org",e.prev=7,l="".concat(c,"/route/v1/driving/").concat(r,",").concat(a,";").concat(s,",").concat(i,"?overview=false"),e.next=11,fetch(l);case 11:if(!(d=e.sent).ok){e.next=20;break}return e.next=15,d.json();case 15:if(!((u=e.sent).routes&&u.routes.length>0)){e.next=20;break}return p=u.routes[0].distance,x=p/1e3,e.abrupt("return",Math.round(x));case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(7),console.warn("OSRM API failed, falling back to Haversine math:",e.t0);case 25:return 6371,h=(f=function(e){return e*Math.PI/180})(i-a),g=f(s-r),m=Math.sin(h/2)*Math.sin(h/2)+Math.cos(f(a))*Math.cos(f(i))*Math.sin(g/2)*Math.sin(g/2),Z=2*Math.atan2(Math.sqrt(m),Math.sqrt(1-m)),b=6371*Z,e.abrupt("return",Math.round(1.3*b));case 33:case"end":return e.stop()}}),e,null,[[7,22]])})));return function(t,n){return e.apply(this,arguments)}}(),i=function(e,t,n,o){return e<o?t:(e-o)*n+t}}}]);