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

1 line
52 KiB
JavaScript

"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[2912],{62912:function(e,t,n){n.r(t);var a=n(93433),o=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),m=n(69099),g=n(47131),Z=n(16429),b=n(83929),v=n(44758),j=n(66212),k=n(70024),S=n(19536),y=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),L=n(19860),z=n(91547),N=n(11577),H=(n(46926),n(97316),n(29736)),F=n(23208),B=n(45904),O=n(94469),U=n(10658),K=n.n(U),q=n(90842),V=n(40765),G=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)",ae="0 18px 50px rgba(15, 23, 42, 0.18)",oe="#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",me="#9255AB",ge=function(e){var t=e.color,n=e.icon,a=e.title,o=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:oe,fontSize:14,lineHeight:1.1},children:a}),o&&(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:re,fontWeight:600},children:o})]})]}),r]})},Ze=function(e){var t=e.children,n=e.sx,a=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%"},a),children:t})},be=function(e){return(0,Q.jsx)(X.Z,(0,s.Z)((0,s.Z)({},e),{},{sx:{mt:.75,borderRadius:2,boxShadow:ae,border:"1px solid",borderColor:"divider",overflow:"hidden"}}))};t.default=function(){var e=c.useState(""),t=(0,i.Z)(e,2),n=t[0],U=t[1],$=c.useState(""),ae=(0,i.Z)($,2),de=ae[0],ve=ae[1],je=(0,c.useState)(""),ke=(0,i.Z)(je,2),Se=(ke[0],ke[1],(0,c.useState)("")),ye=(0,i.Z)(Se,2),_e=(ye[0],ye[1],(0,c.useState)("")),Ce=(0,i.Z)(_e,2),we=(Ce[0],Ce[1],(0,c.useState)("")),Pe=(0,i.Z)(we,2),Ae=(Pe[0],Pe[1],(0,c.useState)("")),Ee=(0,i.Z)(Ae,2),Ie=(Ee[0],Ee[1],(0,c.useState)("")),De=(0,i.Z)(Ie,2),Re=(De[0],De[1],(0,c.useState)("")),Ye=(0,i.Z)(Re,2),Me=(Ye[0],Ye[1],(0,c.useState)("")),We=(0,i.Z)(Me,2),Te=(We[0],We[1],(0,c.useState)("")),Le=(0,i.Z)(Te,2),ze=(Le[0],Le[1],(0,c.useState)("")),Ne=(0,i.Z)(ze,2),He=(Ne[0],Ne[1],(0,c.useState)("")),Fe=(0,i.Z)(He,2),Be=(Fe[0],Fe[1],(0,c.useState)("")),Oe=(0,i.Z)(Be,2),Ue=(Oe[0],Oe[1],(0,c.useState)("")),Ke=(0,i.Z)(Ue,2),qe=(Ke[0],Ke[1],(0,c.useState)("")),Ve=(0,i.Z)(qe,2),Ge=(Ve[0],Ve[1],(0,c.useState)("")),Xe=(0,i.Z)(Ge,2),Qe=(Xe[0],Xe[1],(0,c.useState)("")),$e=(0,i.Z)(Qe,2),Je=($e[0],$e[1],(0,c.useState)(localStorage.getItem("locationid"))),et=(0,i.Z)(Je,2),tt=et[0],nt=et[1],at=(0,c.useState)(!1),ot=(0,i.Z)(at,2),rt=ot[0],it=ot[1],st=(0,c.useRef)(null),ct=(0,c.useRef)(null),lt=(0,c.useState)(0),dt=(0,i.Z)(lt,2),ut=dt[0],pt=dt[1],xt=(0,c.useState)(1),ft=(0,i.Z)(xt,2),ht=ft[0],mt=ft[1],gt=localStorage.getItem("applocationid"),Zt=(0,Y.s0)(),bt=(0,c.useState)({}),vt=(0,i.Z)(bt,2),jt=(vt[0],vt[1],(0,c.useState)("")),kt=(0,i.Z)(jt,2),St=(kt[0],kt[1],(0,c.useState)(!1)),yt=(0,i.Z)(St,2),_t=(yt[0],yt[1],(0,c.useState)(!1)),Ct=(0,i.Z)(_t,2),wt=(Ct[0],Ct[1],(0,c.useState)(!1)),Pt=(0,i.Z)(wt,2),At=Pt[0],Et=Pt[1],It=(0,c.useState)(1),Dt=(0,i.Z)(It,2),Rt=(Dt[0],Dt[1],(0,c.useState)([])),Yt=(0,i.Z)(Rt,2),Mt=(Yt[0],Yt[1],(0,c.useState)([])),Wt=(0,i.Z)(Mt,2),Tt=Wt[0],Lt=Wt[1],zt=(0,c.useState)(""),Nt=(0,i.Z)(zt,2),Ht=(Nt[0],Nt[1],(0,c.useState)(K()().format("MM-DD-YYYY"))),Ft=(0,i.Z)(Ht,2),Bt=Ft[0],Ot=Ft[1],Ut=(0,c.useState)(K()().add(1,"day").format("MM-DD-YYYY")),Kt=(0,i.Z)(Ut,2),qt=(Kt[0],Kt[1]),Vt=(0,c.useState)(),Gt=(0,i.Z)(Vt,2),Xt=Gt[0],Qt=Gt[1],$t=(0,c.useState)(),Jt=(0,i.Z)($t,2),en=Jt[0],tn=Jt[1],nn=(0,c.useState)([]),an=(0,i.Z)(nn,2),on=an[0],rn=an[1],sn=(0,c.useState)(""),cn=(0,i.Z)(sn,2),ln=(cn[0],cn[1],(0,c.useState)([])),dn=(0,i.Z)(ln,2),un=(dn[0],dn[1],(0,L.Z)()),pn=(0,c.useState)(""),xn=(0,i.Z)(pn,2),fn=xn[0],hn=xn[1],mn=(0,c.useState)([]),gn=(0,i.Z)(mn,2),Zn=(gn[0],gn[1],(0,c.useState)([])),bn=(0,i.Z)(Zn,2),vn=(bn[0],bn[1],(0,c.useState)([])),jn=(0,i.Z)(vn,2),kn=(jn[0],jn[1],(0,c.useState)([])),Sn=(0,i.Z)(kn,2),yn=(Sn[0],Sn[1],(0,c.useState)(!1)),_n=(0,i.Z)(yn,2),Cn=(_n[0],_n[1]),wn=(0,c.useState)(!1),Pn=(0,i.Z)(wn,2),An=Pn[0],En=Pn[1],In=(0,c.useState)(!1),Dn=(0,i.Z)(In,2),Rn=Dn[0],Yn=Dn[1],Mn=(0,c.useState)([]),Wn=(0,i.Z)(Mn,2),Tn=Wn[0],Ln=(Wn[1],(0,c.useState)([])),zn=(0,i.Z)(Ln,2),Nn=(zn[0],zn[1],(0,c.useState)([])),Hn=(0,i.Z)(Nn,2),Fn=(Hn[0],Hn[1]),Bn=(0,c.useState)(""),On=(0,i.Z)(Bn,2),Un=On[0],Kn=On[1],qn=(0,c.useState)(""),Vn=(0,i.Z)(qn,2),Gn=(Vn[0],Vn[1],(0,c.useState)({})),Xn=(0,i.Z)(Gn,2),Qn=(Xn[0],Xn[1],(0,c.useState)("")),$n=(0,i.Z)(Qn,2),Jn=$n[0],ea=($n[1],(0,c.useState)([])),ta=(0,i.Z)(ea,2),na=(ta[0],ta[1]),aa=(0,c.useState)([]),oa=(0,i.Z)(aa,2),ra=(oa[0],oa[1],(0,c.useState)()),ia=(0,i.Z)(ra,2),sa=ia[0],ca=ia[1],la=(0,c.useState)([]),da=(0,i.Z)(la,2),ua=(da[0],da[1],(0,c.useState)({})),pa=(0,i.Z)(ua,2),xa=pa[0],fa=pa[1],ha=(0,c.useState)({}),ma=(0,i.Z)(ha,2),ga=(ma[0],ma[1],(0,c.useState)("")),Za=(0,i.Z)(ga,2),ba=Za[0],va=Za[1],ja=(0,c.useState)([]),ka=(0,i.Z)(ja,2),Sa=(ka[0],ka[1],(0,c.useState)()),ya=(0,i.Z)(Sa,2),_a=(ya[0],ya[1]),Ca=(0,c.useState)(""),wa=(0,i.Z)(Ca,2),Pa=(wa[0],wa[1],(0,c.useState)(!0)),Aa=(0,i.Z)(Pa,2),Ea=(Aa[0],Aa[1],(0,c.useState)("B")),Ia=(0,i.Z)(Ea,2),Da=(Ia[0],Ia[1],(0,c.useState)(!1)),Ra=(0,i.Z)(Da,2),Ya=(Ra[0],Ra[1],(0,c.useState)({latitude:0,longitude:0})),Ma=(0,i.Z)(Ya,2),Wa=Ma[0],Ta=Ma[1],La=(0,c.useState)({latitude:0,longitude:0}),za=(0,i.Z)(La,2),Na=za[0],Ha=za[1],Fa=(0,c.useState)(!1),Ba=(0,i.Z)(Fa,2),Oa=Ba[0],Ua=Ba[1],Ka=(0,c.useState)(0),qa=(0,i.Z)(Ka,2),Va=qa[0],Ga=qa[1],Xa=(0,c.useState)(0),Qa=(0,i.Z)(Xa,2),$a=Qa[0],Ja=Qa[1],eo=(0,c.useState)(0),to=(0,i.Z)(eo,2),no=to[0],ao=to[1],oo=(0,c.useState)(0),ro=(0,i.Z)(oo,2),io=ro[0],so=ro[1],co=(0,c.useState)(0),lo=(0,i.Z)(co,2),uo=lo[0],po=lo[1],xo=(0,c.useState)([]),fo=(0,i.Z)(xo,2),ho=fo[0],mo=fo[1],go=(0,c.useState)("Select "),Zo=(0,i.Z)(go,2),bo=Zo[0],vo=Zo[1],jo=(0,c.useState)(),ko=(0,i.Z)(jo,2),So=ko[0],yo=ko[1],_o=(0,c.useState)(""),Co=(0,i.Z)(_o,2),wo=(Co[0],Co[1]),Po=localStorage.getItem("tenantid"),Ao=(0,c.useState)(null),Eo=(0,i.Z)(Ao,2),Io=Eo[0],Do=Eo[1],Ro=(0,c.useState)(!1),Yo=(0,i.Z)(Ro,2),Mo=Yo[0],Wo=Yo[1],To=(0,c.useState)(""),Lo=(0,i.Z)(To,2),zo=Lo[0],No=Lo[1],Ho=(0,c.useState)([]),Fo=(0,i.Z)(Ho,2),Bo=Fo[0],Oo=Fo[1],Uo=(0,c.useState)({}),Ko=(0,i.Z)(Uo,2),qo=Ko[0],Vo=Ko[1],Go=(0,c.useState)({}),Xo=(0,i.Z)(Go,2),Qo=Xo[0],$o=Xo[1],Jo=(0,c.useState)(0),er=(0,i.Z)(Jo,2),tr=er[0],nr=er[1],ar=(0,c.useState)(0),or=(0,i.Z)(ar,2),rr=or[0],ir=or[1],sr=(0,c.useState)(0),cr=(0,i.Z)(sr,2),lr=cr[0],dr=cr[1],ur=(0,c.useState)([]),pr=(0,i.Z)(ur,2),xr=pr[0],fr=pr[1],hr=(0,c.useState)(),mr=(0,i.Z)(hr,2),gr=mr[0],Zr=mr[1],br=(0,c.useState)(),vr=(0,i.Z)(br,2),jr=vr[0],kr=vr[1],Sr=(0,c.useState)(),yr=(0,i.Z)(Sr,2),_r=yr[0],Cr=yr[1],wr=Number.isFinite(Number(gr))&&Number.isFinite(Number(jr))&&!(0===Number(gr)&&0===Number(jr)),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)(0),Tr=(0,i.Z)(Wr,2),Lr=Tr[0],zr=Tr[1],Nr=(0,c.useState)(0),Hr=(0,i.Z)(Nr,2),Fr=Hr[0],Br=Hr[1],Or=(0,c.useState)(),Ur=(0,i.Z)(Or,2),Kr=Ur[0],qr=Ur[1],Vr=(0,c.useState)(),Gr=(0,i.Z)(Vr,2),Xr=Gr[0],Qr=Gr[1],$r=(0,c.useState)(!1),Jr=(0,i.Z)($r,2),ei=Jr[0],ti=Jr[1],ni=(0,c.useState)(!1),ai=(0,i.Z)(ni,2),oi=ai[0],ri=ai[1],ii=(0,c.useState)(0),si=(0,i.Z)(ii,2),ci=si[0],li=si[1];(0,c.useEffect)((function(){console.log(ci)}),[ci]);var di=function(e){Do(e)},ui=function(e){return{cursor:"pointer",backgroundColor:Io===e?un.palette.primary.main:"default",color:Io===e?"#fff":"","&:hover":{backgroundColor:Io===e?un.palette.primary.main:un.palette.primary.light,color:"#fff"}}},pi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){var t;return(0,o.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(Po));case 3:t=e.sent,console.log("pricingResponse",t.data.details),Ja(t.data.details.baseprice),ao(t.data.details.priceperkm),so(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(){pi()}),[]),(0,c.useEffect)((function(){console.log("startPoint",Wa),console.log("endPoint",Na),0!=Wa.latitude&&0!=Wa.longitude&&0!=Na.latitude&&0!=Na.longitude&&xi(Wa,Na)}),[Wa,Na]);var xi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(t,n){var a,r,i;return(0,o.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:a=e.sent,console.log("calculated distance in km:",a),Ga(a),r=(0,A.j)(a,$a,no,io),console.log("total charge:",r),po(r),Ua(!0),a>_r&&(Ua(!0),Et(!0)),40,i=Math.round(a/40*60),console.log("Distance: ".concat(a,", 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(on[0]){var e=[];on.map((function(t){K()().diff(K()("".concat(K()(Bt).format("MM-DD-YYYY")," ").concat(K()(t).format("HH:mm:ss"))),"m")<=0&&e.push(t)})),e[0]&&Fn([{sno:1,address:"",customerid:"",deliverytime:K()(e[0])||"",deliverylocationid:"",clientname:"",contactno:"",latitude:"",longitude:""}])}}),[on]),(0,c.useEffect)((function(){if(Jn){var e=Tt.filter((function(e){return e.address.toLowerCase().includes(Jn.toLowerCase())||e.firstname.toLowerCase().includes(Jn.toLowerCase())||e.contactno.toLowerCase().includes(Jn.toLowerCase())}));console.log(e),na((0,a.Z)(e))}else na((0,a.Z)(Tt))}),[Jn]);var fi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return En(!0),console.log("tid",Po),e.next=4,T.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantinfo/?tenantid=").concat(Po)).then((function(e){console.log("fetchtenantinfo",e),e.data.status&&(fa(e.data.details),_a(e.data.details.tenantid),gi(),yo(e.data.details.subcategoryid)),En(!1)})).catch((function(e){console.log(e),En(!1)}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){fi()}),[]);var hi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){return(0,o.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?mo(e.data.details):mo([])})).catch((function(e){console.log(e),mo([])}));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){hi()}),[]);var mi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return En(!0),e.next=3,T.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocations/?applocationid=").concat(gt)).then((function(e){var t,n;console.log("fetchTiming",e);var a=null===(t=e.data)||void 0===t||null===(n=t.details)||void 0===n?void 0:n[0];if(e.data.status&&a){var o=a.opentime,r=a.closetime,i=a.latitude,s=a.longitude,c=a.radius;Zr(i),kr(s),Cr(c),Qt("".concat(K()().format("MM-DD-YYYY")," ").concat(o)),tn("".concat(K()().format("MM-DD-YYYY")," ").concat(r)),console.log("starttime","".concat(K()().format("MM-DD-YYYY")," ").concat(o)),console.log("endtime","".concat(K()().format("MM-DD-YYYY")," ").concat(r," "));for(var l=[],d="".concat(K()().format("MM-DD-YYYY")," ").concat(o);K()("".concat(K()().format("MM-DD-YYYY")," ").concat(r," ")).diff(d,"m")>=0;d=K()(d).add(30,"m"))l.push(d);console.log("setTimeslotarr",l),rn(l)}En(!1)})).catch((function(e){console.log(e),En(!1)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){mi()}),[]);var gi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return En(!0),e.next=3,T.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocationconfig/?applocationid=").concat(gt)).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&&ca(t),En(!1)})).catch((function(e){console.log(e),En(!1)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){Xt&&en&&gi()}),[Xt,en]);var Zi=function(e,t,n){(0,q.yv)(e,{variant:t,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:n||2e3}),console.log(Un)};var bi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){var t,n,a,r,i,s,c,l,d,u,p;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=qo.latitude||Wa.latitude||0,n=qo.longitude||Wa.longitude||0,a=Qo.latitude||Na.latitude||0,r=Qo.longitude||Na.longitude||0,i={},i={orders:{applocationid:xa.applolcationid,cancellled:"",categoryid:+xa.categoryid,configid:7,customerid:0==Er&&+qo.customerid||0,deliveryaddress:Qo.address||"",deliverycharge:+uo.toFixed(2)||0,deliverycity:Qo.city||"",deliverycontactno:Qo.contactno||"",deliverycustomer:Qo.firstname||"",deliveryid:0==Yr&&+Qo.customerid||0,deliverylandmark:Qo.landmark||"",deliverylat:(a||0).toString(),deliverylocation:Qo.suburb||"",deliverylocationid:Qo.deliverylocationid||0,deliverylong:(r||0).toString(),deliverytime:"".concat(K()(Bt).format("YYYY-MM-DD")," ").concat(K()((null===ba||void 0===ba?void 0:ba.$d)||ba).format("HH:mm:ss")),deliverytype:0!==qo.customerid||0!==Qo.customerid?"B":"C",delivered:"",itemcount:1,kms:Va.toString()||0,locationid:+tt,moduleid:+xa.moduleid,orderamount:+uo.toFixed(2)||0,ordercharges:0,orderdate:K()().format("YYYY-MM-DD HH:mm:ss"),orderheaderid:0,orderid:"",ordernotes:fn,orderstatus:"created",ordervalue:+uo.toFixed(2)||0,partnerid:xa.partnerid,paymentstatus:1,paymenttype:42,pending:"",pickupaddress:qo.address||"",pickupcity:qo.city||"",pickupcontactno:qo.contactno||"",pickupcustomer:qo.firstname||"",pickuplandmark:qo.landmark||"",pickuplat:(t||0).toString(),pickuplocation:qo.suburb||"",pickuplocationid:qo.deliverylocationid||0,pickuplong:(n||0).toString(),processing:"",ready:"",remarks:"",smsdelivery:ci,subcategoryid:+So,taxamount:0,tenantid:xa.tenantid,tenantuserid:parseInt(localStorage.getItem("userid")),collectionamt:+ut||0,quantity:+ht||1},pickup:{address:qo.address||"",applocationid:xa.applolcationid,city:qo.city||"",configid:7,contactno:qo.contactno||"",customertoken:"",customerid:0==Er&&qo.customerid||0,devicetype:"",deviceid:"",dialcode:"+91",doorno:qo.doorno||"",email:qo.email||"",firstname:qo.firstname||"",landmark:qo.landmark||"",latitude:(t||0).toString(),longitude:(n||0).toString(),locationid:qo.deliverylocationid||0,postcode:qo.postcode||"",primaryaddress:1,profileimage:"",state:qo.state||"",suburb:qo.suburb||"",tenantid:xa.tenantid},drop:{address:Qo.address||"",applocationid:xa.applolcationid,city:Qo.city||"",configid:7,contactno:Qo.contactno||"",customertoken:"",customerid:0==Yr&&Qo.customerid||0,devicetype:"",deviceid:"",dialcode:"+91",doorno:Qo.doorno||"",email:Qo.email||"",firstname:Qo.firstname||"",landmark:Qo.landmark||"",latitude:(a||0).toString(),longitude:(r||0).toString(),locationid:Qo.deliverylocationid||0,postcode:Qo.postcode||"",primaryaddress:1,profileimage:"",state:Qo.state||"",suburb:Qo.suburb||"",tenantid:xa.tenantid}},console.log("createsubmitobj2",i),qo.firstname){e.next=11;break}Zi("Enter Pickup Contact Name ","warning",2e3),e.next=103;break;case 11:if(qo.contactno){e.next=15;break}Zi("Enter Pickup Contact Number ","warning",2e3),e.next=103;break;case 15:if(10==qo.contactno.length){e.next=19;break}Zi("Check Pickup Contact Number ","error",2e3),e.next=103;break;case 19:if(qo.suburb){e.next=23;break}Zi("Enter Pickup Location ","warning",2e3),e.next=103;break;case 23:if(qo.city){e.next=27;break}Zi("Enter Pickup City ","warning",2e3),e.next=103;break;case 27:if(qo.postcode){e.next=31;break}Zi("Enter Pickup Postcode ","warning",2e3),e.next=103;break;case 31:if(qo.landmark){e.next=35;break}Zi("Enter Pickup Landmark ","warning",2e3),e.next=103;break;case 35:if(Number(t)&&Number(n)){e.next=39;break}Zi("Could not locate Pickup address on map, please recheck the address","error",3e3),e.next=103;break;case 39:if(Qo.firstname){e.next=43;break}Zi("Enter Drop Contact Name ","warning",2e3),e.next=103;break;case 43:if(Qo.contactno){e.next=47;break}Zi("Enter Drop Contact Number","warning",2e3),e.next=103;break;case 47:if(10===Qo.contactno.length){e.next=51;break}Zi("Check Drop Contact Number ","error",2e3),e.next=103;break;case 51:if(Qo.suburb){e.next=55;break}Zi("Enter Drop Suburb ","warning",2e3),e.next=103;break;case 55:if(Qo.city){e.next=59;break}Zi("Enter Drop City ","warning",2e3),e.next=103;break;case 59:if(Qo.postcode){e.next=63;break}Zi("Enter Drop postcode ","warning",2e3),e.next=103;break;case 63:if(Qo.landmark){e.next=67;break}Zi("Enter Drop Landmark ","warning",2e3),e.next=103;break;case 67:if(Number(a)&&Number(r)){e.next=71;break}Zi("Could not locate Drop address on map, please recheck the address","error",3e3),e.next=103;break;case 71:if(ba){e.next=75;break}Zi("Choose deliverytime ","warning",2e3),e.next=103;break;case 75:if(So){e.next=79;break}Zi("Choose SubCategory ","warning",2e3),e.next=103;break;case 79:return e.prev=79,e.next=82,T.Z.post("".concat("https://jupiter.nearle.app/live/api/v2","/orders/createorder"),i);case 82:if(l=e.sent,!Boolean((null===l||void 0===l||null===(s=l.data)||void 0===s?void 0:s.status)||200===(null===l||void 0===l||null===(c=l.data)||void 0===c?void 0:c.code)||200===(null===l||void 0===l?void 0:l.status))){e.next=93;break}if(console.log("createRes",l),(0,q.yv)("Order Created Successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:1e3}),sa)try{ji(sa)}catch(o){console.warn("Notification send error (non-blocking):",o)}return En(!1),Zt("/nearle/orders"),e.abrupt("return");case 93:Zi((null===l||void 0===l||null===(d=l.data)||void 0===d?void 0:d.message)||"Something went wrong, Cannot create order","warning");case 94:En(!1),console.log(l),e.next=103;break;case 98:e.prev=98,e.t0=e.catch(79),console.log("createResErr",e.t0),Zi((null===e.t0||void 0===e.t0||null===(u=e.t0.response)||void 0===u||null===(p=u.data)||void 0===p?void 0:p.message)||(null===e.t0||void 0===e.t0?void 0:e.t0.message)||"Something went wrong, Cannot create order","error"),En(!1);case 103:case"end":return e.stop()}}),e,null,[[79,98]])})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){console.log("shiftarr"),console.log(Tn)}),[Tn]);var vi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){var t;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Cn(!0),e.prev=1,t=""==zo?"".concat("https://jupiter.nearle.app/live/api/v1","/customers/gettenantcustomers/?tenantid=").concat(Po,"&pageno=1&pagesize=20"):"".concat("https://jupiter.nearle.app/live/api/v1","/customers/search/?tenantid=").concat(Po,"&keyword=").concat(zo),e.next=5,T.Z.get(t).then((function(e){if(console.log("clientdetails",e.data.details),e.data.status&&e.data.details){Lt(e.data.details||[]),Oo(e.data.details||[]);var t=[];e.data.details.map((function(e){t.push((0,s.Z)({label:"".concat(e.firstname," | ").concat(e.contactno)},e))})),na(t)}else Lt([]),Oo([]),na([]);Cn(!1)})).catch((function(e){console.log(e),Cn(!1),Zi("server error","warning")}));case 5:e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.log(e.t0),Cn(!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"),vi()}),[zo.length>3,""==zo]);var ji=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(t){var n,a,r;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=t||sa)&&(!Array.isArray(n)||0!==n.length)){e.next=3;break}return e.abrupt("return");case 3:return e.prev=3,e.next=6,T.Z.post("".concat("https://jupiter.nearle.app/live/api/v1","/utils/sendnotifications"),{priority:"high",registration_ids:n,data:{accessid:"AAAAILMpCEU:APA91bEavuOllBI6sFgYtxXAgNmAVwNA-MnCMHLGlR4_t7UqpLajAkdn3T0CZr_zaLBknLyim9ytFLMZgbeXmKqTad_PKCbqlYjHpaizVrLXtecxqyEy4UktIacK2UvHVUATHL-7VQQk"},notification:{title:"Nearle Merchant",body:"An Order has been placed successfully, kindly process the same",sound:"ring"}});case 6:r=e.sent,console.log("sendnotifications res:",r),"Success"===(null===r||void 0===r||null===(a=r.data)||void 0===a?void 0:a.message)&&(0,q.yv)("Notification sent Successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:1e3}),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(3),console.warn("sendnotifications error (non-fatal):",e.t0);case 14:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(t){return e.apply(this,arguments)}}(),ki=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.overwriteFields,a=void 0===n||n,o=e.geometry.location.lat(),r=e.geometry.location.lng();if(Ta({latitude:o,longitude:r}),a){U("".concat(e.name,", ").concat(e.formatted_address)),Vo((0,s.Z)((0,s.Z)({},qo),{},{address:"".concat(e.name," ").concat(e.formatted_address)}));var i={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":i.street_number=e.long_name;break;case"route":i.route=e.long_name;break;case"locality":i.locality=e.long_name;break;case"sublocality_level_1":i.sublocality_level_1=e.long_name;break;case"administrative_area_level_3":i.administrative_area_level_3=e.long_name;break;case"administrative_area_level_1":i.administrative_area_level_1=e.long_name;break;case"country":i.country=e.long_name;break;case"postal_code":i.postal_code=e.long_name}}))})),Vo((0,s.Z)((0,s.Z)({},qo),{},{address:i.address,doorno:"".concat(i.street_number," ").concat(i.route),suburb:i.sublocality_level_1,city:i.locality,postcode:i.postal_code,latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}))}else Vo((function(e){return(0,s.Z)((0,s.Z)({},e),{},{latitude:o,longitude:r})}))},Si=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.overwriteFields,a=void 0===n||n,o=e.geometry.location.lat(),r=e.geometry.location.lng();if(Ha({latitude:o,longitude:r}),a){ve("".concat(e.name,", ").concat(e.formatted_address)),$o((0,s.Z)((0,s.Z)({},Qo),{},{address:"".concat(e.name," ").concat(e.formatted_address)}));var i={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":i.street_number=e.long_name;break;case"route":i.route=e.long_name;break;case"locality":i.locality=e.long_name;break;case"sublocality_level_1":i.sublocality_level_1=e.long_name;break;case"administrative_area_level_3":i.administrative_area_level_3=e.long_name;break;case"administrative_area_level_1":i.administrative_area_level_1=e.long_name;break;case"country":i.country=e.long_name;break;case"postal_code":i.postal_code=e.long_name}}))})),$o((0,s.Z)((0,s.Z)({},Qo),{},{address:i.address,doorno:"".concat(i.street_number," ").concat(i.route),suburb:i.sublocality_level_1,city:i.locality,postcode:i.postal_code,latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}))}else $o((function(e){return(0,s.Z)((0,s.Z)({},e),{},{latitude:o,longitude:r})}))};(0,c.useEffect)((function(){if(0===Wa.latitude&&0===Wa.longitude){var e=n&&n.trim().length>=6&&n||qo.suburb&&qo.city&&[qo.doorno,qo.suburb,qo.city,qo.postcode].filter(Boolean).join(", ");if(e){var t=setTimeout((0,r.Z)((0,o.Z)().mark((function t(){var n;return(0,o.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,z.gA)(e,{bias:{lat:gr,lng:jr}});case 2:(n=t.sent)&&ki(n,{overwriteFields:!1});case 4:case"end":return t.stop()}}),t)}))),800);return function(){return clearTimeout(t)}}}}),[n,qo.doorno,qo.suburb,qo.city,qo.postcode,gr,jr]),(0,c.useEffect)((function(){if(0===Na.latitude&&0===Na.longitude){var e=de&&de.trim().length>=6&&de||Qo.suburb&&Qo.city&&[Qo.doorno,Qo.suburb,Qo.city,Qo.postcode].filter(Boolean).join(", ");if(e){var t=setTimeout((0,r.Z)((0,o.Z)().mark((function t(){var n;return(0,o.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,z.gA)(e,{bias:{lat:gr,lng:jr}});case 2:(n=t.sent)&&Si(n,{overwriteFields:!1});case 4:case"end":return t.stop()}}),t)}))),800);return function(){return clearTimeout(t)}}}}),[de,Qo.doorno,Qo.suburb,Qo.city,Qo.postcode,gr,jr]);var yi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){var t;return(0,o.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(Po));case 3:t=e.sent,console.log("gettenantlocations",t.data.details),t.data&&t.data.details?(fr(t.data.details),1==t.data.details.length&&(it(!0),nt(t.data.details[0].locationid))):fr([]),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),console.log("gettenantlocations",e.t0),fr([]);case 12:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}();return(0,c.useEffect)((function(){yi()}),[]),(0,Q.jsxs)(Q.Fragment,{children:[An&&(0,Q.jsx)(N.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(me)," 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:oe,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===xr.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})," ",xr[0].locationname]}):(0,Q.jsx)(f.Z,{options:xr||[],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&&(nt(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)(ge,{color:"#0ea5e9",icon:(0,Q.jsx)(M.$0r,{size:16}),title:"Pickup Details",subtitle:"Where the order is picked up",action:(0,Q.jsx)(m.Z,{size:"small",variant:"outlined",startIcon:(0,Q.jsx)(M.Bjz,{size:14}),onClick:function(){rt?(Wo(!0),nr(1),Vo({}),U(""),No("")):Zi("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:st,disabled:!rt,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.Xws,{})})},variant:"outlined",label:"Contact Name",value:qo.firstname,onChange:function(e){Vo((0,s.Z)((0,s.Z)({},qo),{},{firstname:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{error:ei,disabled:!rt,fullWidth:!0,type:"number",InputProps:{inputProps:{maxLength:10},startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(E.DNl,{color:ei&&"red"})})},variant:"outlined",label:"Contact Number",value:qo.contactno,onChange:function(e){e.target.value.length<=10&&Vo((0,s.Z)((0,s.Z)({},qo),{},{contactno:e.target.value})),Kr==e.target.value?zr(0):zr(1),e.target.value.length<10?ti(!0):ti(!1)}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(l.Z,{spacing:1.25,sx:{mt:0},children:0==rr?(0,Q.jsx)("div",{children:(0,Q.jsx)(z.ZP,{label:"Address",disabled:!rt||!wr,placeholder:wr?"Search address":"Loading location\u2026",id:"addressAuto1",fullWidth:!0,value:n,onChange:U,onPlaceSelected:ki,bias:{lat:gr,lng:jr},TextFieldProps:{variant:"outlined",InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){U(""),Vo((0,s.Z)((0,s.Z)({},qo),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ua(!1),Ta({latitude:0,longitude:0})},size:"small",children:(0,Q.jsx)(P.Z,{})})}}})}):(0,Q.jsx)(h.Z,{InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){ir(0),Vo((0,s.Z)((0,s.Z)({},qo),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ua(!1),Ta({latitude:0,longitude:0})},children:(0,Q.jsx)(R.Z,{})})},variant:"outlined",placeholder:"Select",value:qo.address,onChange:function(e){Vo((0,s.Z)((0,s.Z)({},qo),{},{address:e.target.value})),""==e.target.value&&(ir(0),Ua(!1),Ta({latitude:0,longitude:0}))}})})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(I.Lmk,{})})},variant:"outlined",label:"Door No / Street",value:qo.doorno,onChange:function(e){Vo((0,s.Z)((0,s.Z)({},qo),{},{doorno:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.GUT,{})})},variant:"outlined",label:"Location",value:qo.suburb,onChange:function(e){Vo((0,s.Z)((0,s.Z)({},qo),{},{suburb:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(M.Ys1,{})})},variant:"outlined",label:"City",value:qo.city,onChange:function(e){Vo((0,s.Z)((0,s.Z)({},qo),{},{city:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(W.kk8,{})})},variant:"outlined",label:"Postcode",value:qo.postcode,onChange:function(e){Vo((0,s.Z)((0,s.Z)({},qo),{},{postcode:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.I2o,{})})},variant:"outlined",label:"Landmark",value:qo.landmark,onChange:function(e){Vo((0,s.Z)((0,s.Z)({},qo),{},{landmark:e.target.value}))}})}),1==Lr&&(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===Er,onChange:function(e){Ir(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)(ge,{color:he,icon:(0,Q.jsx)(M.ili,{size:16}),title:"Drop Details",subtitle:"Where the order is delivered",action:(0,Q.jsx)(m.Z,{size:"small",variant:"outlined",startIcon:(0,Q.jsx)(M.Bjz,{size:14}),onClick:function(){rt?(Wo(!0),nr(2),ve(""),No("")):Zi("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)(m.Z,{variant:"outlined",sx:{"&:hover":{bgcolor:un.palette.primary.main,color:"white"}},onClick:function(){rt?(Wo(!0),nr(2),ve(""),No("")):Zi("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:ct,disabled:!rt,fullWidth:!0,variant:"outlined",label:"Contact Name",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.Xws,{})})},value:Qo.firstname,onChange:function(e){$o((0,s.Z)((0,s.Z)({},Qo),{},{firstname:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,error:oi,fullWidth:!0,type:"number",variant:"outlined",label:"Contact Number",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(E.DNl,{color:oi&&"red"})})},value:Qo.contactno,onChange:function(e){e.target.value.length<=10&&$o((0,s.Z)((0,s.Z)({},Qo),{},{contactno:e.target.value})),Xr==e.target.value?Br(0):Br(1),e.target.value.length<10?ri(!0):ri(!1)}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(l.Z,{spacing:1.25,sx:{mt:0},children:0==lr?(0,Q.jsx)("div",{children:(0,Q.jsx)(z.ZP,{id:"addressAuto2",disabled:!rt||!wr,placeholder:wr?"Search address":"Loading location\u2026",label:"Address",fullWidth:!0,value:de,onChange:ve,onPlaceSelected:Si,bias:{lat:gr,lng:jr},TextFieldProps:{InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){ve(""),$o((0,s.Z)((0,s.Z)({},Qo),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ua(!1),Ha({latitude:0,longitude:0})},size:"small",children:(0,Q.jsx)(P.Z,{})})}}})}):(0,Q.jsx)(h.Z,{disabled:!rt,InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){dr(0),$o((0,s.Z)((0,s.Z)({},Qo),{},{firstname:"",contactno:"",doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ua(!1),Ha({latitude:0,longitude:0})},children:(0,Q.jsx)(R.Z,{})})},variant:"outlined",placeholder:"Select",value:Qo.address,onChange:function(e){$o((0,s.Z)((0,s.Z)({},Qo),{},{address:e.target.value})),""==e.target.value&&(dr(0),Ua(!1),Ha({latitude:0,longitude:0}))}})})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,variant:"outlined",label:"Door No / Street",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(I.Lmk,{})})},value:Qo.doorno,onChange:function(e){$o((0,s.Z)((0,s.Z)({},Qo),{},{doorno:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,variant:"outlined",label:"Location",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.GUT,{})})},value:Qo.suburb,onChange:function(e){$o((0,s.Z)((0,s.Z)({},Qo),{},{suburb:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,variant:"outlined",label:"City",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(M.Ys1,{})})},value:Qo.city,onChange:function(e){$o((0,s.Z)((0,s.Z)({},Qo),{},{city:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,variant:"outlined",label:"Postcode",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(W.kk8,{})})},value:Qo.postcode,onChange:function(e){$o((0,s.Z)((0,s.Z)({},Qo),{},{postcode:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,variant:"outlined",label:"Landmark",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.I2o,{})})},value:Qo.landmark,onChange:function(e){$o((0,s.Z)((0,s.Z)({},Qo),{},{landmark:e.target.value}))}})}),1==Fr&&(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===Yr,onChange:function(e){Mr(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)(ge,{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)(F._,{dateAdapter:B.y,sx:{},children:(0,Q.jsx)(H.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),va(""),t<=0){console.log("startdate",e),Ot(e),qt(e);var n=[];on.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]?Fn([{sno:1,address:"",customerid:"",deliverytime:K()(n[0])||"",deliverylocationid:"",clientname:"",contactno:"",latitude:"",longitude:""}]):Fn([])}else Kn("choose Upcoming Date"),Zi("choose Upcoming Date","warning"),Ot(NaN)},value:K()(Bt),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:on.map((function(e,t){if(K()().diff(K()("".concat(K()(Bt).format("MM-DD-YYYY")," ").concat(K()(e).format("HH:mm:ss"))),"m")<=0){var n=K()(ba).format("HH:mm")==K()(e).format("HH:mm");return(0,Q.jsxs)(x.Z,{onClick:function(){Va>_r?Et(!0):Oa?va(e):Zi("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)(ge,{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:[Oa&&(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(uo.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:ho,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:""==bo?xa.subcategoryname:bo}))},onChange:function(e,t,n){t&&(console.log(t),vo(t.subcategoryname),yo(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:ui("1-10kgs"),onClick:function(){di("1-10kgs"),wo("1-10kgs")}}),(0,Q.jsx)(j.Z,{variant:"contained",color:"default",label:"11-20kgs",sx:ui("11-20kgs"),onClick:function(){di("11-20kgs"),wo("11-20kgs")}}),(0,Q.jsx)(j.Z,{variant:"contained",color:"default",label:"21-30kgs",sx:ui("21-30kgs"),onClick:function(){di("21-30kgs"),wo("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)(k.Z,{checked:1===ci,onChange:function(e){li(e.target.checked?1:0)}})]})]})]})})]})})}),(0,Q.jsxs)(Ze,{sx:{mt:2},children:[(0,Q.jsx)(ge,{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:ut,fullWidth:!0,label:"Cash Collect",onChange:function(e){return pt(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 mt(e.target.value)},inputProps:{min:1}})})]})})]}),(0,Q.jsxs)(Ze,{sx:{mt:2},children:[(0,Q.jsx)(ge,{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:fn,onChange:function(e){return hn(e.target.value)}}),(0,Q.jsx)(S.Z,{sx:{my:1.5}}),(0,Q.jsxs)(l.Z,{direction:"row",justifyContent:"flex-end",alignItems:"center",spacing:1.25,children:[!Oa&&(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:ie,fontWeight:700},children:"Set pickup & drop to enable"}),(0,Q.jsx)(m.Z,{size:"medium",disabled:!Oa,variant:"contained",startIcon:Rn?null:(0,Q.jsx)(M.ZSR,{size:16}),onClick:(0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return En(!0),Yn(!0),e.prev=2,e.next=5,bi();case 5:return e.prev=5,En(!1),Yn(!1),e.finish(5);case 9:case"end":return e.stop()}}),e,null,[[2,,5,9]])}))),sx:{borderRadius:999,px:3,py:1,fontWeight:800,textTransform:"none",fontSize:13,background:"linear-gradient(135deg, ".concat(he," 0%, ").concat(me," 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:Rn?(0,Q.jsx)(y.Z,{size:18,thickness:5,sx:{color:"#fff"}}):"Create Order"})]})]})]})]})}),(0,Q.jsxs)(O.Z,{open:Mo,onClose:function(){return Wo(!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(me)," 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:oe},children:"Saved Locations"}),(0,Q.jsxs)(u.Z,{variant:"caption",sx:{color:re,fontWeight:600},children:["Pick a saved customer for ",1===tr?"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)(V.Z,{style:{color:he,fontSize:14}}),(0,Q.jsx)(C.Z,{fullWidth:!0,placeholder:"Search saved customer",value:zo,onChange:function(e){return No(e.target.value)},sx:{flex:1,"& .MuiOutlinedInput-input":{p:"6px 4px",fontSize:13,fontWeight:600},"& fieldset":{border:"none"}},endAdornment:zo&&(0,Q.jsx)(g.Z,{size:"small",onClick:function(){return No("")},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===Bo.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:oe},children:"No saved locations"}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:re},children:zo?"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:Bo.map((function(e,t){var n=qo.customerid===e.customerid;return(0,Q.jsxs)(x.Z,{onClick:function(){n||(Wo(!1),1===tr?(ir(1),Ta({latitude:e.latitude,longitude:e.longitude}),Vo(e),qr(e.contactno)):(dr(1),Ha({latitude:e.latitude,longitude:e.longitude}),$o(e),Qr(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:oe,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)(m.Z,{variant:"outlined",onClick:function(){return Wo(!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)(O.Z,{open:At,onClose:function(){return Et(!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)(G.Z,{})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h5",sx:{fontWeight:800,color:oe},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)(m.Z,{variant:"contained",onClick:function(){return Et(!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 a=n(74165),o=n(15861),r=function(){var e=(0,o.Z)((0,a.Z)().mark((function e(t,n){var o,r,i,s,c,l,d,u,p,x,f,h,m,g,Z,b;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=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!=o&&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_RIDER_ACCESS_ID:"AAAAILMpCEU:APA91bEavuOllBI6sFgYtxXAgNmAVwNA-MnCMHLGlR4_t7UqpLajAkdn3T0CZr_zaLBknLyim9ytFLMZgbeXmKqTad_PKCbqlYjHpaizVrLXtecxqyEy4UktIacK2UvHVUATHL-7VQQk",REACT_APP_URL:"https://jupiter.nearle.app/live/api/v1",REACT_APP_URL2:"https://jupiter.nearle.app/live/api/v2",REACT_APP_URL3:"https://jupiter.nearle.app/live/api/v3",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(o,";").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-o),m=f(s-r),g=Math.sin(h/2)*Math.sin(h/2)+Math.cos(f(o))*Math.cos(f(i))*Math.sin(m/2)*Math.sin(m/2),Z=2*Math.atan2(Math.sqrt(g),Math.sqrt(1-g)),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,a){return e<a?t:(e-a)*n+t}}}]);