"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[2912],{91547:function(e,t,n){n.d(t,{gA:function(){return P}});var a=n(93433),r=n(29439),o=n(74165),i=n(15861),s=n(1413),c=n(47313),l=n(76088),d=n(16783),u=n(85281),p=n(88706),x=n(44453),f=n(46417),h="https://nominatim.openstreetmap.org/search",m="https://nominatim.openstreetmap.org/reverse",g=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=[],n=function(e,n){e&&t.push({long_name:e,short_name:e,types:n})};return n(e.house_number,["street_number"]),n(e.road||e.pedestrian,["route"]),n(e.suburb||e.neighbourhood||e.quarter,["sublocality_level_1","sublocality"]),n(e.city_district||e.county,["administrative_area_level_3"]),n(e.city||e.town||e.village,["locality"]),n(e.state,["administrative_area_level_1"]),n(e.country,["country"]),n(e.postcode,["postal_code"]),t},b=function(e){var t;return{formatted_address:e.display_name,name:(null===(t=e.display_name)||void 0===t?void 0:t.split(",")[0])||"",geometry:{location:{lat:function(){return parseFloat(e.lat)},lng:function(){return parseFloat(e.lon)}}},address_components:g(e.address)}},Z=function(e,t){var n=new AbortController,a=setTimeout((function(){return n.abort()}),8e3);return fetch(e,(0,s.Z)((0,s.Z)({},t),{},{signal:n.signal})).finally((function(){return clearTimeout(a)}))},v=new x.Z,j="23456789CFGHJMPQRVWX",S=new RegExp("[".concat(j,"]{2,8}\\+[").concat(j,"]{2,3}"),"i");function k(e,t){return y.apply(this,arguments)}function y(){return(y=(0,i.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,a=new URLSearchParams({lat:String(t),lon:String(n),format:"json",addressdetails:"1"}),e.next=4,Z("".concat(m,"?").concat(a.toString()),{headers:{Accept:"application/json"}});case 4:if((r=e.sent).ok){e.next=7;break}return e.abrupt("return",null);case 7:return e.next=9,r.json();case 9:if((i=e.sent)&&!i.error){e.next=12;break}return e.abrupt("return",null);case 12:return e.abrupt("return",i);case 15:return e.prev=15,e.t0=e.catch(0),e.abrupt("return",null);case 18:case"end":return e.stop()}}),e,null,[[0,15]])})))).apply(this,arguments)}var _=function(){var e=(0,i.Z)((0,o.Z)().mark((function e(t,n){var a,r,i,c,l,d,u,p,x;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.match(S)){e.next=3;break}return e.abrupt("return",null);case 3:if(r=a[0].toUpperCase(),v.isValid(r)){e.next=6;break}return e.abrupt("return",null);case 6:if(e.prev=6,i=r,!v.isShort(r)){e.next=14;break}if(c=Number(null===n||void 0===n?void 0:n.lat),l=Number(null===n||void 0===n?void 0:n.lng),Number.isFinite(c)&&Number.isFinite(l)&&(0!==c||0!==l)){e.next=13;break}return e.abrupt("return",null);case 13:i=v.recoverNearest(r,c,l);case 14:if(v.isFull(i)){e.next=16;break}return e.abrupt("return",null);case 16:return d=v.decode(i),u=d.latitudeCenter,p=d.longitudeCenter,e.next=19,k(u,p);case 19:return x=e.sent,e.abrupt("return",(0,s.Z)((0,s.Z)({},x),{},{place_id:"pluscode-".concat(i),lat:String(u),lon:String(p),display_name:null!==x&&void 0!==x&&x.display_name?"".concat(x.display_name," (near ").concat(r,")"):"".concat(r," (Plus Code location)"),address:(null===x||void 0===x?void 0:x.address)||{}}));case 23:return e.prev=23,e.t0=e.catch(6),e.abrupt("return",null);case 26:case"end":return e.stop()}}),e,null,[[6,23]])})));return function(t,n){return e.apply(this,arguments)}}(),C=function(e,t){var n=new URLSearchParams({q:e,format:"json",addressdetails:"1",limit:"5"}),a=Number(null===t||void 0===t?void 0:t.lat),r=Number(null===t||void 0===t?void 0:t.lng);if(Number.isFinite(a)&&Number.isFinite(r)){var o=.5;n.set("viewbox","".concat(r-o,",").concat(a+o,",").concat(r+o,",").concat(a-o))}return n};function P(e){return w.apply(this,arguments)}function w(){return w=(0,i.Z)((0,o.Z)().mark((function e(t){var n,a,r,i,s,c,l=arguments;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=l.length>1&&void 0!==l[1]?l[1]:{},a=n.bias,t){e.next=3;break}return e.abrupt("return",null);case 3:return e.next=5,_(t,a);case 5:if(!(r=e.sent)){e.next=8;break}return e.abrupt("return",b(r));case 8:return e.prev=8,(i=C(t,a)).set("limit","1"),e.next=13,Z("".concat(h,"?").concat(i.toString()),{headers:{Accept:"application/json"}});case 13:if((s=e.sent).ok){e.next=16;break}return e.abrupt("return",null);case 16:return e.next=18,s.json();case 18:if(null!==(c=e.sent)&&void 0!==c&&c.length){e.next=21;break}return e.abrupt("return",null);case 21:return e.abrupt("return",b(c[0]));case 24:return e.prev=24,e.t0=e.catch(8),console.error("geocodeAddress error:",e.t0),e.abrupt("return",null);case 28:case"end":return e.stop()}}),e,null,[[8,24]])}))),w.apply(this,arguments)}t.ZP=function(e){var t=e.id,n=e.label,o=e.placeholder,i=void 0===o?"Search address":o,x=e.value,m=e.onChange,g=e.onPlaceSelected,v=e.bias,j=e.sx,S=e.textFieldSx,k=e.fullWidth,y=void 0===k||k,P=e.disabled,w=e.inputRef,A=e.TextFieldProps,E=void 0===A?{}:A,I=(0,c.useState)(x||""),R=(0,r.Z)(I,2),D=R[0],T=R[1],Y=(0,c.useState)([]),W=(0,r.Z)(Y,2),M=W[0],z=W[1],L=(0,c.useState)(!1),N=(0,r.Z)(L,2),F=N[0],H=N[1];(0,c.useEffect)((function(){void 0!==x&&x!==D&&T(x||"")}),[x]);var O=(0,c.useMemo)((function(){return(0,p.Z)((function(e,t,n){if(e){var o=C(e,t),i=Z("".concat(h,"?").concat(o.toString()),{headers:{Accept:"application/json"}}).then((function(e){return e.ok?e.json():[]})).catch((function(){return[]})),s=_(e,t).catch((function(){return null}));Promise.all([i,s]).then((function(e){var t=(0,r.Z)(e,2),o=t[0],i=t[1];n(i?[i].concat((0,a.Z)(o||[])):o||[])}))}else n([])}),500)}),[]);return(0,c.useEffect)((function(){var e=!0;return D?(H(!0),O(D,v,(function(t){e&&(H(!1),z(t))})),function(){e=!1}):(z([]),void H(!1))}),[D,null===v||void 0===v?void 0:v.lat,null===v||void 0===v?void 0:v.lng,O]),(0,f.jsx)(l.Z,{id:t,freeSolo:!0,fullWidth:y,disabled:P,sx:j,options:M,filterOptions:function(e){return e},getOptionLabel:function(e){return"string"===typeof e?e:e.display_name||""},isOptionEqualToValue:function(e,t){return e.place_id===(null===t||void 0===t?void 0:t.place_id)},noOptionsText:F?"Searching\u2026":D.trim().length>=3?"No match found \u2014 drop the business name/Plus Code, or try just City + Postcode":"Type an address to search",inputValue:D,onInputChange:function(e,t){T(t),null===m||void 0===m||m(t)},onChange:function(e,t){t&&"string"!==typeof t&&(T(t.display_name||""),null===g||void 0===g||g(b(t)))},renderInput:function(e){var t,a,r,o;return(0,f.jsx)(d.Z,(0,s.Z)((0,s.Z)((0,s.Z)({},e),E),{},{inputRef:w,label:n,placeholder:i,sx:S,autoComplete:"off",InputProps:(0,s.Z)((0,s.Z)((0,s.Z)({},e.InputProps),E.InputProps),{},{startAdornment:null!==(t=null===(a=E.InputProps)||void 0===a?void 0:a.startAdornment)&&void 0!==t?t:e.InputProps.startAdornment,endAdornment:(0,f.jsxs)(f.Fragment,{children:[F?(0,f.jsx)(u.Z,{color:"inherit",size:16}):null,null!==(r=null===(o=E.InputProps)||void 0===o?void 0:o.endAdornment)&&void 0!==r?r:e.InputProps.endAdornment]})})}))}})}},62912:function(e,t,n){n.r(t);var a=n(93433),r=n(74165),o=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),b=n(16429),Z=n(83929),v=n(44758),j=n(66212),S=n(70024),k=n(19536),y=n(85281),_=n(33604),C=n(49914),P=n(96467),w=n(11198),A=n(37159),E=n(36528),I=n(12058),R=n(88960),D=n(23195),T=n(58467),Y=n(22539),W=n(66277),M=n(56573),z=n(19860),L=n(91547),N=n(11577),F=(n(46926),n(97316),n(29736)),H=n(23208),O=n(45904),B=n(94469),U=n(10658),K=n.n(U),q=n(90842),G=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)",ae="0 18px 50px rgba(15, 23, 42, 0.18)",re="#0f172a",oe="#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,r=e.subtitle,o=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:re,fontSize:14,lineHeight:1.1},children:a}),r&&(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:oe,fontWeight:600},children:r})]})]}),o]})},be=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})},Ze=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)(""),Se=(0,i.Z)(je,2),ke=(Se[0],Se[1],(0,c.useState)("")),ye=(0,i.Z)(ke,2),_e=(ye[0],ye[1],(0,c.useState)("")),Ce=(0,i.Z)(_e,2),Pe=(Ce[0],Ce[1],(0,c.useState)("")),we=(0,i.Z)(Pe,2),Ae=(we[0],we[1],(0,c.useState)("")),Ee=(0,i.Z)(Ae,2),Ie=(Ee[0],Ee[1],(0,c.useState)("")),Re=(0,i.Z)(Ie,2),De=(Re[0],Re[1],(0,c.useState)("")),Te=(0,i.Z)(De,2),Ye=(Te[0],Te[1],(0,c.useState)("")),We=(0,i.Z)(Ye,2),Me=(We[0],We[1],(0,c.useState)("")),ze=(0,i.Z)(Me,2),Le=(ze[0],ze[1],(0,c.useState)("")),Ne=(0,i.Z)(Le,2),Fe=(Ne[0],Ne[1],(0,c.useState)("")),He=(0,i.Z)(Fe,2),Oe=(He[0],He[1],(0,c.useState)("")),Be=(0,i.Z)(Oe,2),Ue=(Be[0],Be[1],(0,c.useState)("")),Ke=(0,i.Z)(Ue,2),qe=(Ke[0],Ke[1],(0,c.useState)("")),Ge=(0,i.Z)(qe,2),Ve=(Ge[0],Ge[1],(0,c.useState)("")),Xe=(0,i.Z)(Ve,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),rt=(0,i.Z)(at,2),ot=rt[0],it=rt[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"),bt=(0,T.s0)(),Zt=(0,c.useState)({}),vt=(0,i.Z)(Zt,2),jt=(vt[0],vt[1],(0,c.useState)("")),St=(0,i.Z)(jt,2),kt=(St[0],St[1],(0,c.useState)(!1)),yt=(0,i.Z)(kt,2),_t=(yt[0],yt[1],(0,c.useState)(!1)),Ct=(0,i.Z)(_t,2),Pt=(Ct[0],Ct[1],(0,c.useState)(!1)),wt=(0,i.Z)(Pt,2),At=wt[0],Et=wt[1],It=(0,c.useState)(1),Rt=(0,i.Z)(It,2),Dt=(Rt[0],Rt[1],(0,c.useState)([])),Tt=(0,i.Z)(Dt,2),Yt=(Tt[0],Tt[1],(0,c.useState)([])),Wt=(0,i.Z)(Yt,2),Mt=Wt[0],zt=Wt[1],Lt=(0,c.useState)(""),Nt=(0,i.Z)(Lt,2),Ft=(Nt[0],Nt[1],(0,c.useState)(K()().format("MM-DD-YYYY"))),Ht=(0,i.Z)(Ft,2),Ot=Ht[0],Bt=Ht[1],Ut=(0,c.useState)(K()().add(1,"day").format("MM-DD-YYYY")),Kt=(0,i.Z)(Ut,2),qt=(Kt[0],Kt[1]),Gt=(0,c.useState)(),Vt=(0,i.Z)(Gt,2),Xt=Vt[0],Qt=Vt[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),rn=an[0],on=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,z.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),bn=(gn[0],gn[1],(0,c.useState)([])),Zn=(0,i.Z)(bn,2),vn=(Zn[0],Zn[1],(0,c.useState)([])),jn=(0,i.Z)(vn,2),Sn=(jn[0],jn[1],(0,c.useState)([])),kn=(0,i.Z)(Sn,2),yn=(kn[0],kn[1],(0,c.useState)(!1)),_n=(0,i.Z)(yn,2),Cn=(_n[0],_n[1]),Pn=(0,c.useState)(!1),wn=(0,i.Z)(Pn,2),An=wn[0],En=wn[1],In=(0,c.useState)(!1),Rn=(0,i.Z)(In,2),Dn=Rn[0],Tn=Rn[1],Yn=(0,c.useState)([]),Wn=(0,i.Z)(Yn,2),Mn=Wn[0],zn=(Wn[1],(0,c.useState)([])),Ln=(0,i.Z)(zn,2),Nn=(Ln[0],Ln[1],(0,c.useState)([])),Fn=(0,i.Z)(Nn,2),Hn=(Fn[0],Fn[1]),On=(0,c.useState)(""),Bn=(0,i.Z)(On,2),Un=Bn[0],Kn=Bn[1],qn=(0,c.useState)(""),Gn=(0,i.Z)(qn,2),Vn=(Gn[0],Gn[1],(0,c.useState)({})),Xn=(0,i.Z)(Vn,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)([]),ra=(0,i.Z)(aa,2),oa=(ra[0],ra[1],(0,c.useState)()),ia=(0,i.Z)(oa,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)("")),ba=(0,i.Z)(ga,2),Za=ba[0],va=ba[1],ja=(0,c.useState)([]),Sa=(0,i.Z)(ja,2),ka=(Sa[0],Sa[1],(0,c.useState)()),ya=(0,i.Z)(ka,2),_a=(ya[0],ya[1]),Ca=(0,c.useState)(""),Pa=(0,i.Z)(Ca,2),wa=(Pa[0],Pa[1],(0,c.useState)(!0)),Aa=(0,i.Z)(wa,2),Ea=(Aa[0],Aa[1],(0,c.useState)("B")),Ia=(0,i.Z)(Ea,2),Ra=(Ia[0],Ia[1],(0,c.useState)(!1)),Da=(0,i.Z)(Ra,2),Ta=(Da[0],Da[1],(0,c.useState)({latitude:0,longitude:0})),Ya=(0,i.Z)(Ta,2),Wa=Ya[0],Ma=Ya[1],za=(0,c.useState)({latitude:0,longitude:0}),La=(0,i.Z)(za,2),Na=La[0],Fa=La[1],Ha=(0,c.useState)(!1),Oa=(0,i.Z)(Ha,2),Ba=Oa[0],Ua=Oa[1],Ka=(0,c.useState)(0),qa=(0,i.Z)(Ka,2),Ga=qa[0],Va=qa[1],Xa=(0,c.useState)(0),Qa=(0,i.Z)(Xa,2),$a=Qa[0],Ja=Qa[1],er=(0,c.useState)(0),tr=(0,i.Z)(er,2),nr=tr[0],ar=tr[1],rr=(0,c.useState)(0),or=(0,i.Z)(rr,2),ir=or[0],sr=or[1],cr=(0,c.useState)(0),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],mr=(0,c.useState)("Select "),gr=(0,i.Z)(mr,2),br=gr[0],Zr=gr[1],vr=(0,c.useState)(),jr=(0,i.Z)(vr,2),Sr=jr[0],kr=jr[1],yr=(0,c.useState)(""),_r=(0,i.Z)(yr,2),Cr=(_r[0],_r[1]),Pr=localStorage.getItem("tenantid"),wr=(0,c.useState)(null),Ar=(0,i.Z)(wr,2),Er=Ar[0],Ir=Ar[1],Rr=(0,c.useState)(!1),Dr=(0,i.Z)(Rr,2),Tr=Dr[0],Yr=Dr[1],Wr=(0,c.useState)(""),Mr=(0,i.Z)(Wr,2),zr=Mr[0],Lr=Mr[1],Nr=(0,c.useState)([]),Fr=(0,i.Z)(Nr,2),Hr=Fr[0],Or=Fr[1],Br=(0,c.useState)({}),Ur=(0,i.Z)(Br,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),eo=Jr[0],to=Jr[1],no=(0,c.useState)(0),ao=(0,i.Z)(no,2),ro=ao[0],oo=ao[1],io=(0,c.useState)(0),so=(0,i.Z)(io,2),co=so[0],lo=so[1],uo=(0,c.useState)([]),po=(0,i.Z)(uo,2),xo=po[0],fo=po[1],ho=(0,c.useState)(),mo=(0,i.Z)(ho,2),go=mo[0],bo=mo[1],Zo=(0,c.useState)(),vo=(0,i.Z)(Zo,2),jo=vo[0],So=vo[1],ko=(0,c.useState)(),yo=(0,i.Z)(ko,2),_o=yo[0],Co=yo[1],Po=(0,c.useState)(0),wo=(0,i.Z)(Po,2),Ao=wo[0],Eo=wo[1],Io=(0,c.useState)(0),Ro=(0,i.Z)(Io,2),Do=Ro[0],To=Ro[1],Yo=(0,c.useState)(0),Wo=(0,i.Z)(Yo,2),Mo=Wo[0],zo=Wo[1],Lo=(0,c.useState)(0),No=(0,i.Z)(Lo,2),Fo=No[0],Ho=No[1],Oo=(0,c.useState)(),Bo=(0,i.Z)(Oo,2),Uo=Bo[0],Ko=Bo[1],qo=(0,c.useState)(),Go=(0,i.Z)(qo,2),Vo=Go[0],Xo=Go[1],Qo=(0,c.useState)(!1),$o=(0,i.Z)(Qo,2),Jo=$o[0],ei=$o[1],ti=(0,c.useState)(!1),ni=(0,i.Z)(ti,2),ai=ni[0],ri=ni[1],oi=(0,c.useState)(0),ii=(0,i.Z)(oi,2),si=ii[0],ci=ii[1];(0,c.useEffect)((function(){console.log(si)}),[si]);var li=function(e){Ir(e)},di=function(e){return{cursor:"pointer",backgroundColor:Er===e?un.palette.primary.main:"default",color:Er===e?"#fff":"","&:hover":{backgroundColor:Er===e?un.palette.primary.main:un.palette.primary.light,color:"#fff"}}},ui=function(){var e=(0,o.Z)((0,r.Z)().mark((function e(){var t;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantpricing/?tenantid=").concat(Pr));case 3:t=e.sent,console.log("pricingResponse",t.data.details),Ja(t.data.details.baseprice),ar(t.data.details.priceperkm),sr(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(){ui()}),[]),(0,c.useEffect)((function(){console.log("startPoint",Wa),console.log("endPoint",Na),0!=Wa.latitude&&0!=Wa.longitude&&0!=Na.latitude&&0!=Na.longitude&&pi(Wa,Na)}),[Wa,Na]);var pi=function(){var e=(0,o.Z)((0,r.Z)().mark((function e(t,n){var a,o,i;return(0,r.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),Va(a),o=(0,A.j)(a,$a,nr,ir),console.log("total charge:",o),ur(o),Ua(!0),a>_o&&(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(rn[0]){var e=[];rn.map((function(t){K()().diff(K()("".concat(K()(Ot).format("MM-DD-YYYY")," ").concat(K()(t).format("HH:mm:ss"))),"m")<=0&&e.push(t)})),e[0]&&Hn([{sno:1,address:"",customerid:"",deliverytime:K()(e[0])||"",deliverylocationid:"",clientname:"",contactno:"",latitude:"",longitude:""}])}}),[rn]),(0,c.useEffect)((function(){if(Jn){var e=Mt.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)(Mt))}),[Jn]);var xi=function(){var e=(0,o.Z)((0,r.Z)().mark((function e(){return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return En(!0),console.log("tid",Pr),e.next=4,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantinfo/?tenantid=").concat(Pr)).then((function(e){console.log("fetchtenantinfo",e),e.data.status&&(fa(e.data.details),_a(e.data.details.tenantid),mi(),kr(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(){xi()}),[]);var fi=function(){var e=(0,o.Z)((0,r.Z)().mark((function e(){return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,M.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?hr(e.data.details):hr([])})).catch((function(e){console.log(e),hr([])}));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){fi()}),[]);var hi=function(){var e=(0,o.Z)((0,r.Z)().mark((function e(){return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return En(!0),e.next=3,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocations/?applocationid=").concat(gt)).then((function(e){console.log("fetchTiming",e);var t=e.data.details[0],n=t.opentime,a=t.closetime,r=t.latitude,o=t.longitude,i=t.radius;if(e.data.status){bo(r),So(o),Co(i),Qt("".concat(K()().format("MM-DD-YYYY")," ").concat(n)),tn("".concat(K()().format("MM-DD-YYYY")," ").concat(a)),console.log("starttime","".concat(K()().format("MM-DD-YYYY")," ").concat(n)),console.log("endtime","".concat(K()().format("MM-DD-YYYY")," ").concat(a," "));for(var s=[],c="".concat(K()().format("MM-DD-YYYY")," ").concat(n);K()("".concat(K()().format("MM-DD-YYYY")," ").concat(a," ")).diff(c,"m")>=0;c=K()(c).add(30,"m"))s.push(c);console.log("setTimeslotarr",s),on(s)}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(){hi()}),[]);var mi=function(){var e=(0,o.Z)((0,r.Z)().mark((function e(){return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return En(!0),e.next=3,M.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&&mi()}),[Xt,en]);var gi=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,o.Z)((0,r.Z)().mark((function e(){var t,n;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},t={orders:{applocationid:xa.applolcationid,cancellled:"",categoryid:+xa.categoryid,configid:7,customerid:0==Ao&&+Kr.customerid||0,deliveryaddress:Xr.address||"",deliverycharge:+dr.toFixed(2)||0,deliverycity:Xr.city||"",deliverycontactno:Xr.contactno||"",deliverycustomer:Xr.firstname||"",deliveryid:0==Do&&+Xr.customerid||0,deliverylandmark:Xr.landmark||"",deliverylat:(Xr.latitude||0).toString(),deliverylocation:Xr.suburb||"",deliverylocationid:Xr.deliverylocationid||0,deliverylong:(Xr.longitude||0).toString(),deliverytime:"".concat(K()(Ot).format("YYYY-MM-DD")," ").concat(K()(Za.$d).format("HH:mm:ss")),deliverytype:0!==Kr.customerid||0!==Xr.customerid?"B":"C",delivered:"",itemcount:1,kms:Ga.toString()||0,locationid:+tt,moduleid:+xa.moduleid,orderamount:+dr.toFixed(2)||0,ordercharges:0,orderdate:K()().format("YYYY-MM-DD HH:mm:ss"),orderheaderid:0,orderid:"",ordernotes:fn,orderstatus:"created",ordervalue:+dr.toFixed(2)||0,partnerid:xa.partnerid,paymentstatus:1,paymenttype:42,pending:"",pickupaddress:Kr.address||"",pickupcity:Kr.city||"",pickupcontactno:Kr.contactno||"",pickupcustomer:Kr.firstname||"",pickuplandmark:Kr.landmark||"",pickuplat:(Kr.latitude||0).toString(),pickuplocation:Kr.suburb||"",pickuplocationid:Kr.deliverylocationid||0,pickuplong:(Kr.longitude||0).toString(),processing:"",ready:"",remarks:"",smsdelivery:si,subcategoryid:+Sr,taxamount:0,tenantid:xa.tenantid,tenantuserid:parseInt(localStorage.getItem("userid")),collectionamt:+ut||0,quantity:+ht||1},pickup:{address:Kr.address||"",applocationid:xa.applolcationid,city:Kr.city||"",configid:7,contactno:Kr.contactno||"",customertoken:"",customerid:0==Ao&&Kr.customerid||0,devicetype:"",deviceid:"",dialcode:"+91",doorno:Kr.doorno||"",email:Kr.email||"",firstname:Kr.firstname||"",landmark:Kr.landmark||"",latitude:(Kr.latitude||0).toString(),longitude:(Kr.longitude||0).toString(),locationid:Kr.deliverylocationid||0,postcode:Kr.postcode||"",primaryaddress:1,profileimage:"",state:Kr.state||"",suburb:Kr.suburb||"",tenantid:xa.tenantid},drop:{address:Xr.address||"",applocationid:xa.applolcationid,city:Xr.city||"",configid:7,contactno:Xr.contactno||"",customertoken:"",customerid:0==Do&&Xr.customerid||0,devicetype:"",deviceid:"",dialcode:"+91",doorno:Xr.doorno||"",email:Xr.email||"",firstname:Xr.firstname||"",landmark:Xr.landmark||"",latitude:(Xr.latitude||0).toString(),longitude:(Xr.longitude||0).toString(),locationid:Xr.deliverylocationid||0,postcode:Xr.postcode||"",primaryaddress:1,profileimage:"",state:Xr.state||"",suburb:Xr.suburb||"",tenantid:xa.tenantid}},console.log("createsubmitobj2",t),Kr.firstname){e.next=7;break}gi("Enter Pickup Contact Name ","warning",2e3),e.next=87;break;case 7:if(Kr.contactno){e.next=11;break}gi("Enter Pickup Contact Number ","warning",2e3),e.next=87;break;case 11:if(10==Kr.contactno.length){e.next=15;break}gi("Check Pickup Contact Number ","error",2e3),e.next=87;break;case 15:if(Kr.suburb){e.next=19;break}gi("Enter Pickup Location ","warning",2e3),e.next=87;break;case 19:if(Kr.city){e.next=23;break}gi("Enter Pickup City ","warning",2e3),e.next=87;break;case 23:if(Kr.postcode){e.next=27;break}gi("Enter Pickup Postcode ","warning",2e3),e.next=87;break;case 27:if(Kr.landmark){e.next=31;break}gi("Enter Pickup Landmark ","warning",2e3),e.next=87;break;case 31:if(Kr.latitude&&Kr.longitude){e.next=35;break}gi("Could not locate Pickup address on map, please recheck the address","error",3e3),e.next=87;break;case 35:if(Xr.firstname){e.next=39;break}gi("Enter Drop Contact Name ","warning",2e3),e.next=87;break;case 39:if(Xr.contactno){e.next=43;break}gi("Enter Drop Contact Number","warning",2e3),e.next=87;break;case 43:if(10===Xr.contactno.length){e.next=47;break}gi("Check Drop Contact Number ","error",2e3),e.next=87;break;case 47:if(Xr.suburb){e.next=51;break}gi("Enter Drop Suburb ","warning",2e3),e.next=87;break;case 51:if(Xr.city){e.next=55;break}gi("Enter Drop City ","warning",2e3),e.next=87;break;case 55:if(Xr.postcode){e.next=59;break}gi("Enter Drop postcode ","warning",2e3),e.next=87;break;case 59:if(Xr.landmark){e.next=63;break}gi("Enter Drop Landmark ","warning",2e3),e.next=87;break;case 63:if(Xr.latitude&&Xr.longitude){e.next=67;break}gi("Could not locate Drop address on map, please recheck the address","error",3e3),e.next=87;break;case 67:if(Za){e.next=71;break}gi("Choose deliverytime ","warning",2e3),e.next=87;break;case 71:if(kr){e.next=75;break}gi("Choose SubCategory ","warning",2e3),e.next=87;break;case 75:return e.prev=75,e.next=78,M.Z.post("".concat("https://jupiter.nearle.app/live/api/v2","/orders/createorder"),t);case 78:(n=e.sent).data.status?(console.log("createRes",n),(0,q.yv)("Order Created Successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:1e3}),sa&¬ifyadmin(sa),bt("/nearle/orders")):gi("Something went wrong, Cannot create order","warning"),En(!1),console.log(n),e.next=87;break;case 84:e.prev=84,e.t0=e.catch(75),console.log("createResErr",e.t0);case 87:case"end":return e.stop()}}),e,null,[[75,84]])})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){console.log("shiftarr"),console.log(Mn)}),[Mn]);var Zi=function(){var e=(0,o.Z)((0,r.Z)().mark((function e(){var t;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Cn(!0),e.prev=1,t=""==zr?"".concat("https://jupiter.nearle.app/live/api/v1","/customers/gettenantcustomers/?tenantid=").concat(Pr,"&pageno=1&pagesize=20"):"".concat("https://jupiter.nearle.app/live/api/v1","/customers/search/?tenantid=").concat(Pr,"&keyword=").concat(zr),e.next=5,M.Z.get(t).then((function(e){if(console.log("clientdetails",e.data.details),e.data.status&&e.data.details){zt(e.data.details||[]),Or(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 zt([]),Or([]),na([]);Cn(!1)})).catch((function(e){console.log(e),Cn(!1),gi("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"),Zi()}),[zr.length>3,""==zr]);var vi=function(e){U("".concat(e.name,", ").concat(e.formatted_address)),Ma({latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}),qr((0,s.Z)((0,s.Z)({},Kr),{},{address:"".concat(e.name," ").concat(e.formatted_address)}));var t={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(n){switch(n){case"street_number":t.street_number=e.long_name;break;case"route":t.route=e.long_name;break;case"locality":t.locality=e.long_name;break;case"sublocality_level_1":t.sublocality_level_1=e.long_name;break;case"administrative_area_level_3":t.administrative_area_level_3=e.long_name;break;case"administrative_area_level_1":t.administrative_area_level_1=e.long_name;break;case"country":t.country=e.long_name;break;case"postal_code":t.postal_code=e.long_name}}))})),qr((0,s.Z)((0,s.Z)({},Kr),{},{address:t.address,doorno:"".concat(t.street_number," ").concat(t.route),suburb:t.sublocality_level_1,city:t.locality,postcode:t.postal_code,latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}))},ji=function(e){ve("".concat(e.name,", ").concat(e.formatted_address)),Fa({latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}),Qr((0,s.Z)((0,s.Z)({},Xr),{},{address:"".concat(e.name," ").concat(e.formatted_address)}));var t={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(n){switch(n){case"street_number":t.street_number=e.long_name;break;case"route":t.route=e.long_name;break;case"locality":t.locality=e.long_name;break;case"sublocality_level_1":t.sublocality_level_1=e.long_name;break;case"administrative_area_level_3":t.administrative_area_level_3=e.long_name;break;case"administrative_area_level_1":t.administrative_area_level_1=e.long_name;break;case"country":t.country=e.long_name;break;case"postal_code":t.postal_code=e.long_name}}))})),Qr((0,s.Z)((0,s.Z)({},Xr),{},{address:t.address,doorno:"".concat(t.street_number," ").concat(t.route),suburb:t.sublocality_level_1,city:t.locality,postcode:t.postal_code,latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}))};(0,c.useEffect)((function(){if(0===Wa.latitude&&0===Wa.longitude){var e=n&&n.trim().length>=6&&n||Kr.suburb&&Kr.city&&[Kr.doorno,Kr.suburb,Kr.city,Kr.postcode].filter(Boolean).join(", ");if(e){var t=setTimeout((0,o.Z)((0,r.Z)().mark((function t(){var n;return(0,r.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,L.gA)(e,{bias:{lat:go,lng:jo}});case 2:(n=t.sent)&&vi(n);case 4:case"end":return t.stop()}}),t)}))),800);return function(){return clearTimeout(t)}}}}),[n,Kr.doorno,Kr.suburb,Kr.city,Kr.postcode,go,jo]),(0,c.useEffect)((function(){if(0===Na.latitude&&0===Na.longitude){var e=de&&de.trim().length>=6&&de||Xr.suburb&&Xr.city&&[Xr.doorno,Xr.suburb,Xr.city,Xr.postcode].filter(Boolean).join(", ");if(e){var t=setTimeout((0,o.Z)((0,r.Z)().mark((function t(){var n;return(0,r.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,L.gA)(e,{bias:{lat:go,lng:jo}});case 2:(n=t.sent)&&ji(n);case 4:case"end":return t.stop()}}),t)}))),800);return function(){return clearTimeout(t)}}}}),[de,Xr.doorno,Xr.suburb,Xr.city,Xr.postcode,go,jo]);var Si=function(){var e=(0,o.Z)((0,r.Z)().mark((function e(){var t;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantlocations/?tenantid=").concat(Pr));case 3:t=e.sent,console.log("gettenantlocations",t.data.details),t.data&&t.data.details?(fo(t.data.details),1==t.data.details.length&&(it(!0),nt(t.data.details[0].locationid))):fo([]),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),console.log("gettenantlocations",e.t0),fo([]);case 12:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}();return(0,c.useEffect)((function(){Si()}),[]),(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)(Y.tX2,{size:22})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h3",sx:{fontWeight:800,color:re,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:oe,fontWeight:600},children:"Fill pickup, drop, schedule & pricing details"})]})]})]}),1===xo.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)(Y.x$F,{size:14})," ",xo[0].locationname]}):(0,Q.jsx)(f.Z,{options:xo||[],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:Ze,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)(Y.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)(be,{children:[(0,Q.jsx)(ge,{color:"#0ea5e9",icon:(0,Q.jsx)(Y.$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)(Y.Bjz,{size:14}),onClick:function(){ot?(Yr(!0),to(1),qr({}),U(""),Lr("")):gi("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:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(R.Xws,{})})},variant:"outlined",label:"Contact Name",value:Kr.firstname,onChange:function(e){qr((0,s.Z)((0,s.Z)({},Kr),{},{firstname:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{error:Jo,disabled:!ot,fullWidth:!0,type:"number",InputProps:{inputProps:{maxLength:10},startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(E.DNl,{color:Jo&&"red"})})},variant:"outlined",label:"Contact Number",value:Kr.contactno,onChange:function(e){e.target.value.length<=10&&qr((0,s.Z)((0,s.Z)({},Kr),{},{contactno:e.target.value})),Uo==e.target.value?zo(0):zo(1),e.target.value.length<10?ei(!0):ei(!1)}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(l.Z,{spacing:1.25,sx:{mt:0},children:0==ro?(0,Q.jsx)("div",{children:(0,Q.jsx)(L.ZP,{label:"Address",disabled:!ot,id:"addressAuto1",fullWidth:!0,value:n,onChange:U,onPlaceSelected:vi,bias:{lat:go,lng:jo},TextFieldProps:{variant:"outlined",InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){U(""),qr((0,s.Z)((0,s.Z)({},Kr),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ua(!1),Ma({latitude:0,longitude:0})},size:"small",children:(0,Q.jsx)(w.Z,{})})}}})}):(0,Q.jsx)(h.Z,{InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){oo(0),qr((0,s.Z)((0,s.Z)({},Kr),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ua(!1),Ma({latitude:0,longitude:0})},children:(0,Q.jsx)(D.Z,{})})},variant:"outlined",placeholder:"Select",value:Kr.address,onChange:function(e){qr((0,s.Z)((0,s.Z)({},Kr),{},{address:e.target.value})),""==e.target.value&&(oo(0),Ua(!1),Ma({latitude:0,longitude:0}))}})})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(I.Lmk,{})})},variant:"outlined",label:"Door No / Street",value:Kr.doorno,onChange:function(e){qr((0,s.Z)((0,s.Z)({},Kr),{},{doorno:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(R.GUT,{})})},variant:"outlined",label:"Location",value:Kr.suburb,onChange:function(e){qr((0,s.Z)((0,s.Z)({},Kr),{},{suburb:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(Y.Ys1,{})})},variant:"outlined",label:"City",value:Kr.city,onChange:function(e){qr((0,s.Z)((0,s.Z)({},Kr),{},{city:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(W.kk8,{})})},variant:"outlined",label:"Postcode",value:Kr.postcode,onChange:function(e){qr((0,s.Z)((0,s.Z)({},Kr),{},{postcode:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(R.I2o,{})})},variant:"outlined",label:"Landmark",value:Kr.landmark,onChange:function(e){qr((0,s.Z)((0,s.Z)({},Kr),{},{landmark:e.target.value}))}})}),1==Mo&&(0,Q.jsx)(p.ZP,{item:!0,xs:12,sx:{display:"flex",justifyContent:"end"},children:(0,Q.jsx)(b.Z,{children:(0,Q.jsx)(Z.Z,{control:(0,Q.jsx)(v.Z,{checked:1===Ao,onChange:function(e){Eo(e.target.checked?1:0)}}),label:"Save For Later"})})})]})})})})]})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsxs)(be,{children:[(0,Q.jsx)(ge,{color:he,icon:(0,Q.jsx)(Y.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)(Y.Bjz,{size:14}),onClick:function(){ot?(Yr(!0),to(2),ve(""),Lr("")):gi("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(){ot?(Yr(!0),to(2),ve(""),Lr("")):gi("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:!ot,fullWidth:!0,variant:"outlined",label:"Contact Name",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(R.Xws,{})})},value:Xr.firstname,onChange:function(e){Qr((0,s.Z)((0,s.Z)({},Xr),{},{firstname:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,error:ai,fullWidth:!0,type:"number",variant:"outlined",label:"Contact Number",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(E.DNl,{color:ai&&"red"})})},value:Xr.contactno,onChange:function(e){e.target.value.length<=10&&Qr((0,s.Z)((0,s.Z)({},Xr),{},{contactno:e.target.value})),Vo==e.target.value?Ho(0):Ho(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==co?(0,Q.jsx)("div",{children:(0,Q.jsx)(L.ZP,{id:"addressAuto2",disabled:!ot,label:"Address",fullWidth:!0,value:de,onChange:ve,onPlaceSelected:ji,bias:{lat:go,lng:jo},TextFieldProps:{InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){ve(""),Qr((0,s.Z)((0,s.Z)({},Xr),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ua(!1),Fa({latitude:0,longitude:0})},size:"small",children:(0,Q.jsx)(w.Z,{})})}}})}):(0,Q.jsx)(h.Z,{disabled:!ot,InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){lo(0),Qr((0,s.Z)((0,s.Z)({},Xr),{},{firstname:"",contactno:"",doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ua(!1),Fa({latitude:0,longitude:0})},children:(0,Q.jsx)(D.Z,{})})},variant:"outlined",placeholder:"Select",value:Xr.address,onChange:function(e){Qr((0,s.Z)((0,s.Z)({},Xr),{},{address:e.target.value})),""==e.target.value&&(lo(0),Ua(!1),Fa({latitude:0,longitude:0}))}})})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,variant:"outlined",label:"Door No / Street",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(I.Lmk,{})})},value:Xr.doorno,onChange:function(e){Qr((0,s.Z)((0,s.Z)({},Xr),{},{doorno:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,variant:"outlined",label:"Location",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(R.GUT,{})})},value:Xr.suburb,onChange:function(e){Qr((0,s.Z)((0,s.Z)({},Xr),{},{suburb:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,variant:"outlined",label:"City",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(Y.Ys1,{})})},value:Xr.city,onChange:function(e){Qr((0,s.Z)((0,s.Z)({},Xr),{},{city:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,variant:"outlined",label:"Postcode",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(W.kk8,{})})},value:Xr.postcode,onChange:function(e){Qr((0,s.Z)((0,s.Z)({},Xr),{},{postcode:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,variant:"outlined",label:"Landmark",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(R.I2o,{})})},value:Xr.landmark,onChange:function(e){Qr((0,s.Z)((0,s.Z)({},Xr),{},{landmark:e.target.value}))}})}),1==Fo&&(0,Q.jsx)(p.ZP,{item:!0,xs:12,sx:{display:"flex",justifyContent:"end"},children:(0,Q.jsx)(b.Z,{children:(0,Q.jsx)(Z.Z,{control:(0,Q.jsx)(v.Z,{checked:1===Do,onChange:function(e){To(e.target.checked?1:0)}}),label:"Save For Later"})})})]})})]})})]})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsxs)(be,{sx:{mt:2,minHeight:390},children:[(0,Q.jsx)(ge,{color:"#f59e0b",icon:(0,Q.jsx)(Y.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:oe,mb:1},children:"Date"}),(0,Q.jsx)(H._,{dateAdapter:O.y,sx:{},children:(0,Q.jsx)(F.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),Bt(e),qt(e);var n=[];rn.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]?Hn([{sno:1,address:"",customerid:"",deliverytime:K()(n[0])||"",deliverylocationid:"",clientname:"",contactno:"",latitude:"",longitude:""}]):Hn([])}else Kn("choose Upcoming Date"),gi("choose Upcoming Date","warning"),Bt(NaN)},value:K()(Ot),sx:{width:"100%",mt:2},disablePast:!0})}),(0,Q.jsx)(u.Z,{variant:"subtitle2",sx:{fontWeight:700,color:oe,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:rn.map((function(e,t){if(K()().diff(K()("".concat(K()(Ot).format("MM-DD-YYYY")," ").concat(K()(e).format("HH:mm:ss"))),"m")<=0){var n=K()(Za).format("HH:mm")==K()(e).format("HH:mm");return(0,Q.jsxs)(x.Z,{onClick:function(){Ga>_o?Et(!0):Ba?va(e):gi("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)(Y.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)(be,{sx:{mt:2,minHeight:390},children:[(0,Q.jsx)(ge,{color:"#10b981",icon:(0,Q.jsx)(Y.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:[Ba&&(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(Ga," 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(dr.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:fr,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:""==br?xa.subcategoryname:br}))},onChange:function(e,t,n){t&&(console.log(t),Zr(t.subcategoryname),kr(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:di("1-10kgs"),onClick:function(){li("1-10kgs"),Cr("1-10kgs")}}),(0,Q.jsx)(j.Z,{variant:"contained",color:"default",label:"11-20kgs",sx:di("11-20kgs"),onClick:function(){li("11-20kgs"),Cr("11-20kgs")}}),(0,Q.jsx)(j.Z,{variant:"contained",color:"default",label:"21-30kgs",sx:di("21-30kgs"),onClick:function(){li("21-30kgs"),Cr("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===si,onChange:function(e){ci(e.target.checked?1:0)}})]})]})]})})]})})}),(0,Q.jsxs)(be,{sx:{mt:2},children:[(0,Q.jsx)(ge,{color:"#6366f1",icon:(0,Q.jsx)(Y.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)(be,{sx:{mt:2},children:[(0,Q.jsx)(ge,{color:oe,icon:(0,Q.jsx)(Y.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)(k.Z,{sx:{my:1.5}}),(0,Q.jsxs)(l.Z,{direction:"row",justifyContent:"flex-end",alignItems:"center",spacing:1.25,children:[!Ba&&(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:!Ba,variant:"contained",startIcon:Dn?null:(0,Q.jsx)(Y.ZSR,{size:16}),onClick:function(){En(!0),Tn(!0),bi(),setTimeout((function(){En(!1),Tn(!1)}),1e3)},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:Dn?(0,Q.jsx)(y.Z,{size:18,thickness:5,sx:{color:"#fff"}}):"Create Order"})]})]})]})]})}),(0,Q.jsxs)(B.Z,{open:Tr,onClose:function(){return Yr(!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)(Y.Bjz,{size:20})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h5",sx:{fontWeight:800,color:re},children:"Saved Locations"}),(0,Q.jsxs)(u.Z,{variant:"caption",sx:{color:oe,fontWeight:600},children:["Pick a saved customer for ",1===eo?"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:zr,onChange:function(e){return Lr(e.target.value)},sx:{flex:1,"& .MuiOutlinedInput-input":{p:"6px 4px",fontSize:13,fontWeight:600},"& fieldset":{border:"none"}},endAdornment:zr&&(0,Q.jsx)(g.Z,{size:"small",onClick:function(){return Lr("")},sx:{p:.25,color:he},children:(0,Q.jsx)(D.Z,{fontSize:"small"})}),autoComplete:"off"})]})]}),(0,Q.jsx)(P.Z,{sx:{p:2,bgcolor:le},children:0===Hr.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)(Y.Bjz,{size:26})}),(0,Q.jsx)(u.Z,{variant:"subtitle1",sx:{fontWeight:700,color:re},children:"No saved locations"}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:oe},children:zr?"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:Hr.map((function(e,t){var n=Kr.customerid===e.customerid;return(0,Q.jsxs)(x.Z,{onClick:function(){n||(Yr(!1),1===eo?(oo(1),Ma({latitude:e.latitude,longitude:e.longitude}),qr(e),Ko(e.contactno)):(lo(1),Fa({latitude:e.latitude,longitude:e.longitude}),Qr(e),Xo(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:re,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:oe,fontSize:10.5,fontWeight:800},children:"Already used"})]}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:oe,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 Yr(!1)},sx:{borderRadius:999,px:2.5,borderColor:se,color:oe,fontWeight:700,textTransform:"none","&:hover":{borderColor:oe,bgcolor:le}},children:"Cancel"})})]}),(0,Q.jsxs)(B.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)(V.Z,{})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h5",sx:{fontWeight:800,color:re},children:"Out of Service Area"}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:oe,fontWeight:600},children:"This drop point is outside the supported radius"})]})]})}),(0,Q.jsx)(P.Z,{sx:{pt:2.5},children:(0,Q.jsx)(u.Z,{sx:{color:oe,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 o}});var a=n(74165),r=n(15861),o=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(t,n){var r,o,i,s,c,l,d,u,p,x,f,h,m,g,b,Z;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=null===t||void 0===t?void 0:t.latitude,o=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!=r&&null!=o&&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(o,",").concat(r,";").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-r),m=f(s-o),g=Math.sin(h/2)*Math.sin(h/2)+Math.cos(f(r))*Math.cos(f(i))*Math.sin(m/2)*Math.sin(m/2),b=2*Math.atan2(Math.sqrt(g),Math.sqrt(1-g)),Z=6371*b,e.abrupt("return",Math.round(1.3*Z));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