Files
dailygrubs_console_build/build/static/js/8675.d470ce87.chunk.js

1 line
38 KiB
JavaScript

(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[8675],{7519:function(e,t,r){"use strict";r.d(t,{ZZ:function(){return f}});var n=r(1413),o=(r(47313),r(17592)),i=r(61689),a=r(69099),c=r(85281),l=r(42832),s=r(36287),d=r(53245),u=r(6986),p=r(46417),f=((0,o.ZP)("div")((function(e){var t=e.theme,r=e.x,n=e.y;return{color:t.palette.text.secondary,position:"fixed",pointerEvents:"none",left:12,top:24,transform:"translate(".concat(r,"px, ").concat(n,"px)"),opacity:.6}})),function(e){var t=e.data,r=e.filename,o=e.headers,l=e.label,s=e.style,f=e.btnLoading,h=e.onClick;return(0,p.jsx)(d.CSVLink,{data:t,filename:r,headers:o,children:(0,p.jsx)(i.Z,{title:"CSV Export",children:(0,p.jsx)(a.Z,{startIcon:!f&&(0,p.jsx)(u.Z,{}),variant:f?"outlined":"contained",sx:(0,n.Z)({},s),disabled:f,onClick:function(e){null===h||void 0===h||h(e)},children:f?(0,p.jsx)(c.Z,{size:20,thickness:5}):l||"Download"})})})});t.ZP=f;(0,o.ZP)(l.Z)((function(e){var t=e.theme;return{height:"400px","& .ant-empty-img-1":{fill:t.palette.mode===s.hY.DARK?t.palette.secondary[200]:t.palette.secondary[400]},"& .ant-empty-img-2":{fill:t.palette.secondary.light},"& .ant-empty-img-3":{fill:t.palette.mode===s.hY.DARK?t.palette.secondary.A200:t.palette.secondary[200]},"& .ant-empty-img-4":{fill:t.palette.mode===s.hY.DARK?t.palette.secondary.A300:t.palette.secondary.A100},"& .ant-empty-img-5":{fillOpacity:t.palette.mode===s.hY.DARK?"0.09":"0.95",fill:t.palette.mode===s.hY.DARK?t.palette.secondary.darker:t.palette.secondary.light}}}))},78457:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return Ee}});var n=r(74165),o=r(15861),i=r(29439),a=r(1413),c=r(47313),l=r(56573),s=r(25963),d=r(41962),u=r(19860),p=(r(90842),r(70501)),f=r(48119),h=r(57829),x=r(61113),m=r(42832),v=r(61689),g=r(9019),b=r(84488),y=r(76088),j=r(16783),Z=r(54882),w=r(47131),k=r(51629),S=r(66835),C=r(23477),D=r(24076),A=r(67478),P=r(57861),R=r(85281),M=r(19536),O=r(94469),W=r(96467),z=r(69099),I=r(22539),Y=r(10658),_=r.n(Y),L=r(25223),E=r(99004),F=r(59376),T=r(34605),B=r(78392),N=r(41156),U=r(98589),H=r(79254),K=r(71049),V=r(7519),q=r(11577),J=r(93433),$=r(74580),G=r(88153),Q=r(39062),X=r(73999),ee=r(98817),te=r(87248),re=r.n(te),ne=(r(63331),r(66212)),oe=r(16132),ie=r(5049),ae=r(46417),ce=r(91635);_().extend(ce);var le=new(re().Icon)({iconUrl:"https://cdn.rawgit.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]}),se=new(re().Icon)({iconUrl:"https://cdn.rawgit.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-red.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]}),de=function(e){var t=e.coordinates,r=e.additionalProps,n=e.order,o=e.setMapOpen;console.log("setMapOpen:",typeof o),console.log("coordinates",t),console.log(r.riderStart),console.log(r.riderEnd),console.log("order",n);var i=(0,c.useRef)(null);oe.u;(0,c.useEffect)((function(){if(i.current&&t.length>0){var e=a(t);i.current.fitBounds(e)}}),[t]);var a=function(e){var t=e.map((function(e){return e.lat})),r=e.map((function(e){return e.lng})),n=Math.min.apply(Math,(0,J.Z)(t)),o=Math.max.apply(Math,(0,J.Z)(t));return[[n,Math.min.apply(Math,(0,J.Z)(r))],[o,Math.max.apply(Math,(0,J.Z)(r))]]},l=t.length,s=Math.round(t.length/2),d=t[0],u=t[l-1],p=t[s],f=function(e,t){return(0,ae.jsxs)(m.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,ae.jsxs)(x.Z,{variant:"h5",color:"text.primary",sx:{fontSize:13},children:[e,":"]}),(0,ae.jsx)(ne.Z,{label:t||"N/A",color:"primary",variant:"combined",size:"small",sx:{fontWeight:1e3,fontSize:14}})]})};return t&&t.length>0&&(0,ae.jsxs)("div",{id:"map",style:{width:"100%",height:"90vh",margin:"0 auto",position:"relative"},children:[(0,ae.jsx)(ne.Z,{label:"close",color:"primary",variant:"combined",onClick:function(){return o(!1)},size:"large",sx:{position:"absolute",top:8,right:8,zIndex:1e3,"&:hover":{},cursor:"pointer"},icon:(0,ae.jsx)(ie.Z,{})}),(0,ae.jsxs)(m.Z,{direction:"row",gap:2,flexWrap:"wrap",alignItems:"center",justifyContent:"flex-start",sx:{position:"absolute",bottom:0,zIndex:1e3,left:0,right:0,px:{xs:1,custom500:2,custom700:2},py:{xs:1,custom500:2,custom900:4},backgroundColor:"rgba(255, 255, 255, 0.95)",maxWidth:"100%",width:"auto",boxShadow:function(e){return e.shadows[3]}},children:[f("Tenant",null===n||void 0===n?void 0:n.tenantname),f("Rider",null===n||void 0===n?void 0:n.ridername),f("Pickup",null===n||void 0===n?void 0:n.pickupcustomer),f("Drop",null===n||void 0===n?void 0:n.deliverycustomer),f("Kms",null===n||void 0===n?void 0:n.kms),f("Actual kms",null===n||void 0===n?void 0:n.actualkms),f("Rider kms",null===n||void 0===n?void 0:n.riderkms)]}),(0,ae.jsxs)($.h,{center:p,zoom:15,scrollWheelZoom:!1,style:{height:"100%",width:"100%"},ref:i,children:[(0,ae.jsx)(G.I,{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(0,ae.jsx)(Q.J,{position:d,icon:le,children:(0,ae.jsx)(X.u,{direction:"bottom",children:(0,ae.jsx)("span",{children:"Pickup Point: ".concat(_()(r.riderStart).utc().format("DD-MM-YYYY")," (").concat(_()(r.riderStart).utc().format("hh:mm A"),")")})})}),(0,ae.jsx)(Q.J,{position:u,icon:se,children:(0,ae.jsx)(X.u,{direction:"bottom",children:(0,ae.jsx)("span",{children:"Drop Point: ".concat(_()(r.riderEnd).utc().format("DD-MM-YYYY")," (").concat(_()(r.riderEnd).utc().format("hh:mm A"),")")})})}),(0,ae.jsx)(ee.a,{pathOptions:{color:"blue",weight:8,dashArray:"4 4"},positions:t})]})]})},ue=r(91635);_().extend(ue);var pe=999,fe=16,he="0 14px 40px rgba(15, 23, 42, 0.10)",xe="0 8px 24px rgba(15, 23, 42, 0.08)",me="0 18px 50px rgba(15, 23, 42, 0.18)",ve="#0f172a",ge="#64748b",be="#94a3b8",ye="#e2e8f0",je="#f1f5f9",Ze="#f8fafc",we=function(e,t){return"".concat(e).concat(t)},ke=function(e){return we(e,"08")},Se=function(e){return we(e,"18")},Ce=function(e){return we(e,"26")},De=function(e){return we(e,"55")},Ae="#662582",Pe="#9255AB",Re={created:{label:"Created",color:"#0ea5e9",icon:I.ili},pending:{label:"Pending",color:"#f59e0b",icon:I.Ley},accepted:{label:"Accepted",color:"#6366f1",icon:I.Z5O},arrived:{label:"Arrived",color:"#06b6d4",icon:I.ZSR},picked:{label:"Picked",color:"#8b5cf6",icon:I.ili},active:{label:"Active",color:"#14b8a6",icon:I.ili},delivered:{label:"Delivered",color:"#10b981",icon:I.ZSR},skipped:{label:"Skipped",color:"#f97316",icon:I.B4e},cancelled:{label:"Cancelled",color:"#ef4444",icon:I.B4e}},Me=[{id:0,status:"All",statusLow:"All",color:Ae,icon:I.YgO},{id:1,status:"Pending",statusLow:"pending",color:"#f59e0b",icon:I.Ley},{id:2,status:"Accepted",statusLow:"accepted",color:"#6366f1",icon:I.Z5O},{id:3,status:"Arrived",statusLow:"arrived",color:"#06b6d4",icon:I.ZSR},{id:4,status:"Picked",statusLow:"picked",color:"#8b5cf6",icon:I.ili},{id:5,status:"Active",statusLow:"active",color:"#14b8a6",icon:I.ili},{id:6,status:"Delivered",statusLow:"delivered",color:"#10b981",icon:I.ZSR},{id:7,status:"Skipped",statusLow:"skipped",color:"#f97316",icon:I.B4e},{id:8,status:"Cancelled",statusLow:"cancelled",color:"#ef4444",icon:I.B4e}],Oe=function(e){return(0,ae.jsx)(p.Z,(0,a.Z)((0,a.Z)({},e),{},{sx:{mt:.75,borderRadius:2,boxShadow:me,border:"1px solid",borderColor:"divider",overflow:"hidden"}}))},We=function(e){var t=e.color,r=e.selected,n=e.size,o=void 0===n?24:n,i=e.children;return(0,ae.jsx)(f.Z,{sx:{width:o,height:o,bgcolor:r?t:Se(t),color:r?"#fff":t,transition:"background-color 0.15s, color 0.15s"},children:i})},ze=function(e){return{"& .MuiOutlinedInput-root":{borderRadius:pe+"px",bgcolor:ke(e),fontWeight:600,"& fieldset":{borderColor:De(e),borderWidth:1.5},"&:hover fieldset":{borderColor:e},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(Ce(e))},"&.Mui-focused fieldset":{borderColor:e,borderWidth:2}}}},Ie=function(e){var t=e.status,r=Re[String(t||"").toLowerCase()]||{label:t||"\u2014",color:be,icon:I.Y8K},n=r.icon;return(0,ae.jsxs)(h.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1,py:.375,borderRadius:999,bgcolor:ke(r.color),border:"1px solid ".concat(De(r.color)),color:r.color,fontSize:11,fontWeight:800,whiteSpace:"nowrap",minWidth:80,justifyContent:"center"},children:[(0,ae.jsx)(n,{size:12})," ",r.label]})},Ye=function(e){var t=e.value,r=e.color,n=e.icon,o=e.isMoney,i=void 0!==o&&o,a=Number(t),c=i?Le(a):Number.isFinite(a)?a:t||0;return!Number.isFinite(a)||0===a?(0,ae.jsx)(x.Z,{variant:"caption",sx:{color:be,fontWeight:700},children:c}):(0,ae.jsxs)(h.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:.875,py:.25,borderRadius:999,bgcolor:ke(r),border:"1px solid ".concat(De(r)),color:r,fontSize:12,fontWeight:800,whiteSpace:"nowrap"},children:[n,c]})},_e=function(e){var t=e.value,r=e.color;return t?(0,ae.jsxs)(m.Z,{direction:"row",alignItems:"center",spacing:.5,children:[(0,ae.jsx)(h.Z,{sx:{width:6,height:6,borderRadius:"50%",bgcolor:r,boxShadow:"0 0 0 3px ".concat(Ce(r)),flexShrink:0}}),(0,ae.jsxs)(m.Z,{children:[(0,ae.jsx)(x.Z,{sx:{fontSize:11,fontWeight:700,color:ve},noWrap:!0,children:_()(t).format("DD/MM/YYYY")}),(0,ae.jsx)(x.Z,{sx:{fontSize:11,fontWeight:700,color:ve},noWrap:!0,children:_()(t).format("hh:mm A")})]})]}):(0,ae.jsx)(x.Z,{variant:"caption",sx:{color:be,fontWeight:700},children:"\u2014"})};function Le(e){return new Intl.NumberFormat("en-IN",{style:"currency",currency:"INR",minimumFractionDigits:2}).format(e||0)}function Ee(){(0,u.Z)();var e,t,r=localStorage.getItem("tenantid"),Y=(0,c.useRef)(null),J=(0,c.useRef)(),$=(0,c.useRef)(),G=(0,c.useState)(_()().format("YYYY-MM-DD")),Q=(0,i.Z)(G,2),X=Q[0],ee=Q[1],te=(0,c.useState)(_()().format("YYYY-MM-DD")),re=(0,i.Z)(te,2),ne=re[0],oe=re[1],ie=(0,c.useState)(!1),ce=(0,i.Z)(ie,2),le=ce[0],se=ce[1],ue=(0,c.useState)("Today"),pe=(0,i.Z)(ue,2),me=pe[0],we=pe[1],Ee=(0,c.useState)(0),Fe=(0,i.Z)(Ee,2),Te=Fe[0],Be=Fe[1],Ne=(0,c.useState)(0),Ue=(0,i.Z)(Ne,2),He=Ue[0],Ke=Ue[1],Ve=(0,c.useState)(""),qe=(0,i.Z)(Ve,2),Je=qe[0],$e=qe[1],Ge=(0,c.useState)([]),Qe=(0,i.Z)(Ge,2),Xe=Qe[0],et=(Qe[1],(0,c.useState)()),tt=(0,i.Z)(et,2),rt=tt[0],nt=(tt[1],(0,c.useState)()),ot=(0,i.Z)(nt,2),it=ot[0],at=(ot[1],(0,c.useState)(!1)),ct=(0,i.Z)(at,2),lt=ct[0],st=ct[1],dt=(0,c.useState)({}),ut=(0,i.Z)(dt,2),pt=ut[0],ft=(ut[1],(0,c.useState)("All")),ht=(0,i.Z)(ft,2),xt=ht[0],mt=ht[1],vt=(0,c.useState)(0),gt=(0,i.Z)(vt,2),bt=gt[0],yt=gt[1],jt=(0,c.useState)(Me[0]),Zt=(0,i.Z)(jt,2),wt=Zt[0],kt=Zt[1],St=(0,c.useState)([]),Ct=(0,i.Z)(St,2),Dt=Ct[0],At=Ct[1],Pt=(0,c.useState)(0),Rt=(0,i.Z)(Pt,2),Mt=Rt[0],Ot=Rt[1],Wt=(0,c.useState)("All Locations"),zt=(0,i.Z)(Wt,2),It=zt[0],Yt=zt[1],_t=(0,c.useState)(null),Lt=(0,i.Z)(_t,2),Et=Lt[0],Ft=Lt[1],Tt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,r=(0,c.useState)(e),n=(0,i.Z)(r,2),o=n[0],a=n[1];return(0,c.useEffect)((function(){var r=setTimeout((function(){a(e)}),t);return function(){return clearTimeout(r)}}),[e,t]),o}(Je,500),Bt=function(){var e=(0,o.Z)((0,n.Z)().mark((function e(t){var r;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,l.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantlocations/?tenantid=").concat(t));case 3:r=e.sent,At(r.data.details||[]),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.log("gettenantlocations",e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){Bt(r)}),[]);(0,c.useEffect)((function(){var e=function(e){"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),Y.current&&Y.current.focus()),"Escape"===e.key&&document.activeElement===Y.current&&Y.current.blur()};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}}),[]);var Nt=(0,s.N)({queryKey:[X,ne,xt,Mt,Tt],queryFn:K.$w,getNextPageParam:function(e){return e.nextPage}}),Ut=Nt.data,Ht=Nt.isError,Kt=Nt.error,Vt=Nt.fetchNextPage,qt=Nt.isLoading,Jt=Nt.hasNextPage,$t=Nt.isFetchingNextPage,Gt=(null===Ut||void 0===Ut?void 0:Ut.pages.flatMap((function(e){return e.details})))||[];(0,c.useEffect)((function(){if(Jt){var e=new IntersectionObserver((function(e){e[0].isIntersecting&&Vt()}),{root:document.querySelector(".MuiTableContainer-root"),rootMargin:"0px",threshold:1});return J.current&&e.observe(J.current),function(){J.current&&e.unobserve(J.current)}}}),[Jt,Vt]);var Qt=(0,d.a)({queryKey:["deliverycount",X,ne,xt,Mt],queryFn:K.Vf}).data;if((0,c.useEffect)((function(){var e,t={All:null===Qt||void 0===Qt?void 0:Qt.total,pending:null===Qt||void 0===Qt?void 0:Qt.pending,accepted:null===Qt||void 0===Qt?void 0:Qt.accepted,arrived:null===Qt||void 0===Qt?void 0:Qt.arrived,picked:null===Qt||void 0===Qt?void 0:Qt.picked,active:null===Qt||void 0===Qt?void 0:Qt.active,delivered:null===Qt||void 0===Qt?void 0:Qt.delivered,cancelled:null===Qt||void 0===Qt?void 0:Qt.cancelled};yt(null!==(e=t[xt])&&void 0!==e?e:0)}),[xt,Qt]),(0,c.useEffect)((function(){var e=0,t=0;Gt&&Gt.forEach((function(r){e+=r.deliverycharges,t+=r.deliveryamt})),Be(e),Ke(t)}),[Gt]),Ht)return"An error has occurred:(isErrorOrderDetails) "+Kt.message;var Xt=Gt.map((function(e){return{tenantname:e.tenantname,tenantcity:e.tenantcity,tenantcontactno:e.tenantcontactno,rider:e.rider,orderid:e.orderid,orderdate:e.orderdate,deliverydate:e.deliverydate,orderstatus:e.orderstatus,deliverystatus:e.deliverystatus,ordernotes:e.ordernotes,kms:e.kms,actualkms:e.actualkms,assigntime:e.assigntime,starttime:e.starttime,arrivaltime:e.arrivaltime,pickuptime:e.pickuptime,deliverytime:e.deliverytime,canceltime:e.canceltime,deliverycharge:e.deliverycharge,deliveryamt:e.deliveryamt,pickupcustomer:e.pickupcustomer,pickupcontactno:e.pickupcontactno,pickupaddress:e.pickupaddress,pickupsuburb:e.pickupsuburb,pickupcity:e.pickupcity,pickuplat:e.pickuplat,pickuplong:e.pickuplong,deliverycustomer:e.deliverycustomer,deliverycontactno:e.deliverycontactno,deliveryaddress:e.deliveryaddress,deliverysuburb:e.deliverysuburb,deliverylat:e.deliverylat,deliverylong:e.deliverylong,locationname:e.locationname,locationsuburb:e.locationsuburb,locationcity:e.locationcity,locationcontactno:e.locationcontactno}})),er=[{key:"total",label:"".concat("All"===xt?"Total":xt," Orders"),color:Ae,icon:I.YgO,value:bt},{key:"pending",label:"Pending",color:"#f59e0b",icon:I.Ley,value:null!==(e=null===Qt||void 0===Qt?void 0:Qt.pending)&&void 0!==e?e:0},{key:"delivered",label:"Delivered",color:"#10b981",icon:I.ZSR,value:null!==(t=null===Qt||void 0===Qt?void 0:Qt.delivered)&&void 0!==t?t:0},{key:"charges",label:"Total Charges",color:"#6366f1",icon:I.Rtn,value:Te,isMoney:!0},{key:"amount",label:"Total Amount",color:"#10b981",icon:I.vCl,value:He,isMoney:!0}];return(0,ae.jsxs)(ae.Fragment,{children:[qt&&(0,ae.jsx)(q.Z,{}),(0,ae.jsx)(p.Z,{elevation:0,sx:{mb:{xs:1.5,md:2},p:{xs:1.5,sm:2,md:2.5},borderRadius:fe/8,border:"1px solid",borderColor:ye,background:"linear-gradient(135deg, ".concat(ke(Ae)," 0%, ").concat(ke(Pe)," 100%)"),boxShadow:xe},children:(0,ae.jsxs)(m.Z,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",spacing:{xs:1.5,sm:2},children:[(0,ae.jsxs)(m.Z,{direction:"row",alignItems:"center",spacing:{xs:1.25,sm:1.75},children:[(0,ae.jsx)(f.Z,{sx:{width:{xs:40,sm:48},height:{xs:40,sm:48},bgcolor:Ae,color:"#fff",boxShadow:"0 6px 18px ".concat(Ce(Ae))},children:(0,ae.jsx)(I.VHP,{size:22})}),(0,ae.jsxs)(m.Z,{children:[(0,ae.jsx)(x.Z,{variant:"h3",sx:{fontWeight:800,color:ve,lineHeight:1.1,fontSize:{xs:"1.25rem",sm:"1.5rem",md:"1.75rem"}},children:"Orders Details"}),(0,ae.jsxs)(m.Z,{direction:"row",alignItems:"center",spacing:.75,sx:{mt:.5},children:[(0,ae.jsx)(h.Z,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:"#10b981",boxShadow:"0 0 0 4px rgba(16,185,129,0.18)"}}),(0,ae.jsxs)(x.Z,{variant:"caption",sx:{color:ge,fontWeight:600},children:["Live \xb7 ",It," \xb7 ",me]})]})]})]}),(0,ae.jsxs)(m.Z,{direction:"row",alignItems:"center",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:[(0,ae.jsx)(v.Z,{title:"Date Filter",children:(0,ae.jsxs)(h.Z,{onClick:function(){return se(!0)},sx:{display:"inline-flex",alignItems:"center",gap:.75,px:1.5,py:.875,borderRadius:999,cursor:"pointer",bgcolor:"#fff",border:"1.5px solid ".concat(De("#f59e0b")),color:"#f59e0b",fontWeight:800,fontSize:12,transition:"all 0.18s","&:hover":{borderColor:"#f59e0b",boxShadow:"0 0 0 3px ".concat(Ce("#f59e0b"))}},children:[(0,ae.jsx)(I.sHf,{size:14}),X&&ne?"".concat(_()(X).format("DD/MM/YY")," \u2013 ").concat(_()(ne).format("DD/MM/YY")):"All time"]})}),(0,ae.jsx)(h.Z,{sx:{display:"inline-flex",alignItems:"center",p:.25,borderRadius:999,bgcolor:"#fff",border:"1.5px solid ".concat(De(Ae)),"& > div, & > a, & > button":{color:Ae,fontWeight:700}},children:(0,ae.jsx)(V.ZZ,{data:Xt,filename:"Orders_Detail_".concat(_()().format("YYYY-MM-DD_HHmmss"),".csv")})})]})]})}),(0,ae.jsx)(g.ZP,{container:!0,spacing:{xs:1.25,sm:1.5,md:2},children:er.map((function(e){var t,r=e.icon;return(0,ae.jsx)(g.ZP,{item:!0,xs:6,sm:6,md:e.isMoney?3:2,children:(0,ae.jsxs)(p.Z,{elevation:0,sx:{position:"relative",overflow:"hidden",p:{xs:1.25,sm:1.75,md:2.25},borderRadius:fe/8,border:"1px solid",borderColor:ye,background:"#fff",transition:"transform 0.2s, box-shadow 0.2s, border-color 0.2s","&:hover":{transform:"translateY(-3px)",boxShadow:xe,borderColor:De(e.color)}},children:[(0,ae.jsx)(h.Z,{sx:{position:"absolute",top:0,left:0,right:0,height:3,background:"linear-gradient(90deg, ".concat(e.color," 0%, ").concat(Se(e.color)," 100%)")}}),(0,ae.jsxs)(m.Z,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",spacing:1,children:[(0,ae.jsxs)(m.Z,{spacing:.5,sx:{minWidth:0,flex:1},children:[(0,ae.jsx)(x.Z,{variant:"caption",sx:{color:ge,fontWeight:700,letterSpacing:.4,textTransform:"uppercase",fontSize:{xs:10,sm:11},whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.label}),(0,ae.jsx)(x.Z,{sx:{fontWeight:800,color:ve,lineHeight:1.1,fontSize:{xs:"1.05rem",sm:"1.3rem",md:"1.5rem"}},children:qt&&!e.value?(0,ae.jsx)(b.Z,{sx:{width:40},animation:"wave"}):e.isMoney?Le(e.value):null!==(t=e.value)&&void 0!==t?t:0})]}),(0,ae.jsx)(f.Z,{sx:{width:{xs:32,sm:38,md:44},height:{xs:32,sm:38,md:44},bgcolor:Se(e.color),color:e.color,boxShadow:"inset 0 0 0 1px ".concat(De(e.color)),flexShrink:0},children:(0,ae.jsx)(r,{size:18})})]})]})},e.key)}))}),(0,ae.jsx)(p.Z,{elevation:0,sx:{mt:{xs:1.5,md:2},p:{xs:1.25,md:1.75},borderRadius:fe/8,border:"1px solid",borderColor:ye,background:"#fff",boxShadow:he},children:(0,ae.jsxs)(g.ZP,{container:!0,spacing:1.25,alignItems:"center",children:[(0,ae.jsx)(g.ZP,{item:!0,xs:12,sm:6,md:4,children:1===Dt.length?(0,ae.jsxs)(h.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.75,px:1.5,py:.875,borderRadius:999,bgcolor:ke(Ae),border:"1.5px solid ".concat(De(Ae)),color:Ae,fontWeight:800,fontSize:13,width:"100%"},children:[(0,ae.jsx)(I.x$F,{size:14})," ",Dt[0].locationname]}):(0,ae.jsx)(y.Z,{fullWidth:!0,options:Dt||[],value:Et,getOptionLabel:function(e){return e?"".concat(e.locationname," (").concat(e.suburb||"",")"):""},PaperComponent:Oe,onChange:function(e,t,r){t&&(Ft(t),Ot(t.locationid),Yt(t.locationname)),"clear"===r&&(Ft(null),Ot(0),Yt("All Locations"))},renderInput:function(e){return(0,ae.jsx)(j.Z,(0,a.Z)((0,a.Z)({},e),{},{placeholder:"All Locations",size:"small",sx:ze("#10b981"),InputProps:(0,a.Z)((0,a.Z)({},e.InputProps),{},{startAdornment:(0,ae.jsx)(m.Z,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5},children:(0,ae.jsx)(We,{color:"#10b981",size:22,selected:!0,children:(0,ae.jsx)(I.c7Z,{size:13})})})})}))}})}),(0,ae.jsx)(g.ZP,{item:!0,xs:12,sm:6,md:4,children:(0,ae.jsx)(y.Z,{fullWidth:!0,options:Me,value:wt,getOptionLabel:function(e){return(null===e||void 0===e?void 0:e.status)||""},PaperComponent:Oe,onChange:function(e,t,r){"clear"===r?(mt("All"),kt(Me[0])):(mt(t.statusLow),kt(t))},renderInput:function(e){return(0,ae.jsx)(j.Z,(0,a.Z)((0,a.Z)({},e),{},{placeholder:"Status",size:"small",sx:ze((null===wt||void 0===wt?void 0:wt.color)||Ae),InputProps:(0,a.Z)((0,a.Z)({},e.InputProps),{},{startAdornment:(0,ae.jsx)(m.Z,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5},children:(0,ae.jsx)(We,{color:(null===wt||void 0===wt?void 0:wt.color)||Ae,size:22,selected:!0,children:null!==wt&&void 0!==wt&&wt.icon?c.createElement(wt.icon,{size:13}):(0,ae.jsx)(I.VK0,{size:13})})})})}))}})}),(0,ae.jsx)(g.ZP,{item:!0,xs:12,sm:12,md:4,children:(0,ae.jsxs)(h.Z,{sx:{display:"flex",alignItems:"center",gap:.75,px:1.25,py:.75,borderRadius:999,bgcolor:ke(Ae),border:"1.5px solid ".concat(De(Ae)),transition:"all 0.18s","&:focus-within":{borderColor:Ae,boxShadow:"0 0 0 3px ".concat(Ce(Ae))}},children:[(0,ae.jsx)(I.vU7,{size:16,style:{color:Ae,flexShrink:0}}),(0,ae.jsx)(Z.ZP,{inputRef:Y,placeholder:"Search (ctrl+k)",value:Je,onChange:function(e){return $e(e.target.value)},autoComplete:"off",sx:{flex:1,fontSize:13,fontWeight:600,color:ve,"& input::placeholder":{color:be,opacity:1}}}),Je&&(0,ae.jsx)(w.Z,{size:"small",onClick:function(){return $e("")},sx:{p:.25,color:Ae},children:(0,ae.jsx)(I.lUB,{size:14})})]})})]})}),(0,ae.jsxs)(p.Z,{elevation:0,sx:{mt:{xs:1.5,md:2},borderRadius:fe/8,border:"1px solid",borderColor:ye,overflow:"hidden",background:"#fff"},children:[(0,ae.jsx)(k.Z,{ref:$,onScroll:function(e){var t=e.currentTarget,r=t.scrollTop,n=t.scrollHeight;r+t.clientHeight>=n-50&&Jt&&!$t&&Vt()},sx:{minHeight:"auto",maxHeight:"65vh",overflow:"auto","&::-webkit-scrollbar":{width:10,height:10},"&::-webkit-scrollbar-thumb":{backgroundColor:De(Ae),borderRadius:8,"&:hover":{backgroundColor:Ae}},"&::-webkit-scrollbar-track":{backgroundColor:Ze}},children:(0,ae.jsxs)(S.Z,{stickyHeader:!0,sx:{minWidth:1320},children:[(0,ae.jsx)(C.Z,{children:(0,ae.jsxs)(D.Z,{sx:{"& th":{backgroundColor:Ze,color:ge,fontSize:{xs:10,md:11},fontWeight:800,letterSpacing:.6,textTransform:"uppercase",whiteSpace:"nowrap",borderBottom:"1px solid ".concat(ye),py:{xs:1,md:1.25},px:{xs:1,md:1.5}}},children:[(0,ae.jsx)(A.Z,{children:"#"}),(0,ae.jsx)(A.Z,{children:"Location"}),(0,ae.jsx)(A.Z,{children:"Pickup"}),(0,ae.jsx)(A.Z,{children:"Drop"}),(0,ae.jsx)(A.Z,{children:"Status"}),(0,ae.jsx)(A.Z,{children:"Assigned"}),(0,ae.jsx)(A.Z,{children:"Accepted"}),(0,ae.jsx)(A.Z,{children:"Arrived"}),(0,ae.jsx)(A.Z,{children:"Picked"}),(0,ae.jsx)(A.Z,{children:"Delivered"}),(0,ae.jsx)(A.Z,{children:"Cancelled"}),(0,ae.jsx)(A.Z,{align:"center",children:"Kms"}),(0,ae.jsx)(A.Z,{align:"right",children:"Charges"})]})}),(0,ae.jsxs)(P.Z,{children:[0===(null===Gt||void 0===Gt?void 0:Gt.length)&&!qt&&(0,ae.jsx)(D.Z,{children:(0,ae.jsx)(A.Z,{colSpan:13,sx:{py:6,borderBottom:"none"},children:(0,ae.jsxs)(m.Z,{alignItems:"center",spacing:1.5,children:[(0,ae.jsx)(f.Z,{sx:{width:64,height:64,bgcolor:Se("#94a3b8"),color:be},children:(0,ae.jsx)(I.VHP,{size:28})}),(0,ae.jsx)(x.Z,{variant:"subtitle1",sx:{fontWeight:700,color:ve},children:"No order details"}),(0,ae.jsx)(x.Z,{variant:"caption",sx:{color:ge},children:Je?"Try a different keyword.":"Adjust the filters above to load orders."})]})})}),qt&&0===Gt.length&&[0,1,2,3,4].map((function(e,t){return(0,ae.jsx)(D.Z,{children:Array.from({length:13}).map((function(e,t){return(0,ae.jsx)(A.Z,{sx:{borderBottom:"1px solid ".concat(je)},children:(0,ae.jsx)(b.Z,{animation:"wave"})},t)}))},"sk-".concat(t))})),Gt.map((function(e,t){return(0,ae.jsxs)(D.Z,{sx:{cursor:"pointer",transition:"background-color 0.15s","& td":{borderBottom:"1px solid ".concat(je),py:{xs:1,md:1.25},px:{xs:1,md:1.5}},"&:hover":{backgroundColor:Ze}},children:[(0,ae.jsx)(A.Z,{children:(0,ae.jsx)(x.Z,{sx:{fontWeight:700,color:ge},children:t+1})}),(0,ae.jsxs)(A.Z,{children:[(0,ae.jsx)(x.Z,{variant:"subtitle2",sx:{fontWeight:700,color:ve},noWrap:!0,children:e.locationname}),(0,ae.jsx)(v.Z,{title:"Order Id",children:(0,ae.jsx)(x.Z,{variant:"caption",sx:{color:ge},noWrap:!0,children:e.orderid})}),(0,ae.jsx)(v.Z,{title:"Delivery Date",children:(0,ae.jsxs)(m.Z,{direction:"row",alignItems:"center",spacing:.5,sx:{mt:.25},children:[(0,ae.jsx)(I.dKE,{size:11,style:{color:be,flexShrink:0}}),(0,ae.jsxs)(x.Z,{sx:{fontSize:11,color:ge,fontWeight:600},noWrap:!0,children:[_()(e.deliverydate).utc().format("DD/MM/YYYY")," \xb7"," ",_()(e.deliverydate).utc().format("hh:mm A")]})]})})]}),(0,ae.jsx)(A.Z,{children:(0,ae.jsxs)(m.Z,{children:[(0,ae.jsx)(x.Z,{variant:"subtitle2",sx:{fontWeight:700,color:ve},noWrap:!0,children:e.pickupcustomer}),(0,ae.jsx)(x.Z,{variant:"caption",sx:{color:ge},noWrap:!0,children:e.pickupcontactno}),(0,ae.jsx)(v.Z,{title:e.Pickupaddress||e.pickupaddress,children:(0,ae.jsx)(x.Z,{variant:"caption",sx:{color:be},noWrap:!0,children:e.pickupsuburb||e.pickuplocation||(e.Pickupaddress?"".concat(e.Pickupaddress.slice(0,20),"\u2026"):"\u2014")})})]})}),(0,ae.jsx)(A.Z,{children:(0,ae.jsxs)(m.Z,{children:[(0,ae.jsx)(x.Z,{variant:"subtitle2",sx:{fontWeight:700,color:ve},noWrap:!0,children:e.deliverycustomer}),(0,ae.jsx)(x.Z,{variant:"caption",sx:{color:ge},noWrap:!0,children:e.deliverycontactno}),(0,ae.jsx)(v.Z,{title:e.deliveryaddress,children:(0,ae.jsx)(x.Z,{variant:"caption",sx:{color:be},noWrap:!0,children:e.deliverysuburb||e.deliverylocation||(e.deliveryaddress?"".concat(e.deliveryaddress.slice(0,20),"\u2026"):"\u2014")})})]})}),(0,ae.jsx)(A.Z,{children:(0,ae.jsx)(Ie,{status:e.orderstatus})}),(0,ae.jsx)(A.Z,{children:(0,ae.jsxs)(m.Z,{spacing:.25,children:[e.ridername&&(0,ae.jsx)(x.Z,{variant:"caption",sx:{fontWeight:800,color:Ae},noWrap:!0,children:e.ridername}),(0,ae.jsx)(_e,{value:e.assigntime,color:Re.pending.color})]})}),(0,ae.jsx)(A.Z,{children:(0,ae.jsx)(_e,{value:e.starttime,color:Re.accepted.color})}),(0,ae.jsx)(A.Z,{children:(0,ae.jsx)(_e,{value:e.arrivaltime,color:Re.arrived.color})}),(0,ae.jsx)(A.Z,{children:(0,ae.jsx)(_e,{value:e.pickuptime,color:Re.picked.color})}),(0,ae.jsx)(A.Z,{children:(0,ae.jsx)(_e,{value:e.deliverytime,color:Re.delivered.color})}),(0,ae.jsx)(A.Z,{children:(0,ae.jsx)(_e,{value:e.canceltime,color:Re.cancelled.color})}),(0,ae.jsx)(A.Z,{align:"center",children:(0,ae.jsx)(Ye,{value:"cancelled"===e.orderstatus||""===e.kms?0:Number(parseFloat(e.kms||0).toFixed(1)),color:"#f59e0b",icon:(0,ae.jsx)(I.v93,{size:11})})}),(0,ae.jsx)(A.Z,{align:"right",children:(0,ae.jsx)(Ye,{value:"cancelled"===e.orderstatus||""===e.deliverycharges?0:Number(e.deliverycharges),color:Ae,icon:(0,ae.jsx)(I.vCl,{size:11}),isMoney:!0})})]},"".concat(e.orderid,"-").concat(t))})),0!==Gt.length&&(0,ae.jsx)(D.Z,{children:(0,ae.jsx)(A.Z,{colSpan:13,rowSpan:3,sx:{borderBottom:"none"},children:(0,ae.jsx)("div",{ref:J,style:{height:40,textAlign:"center"},children:$t||Jt?(0,ae.jsx)(R.Z,{size:20,sx:{color:Ae}}):(0,ae.jsx)(x.Z,{variant:"caption",sx:{color:be,fontWeight:700},children:"No more orders"})})})})]})]})}),(0,ae.jsx)(M.Z,{}),(0,ae.jsxs)(m.Z,{direction:{xs:"column",sm:"row"},spacing:1.25,alignItems:"center",justifyContent:"flex-end",sx:{p:{xs:1.25,md:1.75},background:"linear-gradient(135deg, ".concat(ke(Ae)," 0%, ").concat(ke(Pe)," 100%)"),borderTop:"1px solid ".concat(De(Ae))},children:[(0,ae.jsxs)(h.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.75,px:1.25,py:.5,borderRadius:999,bgcolor:"#fff",border:"1.5px solid ".concat(De("#ef4444")),color:"#ef4444",fontWeight:800,fontSize:13},children:[(0,ae.jsx)(I.Rtn,{size:13})," Total Charges \xb7 ",Le(Te)]}),(0,ae.jsxs)(h.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.75,px:1.25,py:.5,borderRadius:999,bgcolor:"#fff",border:"1.5px solid ".concat(De("#10b981")),color:"#10b981",fontWeight:800,fontSize:13},children:[(0,ae.jsx)(I.vCl,{size:13})," Total Amount \xb7 ",Le(He)]})]})]}),(0,ae.jsxs)(O.Z,{open:le,onClose:function(){return se(!1)},PaperProps:{sx:{borderRadius:3}},children:[(0,ae.jsx)(h.Z,{sx:{p:2.5,background:"linear-gradient(135deg, ".concat(ke(Ae)," 0%, ").concat(ke(Pe)," 100%)"),borderBottom:"1px solid ".concat(ye)},children:(0,ae.jsxs)(m.Z,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,ae.jsx)(f.Z,{sx:{bgcolor:Ae,color:"#fff",width:40,height:40,boxShadow:"0 6px 18px ".concat(Ce(Ae))},children:(0,ae.jsx)(I.sHf,{size:20})}),(0,ae.jsxs)(m.Z,{children:[(0,ae.jsx)(x.Z,{variant:"h5",sx:{fontWeight:800,color:ve},children:"Select Date Range"}),(0,ae.jsx)(x.Z,{variant:"caption",sx:{color:ge,fontWeight:600},children:"Filter the order details by a date range or preset"})]})]})}),(0,ae.jsx)(W.Z,{sx:{width:"100%"},className:"datedialog",children:(0,ae.jsx)(L.D,{open:le,toggle:function(){return se(!le)},id:"daterange1",onChange:function(e){"All"===e.label?(ee(""),oe(""),we("All"),se(!1)):(ee(_()(e.startDate).format("YYYY-MM-DD")),oe(_()(e.endDate).format("YYYY-MM-DD")),we(e.label||""))},definedRanges:[{label:"Today",startDate:new Date,endDate:new Date},{label:"Yesterday",startDate:(0,E.Z)(new Date,-1),endDate:(0,E.Z)(new Date,-1)},{label:"Tomorrow",startDate:(0,E.Z)(new Date,1),endDate:(0,E.Z)(new Date,1)},{label:"This Week",startDate:(0,F.Z)(new Date),endDate:(0,T.Z)(new Date)},{label:"Last Week",startDate:(0,F.Z)((0,B.Z)(new Date,-1)),endDate:(0,T.Z)((0,B.Z)(new Date,-1))},{label:"Last 7 Days",startDate:(0,B.Z)(new Date,-1),endDate:new Date},{label:"This Month",startDate:(0,N.Z)(new Date),endDate:(0,U.Z)(new Date)},{label:"Last Month",startDate:(0,N.Z)((0,H.Z)(new Date,-1)),endDate:(0,U.Z)((0,H.Z)(new Date,-1))},{label:"All",startDate:new Date,endDate:(0,E.Z)(new Date,-1)}]})}),(0,ae.jsxs)(m.Z,{direction:"row",justifyContent:"flex-end",spacing:1,sx:{width:"100%",p:2,borderTop:"1px solid ".concat(je)},children:[(0,ae.jsx)(z.Z,{variant:"outlined",onClick:function(){return se(!1)},sx:{borderRadius:999,px:2.5,borderColor:ye,color:ge,fontWeight:700,"&:hover":{borderColor:ge,bgcolor:Ze}},children:"Cancel"}),(0,ae.jsx)(z.Z,{variant:"contained",onClick:function(){return se(!1)},sx:{borderRadius:999,px:3,bgcolor:Ae,fontWeight:700,boxShadow:"0 6px 18px ".concat(Ce(Ae)),"&:hover":{bgcolor:"#4D1C61"}},children:"Apply"})]})]}),(0,ae.jsx)(O.Z,{open:lt,onClose:function(){return st(!1)},maxWidth:"lg",fullWidth:!0,PaperProps:{sx:{borderRadius:3,overflow:"hidden"}},children:Xe&&(0,ae.jsx)(h.Z,{children:(0,ae.jsx)(de,{coordinates:Xe,additionalProps:{riderStart:rt,riderEnd:it},order:pt,setMapOpen:st})})})]})}},6986:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(87462),o=r(47313),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"download",theme:"outlined"},a=r(16141),c=function(e,t){return o.createElement(a.Z,(0,n.Z)({},e,{ref:t,icon:i}))};var l=o.forwardRef(c)},53245:function(e,t,r){e.exports=r(47020)},26193:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(47313),a=(n=i)&&n.__esModule?n:{default:n},c=r(22824),l=r(67334);var s=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={},r}return function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"buildURI",value:function(){return c.buildURI.apply(void 0,arguments)}},{key:"componentDidMount",value:function(){var e=this.props,t=e.data,r=e.headers,n=e.separator,o=e.enclosingCharacter,i=e.uFEFF,a=e.target,c=e.specs,l=e.replace;this.state.page=window.open(this.buildURI(t,i,r,n,o),a,c,l)}},{key:"getWindow",value:function(){return this.state.page}},{key:"render",value:function(){return null}}]),t}(a.default.Component);s.defaultProps=Object.assign(l.defaultProps,{target:"_blank"}),s.propTypes=l.propTypes,t.default=s},92332:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(47313),c=(n=a)&&n.__esModule?n:{default:n},l=r(22824),s=r(67334);var d=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.buildURI=r.buildURI.bind(r),r}return function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"buildURI",value:function(){return l.buildURI.apply(void 0,arguments)}},{key:"handleLegacy",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(window.navigator.msSaveOrOpenBlob){e.preventDefault();var r=this.props,n=r.data,o=r.headers,i=r.separator,a=r.filename,c=r.enclosingCharacter,s=r.uFEFF,d=t&&"function"===typeof n?n():n,u=new Blob([s?"\ufeff":"",(0,l.toCSV)(d,o,i,c)]);return window.navigator.msSaveBlob(u,a),!1}}},{key:"handleAsyncClick",value:function(e){var t=this;this.props.onClick(e,(function(r){!1!==r?t.handleLegacy(e,!0):e.preventDefault()}))}},{key:"handleSyncClick",value:function(e){!1===this.props.onClick(e)?e.preventDefault():this.handleLegacy(e)}},{key:"handleClick",value:function(){var e=this;return function(t){if("function"===typeof e.props.onClick)return e.props.asyncOnClick?e.handleAsyncClick(t):e.handleSyncClick(t);e.handleLegacy(t)}}},{key:"render",value:function(){var e=this,t=this.props,r=t.data,n=t.headers,i=t.separator,a=t.filename,l=t.uFEFF,s=t.children,d=(t.onClick,t.asyncOnClick,t.enclosingCharacter),u=function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(t,["data","headers","separator","filename","uFEFF","children","onClick","asyncOnClick","enclosingCharacter"]),p="undefined"===typeof window?"":this.buildURI(r,l,n,i,d);return c.default.createElement("a",o({download:a},u,{ref:function(t){return e.link=t},target:"_self",href:p,onClick:this.handleClick()}),s)}}]),t}(c.default.Component);d.defaultProps=s.defaultProps,d.propTypes=s.propTypes,t.default=d},22824:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}var o=t.isSafari=function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},i=t.isJsons=function(e){return Array.isArray(e)&&e.every((function(e){return"object"===("undefined"===typeof e?"undefined":r(e))&&!(e instanceof Array)}))},a=t.isArrays=function(e){return Array.isArray(e)&&e.every((function(e){return Array.isArray(e)}))},c=t.jsonsHeaders=function(e){return Array.from(e.map((function(e){return Object.keys(e)})).reduce((function(e,t){return new Set([].concat(n(e),n(t)))}),[]))},l=t.jsons2arrays=function(e,t){var r=t=t||c(e),o=t;i(t)&&(r=t.map((function(e){return e.label})),o=t.map((function(e){return e.key})));var a=e.map((function(e){return o.map((function(t){return s(t,e)}))}));return[r].concat(n(a))},s=t.getHeaderValue=function(e,t){var r=e.replace(/\[([^\]]+)]/g,".$1").split(".").reduce((function(e,t,r,n){var o=e[t];if(void 0!==o&&null!==o)return o;n.splice(1)}),t);return void 0===r?e in t?t[e]:"":r},d=t.elementOrEmpty=function(e){return"undefined"===typeof e||null===e?"":e},u=t.joiner=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:'"';return e.filter((function(e){return e})).map((function(e){return e.map((function(e){return d(e)})).map((function(e){return""+r+e+r})).join(t)})).join("\n")},p=t.arrays2csv=function(e,t,r,o){return u(t?[t].concat(n(e)):e,r,o)},f=t.jsons2csv=function(e,t,r,n){return u(l(e,t),r,n)},h=t.string2csv=function(e,t,r,n){return t?t.join(r)+"\n"+e:e.replace(/"/g,'""')},x=t.toCSV=function(e,t,r,n){if(i(e))return f(e,t,r,n);if(a(e))return p(e,t,r,n);if("string"===typeof e)return h(e,t,r);throw new TypeError('Data should be a "String", "Array of arrays" OR "Array of objects" ')};t.buildURI=function(e,t,r,n,i){var a=x(e,r,n,i),c=o()?"application/csv":"text/csv",l=new Blob([t?"\ufeff":"",a],{type:c}),s="data:"+c+";charset=utf-8,"+(t?"\ufeff":"")+a,d=window.URL||window.webkitURL;return"undefined"===typeof d.createObjectURL?s:d.createObjectURL(l)}},47020:function(e,t,r){"use strict";t.CSVLink=void 0;var n=i(r(26193)),o=i(r(92332));function i(e){return e&&e.__esModule?e:{default:e}}n.default,t.CSVLink=o.default},67334:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PropsNotForwarded=t.defaultProps=t.propTypes=void 0;var n,o=r(47313),i=((n=o)&&n.__esModule,r(75192));t.propTypes={data:(0,i.oneOfType)([i.string,i.array,i.func]).isRequired,headers:i.array,target:i.string,separator:i.string,filename:i.string,uFEFF:i.bool,onClick:i.func,asyncOnClick:i.bool,enclosingCharacter:i.string},t.defaultProps={separator:",",filename:"generatedBy_react-csv.csv",uFEFF:!0,asyncOnClick:!1,enclosingCharacter:'"'},t.PropsNotForwarded=["data","headers"]}}]);