1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[86],{6157:function(e,t){t.Z={src:"/_next/static/media/googleLogo.58b4a4f1.png",height:49,width:48,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAMAAADz0U65AAAAY1BMVEVMaXHrRDVFiv0zp1DzRDc/fPczqE4lpUsyqVNChPNBhfXwRDVxjcbpQDJAkdXoPzDoQjRDh/ZBhPRFi/ynticqpljduRDkLzr8mxLnQjT/uQTwWi3cMzj/wwM6rXY4tVlLtlI5JNPhAAAAHXRSTlMAO/7A/S6eI+jQuOoNj+JEz5Oj0KZOtzC8x6z+OzNJUd4AAAAJcEhZcwAAFiUAABYlAUlSJPAAAABASURBVHicHcEFDoAwAACxmzvuMOD/ryShBbFr3Qm4dColtbCdK796kEMIA3UhxyhHpncGI3ucf5S6GwPOem8dH2DbAqXS144yAAAAAElFTkSuQmCC",blurWidth:8,blurHeight:8}},9183:function(e,t){t.Z={src:"/_next/static/media/lostfr8.e644306b.png",height:1e3,width:1e3,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAMAAADz0U65AAAAKlBMVEVMaXGJQBizViqwcBmtVSm2aiC7chzAZybklx3qiSLugyHikR/xhyTqVyhLFVmkAAAADXRSTlMAD/4v0kVc/ZvQ1Kz2sKRJhAAAAAlwSFlzAAALEwAACxMBAJqcGAAAADNJREFUeJxNikkOACAIxIYBxI3/f9egF3tp0hT46O1Z99SyrMwhADzIqOQkWZeamXk9FxwWvQCmJd01XwAAAABJRU5ErkJggg==",blurWidth:8,blurHeight:8}},101:function(e,t,i){i.d(t,{O:function(){return h}});var n=i(5893),r=i(6596),l=i(72),s=i(3636),o=i(8029),a=i(8491),d=i(7294),c=i(5005),u=i(6642);let h=e=>{let{copy:t,text:i,event:h,size:x="sm"}=e,p=(0,r.p)(),{hasCopied:m,onCopy:j,setValue:v}=(0,l.V)(t);return(0,d.useEffect)(()=>{v(t)},[t,v]),(0,n.jsxs)(s.U,{mb:2,children:[(0,n.jsx)(o.x,{children:i}),(0,n.jsx)(a.z,{size:x,onClick:e=>{e.preventDefault(),j(),p({description:"Copied ".concat(t,"."),status:"success",duration:3e3,position:"bottom-left",isClosable:!0}),h&&(0,c.j)(h)},children:m?(0,n.jsx)(u.rE,{}):(0,n.jsx)(u.TI,{})})]})}},6823:function(e,t,i){i.d(t,{S:function(){return B}});var n=i(5893),r=i(3658),l=i(3712),s=i(4270),o=i(8029),a=i(3491),d=i(4703),c=i(1901),u=i(6007),h=i(7294),x=i(5011),p=i(1325),m=i(7167),j=i(4476),v=i(7879),g=i(3636),f=i(6642);let y=e=>{let t,{changeSort:i,editable:r,sortKey:l,sortOrder:s}=e,a=e=>e==l?"ASC"==s?(0,n.jsx)(f.v4,{}):(0,n.jsx)(f.g8,{}):(0,n.jsx)(o.x,{w:"12px",h:"12px"});return(0,n.jsx)(m.Tr,{children:(t=[{text:"Date",sortKey:"DATE"},{text:"Equipment",sortKey:"EQUIP"},{text:"Origin",sortKey:"ORIGIN"},{text:"Destination",sortKey:"DEST"},{text:"F/P",sortKey:"FP"},{text:"Len/Wt"},{text:"Notes"}],r&&(t.splice(0,0,{text:"Avail"}),t.splice(4,0,{}),t.splice(9,0,{})),t).flatMap((e,t)=>e.text&&e.sortKey?(0,n.jsx)(j.Th,{fontSize:"sm",children:(0,n.jsx)(v.r,{onClick:()=>{e.sortKey&&i(e.sortKey)},children:(0,n.jsxs)(g.U,{spacing:1,children:[(0,n.jsx)(o.x,{children:e.text}),a(e.sortKey)]})})},t):e.text?(0,n.jsx)(j.Th,{fontSize:"sm",children:e.text},t):(0,n.jsx)(j.Th,{fontSize:"sm"},t))})};var b=i(2729),C=i(6596),w=i(3416),S=i(6058),k=i(5715),I=i(8491),A=i(8872),T=i(7837),O=i(1163),E=i(5953),D=i(1233),z=i(3521),q=i(658);let L=e=>{let t={[x.ifq.V53]:"Dry Van",[x.ifq.V48]:"Dry Van",[x.ifq.R53]:"Reefer",[x.ifq.R48]:"Reefer",[x.ifq.F53]:"Flatbed",[x.ifq.F48]:"Flatbed",[x.ifq.Po]:"Power Only",[x.ifq.Spv]:"Sprinter Van",[x.ifq.T]:"Tanker"};return t[e]},R=e=>{let t=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(i,"-").concat(n)},U=async(e,t)=>{if(!e.origin||!e.destination)return{data:[],status:"invalid",pagination:void 0};let{origin:i,destination:n,originRadius:r,destinationRadius:l,date:s,equipment:o}=e,a=R(s),d={origin_city:null==i?void 0:i.address,origin_radius:r,destination_city:null==n?void 0:n.address,destination_radius:l,pick_up_start_date:a,pick_up_end_date:a,equipments:o,page_items:"10"};"STATE"==e.origin.type&&(d.origin_city=void 0,d.origin_states=e.origin.address),"STATE"==e.destination.type&&(d.destination_city=void 0,d.destination_states=e.destination.address),"ANYWHERE"==e.destination.type&&(d.destination_city=void 0,d.destination_states=void 0);let c=t;if(c){let e=new URL(c);c="/api/newtrul/loads".concat(e.search)}else{let e=Object.keys(d).map(e=>(function(e,t){if(!t)return"";switch(e){case"equipments":return t.length>0&&"Any"!==t&&"".concat(e,"[]=").concat(t);case"origin_states":case"destination_states":return t.length>0&&"".concat(e,"[]=").concat(t);default:return"".concat(e,"=").concat(encodeURIComponent(t))}}
1)(e,d[e])).filter(Boolean).join("&");c="/api/newtrul/loads?".concat(e)}let u=await fetch(c),h=await u.json();return h};var F=i(697),M=i(8614),P=i(10),W=i(4609),V=i(5952);let _=e=>new Date(e.replace(/-/g,"/")),N=new Date;N.setHours(0,0,0,0);let K=e=>{let t=_(e.available);return t.getTime()<N.getTime()},Q=h.memo(e=>{let{capacity:t,editable:i,handleUpdateCapacity:r}=e,l=(0,E.Yg)(),[s,a]=(0,h.useState)(t),d=e=>_(e).toLocaleString("default",{month:"short",day:"numeric"}),c=(0,h.useCallback)(e=>{e.toLocaleDateString()!=new Date(s.available).toLocaleDateString()&&r(s.id,{available:e})},[s.available,s.id,r]),u=(0,h.useMemo)(()=>_(s.available),[s.available]);return((0,h.useEffect)(()=>{a(t)},[t]),i)?(0,n.jsx)(V.M,{initialDate:u,dateSelected:c,children:(0,n.jsx)(v.r,{fontSize:"12px",color:K(s)?l:"chakra-body-text",children:d(s.available)})}):(0,n.jsx)(o.x,{children:d(s.available)})});function H(){let e=(0,b._)(["\n 50% { background-color: #4299e199;}"]);return H=function(){return e},e}let Y=h.memo(e=>{var t;let{capacity:i,editable:l,liveUpdates:s,shouldFetchNewtrulLoads:a=!1,openEquipment:d,onEdit:c}=e,u=(0,C.p)(),j=(0,O.useRouter)(),{carrierId:y}=(0,D.d4)(),{socket:b}=(0,p.s)(),{setSearchInput:R}=(0,z.Dm)(),V=(0,E.fG)(),_=(0,A.F4)(H()),{isOpen:N,onOpen:Y,onClose:J}=(0,r.q)(),[B,Z]=(0,h.useState)(),[X,G]=(0,h.useState)(i),[$,ee]=(0,h.useState)(!1),[et,ei]=(0,h.useState)(!1),en=(0,h.useMemo)(()=>et,[et]),[{data:er}]=(0,x.ULu)(),[,el]=(0,x.HRF)(),es=(0,h.useCallback)(async(e,t,i)=>{var n,r,l,s;if(!y)return;let o=await el({id:t,carrierId:y,capacity:i}),a=null===(n=o.data)||void 0===n?void 0:null===(r=n.updateCapacity)||void 0===r?void 0:r.error;(null===(l=o.data)||void 0===l?void 0:null===(s=l.updateCapacity)||void 0===s?void 0:s.capacity)?u({title:"Success!",description:"Capacity ".concat(e," successfully updated."),status:"success",duration:3e3,position:"top",isClosable:!0}):a&&u({title:"Error.",description:a,status:"error",duration:5e3,position:"top",isClosable:!0})},[y,u,el]),eo=()=>{if($)return"".concat(_," ").concat(2e3,"ms normal forwards ease-in-out")},ea=(0,h.useCallback)((e,t)=>{es("available date",e,t)},[es]),ed=(0,h.useCallback)(e=>{e.address!==X.origin&&es("origin",X.id,{origin:e.address,originLatitude:e.latitude,originLongitude:e.longitude,originType:e.type})},[X.id,X.origin,es]),ec=(0,h.useCallback)(async()=>{"Anywhere"===X.destination?u({title:"Error.",description:"Origin can not be 'Anywhere'. Please change the origin using the text entry.",status:"error",duration:5e3,position:"top",isClosable:!0}):(ei(!0),await es("origin and destination",X.id,{origin:X.destination,originRadius:X.destinationRadius,originLatitude:X.destinationLatitude,originLongitude:X.destinationLongitude,originType:X.destinationType,destination:X.origin,destinationRadius:X.originRadius,destinationLatitude:X.originLatitude,destinationLongitude:X.originLongitude,destinationType:X.originType}),ei(!1))},[X.destination,X.destinationLatitude,X.destinationLongitude,X.destinationRadius,X.destinationType,X.id,X.origin,X.originLatitude,X.originLongitude,X.originRadius,X.originType,es,u]),eu=(0,h.useCallback)(e=>{e.address!==X.destination&&es("destination",X.id,{destination:e.address,destinationLatitude:e.latitude,destinationLongitude:e.longitude,destinationType:e.type})},[X.destination,X.id,es]),eh=(0,h.useCallback)(e=>{let t=e.target.checked?x.kKP.Available:x.kKP.Unavailable;t!==X.status&&es("status",X.id,{status:t})},[X.id,X.status,es]),ex=(0,h.useMemo)(()=>X.equipment?1==X.equipment.length&&X.equipment[0].type==x.Q2y.Tractor?[X.equipment[0]]:X.equipment.filter(e=>e.type!==x.Q2y.Tractor):[],[X.equipment]),ep=(0,h.useMemo)(()=>{if(X.equipment)return 1==X.equipment.length&&X.equipment[0].type==x.Q2y.Tractor?X.equipment[0]:X.equipment.filter(e=>e.type!==x.Q2y.Tractor).flatMap(e=>e)[0]},[X.equipment]),em=(0,h.useMemo)(()=>X.equipmentSubtype?L(X.equipmentSubtype):(null==ep?void 0:ep.subtype)?L(ep.subtype):void 0,[null==ep?void 0:ep.subtype,X.equipmentSubtype]),ej=(0,h.useMemo)(()=>{if(em)return{date:new Date(X.available),origin:{address:X.origin,latitude:X.originLatitude,longitude:X.originLongitude,type:X.originType},originRadius:X.originRadius.toString(),destination:{address:X.destination,latitude:X.destinationLatitude,longitude:X.destinationLongitude,type:X.destinationType},destinationRadius:X.destinationRadius.toString(),equipment:em}},[X.available,X.destination,X.destinationLatitude,X.destinationLongitude,X.destinationRadius,X.destinationType,X.origin,X.originLatitude,X.originLongitude,X.originRadius,X.originType,em]),ev=(0,h.useCallback)(async e=>{var t;if(l)return;let i=(null==er?void 0:null===(t=er.authUser)||void 0===t?void 0:t.id)===e.updatedBy&&l,n=e.status==x.kKP.Available,r=K(e);i||r||!n||(G(e),ee(!0),await (0,q._)(2e3),ee(!1))},[l,null==er?void 0:null===(t=er.authUser)||void 0===t?void 0:t.id]);(0,h.useEffect)(()=>
1{if(!s)return;let e="capacity-update-".concat(X.id);return b.on(e,ev),()=>{b.off(e,ev)}},[X,ev,s,b]),(0,h.useEffect)(()=>{G(i)},[i]),(0,h.useEffect)(()=>{N||Z("that")},[N]);let eg=async()=>em&&ej&&a?U(ej):{status:"invalid",data:[]},{isLoading:ef,data:ey}=(0,T.a)(["loads",X],eg);return(0,h.useMemo)(()=>{var e,t;let i=null!==(t=null==ey?void 0:null===(e=ey.pagination)||void 0===e?void 0:e.total_items)&&void 0!==t?t:0;return 1==i?"1 match":"".concat(i," matches")},[ey]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(m.Tr,{children:[l&&X.carrier&&(0,n.jsx)(w.Td,{animation:eo(),w:"40px",children:(0,n.jsx)(S.X,{isChecked:X.status==x.kKP.Available,onChange:eh})}),(0,n.jsx)(w.Td,{animation:eo(),roundedBottomLeft:"lg",roundedTopLeft:"lg",children:(0,n.jsx)(Q,{capacity:X,editable:l,handleUpdateCapacity:ea})}),(0,n.jsx)(w.Td,{animation:eo(),children:(0,n.jsxs)(g.U,{overflowX:"scroll",maxW:"100px",style:{scrollbarWidth:"none"},children:[0==ex.length&&X.equipmentType&&X.equipmentSubtype&&(0,n.jsx)(o.x,{children:(0,n.jsx)(F.$,{id:X.id,type:X.equipmentType,subtype:X.equipmentSubtype,size:"sm"})},X.id),ex.flatMap(e=>(0,n.jsx)(o.x,{children:(0,n.jsx)(F.$,{id:e.id,type:e.type,subtype:e.subtype,size:"sm"})},e.id)),X.equipment&&X.equipment.sort(function(e,t){return e.type===x.Q2y.Tractor?-1:1}).flatMap((e,t)=>{var i;let r=t+1===(null===(i=X.equipment)||void 0===i?void 0:i.length);return(0,n.jsxs)(o.x,{children:[(0,n.jsx)(v.r,{color:V,onClick:()=>{d&&d(e)},children:e.number}),!r&&", "]},e.id)})]})}),(0,n.jsx)(w.Td,{animation:eo(),w:"200px",minW:"200px",children:l&&X.carrier?(0,n.jsx)(M.P,{size:"sm",defaultValue:X.origin,variant:"filled",autocomplete:!0,address:!0,states:!1,selectedPlace:ed}):(0,n.jsxs)(n.Fragment,{children:[X.origin," ",X.originRadius>0&&"(".concat(X.originRadius,"mi)")]})}),l&&X.carrier&&(0,n.jsx)(w.Td,{animation:eo(),children:(0,n.jsx)(k.M,{children:(0,n.jsx)(I.z,{size:"sm",variant:"ghost",isLoading:en,onClick:ec,children:(0,n.jsx)(f.UR,{})})})}),(0,n.jsx)(w.Td,{animation:eo(),w:"200px",minW:"200px",children:l&&X.carrier?(0,n.jsx)(M.P,{size:"sm",defaultValue:X.destination,variant:"filled",autocomplete:!0,address:!0,anywhere:!0,selectedPlace:eu}):(0,n.jsxs)(n.Fragment,{children:[X.destination," ",X.destinationRadius>0&&"(".concat(X.destinationRadius,"mi)")]})}),(0,n.jsx)(w.Td,{animation:eo(),children:X.type==x.L24.Full?X.type:"PTL"}),(0,n.jsx)(w.Td,{overflowX:"scroll",maxW:"125px",animation:eo(),style:{scrollbarWidth:"none"},children:X.length&&X.weight?"".concat(X.length," ft / ").concat(X.weight,"K lbs"):X.length?"".concat(X.length," ft"):X.weight?"".concat(X.weight,"K lbs"):"--"}),(0,n.jsx)(w.Td,{animation:eo(),roundedBottomRight:l?"none":"lg",roundedTopRight:l?"none":"lg",children:X.notes?(0,n.jsx)(W.H,{header:"".concat(X.origin," â ").concat(X.destination),body:X.notes,children:(0,n.jsx)(o.x,{color:V,textDecoration:"underline",cursor:"pointer",children:"Notes"})}):(0,n.jsx)(o.x,{children:"--"})}),l&&(0,n.jsx)(w.Td,{animation:eo(),roundedBottomRight:l?"lg":"none",roundedTopRight:l?"lg":"none",children:(0,n.jsxs)(I.z,{size:"sm",onClick:()=>{c&&c(),j.push({href:"/dashboard",query:{view:"capacity",edit:X.id}})},children:[(0,n.jsx)(f.dY,{}),(0,n.jsx)(o.x,{ml:1,children:"Edit"})]})})]},X.id),(0,n.jsx)(P.W,{title:"Unsupported Equipment Type",body:"We're sorry, but Newtrul does not currently support ".concat(B," equipment. Newtrul is constantly expanding their range of supported equipment types. We will keep you informed as soon as Newtrul adds ").concat(B," equipment to their list of supported equipment. Thank you for your understanding and patience."),actionTitle:"Close",isOpen:N,onAction:J,onClose:J})]})});var J=i(7904);let B=h.memo(e=>{var t,i,m;let{carrierId:j,onlyAvailable:v,filterAvailable:g=!1,filterUnavailable:f=!1,onEdit:b,editable:C=!1}=e,{isOpen:w,onOpen:S,onClose:k}=(0,r.q)(),{socket:I}=(0,p.s)(),[{data:A}]=(0,x.ULu)(),[{data:T,fetching:O}]=(0,x.iz2)({variables:{carrierId:j,available:v,limit:200},pause:!j,requestPolicy:"cache-and-network"}),[E,D]=(0,h.useState)(),[z,q]=(0,h.useState)("AVAIL"),[L,R]=(0,h.useState)("DESC"),[U,F]=(0,h.useState)(),M=(e,t,i)=>[...e].sort(function(e,n){let r,l;switch(t){case"DATE":r=e.available,l=n.available;break;case"EQUIP":if(!e.equipmentSubtype&&!n.equipmentSubtype)break;r=e.equipmentSubtype,l=n.equipmentSubtype;break;case"FP":r=e.type,l=n.type;break;case"ORIGIN":r=e.origin,l=n.origin;break;case"DEST":r=e.destination,l=n.destination;break;case"LENGTH":r=e.length,l=n.length;break;case"WEIGHT":r=e.weight,l=n.weight;break;case"AVAIL":r=e.status,l=n.status}return"ASC"===i?r>l?-1:1:r<l?-1:1}),P=(0,h.useMemo)(()=>
1{if(E)return M(E,z,L)},[E,z,L]),W=(0,h.useMemo)(()=>null==P?void 0:P.filter(e=>e.status!==x.kKP.Available),[P]),V=(0,h.useMemo)(()=>null==P?void 0:P.filter(e=>e.status!==x.kKP.Unavailable),[P]),_=(0,h.useMemo)(()=>g&&f?[]:g?W:f?V:P,[g,f,W,V,P]),N=(0,h.useCallback)(e=>{var t;if(!E||C)return;let i=(null==A?void 0:null===(t=A.authUser)||void 0===t?void 0:t.id)===e.updatedBy&&C,n=K(e);i||n||(E.unshift(e),D([...E]))},[E,C,null==A?void 0:null===(t=A.authUser)||void 0===t?void 0:t.id]),Q=(0,h.useCallback)(e=>{if(!E||C)return;let t=E.findIndex(t=>t.id===e);t>=0&&(E.splice(t,1),D([...E]))},[E,C]),H=(0,h.useCallback)(e=>{var t;if(!E||C)return;let i=(null==A?void 0:null===(t=A.authUser)||void 0===t?void 0:t.id)===e.updatedBy&&C,n=K(e),r=e.status===x.kKP.Unavailable;if(!i){if((n||r)&&!C)Q(e.id);else{let t=E.find(t=>t.id==e.id);t||N(e)}}},[N,C,Q,E,null==A?void 0:null===(i=A.authUser)||void 0===i?void 0:i.id]),B=e=>{F(e),S()};return((0,h.useEffect)(()=>{var e;D(null==T?void 0:null===(e=T.capacityCarrierId)||void 0===e?void 0:e.capacity)},[null==T?void 0:null===(m=T.capacityCarrierId)||void 0===m?void 0:m.capacity]),(0,h.useEffect)(()=>{let e="carrier-capacity-update-".concat(j);I.on(e,H);let t="carrier-capacity-created-".concat(j);I.on(t,N);let i="carrier-capacity-deleted-".concat(j);return I.on(i,Q),()=>{I.off(e,H),I.off(t,N),I.off(i,Q)}},[N,E,j,H,Q,I,z,L]),O)?(0,n.jsxs)(l.K,{children:[(0,n.jsx)(s.O,{height:"100px",rounded:"lg"}),(0,n.jsx)(s.O,{height:"100px",rounded:"lg"}),(0,n.jsx)(s.O,{height:"100px",rounded:"lg"})]}):!O&&_&&_.length<=0?(0,n.jsx)(o.x,{m:6,children:"No available capacity..."}):(0,n.jsxs)(o.x,{children:[(0,n.jsx)(a.x,{pb:C?60:0,children:(0,n.jsxs)(d.i,{variant:"simple",size:"sm",children:[(0,n.jsx)(c.h,{children:(0,n.jsx)(y,{changeSort:e=>{R(e=>"ASC"===e?"DESC":"ASC"),q(e)},editable:C,sortKey:z,sortOrder:L})}),(0,n.jsx)(u.p,{fontSize:"12px",children:null==_?void 0:_.flatMap(e=>(0,n.jsx)(Y,{capacity:e,editable:C,liveUpdates:!0,shouldFetchNewtrulLoads:C,openEquipment:B,onEdit:b},e.id))})]})}),U&&(0,n.jsx)(J.X,{isOpen:w,onClose:k,equipment:U})]})})},729:function(e,t,i){i.d(t,{R:function(){return d}});var n=i(2729),r=i(5893),l=i(7873),s=i(8029),o=i(8872);function a(){let e=(0,n._)(["\n 50% { color: transparent;}"]);return a=function(){return e},e}let d=()=>{let e=(0,o.F4)(a());return(0,r.jsxs)(l.Vp,{variant:"subtle",rounded:"full",colorScheme:"green",pl:2,pr:3,children:[(0,r.jsx)(s.x,{fontSize:"2xl",mr:1,animation:"".concat(e," 3000ms infinite ease-in-out"),children:"â¢"})," ","Connected"]})}},5315:function(e,t,i){i.d(t,{G:function(){return f}});var n=i(5893),r=i(5490),l=i(4614),s=i(5901),o=i(1360),a=i(7391),d=i(3636),c=i(8029),u=i(3828),h=i(5443),x=i(7294),p=i(5011),m=i(5953),j=i(1325),v=i(6823),g=i(729);let f=e=>{let{isOpen:t,onClose:i,carrierId:f,onlyAvailable:y,showConnected:b=!1,editable:C=!1}=e,{connected:w}=(0,j.s)(),S=(0,m.AJ)(),[{data:k,fetching:I}]=(0,p.HWK)({variables:{id:f}}),A=(0,x.useMemo)(()=>{let e=null==k?void 0:k.carrierId;return(null==e?void 0:e.dbaName)?null==e?void 0:e.dbaName:null==e?void 0:e.name},[k]);return(0,n.jsxs)(r.u_,{onClose:i,size:"full",isOpen:t,children:[(0,n.jsx)(l.Z,{}),(0,n.jsxs)(s.h,{children:[(0,n.jsx)(o.o,{}),(0,n.jsxs)(a.x,{children:[A,b&&(0,n.jsxs)(d.U,{children:[(0,n.jsx)(c.x,{fontSize:"sm",textColor:S,children:"Realtime capacity"}),w&&(0,n.jsx)(g.R,{})]})]}),(0,n.jsx)(u.f,{mt:8,children:(0,n.jsx)(v.S,{carrierId:f,onlyAvailable:y,editable:C,onEdit:i})}),(0,n.jsx)(h.m,{})]})]})}},7215:function(e,t,i){i.d(t,{d:function(){return v}});var n=i(5893),r=i(3636),l=i(3321),s=i(8029),o=i(8329),a=i(7873),d=i(8491),c=i(1163),u=i(5011),h=i(5953),x=i(7426),p=i(4609),m=i(6642);let j=e=>{let{contact:t,editable:i=!1}=e,r=(0,c.useRouter)(),l=(0,h.Xn)(),j=(0,h.AJ)(),v=(0,h.fG)();return(0,n.jsxs)(s.x,{backgroundColor:l,rounded:"lg",p:4,minW:40,fontSize:"md",children:[(0,n.jsxs)(o.k,{justifyContent:"space-between",children:[(0,n.jsx)(a.Vp,{size:"md",colorScheme:(e=>{switch(e){case u.uCS.Owner:return"purple";case u.uCS.Billing:return"green";case u.uCS.Dispatch:return"blue";case u.uCS.Safety:return"yellow";case u.uCS.Sales:return"orange"}})(t.type),children:t.type}),i&&(0,n.jsxs)(d.z,{size:"sm",onClick:()=>r.push("/dashboard?view=contacts&edit=".concat(t.id)),children:[(0,n.jsx)(m.dY,{}),(0,n.jsx)(s.x,{ml:1,children:"Edit"})]}),!i&&t.name&&t.notes&&(0,n.jsx)(p.H,{header:"".concat(t.name," - ").concat(t.type),body:t.notes,children:(0,n.jsx)(s.x,{color:v,cursor:"pointer",children:"Notes"})})]}),(0,n.jsx)(s.x,{mt:4,noOfLines:2,fontWeight:"bold",children:t.name}),(0,n.jsxs)(s.x,{mt:4,textColor:j,fontSize:"md",children:[(0,n.jsxs)(s.x,{children:[t.phone&&(0,x.u)(t.phone)," ",t.phoneExt&&"ext: ".concat(t.phoneExt)]}),(0,n.jsx)(s.x,{mt:1,children:t.email})]})]},t.id)},v=e=>{let{contacts:t,direction:i="column",editable:s=!1}=e,o=()=>t.flatMap(e=>(0,n.jsx)(j,{contact:e,editable:s},e.id));return"row"===i?(0,n.jsx)(r.U,{spacing:2,overflowX:"scroll",style:{scrollbarWidth:"none"},whiteSpace:"nowrap",w:"100%",pb:4,children:o()}):(0,n.jsx)(l.M,{columns:{sm:1,md:2,xl:4},spacing:2,w:"100%",pb:4,children:o()})}},4540:function(e,t,i){i.d(t,{K:function(){return g}});var n=i(5893),r=i(2867),l=i(8029),s=i(3636),o=i(7879),a=i(8899),d=i(1163),c=i.n(d),u=i(7294),h=i(5011),x=i(1233),p=i(5658),m=i(9252),j=i(6642),v=i(9055);let g=e=>{let{onPushToView:t}=e,i=(0,p.c)(),{carrierId:d}=(0,x.d4)(),[{data:g}]=(0,h.E8n)({variables:{id:d},pause:!d}),[{fetching:f},y]=(0,h.jN$)(),b=()=>(0,n.jsx)(r.DE,{as:j.rE,color:"green.500"}),C=()=>(0,n.jsx)(r.DE,{as:j.DJ,color:"red.500"}),w=e=>{let{count:t=0,completedCount:i=0}=e;return t>i?(0,n.jsx)(b,{}):(0,n.jsx)(C,{})},S=e=>{null==t||t(e),c().push("/dashboard?view=".concat(e))},k=(0,u.useMemo)(()=>null==g?void 0:g.profileComplete.data,[g]);return k&&100!=k.percentageComplete?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.x,{mb:6,children:"Complete your profile so it's easier for potential customers to offer you relevant opportunities."}),(0,n.jsx)(v.k,{percentageComplete:k.percentageComplete}),(0,n.jsxs)(r.aV,{spacing:2,textAlign:"center",mt:4,children:[(0,n.jsx)(r.HC,{children:(0,n.jsxs)(s.U,{children:[w({count:k.contactsCount}),(0,n.jsxs)(l.x,{children:["Add company"," ",(0,n.jsx)(o.r,{textDecoration:"underline",onClick:()=>S("contacts"),children:"contacts"})]})]})}),(0,n.jsx)(r.HC,{children:(0,n.jsxs)(s.U,{children:[w({count:k.equipmentC
1ount}),(0,n.jsxs)(l.x,{children:["Create"," ",(0,n.jsx)(o.r,{textDecoration:"underline",onClick:()=>S("equipment"),children:"equipment profiles"})]})]})}),(0,n.jsx)(r.HC,{children:(0,n.jsxs)(s.U,{children:[w({count:k.capacityCount}),(0,n.jsxs)(l.x,{children:["Add your available"," ",(0,n.jsx)(o.r,{textDecoration:"underline",onClick:()=>S("capacity"),children:"capacity"})]})]})}),(0,n.jsx)(r.HC,{children:(0,n.jsxs)(s.U,{children:[w({count:k.lanesCount}),(0,n.jsxs)(l.x,{children:["Set your"," ",(0,n.jsx)(o.r,{textDecoration:"underline",onClick:()=>S("lanes"),children:"preferred lanes"})]})]})}),(0,n.jsx)(r.HC,{children:(0,n.jsxs)(s.U,{children:[w({count:k.emailCount,completedCount:4}),(0,n.jsxs)(l.x,{children:["Add"," ",(0,n.jsx)(o.r,{textDecoration:"underline",onClick:()=>S("emails"),children:"5 emails"})," ","to your email list"]})]})}),(0,n.jsx)(r.HC,{children:(0,n.jsxs)(s.U,{children:[w({count:k.truckListSends}),(0,n.jsx)(l.x,{children:(0,n.jsx)(o.r,{textDecoration:"underline",onClick:()=>S("emails"),children:"Send a truck list"})})]})}),(0,n.jsx)(r.HC,{children:(0,n.jsxs)(s.U,{children:[k.activeSubscription?(0,n.jsx)(b,{}):(0,n.jsx)(C,{}),i?(0,n.jsxs)(l.x,{children:[(0,n.jsx)(o.r,{textDecoration:"underline",onClick:()=>{(0,m.X)(c(),{subscribe:"1"})},children:"Subscribe"})," ","to a plan to publish your profile on LOST FR8"]}):k.activeSubscription?(0,n.jsx)(l.x,{children:"Subscribe to a plan to publish your profile on LOST FR8"}):(0,n.jsx)(l.x,{children:"Please contact your Admin to subscribe to a LOST FR8 subscription so your profile can be published."})]})}),k.activeSubscription&&(0,n.jsx)(r.HC,{children:(0,n.jsxs)(s.U,{children:[k.hasPaymentMethod?(0,n.jsx)(b,{}):(0,n.jsx)(C,{}),i?(0,n.jsxs)(l.x,{children:["Add default"," ",(0,n.jsx)(o.r,{textDecoration:"underline",onClick:async()=>{let{data:e}=await y({});(null==e?void 0:e.createPortalSession.url)&&c().push(e.createPortalSession.url)},children:"payment method"})]}):k.hasPaymentMethod?(0,n.jsx)(l.x,{children:"Add a default payment method"}):(0,n.jsx)(l.x,{children:"Please contact your Admin to add a default payment method."}),f&&(0,n.jsx)(a.$,{size:"xs"})]})})]}),(0,n.jsx)(l.x,{mt:6,children:(0,n.jsxs)("i",{children:["Need help getting started? Check out our"," ",(0,n.jsx)(o.r,{href:"https://docs.lostfr8.com/docs/user-guide#4-complete-profile-setup",isExternal:!0,textDecoration:"underline",children:"documentation"}),"!"]})})]}):(0,n.jsx)(n.Fragment,{})}},9055:function(e,t,i){i.d(t,{k:function(){return o}});var n=i(5893),r=i(3636),l=i(8029),s=i(4760);let o=e=>{let{percentageComplete:t}=e;return(0,n.jsxs)(r.U,{mt:2,children:[(0,n.jsxs)(l.x,{fontWeight:"bold",children:[t,"%"]}),(0,n.jsx)(s.E,{isAnimated:!0,hasStripe:!0,value:t,rounded:"lg",w:"100%",colorScheme:"green"})]})}},7776:function(e,t,i){i.d(t,{Y:function(){return c}});var n=i(5893),r=i(6596),l=i(8029),s=i(8329),o=i(8491),a=i(5011),d=i(5953);let c=e=>{var t;let{...i}=e,c=(0,r.p)(),u=(0,d.md)(),[{fetching:h},x]=(0,a.xfV)(),p=async()=>{var e,t;let n=i.dot,r=i.id;if(!n||!r)return;let l=await x({dot:n,id:r}),s=null===(e=l.data)||void 0===e?void 0:e.carrierSnapshotUpdate.error;(null===(t=l.data)||void 0===t?void 0:t.carrierSnapshotUpdate.carrier)?c({title:"Success!",description:"Carrier profile successfully updated.",status:"success",duration:3e3,position:"top",isClosable:!0}):s&&c({title:"Error.",description:s,status:"error",duration:5e3,position:"top",isClosable:!0})};return(0,n.jsxs)(l.x,{mt:4,p:6,bg:u,rounded:"lg",children:[(0,n.jsx)(l.x,{children:i.name}),i.dbaName&&(0,n.jsxs)(l.x,{children:["DBA: ",i.dbaName]}),(0,n.jsx)(l.x,{mt:2,children:i.street}),(0,n.jsxs)(l.x,{children:[i.city,", ",i.state," ",i.postalCode," ",i.country]}),(0,n.jsxs)(l.x,{mt:2,children:["USDOT# ",i.dot]}),null===(t=i.docketNumbers)||void 0===t?void 0:t.flatMap(e=>(0,n.jsx)(l.x,{children:e.description},e.id)),i.powerUnits&&(0,n.jsxs)(l.x,{mt:2,children:["Power Units: ",i.powerUnits]}),i.showRefresh&&(0,n.jsx)(s.k,{justifyContent:"flex-end",children:(0,n.jsx)(o.z,{size:"sm",isLoading:h,onClick:()=>p(),children:"Refresh"})}),(0,n.jsx)(s.k,{justifyContent:"flex-end",mt:1,children:(0,n.jsx)(l.x,{as:"i",fontSize:"x-small",children:"Data provided by FMCSA"})})]})}},7904:function(e,t,i){i.d(t,{X:function(){return u}});var n=i(5893),r=i(1046),l=i(5490),s=i(4614),o=i(5901),a=i(1360),d=i(3828),c=i(4436);let u=e=>{let{isOpen:t,onClose:i,equipment:u}=e,h=(0,r.ff)("white","gray.700");return(0,n.jsxs)(l.u_,{isOpen:t,onClose:i,children:[(0,n.jsx)(s.Z,{}),(0,n.jsxs)(o.h,{children:[(0,n.jsx)(a.o,{}),(0,n.jsx)(d.f,{mb:4,children:(0,n.jsx)(c.g,{equipment:u,bgColor:h})})]})]})}},5299:function(e,t,i){i.d(t,{IQ:function(){return o},OU:function(){return r},aQ:function(){return l},b7:function(){return n},sv:function(){return s}});let n=[{value:"TRACTOR",name:"Tractor"},{value:"TRAILER",name:"Trailer"},{value:"SPECIALIZED",name:"Specialized"}],r=[{value:"TRAC",name:"Tractor (TRAC)"}
1],l=[{value:"BT",name:"Beam Trailer (BT)"},{value:"BTR",name:"B-Train/Supertrain (B-TR)"},{value:"CN",name:"Conestoga (CN)"},{value:"CC20",name:"Container Chassis 20' (CC20)"},{value:"CC40",name:"Container Chassis 40' (CC40)"},{value:"CC53",name:"Container Chassis 53' (CC53)"},{value:"CONT",name:"Container Trailer (CONT)"},{value:"DD",name:"Double Drop (DD)"},{value:"DDE",name:"Double Drop Extended (DDE)"},{value:"DDL",name:"Drop Deck Landoll (DDL)"},{value:"DS",name:"Drop Side (DS)"},{value:"DT",name:"Dump Trailer (DT)"},{value:"EF",name:"Extendible Flatbed (EF)"},{value:"F48",name:"Flatbed 48' (F48)"},{value:"F53",name:"Flatbed 53' (F53)"},{value:"FSD",name:"Flatbed/Stepdeck (F/SD)"},{value:"FWS",name:"Flat with Sides (FWS)"},{value:"HB",name:"Hopper Bottom (HB)"},{value:"HS",name:"Hot Shot (HS)"},{value:"HSF",name:"Hot Shot Flat (HSF)"},{value:"HSV",name:"Hot Shot Van (HSV)"},{value:"LB",name:"Lowboy (LB)"},{value:"LPSD",name:"Low Profile Step Deck (LPSD)"},{value:"MAXI",name:"Maxi or Double Flat Trailers (MAXI)"},{value:"OT",name:"Van Open Top (OT)"},{value:"PDB",name:"Pneumatic Dry Bulk (PDB)"},{value:"R2",name:"Reefer Double (R2)"},{value:"R48",name:"Reefer 48' (R48)"},{value:"R53",name:"Reefer 53' (R53)"},{value:"RA",name:"Reefer with Air Ride (RA)"},{value:"RG",name:"Removable Goose. Ext. (RG)"},{value:"RGN",name:"Removable Goose Neck (RGN)"},{value:"RVV",name:"Reefer or Vented Van (RVV)"},{value:"SD",name:"Step Deck (SD)"},{value:"SR",name:"Stepdeck with Ramps (SR)"},{value:"T",name:"Tankers (T)"},{value:"TA",name:"Tanker Aluminum (TA)"},{value:"TS",name:"Tanker Steel (TS)"},{value:"V2",name:"Van Double (V2)"},{value:"V3",name:"Van Triple (V3)"},{value:"V10",name:"Van 10' (V10)"},{value:"V15",name:"Van 15' (V15)"},{value:"V20",name:"Van 20' (V20)"},{value:"V26",name:"Van 26' (V26)"},{value:"V35",name:"Van 35' (V35)"},{value:"V48",name:"Van 48' (V48)"},{value:"V53",name:"Van 53' (V53)"},{value:"VRB",name:"Van with Roller Bed (VRB)"},{value:"VC",name:"Van with Curtains (VC)"},{value:"VI",name:"Van Insulated (VI)"},{value:"VL",name:"Van Logistics (VL)"},{value:"VV",name:"Vented Van (VV)"},{value:"VW",name:"Van Blanket Wrap (VW)"}],s=[{value:"PO",name:"Power Only (PO)"},{value:"SPV",name:"Sprinter Van (SPV)"},{value:"S16",name:"Straight Truck 16' (S16)"},{value:"S20",name:"Straight Truck 20' (S20)"},{value:"S22",name:"Straight Truck 22' (S22)"},{value:"S24",name:"Straight Truck 24' (S24)"},{value:"S26",name:"Straight Truck 26' (S26)"},{value:"SV",name:"Straight Van (SV)"},{value:"SVR",name:"Straight Van Reefer (SVR)"}],o=[].concat(r,l,s)},1059:function(e,t,i){i.d(t,{s:function(){return T}});var n=i(5893),r=i(3712),l=i(5953),s=i(3658),o=i(3636),a=i(8491),d=i(8029),c=i(1163),u=i(6596),h=i(5490),x=i(4614),p=i(5901),m=i(7391),j=i(1360),v=i(3828),g=i(5443),f=i(5011);let y=e=>{let{dot:t,carrierId:i,id:r,lane:l,isOpen:s,onClose:o}=e,y=(0,c.useRouter)(),b=(0,u.p)(),[{fetching:C},w]=(0,f.Mnu)(),S=async()=>{var e,n,l,s;let a=await w({id:r,carrierId:i,dot:t}),d=null===(e=a.data)||void 0===e?void 0:null===(n=e.deleteLane)||void 0===n?void 0:n.error;(null===(l=a.data)||void 0===l?void 0:null===(s=l.deleteLane)||void 0===s?void 0:s.success)===!0?(b({title:"Success!",description:"Lane deleted successfully.",status:"success",duration:3e3,position:"top",isClosable:!0}),o(),y.replace("/dashboard?view=lanes")):d&&b({title:"Error.",description:d,status:"error",duration:5e3,position:"top",isClosable:!0})};return(0,n.jsxs)(h.u_,{returnFocusOnClose:!1,isOpen:s,onClose:o,children:[(0,n.jsx)(x.Z,{}),(0,n.jsxs)(p.h,{px:6,children:[(0,n.jsx)(m.x,{children:"Delete Lane"}),(0,n.jsx)(j.o,{}),(0,n.jsxs)(v.f,{children:[(0,n.jsx)(d.x,{mb:4,children:"Deleting a lane can not be undone. Please confirm that you would like to delete this lane."}),(0,n.jsx)(d.x,{mb:8,fontWeight:"bold",fontSize:"lg",children:l})]}),(0,n.jsx)(g.m,{justifyContent:"center",children:(0,n.jsx)(d.x,{width:"100%",children:(0,n.jsx)(a.z,{mb:4,colorScheme:"red",width:"100%",onClick:S,isLoading:C,children:"Delete"})})})]})]})};var b=i(6642);let C=e=>{let{lane:t}=e,i=(0,c.useRouter)(),{isOpen:r,onOpen:l,onClose:u}=(0,s.q)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(o.U,{p:2,children:[(0,n.jsxs)(a.z,{size:"sm",onClick:()=>i.push("/dashboard?view=lanes&edit=".concat(t.id)),children:[(0,n.jsx)(b.dY,{}),(0,n.jsx)(d.x,{ml:1,display:{base:"none",md:"flex"},children:"Edit"})]}),(0,n.jsx)(a.z,{size:"sm",onClick:l,children:(0,n.jsx)(b.pJ,{})})]}),t.carrier&&(0,n.jsx)(y,{carrierId:t.carrierId,id:t.id,dot:t.carrier.dot,lane:"".concat(t.origin," â ").concat(t.destination),isOpen:r,onClose:u})]})};var w=i(697),S=i(4609),k=i(5299);let I=e=>{let t=k.OU.flatMap(e=>e.value),i=k.aQ.flatMap(e=>e.value),n=k.sv.flatMap(e=>e.value);return t.includes(e)?f.Q2y.Tractor:i.includes(e)?f.Q2y.Trailer:n.includes(e)?f.Q2y.Specialized:f.Q2y.Trailer},A=e=>{let{lane:t}=e,i=(0,l.AJ)();return(0,n.jsxs)(d.x,{fontSize:"md",p:4,overflow:"hidden",children:[(0,n.jsx)(r.K,{direction:{base:"column",md:"row"},mb:2,children:(0,n.jsxs)(o.U,{children:[(0,n.jsx)(d.x,{as:"b",children:t.origin}),(0,n.jsx)(d.x,{children:"â"}),(0,n.jsx)(d.x,{as:"b",children:t.destination})]})}),(0,n.jsxs)(o.U,{children:[(0,n.jsx)(w.$,{id:t.id,type:I(t.subtype),subtype:t.subtype,size:"md"}),(0,n.jsx)(d.x,{textColor:i,style:{fontVariant:"all-small-caps"},children:t.availableDays})]}),t.notes&&(0,n.jsx)(S.H,{header:"".concat(t.origin," â ").concat(t.destination),body:t.notes,children:(0,n.jsxs)(a.z,{mt:4,w:["100%","auto"],size:"sm",children:[(0,n.jsx)(d.x,{children:(0,n.jsx)(b.Zi,{})}),(0,n.jsx)(d.x,{ml:1,children:"Notes"})]})})]})},T=e=>{let{lanes:t,editable:i=!1}=e,s=(0,l.Xn)();return(0,n.jsx)(r.K,{spacing:2,children:t.flatMap(e=>(0,n.jsxs)(r.K,{direction:"row",spacing:2,justifyContent:"space-between",rounded:"lg",minH:"60px",backgroundColor:s,children:[(0,n.jsx)(A,{lane:e}),i&&(0,n.jsx)(C,{lane:e})]},e.id))})}},4436:function(e,t,i){i.d(t,{g:function(){return p}});var n=i(5893),r=i(8029),l=i(8329),s=i(7873),o=i(8491),a=i(1163),d=i.n(a),c=i(5953),u=i(101),h=i(697),x=i(6642);let p=e=>{let{equipment:t,editable:i=!1,bgColor:a}=e,p=(0,c.Xn)(),m=(0,c.AJ)();return(0,n.jsxs)(r.x,{backgroundColor:null!=a?a:p,rounded:"lg",p:4,minW:72,minH:"168px",fontSize:"md",children:[(0,n.jsxs)(l.k,{justifyContent:"space-between",children:[(0,n.jsxs)(l.k,{children:[(0,n.jsx)(s.Vp,{size:"md",mr:1,children:t.type}),(0,n.jsx)(h.$,{id:t.id,type:t.type,subtype:t.subtype,size:"md"})]}),i&&(0,n.jsxs)(o.z,{size:"sm",onClick:()=>d().push({href:"/dashboard",query:{view:"equipment",edit:t.id}}),children:[(0,n.jsx)(x.dY,{}),(0,n.jsx)(r.x,{ml:1,children:"Edit"})]})]}),(0,n.jsxs)(r.x,{mt:2,children:[(0,n.jsx)(r.x,{minH:4,overflowX:"scroll",style:{scrollbarWidth:"none"},children:t.number&&(0,n.jsxs)(r.x,{fontWeight:"bold",children:["#",t.number]})}),t.vin&&(0,n.jsx)(u.O,{copy:t.vin,text:"VIN: "+t.vin,size:"sm"})]}),(0,n.jsxs)(r.x,{mt:2,textColor:m,fontSize:"md",children:[(0,n.jsx)(r.x,{children:t.year}),(0,n.jsxs)(r.x,{noOfLines:1,children:[t.make," ",t.model]})]})]},t.id)}},2531:function(e,t,i){i.d(t,{F:function(){return o}});var n=i(5893),r=i(3636),l=i(3321),s=i(4436);let o=e=>{let{equipment:t,direction:i="row",editable:o=!1}=e,a=()=>t.flatMap(e=>(0,n.jsx)(s.g,{equipment:e,editable:o},e.id));return"row"===i?(0,n.jsx)(r.U,{spacing:2,overflowX:"scroll",style:{scrollbarWidth:"none"},whiteSpace:"nowrap",w:"100%",pb:4,children:a()}):(0,n.jsx)(l.M,{columns:{md:1,lg:2,xl:3},spacing:2,w:"100%",pb:4,children:a()})}},697:function(e,t,i){i.d(t,{$:function(){return x}});var n=i(5893),r=i(2594),l=i(933),s=i(7873),o=i(3898),a=i(345),d=i(5419),c=i(5299),u=i(5011);let h=e=>{switch(e){case u.Q2y.Specialized:return"yellow";case u.Q2y.Tractor:return"green";case u.Q2y.Trailer:return"blue"}},x=e=>{var t;let{id:i,type:u,subtype:x,size:p}=e,m=null===(t=c.IQ.find(e=>e.value==x))||void 0===t?void 0:t.name;return(0,n.jsxs)(r.J,{trigger:"hover",children:[(0,n.jsx)(l.x,{children:(0,n.jsx)(s.Vp,{colorScheme:h(u),variant:"solid",size:p,cursor:"pointer",children:x},i)}),(0,n.jsxs)(o.y,{w:"auto",children:[(0,n.jsx)(a.Q,{}),(0,n.jsx)(d.b,{children:m})]})]},i)}},5952:function(e,t,i){i.d(t,{M:function(){return F}});var n=i(5893),r=i(7294),l=i(3658),s=i(8029),o=i(5490),a=i(4614),d=i(5901),c=i(3828),u=i(8329),h=i(2594),x=i(933),p=i(3898),m=i(5419),j=i(971);let v=(0,r.createContext)({}),g=()=>(0,r.useContext)(v),f=e=>{let{initialDate:t,time:i,children:l}=e,[s,o]=(0,r.useState)(void 0),a=(0,r.useState)(void 0),d=(0,r.useState)(!1),c=(0,r.useState)(0),u=(0,r.useState)(0);(0,r.useEffect)(()=>{o(t?new Date(t):void 0)},[t]);let h=(0,r.useMemo)(()=>({date:s,setDate:o,selectedDate:a,selectingYear:d,time:u,yearScrollIndex:c,isTime:!!i}),[s,i,a,d,u,c]);return(0,n.jsx)(v.Provider,{value:h,children:l})};var y=i(3636);let b=["Su","Mo","Tu","We","Th","Fr","Sa"],C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],w=["January","February","March","April","May","June","July","August","September","October","November","December"];var S=i(8491);class k{selected(e){var t,i,n,r;if(this.months)return e.getMonth()===(null===(n=this.selectedDate)||void 0===n?void 0:n.getMonth());if(this.years)return e.getFullYear()===(null===(r=this.viewingDate)||void 0===r?void 0:r.getFullYear());let l=e.getDate()===(null===(t=this.selectedDate)||void 0===t?void 0:t.getDate())&&e.getMonth()===(null===(i=this.selectedDate)||void 0===i?void 0:i.getMonth())&&e.getFullYear()===this.selectedDate.getFullYear();return l}outOfMonth(e,t){return(0===e&&t.getDate()>7||e===this.dates.length-1&&7>=t.getDate())&&!(this.months||this.years)}getButtonText(e){return this.months?C[e.getMonth()]:this.years?e.getFullYear():e.getDate()}constructor(e,t,i,n,r){this.dates=e,this.viewingDate=t,this.selectedDate=i,this.years=n,this.months=r}}let I=e=>{var t;let{dates:i,title:l,months:o=!1,years:a=!1}=e,d=g(),c=d.date,h=d.setDate,[x,p]=d.selectedDate,m=(0,r.useMemo)(()=>new k(i,null!=c?c:new Date,null!==(t=null!=x?x:c)&&void 0!==t?t:new Date,a,o),[i,c,x,a,o]),j=e=>()=>{o?(null==x||x.setFullYear((null==c?void 0:c.getFullYear())||new Date().getFullYear()),null==x||x.setMonth(e.getMonth()),p(new Date(x||new Date)),h(new Date(x||new Date))):a?(null==c||c.setFullYear(e.getFullYear()),h(new Date(c||new Date))):(p(new Date(e)),h(new Date(e)))};return(0,n.jsxs)(u.k,{direction:"column","flex-basis":"0",justifyContent:"center",children:[!!l&&(0,n.jsx)(s.x,{m:2,textAlign:"center",fontWeight:"semibold",children:l}),i.map((e,t)=>(0,n.jsx)(S.z,{mt:t>0?"2":void 0,size:"sm",onClick:j(e),variant:m.selected(e)?"solid":"ghost",colorScheme:m.selected(e)?"teal":void 0,color:m.outOfMonth(t,e)?"gray.400":void 0,children:m.getButtonText(e)},t))]})},A=()=>{var e;let t=g(),i=t.date,[l,s]=(0,r.useState)();return(0,r.useEffect)(()=>{s(function(e){let t=new Date(e),i=t.getFullYear(),n=t.getMonth(),r=new Date(i,n,1).getDay(),l=new Date(i,n+1,0).getDate(),s=new Date(i,n+1,0).getDay(),o=new Date(i,n,0).getDate(),a=[],d=o-r;
1return[...Array(Math.round((l+r+(7-s))/7))].forEach((e,t)=>{var s,c,u,h;let x=null!==(h=null==a?void 0:null===(s=a[t-1])||void 0===s?void 0:null===(c=s[6])||void 0===c?void 0:null===(u=c.getDate)||void 0===u?void 0:u.call(c))&&void 0!==h?h:d,p=[...Array(7)].map((e,s)=>0===t?s>=r?new Date(i,n,s-r+1):new Date(i,n-1,o-(r-s-1)):x+1+s>l?new Date(i,n+1,x+1+s-l):new Date(i,n,x+1+s));a.push(p)}),a.reduce((e,t)=>e.concat(t),[]).reduce((e,t,i)=>(e[i%7].push(t),e),[[],[],[],[],[],[],[]])}(i||new Date))},[i]),(0,n.jsx)(y.U,{children:b.map((t,i)=>(0,n.jsx)(I,{title:t,dates:null!==(e=null==l?void 0:l[i])&&void 0!==e?e:[]},i))})};var T=i(4831),O=i(3712);let E=e=>{let{dates:t,title:i,columnSize:l=6,subtitle:o="",...a}=e;return(0,n.jsxs)(O.K,{children:[(0,n.jsxs)(u.k,{flexDirection:"row",justifyContent:"center",alignItems:"center",children:[(0,n.jsx)(s.x,{mt:2,textAlign:"center",fontWeight:"semibold",children:i}),!!o&&(0,n.jsx)(s.x,{mt:2,ml:2,textAlign:"center",fontWeight:"medium",fontSize:"sm",children:o})]}),(0,n.jsx)(u.k,{children:(function(e,t){let i=0,n=e.length,r=[];for(i=0;i<n;i+=t){let n=e.slice(i,i+t);r.push(n)}return r})(t,l).map((e,t)=>(0,r.createElement)(I,{dates:e,...a,key:t}))})]})},D=()=>{let e=g(),t=e.date,[i]=e.yearScrollIndex,l=(0,r.useMemo)(()=>(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:18,i=e.getFullYear(),n=Math.floor((i-2e3)/t),r=2e3+n*t;return[...Array(t)].map((t,i)=>new Date(r+i,e.getMonth(),e.getDate()))})(new Date(2e3+24*i,0),24),[i]),s=(0,r.useMemo)(()=>(function(e){let t=e.getFullYear(),i=e.getDate();return[...Array(12)].map((e,n)=>new Date(t,n,i))})(t||new Date),[t]);return(0,n.jsxs)(y.U,{children:[(0,n.jsx)(E,{title:"Months",dates:s,columnSize:6,months:!0}),(0,n.jsx)(T.i,{orientation:"vertical",h:"auto",alignSelf:"stretch"}),(0,n.jsx)(E,{title:"Years",subtitle:"(".concat(l[0].getFullYear()," - ").concat(l[l.length-1].getFullYear(),")"),dates:l,columnSize:6,years:!0})]})},z=()=>{let e=g(),[t]=e.selectingYear;return t?(0,n.jsx)(D,{}):(0,n.jsx)(A,{})};var q=i(2519),L=i(6642);let R=()=>{let e=g(),t=e.date,i=e.setDate,[r,l]=e.selectingYear,o=t||new Date,a=o.getMonth(),d=o.getFullYear(),c=t=>()=>{let n="backward"===t?-1:1;if(r){e.yearScrollIndex[1](e=>e+n);return}a===("backward"===t?0:11)?o.setFullYear(d+n,Math.abs(11-a)):o.setMonth(a+n),i(new Date(o))},h=w[o.getMonth()];return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(u.k,{alignItems:"center",my:2,children:[(0,n.jsx)(s.x,{children:(0,n.jsx)(q.h,{icon:(0,n.jsx)(L.wy,{}),size:"sm","aria-label":"previous",onClick:c("backward")})}),(0,n.jsx)(u.k,{flex:"1",justifyContent:"center",fontWeight:"bold",fontSize:"large",userSelect:"none",children:r?"Back":"".concat(h," ").concat(d)}),(0,n.jsx)(s.x,{children:(0,n.jsx)(q.h,{icon:(0,n.jsx)(L.XC,{}),size:"sm","aria-label":"next",onClick:c("forward")})})]}),(0,n.jsx)(T.i,{})]})},U=e=>{let{children:t,dateSelected:i}=e,v=(0,j.K)(),{onOpen:f,onClose:y,isOpen:b}=(0,l.q)(),{selectedDate:[C,w]}=g();return((0,r.useEffect)(()=>{C&&(y(),w(void 0),i(C))},[i,y,C,w]),v)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.x,{onClick:f,children:t}),(0,n.jsxs)(o.u_,{isCentered:!0,onClose:y,size:"xl",isOpen:b,children:[(0,n.jsx)(a.Z,{}),(0,n.jsx)(d.h,{children:(0,n.jsx)(c.f,{children:(0,n.jsxs)(u.k,{direction:"column",children:[(0,n.jsx)(R,{}),(0,n.jsx)(z,{})]})})})]})]}):(0,n.jsxs)(h.J,{placement:"bottom-start",isOpen:b,onOpen:f,onClose:y,closeDelay:0,computePositionOnMount:!1,isLazy:!0,children:[(0,n.jsx)(x.x,{children:t}),(0,n.jsx)(p.y,{width:"auto",children:(0,n.jsx)(m.b,{children:(0,n.jsxs)(u.k,{direction:"column",children:[(0,n.jsx)(R,{}),(0,n.jsx)(z,{})]})})})]})},F=r.memo(e=>(0,n.jsx)(f,{initialDate:e.initialDate,children:(0,n.jsx)(U,{...e})}))},1720:function(e,t,i){i.d(t,{y:function(){return h}});var n=i(5893),r=i(8029),l=i(4506),s=i(980),o=i(4795),a=i(2175),d=i(7294),c=i(5953),u=i(4964);let h=e=>{var t;let{label:i,textarea:h,max:x,...p}=e,[m,j]=(0,d.useState)(!1),[v,{error:g,value:f}]=(0,a.U$)({name:p.name,required:p.required});(0,d.useEffect)(()=>{x&&j(v.value.length>x)},[v.value.length,x,f]);let y=(0,c.Yg)();return(0,n.jsx)(r.x,{mt:null!==(t=p.mt)&&void 0!==t?t:4,children:(0,n.jsxs)(l.NI,{isInvalid:!!g||m,children:[(0,n.jsx)(s.l,{htmlFor:v.name,fontWeight:"normal",children:i}),(0,n.jsx)(u.I,{id:v.name,textarea:h,...p,...v,onWheel:e=>{"number"===p.type&&e.currentTarget.blur()},mt:2}),g?(0,n.jsx)(o.J1,{children:g}):null,m?(0,n.jsxs)(r.x,{color:y,mt:2,fontSize:"sm",children:[i," can not be more than ",x," characters.",(0,n.jsxs)(r.x,{children:["Current count: ",v.value.length]})]}):null]})},v.name)}},4964:function(e,t,i){i.d(t,{I:function(){return s}});var n=i(5893),r=i(3244),l=i(2206);let s=e=>{let t,i,{id:s,textarea:o,...a}=e;return t=o?r.g:l.I,o&&(i="160px"),(0,n.jsx)(t,{...a,id:s,w:"100%",p:2,minH:i,borderWidth:"1px"})}},8614:function(e,t,i){i.d(t,{P:function(){return g}});var n=i(5893),r=i(2449),l=i(8029),s=i(3636),o=i(7873),a=i(4296),d=i(2206),c=i(9342),u=i(8329),h=i(7294),x=i(9218),p=i(5953),m=i(6642);let j=(e,t,i)=>{if(!window.google)return;if("0"===e.value&&"Anywhere"===e.name){i({address:"Anywhere",latitude:0,longitude:0,type:"ANYWHERE"});return}var n={placeId:e.value,fields:["address_components","formatted_address","geometry.location"]};let r=new google.maps.places.PlacesService(t);r.getDetails(n,(e,t)=>{var n,r;if(t!=google.maps.places.PlacesServiceStatus.OK||!e||!(null==e?void 0:e.formatted_address)||!(null===(n=e.geometry)||void 0===n?void 0:n.location))return;let l=e.geometry.location.lat(),s=e.geometry.location.lng(),o=null!==(r=e.address_components)&&void 0!==r?r:[],a=o.reduce((e,t)=>
1(t.types.includes("locality")?e.city=t.long_name:t.types.includes("administrative_area_level_1")?e.state=t.short_name:t.types.includes("country")?e.country=t.short_name:t.types.includes("postal_code")&&(e.postalCode=t.long_name),e),{});a.city&&a.state?i({address:"".concat(a.city,", ").concat(a.state),latitude:l,longitude:s,type:"ADDRESS"}):a.state?i({address:a.state,latitude:l,longitude:s,type:"STATE"}):i({address:e.formatted_address,latitude:l,longitude:s,type:"ADDRESS"})})},v=(e,t,i,n,r)=>{if(e.length<2){i([]);return}if(!window.google)return;let l=new google.maps.places.AutocompleteService,s=["locality","postal_code","administrative_area_level_3"];r&&(s=["locality","postal_code","administrative_area_level_1","administrative_area_level_3"]),l.getPlacePredictions({input:e,types:s,componentRestrictions:{country:["us","ca","mx"]},sessionToken:t},(t,r)=>{if(r!=google.maps.places.PlacesServiceStatus.OK||!t)return;let l=t.filter(e=>e.place_id).flatMap(e=>({value:e.place_id,name:e.description}));n&&"anywhere".includes(e.toLowerCase())&&l.unshift({value:"0",name:"Anywhere"}),i(l)})},g=e=>{var t,i;let{options:g,multiselect:f=!1,autocomplete:y=!1,address:b=!1,anywhere:C=!1,states:w=!0,shouldReset:S=!1,defaultValue:k,selectedPlace:I,selectedOption:A,selectedOptionDetails:T,...O}=e,E=(0,p.md)(),D=(0,h.useRef)(null),z=(0,h.useRef)(null),q=(0,h.useRef)(null),L=(0,h.useRef)(null),[R,U]=(0,h.useState)(!1);(0,r.O)({ref:z,handler:()=>U(!1)});let[F,M]=(0,h.useState)(-1);(0,x.y1)("Up",e=>{if(R){if(null==e||e.preventDefault(),F<=0){var t;null===(t=D.current)||void 0===t||t.focus()}else M(e=>e-1);P("up")}},[R,F]),(0,x.y1)("Down",e=>{R&&(null==e||e.preventDefault(),F!==_.length-1&&(M(e=>e+1),P("down")))},[R,F]),(0,x.y1)("Tab",()=>{U(!1)}),(0,x.y1)("Enter",()=>{if(!R||F<=-1)return;let e=_[F];Y(e)},[R,F]);let P=e=>{if(!q.current||!L.current)return;let t=F-1,i=F+1,n=L.current.offsetHeight,r=q.current.offsetHeight,l=q.current.scrollTop;switch(e){case"up":t*n<l&&(q.current.scrollTop=l-n);return;case"down":i*n+16>=r&&(q.current.scrollTop=(i-(r-16)/n)*n+n);return}},[W,V]=(0,h.useState)(new Set),[_,N]=(0,h.useState)(null!=g?g:[]),K=(0,h.useMemo)(()=>{switch(O.size){case"xs":return 6;case"sm":return 8;case"md":default:return 10;case"lg":return 12;case"xl":return 14;case"2xl":return 16}},[O.size]),[Q,H]=(0,h.useState)("");(0,h.useEffect)(()=>{window.google&&(i=new google.maps.places.AutocompleteSessionToken)},[window]),(0,h.useEffect)(()=>{if(void 0===k)return;let e=null==g?void 0:g.find(e=>e.value===k);e?H(e.name):H(k)},[k,g]),(0,h.useEffect)(()=>{N(null!=g?g:[])},[g]),(0,h.useEffect)(()=>{var e;if(!y)return;if(b){v(Q,i,e=>N(e),C,w);return}if(Q.length<=0){N(null!=g?g:[]);return}let t=null!==(e=null==g?void 0:g.filter(e=>e.name.toLowerCase().includes(Q.toLowerCase())))&&void 0!==e?e:[];N(t)},[b,C,w,y,Q,g,i]),(0,h.useEffect)(()=>{R||M(-1)},[R]),(0,h.useEffect)(()=>{S&&V(new Set)},[S]);let Y=e=>{if(M(-1),U(!1),b)D.current&&j(e,D.current,e=>{H(e.address),A&&A(e.address),I&&I(e)});else{H(f?"":e.name);let t=new Set(f?W.add(e):[e]);V(t);let i=Array.from(t).flatMap(e=>e.value).join(",");A&&A(i),!f&&T&&T(e)}},J=e=>{if(!W.has(e))return;W.delete(e);let t=new Set(W);V(t);let i=Array.from(t).flatMap(e=>e.value).join(",");A&&A(i)};return(0,n.jsxs)(l.x,{...O,ref:z,children:[f&&W&&W.size>0&&(0,n.jsx)(s.U,{mt:2,mb:2,spacing:2,overflowX:"scroll",style:{scrollbarWidth:"none"},whiteSpace:"nowrap",children:Array.from(W).flatMap(e=>(0,n.jsx)(l.x,{children:(0,n.jsxs)(o.Vp,{size:"lg",borderRadius:"md",variant:"solid",colorScheme:"teal",children:[(0,n.jsx)(o.Sn,{children:e.name}),(0,n.jsx)(o.SD,{onClick:()=>{J(e)}})]},e.value)},e.value))}),(0,n.jsxs)(a.B,{children:[(0,n.jsx)(d.I,{...O,w:"100%",borderWidth:"1px",borderRadius:"md",cursor:y?"text":"pointer",ref:D,value:Q,readOnly:!y,onChange:e=>{H(e.target.value)},onKeyDown:e=>{"ArrowDown"===e.code&&(e.preventDefault(),e.currentTarget.blur(),M(0)),"Tab"===e.code&&U(!1)},onFocus:()=>{M(-1),U(!0)}}),Q&&y&&(0,n.jsx)(c.x,{mt:O.mt,h:K,children:(0,n.jsx)(m.Tw,{onClick:()=>{H("")}})}),!y&&(0,n.jsx)(c.x,{mt:O.mt,h:K,children:(0,n.jsx)(m.v4,{onClick:()=>{U(e=>!e)}})})]}),R&&_&&_.length>0&&(0,n.jsx)(l.x,{position:"relative",children:(0,n.jsx)(u.k,{direction:"column",mt:2,border:"1px",borderColor:"chakra-border-color",rounded:"md",p:2,zIndex:"popover",position:"absolute",backgroundColor:"chakra-body-bg",w:null===(t=D.current)||void 0===t?void 0:t.offsetWidth,maxH:"416px",overflowY:"scroll",ref:q,children:null==_?void 0:_.flatMap((e,t)=>(0,n.jsx)(l.x,{p:2,ref:L,cursor:"pointer",rounded:"md",backgroundColor:F===t?E:"chakra-body-bg",onClick:()=>{Y(e)},_hover:{backgroundColor:E},children:e.name},e.value))})})]})}},6642:function(e,t,i){i.d(t,{$6:function(){return M},Br:function(){return z},D7:function(){return O},DJ:function(){return J},Ec:function(){return C},LQ:function(){return D},NW:function(){return en},No:function(){return ee},Oq:function(){return K},PT:function(){return p},Qq:function(){return q},RI:function(){return el},Rd:function(){return B},SN:function(){return H},T3:function(){return S},TI:function(){return A},Tw:function(){return k},UG:function(){return P},UR:function(){return er},Vq:function(){return U},W1:function(){return et},X$:function(){return m},XC:function(){return b},XX:function(){return F},Yw:function(){return ea},Zi:function(){return Y},Zm:function(){return ed},aA:function(){return ei},bb:function(){return I},by:function(){return W},dY:function(){return E},g8:function(){return w},h0:function(){return L},hQ:function(){return _},kL:function(){return Q},nQ:function(){return j},oE:function(){return es},pJ:function(){return T},pO:function(){return $},rE:function(){return v},t0:function(){return X},tB:function(){return ec},tE:function(){return R},tv:function(){return V},uB:function(){return eo},uP:function(){return y},v4:function(){return g},vd:function(){return Z},wl:function(){return G},wy:function(){return f},yu:function(){return N}});var n=i(8193),r=i(7516),l=i(3750),s=i(471),o=i(231),a=i(6893),d=i(6653),c=i(3854),u=i(155),h=i(5434),x=i(7106);
1let p=d.HwV,m=a.Wpg,j=d.vyQ,v=u.cfq,g=u._i7,f=u.z2h,y=x.cHs,b=u.ABF,C=x.A3p,w=u.pzk,S=r.YFw,k=u.bjh,I=d.LC5,A=h.twx,T=l.tgD,O=o.j2d,E=a.vPQ,D=h.ixJ,z=d.hIW,q=r.QpC,L=r.rpH,R=n.Zju,U=o.Am9,F=x.fVV,M=s.CIC,P=d.BNm,W=h.$x8,V=d.iB,_=h.K1g,N=n.t0C,K=u.pLT,Q=o.TLr,H=d.t75,Y=r.KuV,J=n._nT,B=d.JF1,Z=d.LBv,X=d.hov,G=a.O9D,$=d.ueT,ee=d.$b,et=d.a4h,ei=a.A8q,en=o.Mei,er=c.Iz7,el=l.FQA,es=d.EFt,eo=o.wOZ,ea=a.C4B,ed=o.lcJ,ec=a.fzv},7271:function(e,t,i){i.d(t,{b:function(){return o}});var n=i(5893),r=i(1046),l=i(2519),s=i(6642);let o=e=>{let{size:t="lg",onClick:i}=e,{toggleColorMode:o}=(0,r.If)(),a=(0,r.ff)("dark","light");(0,r.ff)(!0,!1);let d=(0,r.ff)(s.kL,s.NW);return(0,n.jsx)(l.h,{size:t,fontSize:t,color:"current",onClick:()=>{o(),i()},icon:(0,n.jsx)(d,{}),"aria-label":"Switch to ".concat(a," mode")})}},3722:function(e,t,i){i.d(t,{v:function(){return o}});var n=i(5893),r=i(9008),l=i.n(r),s=i(1163);let o=e=>{let{title:t,appendDefaultTitle:i,ogImage:r,removeIndex:o=!1}=e,{asPath:a}=(0,s.useRouter)(),d=()=>{let e="LOST FR8 - Automate Your Truck List";return t&&i?t+" - ".concat(e):t||e};return(0,n.jsxs)(l(),{children:[(0,n.jsx)("title",{children:d()}),(0,n.jsx)("meta",{property:"og:title",content:d()}),(0,n.jsx)("meta",{property:"og:type",content:"website"}),(0,n.jsx)("meta",{property:"og:url",content:"https://www.lostfr8.com".concat(a)}),(0,n.jsx)("meta",{property:"og:image",content:r||"https://www.lostfr8.com/images/lostfr8.png"}),(0,n.jsx)("meta",{property:"og:description",content:"LOST FR8 - Automate Your Truck List. Send a truck list with one click to brokers and shippers."}),(0,n.jsx)("meta",{charSet:"utf-8"}),(0,n.jsx)("meta",{name:"viewport",content:"initial-scale=1.0, width=device-width"}),o&&!0===o&&(0,n.jsx)("meta",{name:"robots",content:"noindex"})]})}},6861:function(e,t,i){i.d(t,{h:function(){return ec},Q:function(){return ed}});var n=i(5893),r=i(3658),l=i(8029),s=i(8329),o=i(3636),a=i(2553),d=i(8491),c=i(8899),u=i(5675),h=i.n(u),x=i(1163),p=i.n(x),m=i(7294),j=i(708),v=i(9183),g=i(5011),f=i(5005),y=i(1233);let b=()=>{let{carrierId:e,setCarrierId:t,setIsLoading:i}=(0,y.d4)(),[{data:n,fetching:r}]=(0,g.ULu)(),[{data:l,fetching:s,stale:o}]=(0,g.WoI)({pause:!(null==n?void 0:n.authUser)}),a=(0,m.useMemo)(()=>null==l?void 0:l.userCarriers,[null==l?void 0:l.userCarriers]),d=(0,m.useMemo)(()=>a&&a.length>0,[a]);(0,m.useEffect)(()=>{i(r||s||o)},[e,r,s,i,o]),(0,m.useEffect)(()=>{r||s||o||(!e&&d&&a&&(null==n?void 0:n.authUser)&&t(a[0].id),!d&&(null==n?void 0:n.authUser)&&t(void 0))},[e,d,n,r,s,o,a,t])};var C=i(8954),w=i(971),S=i(6642),k=i(9780),I=i(6596),A=i(7879),T=i(5490),O=i(4614),E=i(5901),D=i(7391),z=i(1360),q=i(3828),L=i(4831),R=i(8186),U=i(2206),F=i(5443),M=i(6157),P=i(5953),W=i(123);let V=e=>{let{isOpen:t,onClose:i}=e,r=(0,x.useRouter)(),s=(0,I.p)(),a=(0,P.fG)(),c=(0,P.AJ)(),u=(0,C.o)("signup"),j=(0,C.o)("next"),[v,y]=(0,m.useState)(),[{data:b,fetching:w}]=(0,g.ULu)(),[S,k]=(0,m.useState)("SignIn"),[V,_]=(0,m.useState)(""),[N,K]=(0,m.useState)(""),[Q,H]=(0,m.useState)(""),[Y,J]=(0,m.useState)(),[{fetching:B},Z]=(0,g.y6P)(),[{fetching:X},G]=(0,g.lLU)(),[{fetching:$},ee]=(0,g.qBs)(),[{fetching:et},ei]=(0,g.NMW)(),[{fetching:en},er]=(0,g.zNA)(),el=async()=>{var e,t,n,r,l,o;let a=V.trim(),d=N.trim(),c=Q.trim();switch(S){case"SignIn":if(!a||!d)return;(0,f.j)(f.zW.AuthModal.ClickSignIn);let u=await ei({email:a,password:d}),h=null===(e=u.data)||void 0===e?void 0:e.emailSignIn.error;(null===(t=u.data)||void 0===t?void 0:t.emailSignIn.success)?(i(),(0,f.xU)(a)):h&&s({title:"Error.",description:h,status:"error",duration:5e3,position:"top",isClosable:!0});return;case"SignUp":if(!a||!d||!c)return;if(d!==c){s({title:"Error.",description:"Passwords do not match.",status:"error",duration:5e3,position:"top",isClosable:!0});return}(0,f.j)(f.zW.AuthModal.ClickCreateAccount);let x=await ee({email:a,password:d}),p=null===(n=x.data)||void 0===n?void 0:n.emailSignUp.error;(null===(r=x.data)||void 0===r?void 0:r.emailSignUp.success)?(s({title:"Success!",description:"Please check your email for an email verification link.",status:"success",duration:1e4,position:"top",isClosable:!0}),i(),(0,f.MZ)(a)):p&&s({title:"Error.",description:p,status:"error",duration:5e3,position:"top",isClosable:!0});return;case"ForgotPassword":if(!a)return;(0,f.j)(f.zW.AuthModal.ClickSubmitForgotPassword);let m=await er({email:a}),j=null===(l=m.data)||void 0===l?void 0:l.forgotPassword.error;(null===(o=m.data)||void 0===o?void 0:o.forgotPassword.success)?(s({title:"Success!",description:"Please check your email for a link to reset your password.",status:"success",duration:5e3,position:"top",isClosable:!0}),i()):j&&s({title:"Error.",description:j,status:"error",duration:5e3,position:"top",isClosable:!0});return;case"LinkAccount":if(!d||!Y)return;(0,f.j)(f.zW.AuthModal.ClickLinkAccount),es(Y.email,Y.credential,d);return}},es=(0,m.useCallback)(async(e,t,n)=>{var r,l;let o=await Z({credential:t,password:n}),a=null===(r=o.data)||void 0===r?void 0:r.googleAuth.error;(null===(l=o.data)||void 0===l?void 0:l.googleAuth.success)?(i(),(0,f.xU)(e),n||(0,f.j)(f.zW.AuthModal.ClickCreateAccountWithGoogle)):a&&s({title:"Error.",description:a,status:"error",duration:5e3,position:"top",isClosable:!0})},[Z,i,s]);return(0,m.useEffect)(()=>
1{if(!window.google||!v)return;let e=async e=>{var t;(0,f.j)(f.zW.AuthModal.ClickGoogleAuth);let i=await G({credential:e.credential}),n=null===(t=i.data)||void 0===t?void 0:t.verifyPasswordToLinkGoogle;if(n){if(!0===n.verifyPassword){k("LinkAccount"),J({email:n.email,credential:e.credential});return}es(n.email,e.credential)}};google.accounts.id.initialize({client_id:"206893144539-f5jmr5jt3cds0f00itvevg8kdgef7u8m.apps.googleusercontent.com",callback:e}),google.accounts.id.renderButton(v,{type:"standard",theme:"outline",size:"large",shape:"rectangular",text:"continue_with",width:"400px",logo_alignment:"center"})},[Z,v,es,i,s,G]),(0,m.useEffect)(()=>{u&&k("SignUp")},[u]),(0,m.useEffect)(()=>{(null==b?void 0:b.authUser)&&j&&p().replace(j)},[b,j]),(0,m.useEffect)(()=>{t||(k("SignIn"),_(""),K(""),H(""),J(void 0))},[t]),(0,n.jsxs)(T.u_,{isOpen:t,onClose:i,children:[(0,n.jsx)(O.Z,{}),(0,n.jsxs)(E.h,{px:6,children:[(0,n.jsx)(D.x,{children:(()=>{switch(S){case"SignUp":return"Sign up";case"SignIn":case"LinkAccount":return"Sign in";case"ForgotPassword":return"Forgot password"}})()}),(0,n.jsx)(z.o,{onClick:()=>{(0,f.j)(f.zW.AuthModal.ClickCloseModal),u&&r.back()}}),(0,n.jsxs)(q.f,{children:[(()=>{if(Y)return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.x,{children:"Sign in to link account."}),(0,n.jsxs)(o.U,{mt:4,children:[(0,n.jsx)(h(),{src:M.Z.src,width:24,height:24,alt:"Google logo"}),(0,n.jsx)(l.x,{textColor:c,children:Y.email})]})]});switch(S){case"SignUp":return(0,n.jsxs)(l.x,{children:["Already have an account?"," ",(0,n.jsx)(A.r,{color:a,textDecoration:"underline",onClick:()=>{k("SignIn")},children:"Sign in here"})]});case"SignIn":return(0,n.jsxs)(l.x,{children:["Need to create an account?"," ",(0,n.jsx)(A.r,{color:a,textDecoration:"underline",onClick:()=>{k("SignUp")},children:"Sign up here"})]});case"ForgotPassword":return(0,n.jsx)(A.r,{color:a,textDecoration:"underline",onClick:()=>{k("SignIn")},children:"Back to sign in"})}})(),("SignIn"==S||"SignUp"==S)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.x,{mt:8,borderRadius:"4px",overflow:"hidden",ref:e=>y(e)}),(0,n.jsxs)(o.U,{pt:8,children:[(0,n.jsx)(L.i,{}),(0,n.jsx)(l.x,{children:"or"}),(0,n.jsx)(L.i,{})]})]}),(0,n.jsxs)(R.g,{pt:8,spacing:4,children:[("SignIn"==S||"SignUp"==S||"ForgotPassword"==S)&&(0,n.jsx)(U.I,{placeholder:"email address",type:"email",value:V,onChange:e=>_(e.target.value),onKeyDown:(0,W.c)(el),size:"lg",autoFocus:!0}),("SignIn"==S||"SignUp"==S||"LinkAccount"==S)&&(0,n.jsx)(U.I,{placeholder:"password",type:"password",value:N,onChange:e=>K(e.target.value),onKeyDown:(0,W.c)(el),size:"lg"}),"SignUp"==S&&(0,n.jsx)(U.I,{placeholder:"confirm password",type:"password",value:Q,onChange:e=>H(e.target.value),onKeyDown:(0,W.c)(el),size:"lg"})]})]}),(0,n.jsx)(F.m,{mb:4,justifyContent:"center",children:(0,n.jsxs)(l.x,{width:"100%",children:[(0,n.jsx)(d.z,{mb:4,colorScheme:"teal",width:"100%",onClick:el,isLoading:w||et||$||X||B||en,children:(()=>{switch(S){case"SignUp":return"Create account";case"SignIn":case"LinkAccount":return"Sign in";case"ForgotPassword":return"Submit"}})()}),"SignUp"==S&&(0,n.jsxs)(l.x,{color:"gray.400",children:["By creating a LOST FR8 account, you are agreeing to our"," ",(0,n.jsx)(A.r,{href:"/terms",color:a,textDecoration:"underline",children:"Terms of Use"})," ","and"," ",(0,n.jsx)(A.r,{href:"/privacy",color:a,textDecoration:"underline",children:"Privacy Policy"}),". You also agree to receive email communications from LOST FR8. You can change your subscription preferences at any time."]}),"SignIn"==S&&(0,n.jsx)(l.x,{children:(0,n.jsx)(A.r,{color:a,textDecoration:"underline",onClick:()=>{k("ForgotPassword"),(0,f.j)(f.zW.AuthModal.ClickForgotPassword)},children:"Forgot your password?"})})]})})]})]})};var _=i(7776);let N=e=>{var t;let{isOpen:i,onClose:r}=e,s=(0,x.useRouter)(),o=(0,I.p)(),a=(0,P.fG)(),u=(0,P.Yg)(),{setCarrierId:h}=(0,y.d4)(),[p]=(0,j.Z)(["ref"]),[v,b]=(0,m.useState)(!1),[C,w]=(0,m.useState)(""),[{fetching:S},k]=(0,g.Egs)(),[{fetching:L,data:R}]=(0,g.jTs)({variables:{dot:parseInt(C)},pause:!v}),M=null==R?void 0:null===(t=R.carrierSnapshotByDOT)||void 0===t?void 0:t.snapshot,V=async()=>{v&&M?N():b(!0)};(0,m.useEffect)(()=>{i||(w(""),b(!1))},[i]);let N=async()=>{var e,t,i,n;let l=parseInt(C.trim());if(!l||!M||!M.dot)return;let a=p.ref,d=await k({carrier:{allowedToOperate:M.allowedToOperate,censusType:M.censusType,name:M.name,dbaName:M.dbaName,street:M.street,city:M.city,state:M.state,country:M.country,postalCode:M.postalCode,dot:M.dot,mc:M.mc,ff:M.ff,mx:M.mx,powerUnits:M.powerUnits,phone:null===(e=M.phone)||void 0===e?void 0:e.toString(),referral:a}}),c=null===(t=d.data)||void 0===t?void 0:null===(i=t.createCarrier)||void 0===i?void 0:i.carrier,u=null===(n=d.data)||void 0===n?void 0:n.createCarrier.error;c?((0,f.j)(f.zW.CreateCarrierModal.ClickCreateCarrier),h(c.id),r(),s.replace({pathname:"/dashboard"})):u&&o({title:"Error.",description:u,status:"error",duration:5e3,position:"top",isClosable:!0})};return(0,n.jsxs)(T.u_,{isOpen:i,onClose:r,closeOnOverlayClick:!1,children:[(0,n.jsx)(O.Z,{}),(0,n.jsxs)(E.h,{px:6,children:[(0,n.jsx)(D.x,{children:"Create a carrier profile"}),(0,n.jsx)(z.o,{onClick:()=>s.back()}),(0,n.jsxs)(q.f,{children:[(0,n.jsx)(l.x,{children:"Enter your USDOT# to get started."}),(0,n.jsx)(U.I,{mt:4,placeholder:"USDOT#",autoFocus:!0,value:C,onChange:e=>{b(!1),w(e.target.value)},onKeyDown:(0,W.c)(V)}),(0,n.jsx)(()=>{let e;return L?(0,n.jsx)(c.$,{mt:4,display:v?"block":"none"}):M&&"object"==typeof M?(0,n.jsxs)(l.x,{display:v?"block":"none",children:[(0,n.jsx)(_.Y,{showRefresh:!1,...M,docketNumbers:(e=[],M.mc&&e.push({id:M.mc,description:"MC# ".concat(M.mc)}),M.ff&&e.push({id:M.ff,description:"FF# ".concat(M.ff)}),M.mx&&e.push({id:M.mx,description:"MX# ".concat(M.mc)}),e)}),(0,n.jsxs)(l.x,{mt:2,color:"gray.400",children:["By creating a carrier profile for USDOT# ",M.dot," you confirm that you are authorized to do so and agree to our"," ",(0,n.jsx)(A.r,{href:"/terms",color:a,textDecoration:"underline",children:"Terms of Use"})," ","and"," ",(0,n.jsx)(A.r,{href:"/privacy",color:a,textDecoration:"underline",children:"Privacy Policy"}),"."]})]}):(0,n.jsx)(l.x,{mt:4,textColor:u,display:v?"block":"none",children:"Unable to find that USDOT#. Please try again."})},{})]}),(0,n.jsx)(F.m,{children:(0,n.jsx)(l.x,{w:"100%",mb:4,children:(0,n.jsx)(d.z,{w:"100%",colorScheme:"teal",onClick:V,isLoading:S,children:v&&M?"Create Profile":"Continue"})})})]})]})};var K=i(1046),Q=i(255),H=i(9355),Y=i(2449),J=i(4793),B=i(8657),Z=i(4032),X=(0,i(8617).Z)(m.memo(e=>{var t;let{width:i,searchResults:r,onClick:o}=e,a=(0,x.useRouter)(),d=(0,C.o)("dot"),c=(0,P.md)(),u=(0,P.AJ)(),h=e=>{d!=e&&((0,f.j)(f.zW.Header.ClickSearchSuggestion),a.push({pathname:"/profile/[dot]",query:{dot:e}}))};return(0,n.jsx)(n.Fragment,{children:r&&r.hits.length>0&&(0,n.jsx)(R.g,{mt:2,p:2,align:"stretch",borderRadius:"md",backgroundColor:"chakra-body-bg",position:"absolute",zIndex:"dropdown",w:i,maxH:"416px",overflowY:"scroll",border:"1px",borderColor:"chakra-border-color",children:null==r?void 0:null===(t=r.hits)||void 0===t?void 0:t.flatMap(e=>(0,n.jsxs)(l.x,{rounded:"md",p:2,cursor:"pointer",_hover:{backgroundColor:c},onClick:()=>{o({name:d==e.dot?"":e.name,dot:e.dot}),h(e.dot)},children:[(0,n.jsxs)(s.k,{alignItems:"center",children:[(0,n.jsx)(l.x,{fontWeight:"semibold",letterSpacing:"wide",textOverflow:"ellipsis",noOfLines:1,pr:2,children:e.name}),(0,n.jsxs)(Z.C,{borderRadius:"full",px:"2",colorScheme:"teal",ml:"auto",children:["USDOT# ",e.dot]})]}),e.mc&&(0,n.jsxs)(l.x,{fontWeight:"normal",fontSize:"sm",textColor:u,children:["MC# ",e.mc]})]},e.objectID))})})})),G=i(4296),$=i(9342),ee=i(3739),et=i(1856),ei=i(9218),en=i(4575),er=i(658),el=(0,en.Z)(m.memo(e=>{let{children:t,value:i,overrideColors:r,hitClicked:s,refine:o,onFocus:a,onBlur:d}=e,u=(0,x.useRouter)(),h=(0,C.o)("dot"),[p,j]=(0,m.useState)({textColor:"white",iconColor:"whiteAlpha.300"}),v=(0,m.useRef)(null),g=(0,m.useRef)(null),[y,b]=(0,m.useState)(i),[w,k]=(0,m.useState)(!1);(0,ei.y1)("/",()=>{var e;null==v||null===(e=v.current)||void 0===e||e.focus(),(0,f.j)(f.zW.Header.SearchHotKey)});let I=e=>{(0,ei.rB)("/")||(b(e),o(e))},A=()=>{let e=y.trim();e&&((0,f.j)(f.zW.Header.Search,{query:e}),u.push({pathname:"/search/[search]",query:{search:e}}))};return(0,m.useEffect)(()=>{r&&j(r)},[r]),(0,m.useEffect)(()=>{var e;b(null!==(e=null==s?void 0:s.name)&&void 0!==e?e:"")},[s]),(0,n.jsxs)(l.x,{w:"100%",children:[(0,n.jsxs)(G.B,{children:[(0,n.jsx)($.Z,{pointerEvents:"none",children:s&&h!=s.dot?(0,n.jsx)(c.$,{color:"white",size:"xs"}):(0,n.jsx)(S.W1,{color:p.iconColor})}),(0,n.jsx)(U.I,{w:"100%",bg:"whiteAlpha.200",color:p.textColor,borderColor:p.iconColor,_hover:{borderColor:"whiteAlpha.400"},placeholder:"Search by USDOT, MC, Carrier Name...",onKeyDown:e=>{"Enter"===e.key&&(e.currentTarget.blur(),d(),A()),"Escape"===e.key&&(e.currentTarget.blur(),d())},ref:v,value:y,onFocus:()=>{k(!0),a()},onBlur:async()=>{await (0,er._)(200),k(!1)},onChange:e=>I(e.currentTarget.value)}),!w&&(0,n.jsx)($.x,{display:["none","none","flex"],pointerEvents:"none",children:(0,n.jsx)(ee.T,{color:p.iconColor,borderColor:p.iconColor,background:"transparent",children:"/"})}),w&&(0,n.jsx)($.x,{children:(0,n.jsx)(et.P,{ref:g,color:p.iconColor,size:"sm",onClick:async()=>{var e;I(""),null===(e=v.current)||void 0===e||e.focus(),await (0,er._)(201),k(!0)}})})]}),t]})}
1));let es=m.memo(e=>{var t;let{value:i="",overrideColors:r}=e,{asPath:s}=(0,x.useRouter)(),o=(0,C.o)("dot"),a={...B.u,search:e=>e.every(e=>{let{params:t}=e;return!t.query||t.query.trim().length<2||u})?Promise.resolve({results:e.map(()=>({hits:[],nbHits:0,nbPages:0,page:0,processingTimeMS:0,hitsPerPage:0,exhaustiveNbHits:!1,query:"",params:""}))}):B.u.search(e)},d=(0,m.useRef)(null),c=(0,m.useRef)(null),[u,h]=(0,m.useState)(),[p,j]=(0,m.useState)("none");return(0,Y.O)({ref:c,handler:()=>j("none")}),(0,m.useEffect)(()=>{h(void 0)},[s]),(0,n.jsx)(l.x,{w:"100%",ref:c,children:(0,n.jsx)(J.Z,{searchClient:a,indexName:"carriers",children:(0,n.jsx)(l.x,{ref:d,children:(0,n.jsx)(el,{value:i,overrideColors:r,hitClicked:u,onFocus:()=>j("flex"),onBlur:()=>j("none"),children:(0,n.jsx)(l.x,{display:p,children:(0,n.jsx)(X,{width:null===(t=d.current)||void 0===t?void 0:t.offsetWidth,onClick:e=>{j("none"),o!=e.dot&&h(e)}})})})})})})}),eo=e=>{let{isOpen:t,onClose:i}=e,r=(0,x.useRouter)(),d=(0,Q.Q)(),{carrierId:u}=(0,y.d4)(),[{data:h}]=(0,g.HWK)({variables:{id:u},pause:!u}),p=(0,K.ff)("gray.200",void 0),m=(0,K.ff)({textColor:"gray.800",iconColor:"gray.800"},void 0);return(0,n.jsxs)(T.u_,{onClose:i,size:"full",isOpen:t,children:[(0,n.jsx)(O.Z,{}),(0,n.jsxs)(E.h,{children:[(0,n.jsx)(z.o,{}),(0,n.jsxs)(q.f,{mt:12,fontSize:"lg",children:[(0,n.jsx)(l.x,{w:"full",mb:4,bg:p,rounded:"md",children:(0,n.jsx)(es,{overrideColors:m})}),(0,n.jsx)(R.g,{spacing:4,mt:2,align:"stretch",children:d.flatMap(e=>(0,n.jsx)(k.D,{href:"/dashboard?view="+e.link,onClick:()=>{(0,f.j)(e.event),i()},children:(0,n.jsxs)(s.k,{align:"center",children:[(0,n.jsx)(a.J,{mr:4,fontSize:"16",_groupHover:{color:"white"},as:e.icon}),e.name,e.fetchingNotifications&&(0,n.jsx)(c.$,{ml:2,size:"xs"}),!e.fetchingNotifications&&e.notifications&&e.notifications>0&&(0,n.jsx)(l.x,{ml:2,textDecoration:"none",children:(0,n.jsx)(H.P,{count:e.notifications})})]})},e.name))}),(0,n.jsxs)(o.U,{mt:12,align:"center",onClick:()=>{var e;r.push({pathname:"/profile/[dot]",query:{dot:null==h?void 0:null===(e=h.carrierId)||void 0===e?void 0:e.dot}}),i()},children:[(0,n.jsx)(l.x,{children:"View profile"}),(0,n.jsx)(a.J,{fontSize:"16",as:S.h0})]}),(0,n.jsxs)(o.U,{mt:4,align:"center",onClick:()=>{window.open("https://docs.lostfr8.com/docs/user-guide","_blank"),i()},children:[(0,n.jsx)(l.x,{children:"Help guides"}),(0,n.jsx)(a.J,{fontSize:"16",as:S.by})]}),(0,n.jsx)(L.i,{mt:12}),(0,n.jsx)(R.g,{mt:12,spacing:4,align:"stretch",children:ed().flatMap(e=>(0,n.jsx)(k.D,{href:e.href,isExternal:e.isExternal,onClick:i,children:e.label},e.href))})]})]})]})};var ea=i(557);let ed=()=>[{href:"/#how-it-works",label:"How it works",isExternal:!1},{href:"/#trucks",label:"Get truck lists",isExternal:!1},{href:"/referral",label:"Referral Program",isExternal:!1},{href:"/pricing",label:"Pricing",isExternal:!1},{href:"https://blog.lostfr8.com",label:"Blog",isExternal:!0}],ec=m.memo(e=>{let{searchInput:t}=e;b();let i=(0,x.useRouter)(),u=(0,C.o)("signin"),I=(0,C.o)("signup"),A=(0,C.o)("next"),T=(0,C.o)("create-carrier"),O=(0,C.o)("ref"),[,E]=(0,j.Z)(["ref"]),D="whiteAlpha.200",z={background:D,color:"white",_hover:{background:"whiteAlpha.300"}},{carrierId:q}=(0,y.d4)(),[{data:L,fetching:R}]=(0,g.ULu)(),[{data:U,fetching:F}]=(0,g.WoI)({pause:!(null==L?void 0:L.authUser)}),M=(0,m.useMemo)(()=>null==U?void 0:U.userCarriers,[null==U?void 0:U.userCarriers]),P=(0,m.useMemo)(()=>i.pathname.includes("dashboard"),[i.pathname]),[{data:W,fetching:_}]=(0,g.lFd)(),K=(0,m.useMemo)(()=>{var e;return null!==(e=null==W?void 0:W.notifications.count)&&void 0!==e?e:0},[W]),Q=(0,m.useMemo)(()=>{if(!M||!q)return;let e=M.find(e=>e.id==q);return null==e?void 0:e.dot},[q,M]),{isOpen:Y,onOpen:J,onClose:B}=(0,r.q)(),{isOpen:Z,onOpen:X,onClose:G}=(0,r.q)(),{isOpen:$,onOpen:ee,onClose:et}=(0,r.q)(),ei=(0,w.K)(),en=()=>
1{if(ei){X(),(0,f.j)(f.zW.Header.ClickMobileMenu);return}P||(i.push("/dashboard"),(0,f.j)(f.zW.Header.ClickDashboard))};(0,m.useEffect)(()=>{(null==L?void 0:L.authUser)&&((0,f.MZ)(L.authUser.email),(0,f.go)({$email:L.authUser.email}))},[null==L?void 0:L.authUser]),(0,m.useEffect)(()=>{(I||u)&&((null==L?void 0:L.authUser)&&A?p().replace(A):J())},[I,u,A,L,J]),(0,m.useEffect)(()=>{T&&ee()},[ee,T]),(0,m.useEffect)(()=>{O&&E("ref",O,{path:"/"})},[O,E]);let er=(0,m.useMemo)(()=>(null==L?void 0:L.authUser)?"none":"flex",[null==L?void 0:L.authUser]);return(0,n.jsx)("header",{children:(0,n.jsxs)(l.x,{id:"header",top:0,left:0,pt:4,px:{base:4,xl:12},zIndex:"overlay",position:"fixed",w:"100%",bgColor:"gray.700",children:[(0,n.jsxs)(s.k,{justifyContent:"space-between",alignItems:"center",children:[(0,n.jsx)(s.k,{justifyContent:"space-between",alignItems:"center",children:(0,n.jsx)("nav",{children:(0,n.jsxs)(o.U,{spacing:(null==L?void 0:L.authUser)?2:12,minH:12,children:[(0,n.jsxs)(s.k,{alignItems:"center",children:[(0,n.jsx)(k.D,{href:"/",onClick:()=>{(0,f.j)(f.zW.Header.ClickLogo)},children:(0,n.jsxs)(s.k,{alignItems:"center",children:[(0,n.jsx)(l.x,{width:"40px",height:"40px",children:(0,n.jsx)(h(),{src:v.Z,width:40,height:40,alt:"logo",priority:!0})}),(0,n.jsx)(l.x,{display:er,fontSize:"3xl",fontWeight:"bold",textColor:"white",children:"LOST FR8"})]})}),(null==L?void 0:L.authUser)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.J,{as:S.$6,w:8,h:8,color:"white"}),(0,n.jsx)(l.x,{mr:6,children:(0,n.jsx)(ea.Z,{style:"default"})})]})]},"main"),!P&&(0,n.jsx)(o.U,{spacing:12,display:{base:"none","2xl":"flex"},textColor:"white",children:ed().flatMap(e=>(0,n.jsx)(k.D,{href:e.href,isExternal:e.isExternal,children:e.label},e.label))},"submenu")]})})}),(0,n.jsxs)(s.k,{children:[!P&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.x,{mr:2,w:"386px",display:["none","none","flex"],children:(0,n.jsx)(es,{value:t})}),!(null==L?void 0:L.authUser)&&(0,n.jsx)(d.z,{background:D,color:"white",onClick:()=>{J(),(0,f.j)(f.zW.Header.ClickSignIn)},isLoading:R,w:"112px",children:"Sign In"})]}),(null==L?void 0:L.authUser)&&!R&&(0,n.jsxs)(n.Fragment,{children:[P&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.z,{display:["block","block","none"],sx:z,onClick:()=>en(),children:(0,n.jsx)(S.Oq,{})}),(0,n.jsx)(d.z,{display:["none","none","flex"],sx:z,onClick:()=>{i.push({pathname:"/profile/[dot]",query:{dot:Q}})},children:(0,n.jsxs)(s.k,{alignItems:"center",children:[(0,n.jsx)(l.x,{mr:2,children:"Profile"}),(0,n.jsx)(S.h0,{})]})})]}),!P&&(0,n.jsx)(d.z,{sx:z,onClick:()=>en(),children:(0,n.jsxs)(s.k,{alignItems:"center",children:[(0,n.jsx)(l.x,{display:["block","block","none"],children:(0,n.jsx)(S.Oq,{})}),(0,n.jsx)(l.x,{display:["none","none","flex"],children:"Dashboard"}),_&&(0,n.jsx)(c.$,{ml:2,size:"xs"}),K>0&&(0,n.jsx)(l.x,{ml:2,children:(0,n.jsx)(H.P,{count:K})})]})})]})]})]}),(0,n.jsxs)(s.k,{mt:2,w:"100%",bgColor:"chakra-body-bg",alignItems:"center",children:[!(null==L?void 0:L.authUser)&&!R&&(0,n.jsx)(l.x,{w:"full",display:["flex","flex","none"],bgColor:"gray.700",children:(0,n.jsx)(es,{value:t})}),(0,n.jsx)(V,{isOpen:Y,onClose:B}),(0,n.jsx)(N,{isOpen:$,onClose:et}),(0,n.jsx)(eo,{isOpen:Z,onClose:G})]}),!(null==L?void 0:L.authUser)&&!R&&(0,n.jsx)(o.U,{mt:4,pb:2,color:"white",overflowX:"scroll",style:{scrollbarWidth:"none"},whiteSpace:"nowrap",justifyContent:{base:"flex-start",md:"center"},w:"100%",spacing:8,display:{base:"flex","2xl":"none"},children:ed().flatMap(e=>(0,n.jsx)(k.D,{href:e.href,isExternal:e.isExternal,children:e.label},e.label))})]})})})},557:function(e,t,i){i.d(t,{Z:function(){return b}});var n=i(5893),r=i(1046),l=i(8029),s=i(7873),o=i(8899),a=i(8329),d=i(2553),c=i(4831),u=i(1163),h=i.n(u),x=i(7294),p=i(9661),m=i(5011),j=i(5953),v=i(5005),g=i(1233),f=i(6642);let y=e=>{let{hasCarriers:t,onClick:i}=e,s=(0,u.useRouter)(),o=(0,j.md)(),d=(0,r.ff)("teal.500","teal.200"),c=(0,r.ff)("/dashboard"==s.pathname?"gray.800":t?"gray.800":"white","white");return(0,n.jsxs)(a.k,{p:2,cursor:"pointer",rounded:"md",alignItems:"center",_hover:{backgroundColor:t?o:void 0},onClick:i,children:[(0,n.jsx)(l.x,{color:d,children:(0,n.jsx)(f.wl,{})}),(0,n.jsx)(l.x,{color:c,fontSize:"sm",ml:2,children:t?"Add carrier":"Create profile"})]})},b=e=>{var t,i,u;let{style:b}=e,C=(0,r.ff)("gray.100","gray.800"),w="whiteAlpha.300",S=(0,j.md)(),k=(0,x.useRef)(null),I=(0,x.useRef)(null),{carrierId:A,setCarrierId:T}=(0,g.d4)();(0,p.t$)(k,()=>E(!1));let[O,E]=(0,x.useState)(!1),[{data:D}]=(0,m.ULu)(),[{data:z,fetching:q}]=(0,m.WoI)({pause:!(null==D?void 0:D.authUser)}
1),L=(0,x.useMemo)(()=>null==z?void 0:z.userCarriers,[null==z?void 0:z.userCarriers]),R=(0,x.useMemo)(()=>L&&L.length>0,[L]),U=(0,x.useCallback)(e=>{T(e),E(!1),h().push({pathname:"/dashboard"}),(0,v.j)(v.zW.Header.ClickCarrierDashboard)},[T]),F=()=>{E(!1),h().push({pathname:"/dashboard",query:{"create-carrier":1}}),(0,v.j)(v.zW.Header.ClickCreateCarrier)};return(0,n.jsxs)(l.x,{userSelect:"none",ref:k,bgColor:"dashboard"===b?C:void 0,rounded:"md",children:[(0,n.jsxs)(s.Vp,{w:{base:"100%",md:40},h:8,size:"lg",cursor:"pointer",ref:I,background:"whiteAlpha.200",color:"dashboard"===b?void 0:"white",_hover:{backgroundColor:w},onClick:()=>{R&&(E(!O),(0,v.j)(v.zW.Header.ClickCarrierDropdown))},children:[q&&(0,n.jsx)(o.$,{size:"xs"}),!q&&L&&R&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.Sn,{minW:24,flexGrow:1,children:null!==(u=null===(t=L.find(e=>e.id===A))||void 0===t?void 0:t.name)&&void 0!==u?u:L[0].name}),(0,n.jsx)(s.bq,{rounded:"sm",as:O?f.g8:f.v4,_hover:{backgroundColor:w}})]}),!q&&!R&&(0,n.jsx)(y,{hasCarriers:R,onClick:F})]}),O&&(0,n.jsx)(l.x,{position:"relative",children:(0,n.jsxs)(a.k,{direction:"column",mt:2,border:"1px",borderColor:"chakra-border-color",rounded:"md",p:2,zIndex:"popover",position:"absolute",backgroundColor:"chakra-body-bg",w:null===(i=I.current)||void 0===i?void 0:i.offsetWidth,maxH:96,overflowY:"scroll",style:{scrollbarWidth:"none"},children:[null==L?void 0:L.map(e=>(0,n.jsxs)(a.k,{p:2,cursor:"pointer",rounded:"md",justifyContent:"space-between",alignItems:"center",onClick:()=>U(e.id),_hover:{backgroundColor:S},children:[(0,n.jsx)(l.x,{noOfLines:1,mr:2,fontSize:"sm",children:e.name}),A===e.id&&(0,n.jsx)(d.J,{as:f.nQ,w:3,h:3,mr:1})]},e.id)),(0,n.jsx)(c.i,{my:2}),(0,n.jsx)(y,{hasCarriers:null!=R&&R,onClick:F})]})})]})}},9780:function(e,t,i){i.d(t,{D:function(){return o}});var n=i(5893),r=i(8029),l=i(1664),s=i.n(l);let o=e=>{let{href:t,as:i,replace:l,scroll:o,shallow:a,prefetch:d,children:c,isExternal:u,...h}=e;return(0,n.jsx)(s(),{passHref:!0,href:t,as:i,replace:l,scroll:o,shallow:a,prefetch:d,target:u?"_blank":void 0,children:(0,n.jsx)(r.x,{as:"span",_hover:{textDecoration:"underline"},...h,children:c})})}},10:function(e,t,i){i.d(t,{W:function(){return h}});var n=i(5893),r=i(5490),l=i(4614),s=i(5901),o=i(7391),a=i(1360),d=i(3828),c=i(8029),u=i(8491);let h=e=>{let{title:t,body:i,description:h,actionTitle:x,isOpen:p,isLoading:m=!1,onAction:j,onClose:v}=e;return(0,n.jsxs)(r.u_,{isOpen:p,onClose:v,children:[(0,n.jsx)(l.Z,{}),(0,n.jsxs)(s.h,{children:[(0,n.jsx)(o.x,{children:t}),(0,n.jsx)(a.o,{}),(0,n.jsxs)(d.f,{children:[(0,n.jsx)(c.x,{children:i}),h&&(0,n.jsx)(c.x,{mt:2,fontSize:"sm",fontStyle:"italic",children:h}),(0,n.jsx)(u.z,{mt:4,mb:4,colorScheme:"teal",onClick:j,isLoading:m,children:x})]})]})]})}},9355:function(e,t,i){i.d(t,{P:function(){return s}});var n=i(5893),r=i(5953),l=i(8029);let s=e=>{let{count:t}=e,i=(0,r.Yg)();return(0,n.jsx)(l.x,{px:2,borderRadius:12,backgroundColor:i,textAlign:"center",color:"white",children:t})}},4609:function(e,t,i){i.d(t,{H:function(){return w}});var n=i(5893),r=i(3658),l=i(7879),s=i(5490),o=i(4614),a=i(5901),d=i(7391),c=i(1360),u=i(3828),h=i(8029),x=i(5443),p=i(2594),m=i(933),j=i(3898),v=i(345),g=i(4883),f=i(4665),y=i(5419),b=i(5953),C=i(971);let w=e=>{let{children:t,header:i,body:w}=e,S=(0,b.AJ)(),k=(0,C.K)(),{isOpen:I,onOpen:A,onClose:T}=(0,r.q)();return k?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.r,{onClick:A,children:t}),(0,n.jsxs)(s.u_,{onClose:T,size:"full",isOpen:I,scrollBehavior:"inside",children:[(0,n.jsx)(o.Z,{}),(0,n.jsxs)(a.h,{children:[(0,n.jsx)(d.x,{textColor:S,children:i}),(0,n.jsx)(c.o,{}),(0,n.jsx)(u.f,{children:(0,n.jsx)(h.x,{whiteSpace:"pre-wrap",overflowWrap:"break-word",children:w})}),(0,n.jsx)(x.m,{mb:[24,4]})]})]})]}):(0,n.jsxs)(p.J,{children:[(0,n.jsx)(m.x,{children:t}),(0,n.jsxs)(j.y,{textAlign:"start",lineHeight:"5",fontWeight:"normal",fontFamily:"body",fontSize:"md",children:[(0,n.jsx)(v.Q,{}),(0,n.jsx)(g.u,{}),(0,n.jsx)(f.Y,{children:(0,n.jsx)(h.x,{mr:8,whiteSpace:"pre-wrap",overflowWrap:"break-word",textColor:S,children:i})}),(0,n.jsx)(y.b,{whiteSpace:"pre-wrap",overflowWrap:"break-word",overflow:"scroll",color:"chakra-body-text",maxH:96,children:w})]})]})}},9340:function(e,t,i){i.d(t,{b:function(){return j}});var n=i(5893),r=i(3658),l=i(8029),s=i(5490),o=i(4614),a=i(5901),d=i(7391),c=i(1360),u=i(3828),h=i(5443),x=i(6972),p=i(971),m=i(6642);let j=e=>{let{label:t}=e,i=(0,p.K)(),{isOpen:j,onOpen:v,onClose:g}=(0,r.q)();return i?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.x,{onClick:v,children:(0,n.jsx)(m.hQ,{})}),(0,n.jsxs)(s.u_,{onClose:g,size:"full",isOpen:j,scrollBehavior:"inside",closeOnEsc:!0,closeOnOverlayClick:!0,children:[(0,n.jsx)(o.Z,{}),(0,n.jsxs)(a.h,{children:[(0,n.jsx)(d.x,{}),(0,n.jsx)(c.o,{}),(0,n.jsx)(u.f,{children:(0,n.jsx)(l.x,{children:t})}),(0,n.jsx)(h.m,{mb:[24,4]})]})]})]}):(0,n.jsx)(x.u,{label:t,children:(0,n.jsx)(l.x,{boxSize:3,children:(0,n.jsx)(m.hQ,{})})})}},5953:function(e,t,i){i.d(t,{AJ:function(){return d},En:function(){return x},G7:function(){return u},PZ:function(){return p},V1:function(){return h},Xn:function(){return a},Yg:function(){return r},fG:function(){return l},lK:function(){return s},md:function(){return o},oq:function(){return c}});var n=i(1046);let r=()=>(0,n.ff)("red.500","red.300"),l=()=>(0,n.ff)("teal.500","teal.200"),s=()=>(0,n.ff)("teal.600","teal.300"),o=()=>(0,n.ff)("gray.100","whiteAlpha.200"),a=()=>(0,n.ff)("gray.200","gray.700"),d=()=>(0,n.ff)("gray.600","gray.400"),c=()=>(0,n.ff)("gray.700","gray.200"),u=()=>(0,n.ff)("gray.800","white"),h=()=>(0,n.ff)("white","gray.800"),x=()=>(0,n.ff)("white","whiteAlpha.200"),p=()=>(0,n.ff)("gray.50",void 0)},8657:function(e,t,i){i.d(t,{u:function(){return l}});var n=i(290),r=i.n(n);let l=r()("RWPU0V4AR0","1fb520dc81160eaed28a4962f77d46c5")},5658:function(e,t,i){i.d(t,{c:function(){return l}});var n=i(5011),r=i(1233);let l=()=>{let{carrierId:e}=(0,r.d4)(),[{data:t,fetching:i}]=(0,n.ULu)(),[{data:l,fetching:s}]=(0,n.HWK)({variables:{id:e},pause:!e});if(!i&&!s)return null!=t&&!!t.authUser&&null!=l&&!!l.carrierId&&l.carrierId.createdBy===t.authUser.id}},255:function(e,t,i){i.d(t,{Q:function(){return tq}});var n=i(5893),r=i(7294),l=i(6596),s=i(3658),o=i(8029),a=i(8329),d=i(3636),c=i(232),u=i(8491),h=i(4831),x=i(1163),p=i(1233),m=i(8954),j=i(9340),v=i(8899),g=i(6058),f=i(4114),y=i(2553),b=i(5011);let C=e=>e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()});
1var w=i(6823),S=i(5315),k=i(6642),I=i(5715);let A=()=>{let e=(0,x.useRouter)(),{isLoading:t}=(0,p.d4)();return t?(0,n.jsx)(n.Fragment,{}):(0,n.jsxs)(o.x,{mt:[6,12],children:[(0,n.jsx)(o.x,{textAlign:"center",fontWeight:"bold",fontSize:"2xl",children:"Get started by creating a carrier profile"}),(0,n.jsx)(I.M,{mt:6,children:(0,n.jsx)(u.z,{colorScheme:"teal",onClick:()=>e.push({query:{"create-carrier":1}}),children:"Create Profile"})})]})},T=e=>{var t;let{...i}=e,{carrierId:l}=(0,p.d4)(),{isOpen:c,onOpen:h,onClose:x}=(0,s.q)(),[{data:m,fetching:j}]=(0,b.HWK)({variables:{id:l},pause:!l}),[I,T]=(0,r.useState)(!1),[O,E]=(0,r.useState)(!1);return(0,n.jsxs)(o.x,{...i,children:[j&&(0,n.jsx)(v.$,{mb:4}),(!j&&!(null==m?void 0:null===(t=m.carrierId)||void 0===t?void 0:t.capacity)||!l)&&(0,n.jsx)(A,{}),!j&&l&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a.k,{mb:4,justifyContent:"space-between",children:[(0,n.jsxs)(d.U,{spacing:4,children:[(0,n.jsx)(g.X,{defaultChecked:!0,onChange:e=>T(!e.target.checked),children:C(b.kKP.Available)}),(0,n.jsx)(g.X,{defaultChecked:!0,onChange:e=>E(!e.target.checked),children:C(b.kKP.Unavailable)})]}),(0,n.jsx)(f.L,{}),(0,n.jsx)(u.z,{size:"md",onClick:h,children:(0,n.jsx)(y.J,{as:k.Qq})})]}),l&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(w.S,{carrierId:l,onlyAvailable:!1,filterAvailable:I,filterUnavailable:O,editable:!0}),(0,n.jsx)(S.G,{isOpen:c,onClose:x,carrierId:l,onlyAvailable:!1,editable:!0})]})]})]})};var O=i(8186),E=i(7873),D=i(7879),z=i(2175),q=i(5953),L=i(2206),R=i(4506),U=i(980),F=i(4795),M=i(5952);let P=e=>{let{label:t,setFieldValue:i,size:l,...s}=e,[a,{error:d}]=(0,z.U$)(s),[c,u]=(0,r.useState)(new Date().toLocaleDateString());(0,r.useEffect)(()=>{if(!a.value)return;let e=a.value;u(e.toLocaleDateString())},[a.value]);let h=(0,r.forwardRef)((e,t)=>(0,n.jsx)(L.I,{...e,id:a.name,ref:t,p:2,mt:2,value:c,onChange:()=>{},style:{caretColor:"transparent"}}));return(0,n.jsx)(o.x,{mt:4,children:(0,n.jsxs)(R.NI,{isInvalid:!!d,children:[(0,n.jsx)(U.l,{htmlFor:a.name,fontWeight:"normal",children:t}),(0,n.jsx)(M.M,{dateSelected:(0,r.useCallback)(e=>{i(a.name,e)},[a.name,i]),children:(0,n.jsx)(h,{})}),d?(0,n.jsx)(F.J1,{children:d}):null]})})};var W=i(1720),V=i(9860),_=i(3712),N=i(3413);let K=e=>{let{id:t,value:i,defaultValue:r,options:l,onChange:s}=e;return(0,n.jsx)(V.E,{id:t,onChange:s,value:i,defaultValue:r,children:(0,n.jsx)(_.K,{direction:"row",children:null==l?void 0:l.flatMap(e=>(0,n.jsx)(N.Y,{value:e.value,children:e.value},e.value))})})},Q=e=>{var t;let{label:i,options:l,setFieldValue:s,defaultValue:a,size:d,...c}=e,[u,{error:h}]=(0,z.U$)(c),[x,p]=(0,r.useState)(null!=a?a:l[0].value);return(0,r.useEffect)(()=>{s(u.name,x)},[u.name,s,x]),(0,n.jsx)(o.x,{mt:null!==(t=c.mt)&&void 0!==t?t:4,children:(0,n.jsxs)(R.NI,{isInvalid:!!h,children:[(0,n.jsx)(U.l,{htmlFor:u.name,fontWeight:"normal",children:i}),(0,n.jsx)(K,{...u,id:u.name,value:x,options:l,onChange:p}),h?(0,n.jsx)(F.J1,{children:h}):null]})})};var H=i(8614);let Y=e=>{var t;let{label:i,selectedPlace:r,setFieldValue:l,...s}=e,[a,{error:d}]=(0,z.U$)(s);return(0,n.jsx)(o.x,{mt:null!==(t=s.mt)&&void 0!==t?t:4,children:(0,n.jsxs)(R.NI,{isInvalid:!!d,children:[(0,n.jsx)(U.l,{htmlFor:a.name,fontWeight:"normal",children:i}),(0,n.jsx)(H.P,{mt:2,...s,...a,defaultValue:a.value,selectedPlace:r,selectedOption:e=>l(a.name,e)}),d?(0,n.jsx)(F.J1,{children:d}):null]})},a.name)},J=e=>{var t,i,r;let{label:l,defaultValue:s,setFieldValue:a,...d}=e,[c,{error:u}]=(0,z.U$)(d);return(0,n.jsx)(o.x,{mt:null!==(r=d.mt)&&void 0!==r?r:4,children:(0,n.jsxs)(R.NI,{isInvalid:!!u,children:[(0,n.jsx)(U.l,{htmlFor:c.name,fontWeight:"normal",children:l}),(0,n.jsx)(H.P,{mt:2,...d,...c,autocomplete:!0,address:!0,value:null===(t=c.value)||void 0===t?void 0:t.address,defaultValue:null===(i=c.value)||void 0===i?void 0:i.address,selectedPlace:e=>a(c.name,e)}),u?(0,n.jsx)(F.J1,{children:u}):null]})},c.name)};var B=i(5490),Z=i(4614),X=i(5901),G=i(7391),$=i(1360),ee=i(3828),et=i(5443);let ei=e=>{let{dot:t,carrierId:i,id:r,isOpen:s,onClose:a}=e,d=(0,l.p)(),c=(0,x.useRouter)(),[{fetching:h},p]=(0,b.w54)(),m=async()=>{var e,n,l,s;let o=await p({id:r,carrierId:i,dot:t}),u=null===(e=o.data)||void 0===e?void 0:null===(n=e.deleteCapacity)||void 0===n?void 0:n.error;(null===(l=o.data)||void 0===l?void 0:null===(s=l.deleteCapacity)||void 0===s?void 0:s.success)?(d({title:"Success!",description:"Capacity deleted successfully!",status:"success",duration:3e3,position:"top",isClosable:!0}),a(),c.replace("/dashboard?view=capacity")):u&&d({title:"Error.",description:u,status:"error",duration:5e3,position:"top",isClosable:!0})};
1return(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,isOpen:s,onClose:a,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Delete Capacity"}),(0,n.jsx)($.o,{}),(0,n.jsx)(ee.f,{children:(0,n.jsx)(o.x,{mb:8,children:"Deleting capacity can not be undone. Please confirm that you would like to delete your capacity listing."})}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,colorScheme:"red",width:"100%",onClick:m,isLoading:h,children:"Delete"})})})]})]})};var en=i(7904);let er=[{value:"0",name:"0 mi"},{value:"50",name:"50 mi"},{value:"100",name:"100 mi"},{value:"150",name:"150 mi"},{value:"200",name:"200 mi"},{value:"250",name:"250 mi"},{value:"300",name:"300 mi"},{value:"500",name:"500 mi"}],el=e=>{var t,i,c,h,j,g,f,y,C,w,S;let{...k}=e,A=(0,x.useRouter)(),T=(0,l.p)(),L=(0,q.md)(),R=(0,q.fG)(),U=(0,m.o)("edit"),{carrierId:F}=(0,p.d4)(),[{fetching:M},V]=(0,b.HRF)(),{isOpen:_,onOpen:N,onClose:K}=(0,s.q)(),[H,B]=(0,r.useState)(),{isOpen:Z,onOpen:X,onClose:G}=(0,s.q)(),$=e=>{B(e),X()},[{data:ee,fetching:et}]=(0,b.gy$)({variables:{id:parseInt(null!=U?U:"0")},pause:!U}),el=(0,r.useMemo)(()=>null==ee?void 0:ee.capacityId,[null==ee?void 0:ee.capacityId]),es={available:(null==el?void 0:el.available)?new Date(el.available):"",type:null!==(g=null==el?void 0:el.type)&&void 0!==g?g:b.L24.Full,origin:(null==el?void 0:el.origin)?{address:el.origin,latitude:el.originLatitude,longitude:el.originLongitude,type:el.originType}:null,originRadius:null!==(f=null==el?void 0:null===(t=el.originRadius)||void 0===t?void 0:t.toString())&&void 0!==f?f:"150",destination:(null==el?void 0:el.destination)?{address:el.destination,latitude:el.destinationLatitude,longitude:el.destinationLongitude,type:el.originType}:null,destinationRadius:null!==(y=null==el?void 0:null===(i=el.destinationRadius)||void 0===i?void 0:i.toString())&&void 0!==y?y:"150",length:null!==(C=null==el?void 0:null===(c=el.length)||void 0===c?void 0:c.toString())&&void 0!==C?C:"",weight:null!==(w=null==el?void 0:null===(h=el.weight)||void 0===h?void 0:h.toString())&&void 0!==w?w:"",notes:null!==(S=null==el?void 0:el.notes)&&void 0!==S?S:""};return et?(0,n.jsx)(o.x,{...k,children:(0,n.jsx)(v.$,{})}):et||el?(0,n.jsxs)(o.x,{...k,children:[(0,n.jsx)(o.x,{mt:4,p:6,bg:L,rounded:"lg",children:(0,n.jsxs)(O.g,{alignItems:"start",spacing:4,children:[(null==el?void 0:el.equipmentType)&&(null==el?void 0:el.equipmentSubtype)&&(null===(j=el.equipment)||void 0===j?void 0:j.length)===0&&(0,n.jsxs)(d.U,{children:[(0,n.jsx)(E.Vp,{children:(0,n.jsx)(E.Sn,{children:el.equipmentType})}),(0,n.jsx)(E.Vp,{variant:"solid",colorScheme:"teal",children:(0,n.jsx)(E.Sn,{children:el.equipmentSubtype})})]},el.id),(null==el?void 0:el.equipment)&&(null==el?void 0:el.equipment.flatMap(e=>(0,n.jsxs)(d.U,{children:[(0,n.jsxs)(D.r,{color:R,onClick:()=>{$(e)},children:["#",e.number]}),(0,n.jsx)(E.Vp,{children:(0,n.jsx)(E.Sn,{children:e.type})}),(0,n.jsx)(E.Vp,{variant:"solid",colorScheme:"teal",children:(0,n.jsx)(E.Sn,{children:e.subtype})})]},e.id)))]})}),(0,n.jsx)(z.J9,{initialValues:es,onSubmit:async e=>{var t,i,n,r,l,s,o,a,d,c,u,h;if(!F||!U)return;let x=await V({id:parseInt(U),carrierId:F,capacity:{...e,origin:null===(t=e.origin)||void 0===t?void 0:t.address,originLatitude:null===(i=e.origin)||void 0===i?void 0:i.latitude,originLongitude:null===(n=e.origin)||void 0===n?void 0:n.longitude,originType:null===(r=e.origin)||void 0===r?void 0:r.type,destination:null===(l=e.destination)||void 0===l?void 0:l.address,destinationLatitude:null===(s=e.destination)||void 0===s?void 0:s.latitude,destinationLongitude:null===(o=e.destination)||void 0===o?void 0:o.longitude,destinationType:null===(a=e.destination)||void 0===a?void 0:a.type,length:parseInt(e.length),weight:parseInt(e.weight),originRadius:parseInt(e.originRadius),destinationRadius:parseInt(e.destinationRadius),type:e.type}}),p=null===(d=x.data)||void 0===d?void 0:null===(c=d.updateCapacity)||void 0===c?void 0:c.error;(null===(u=x.data)||void 0===u?void 0:null===(h=u.updateCapacity)||void 0===h?void 0:h.capacity)?(T({title:"Success!",description:"Capacity updated.",status:"success",duration:3e3,position:"top",isClosable:!0}),A.push("/dashboard?view=capacity")):p&&T({title:"Error.",description:p,status:"error",duration:5e3,position:"top",isClosable:!0})},children:e=>{let{setFieldValue:t,values:i,initialValues:r}=e;return(0,n.jsxs)(z.l0,{children:[(0,n.jsx)(P,{name:"available",label:"Available on",required:!0,setFieldValue:t}),(0,n.jsx)(Q,{name:"type",placeholder:"Select load type",label:"Load Type",options:[{name:b.L24.Full,value:b.L24.Full},{name:b.L24.Partial,value:b.L24.Partial}],defaultValue:r.type,setFieldValue:t}),(0,n.jsxs)(a.k,{children:[(0,n.jsx)(o.x,{w:"100%",children:(0,n.jsx)(J,{name:"origin",placeholder:"Origin",label:"Origin",required:!0,states:!1,setFieldValue:t,w:"100%"})}),(0,n.jsx)(o.x,{ml:4,children:(0,n.jsx)(Y,{name:"originRadius",placeholder:"0",label:"Radius",options:er,defaultValue:"150",setFieldValue:t})})]}),(0,n.jsxs)(a.k,{children:[(0,n.jsx)(o.x,{w:"100%",children:(0,n.jsx)(J,{name:"destination",placeholder:"Destination",label:"Destination",required:!0,setFieldValue:t,anywhere:!0})}),(0,n.jsx)(o.x,{ml:4,children:(0,n.jsx)(Y,{name:"destinationRadius",placeholder:"0",label:"Radius",options:er,defaultValue:"150",setFieldValue:t})})]}),"PARTIAL"===i.type&&(0,n.jsx)(W.y,{name:"length",placeholder:"Available Length",label:"Available Length (ft)",type:"number",required:!0}),(0,n.jsx)(W.y,{name:"weight",placeholder:"Max Weight",label:"Max Weight (K lbs)",type:"number",required:!0}),(0,n.jsx)(W.y,{name:"notes",placeholder:"Notes...",label:"Notes",textarea:!0,max:1e3}),(0,n.jsx)(u.z,{mt:8,w:"100%",type:"submit",isLoading:M,children:"Save"})]})}}),H&&(0,n.jsx)(en.X,{isOpen:Z,onClose:G,equipment:H}),el&&el.carrier&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.x,{mt:6,children:(0,n.jsx)(I.M,{children:(0,n.jsx)(u.z,{variant:"ghost",fontWeight:"normal",colorScheme:"red",onClick:N,children:"Delete capacity"})})}),(0,n.jsx)(ei,{id:el.id,carrierId:el.carrierId,dot:el.carrier.dot,isOpen:_,onClose:K})]})]}):(0,n.jsx)(o.x,{...k,children:"Unable to load details for capacity..."})};var es=i(3244),eo=i(123),ea=i(5299);let ed=e=>{let{isOpen:t,onClose:i}=e,s=(0,x.useRouter)(),c=(0,l.p)(),{carrierId:h}=(0,p.d4)(),[{fetching:m},j]=(0,b.GCt)(),[{data:v}]=(0,b.YHU)({variables:{carrierId:h},pause:!h}),g=(0,r.useMemo)(()=>{var e,t;let i=null==v?void 0:null===(e=v.availableCarrierEquipment)||void 0===e?void 0:e.filter(e=>e.type===b.Q2y.Trailer),n=null!==(t=null==i?void 0:i.flatMap(e=>({name:"#".concat(e.number," - ").concat(e.subtype),value:e.id.toString(),equipmentId:e.id,equipmentType:e.type,equipmentSubtype:e.subtype})))&&void 0!==t?t:[],r=ea.aQ.map(e=>({name:e.name,value:e.value,equipmentType:b.Q2y.Trailer,equipmentSubtype:e.value}));return null==n||n.push(...r),n},[null==v?void 0:v.availableCarrierEquipment]),f=(0,r.useMemo)(()=>{var e,t;let i=null==v?void 0:null===(e=v.availableCarrierEquipment)||void 0===e?void 0:e.filter(e=>e.type===b.Q2y.Specialized||e.type===b.Q2y.Tractor),n=null!==(t=null==i?void 0:i.flatMap(e=>({name:"#".concat(e.number," - ").concat(e.subtype),value:e.id.toString(),equipmentId:e.id,equipmentType:e.type,equipmentSubtype:e.subtype})))&&void 0!==t?t:[],r=ea.sv.map(e=>({name:e.name,value:e.value,equipmentType:b.Q2y.Specialized,equipmentSubtype:e.value}));return null==n||n.push(...r),n},[null==v?void 0:v.availableCarrierEquipment]),[w,S]=(0,r.useState)({type:void 0,equipmentSubtype:void 0,trailerId:void 0,specializedId:void 0,available:new Date,loadType:b.L24.Full,origin:void 0,originRadius:"150",destination:void 0,destinationRadius:"150",length:"",weight:"",notes:""}),A=async()=>
1{if(!h||!w.origin||!w.weight){c({title:"Error.",description:"Please make sure you have entered a value for ORIGIN and WEIGHT.",status:"error",duration:5e3,position:"top",isClosable:!0});return}let e=[];if(w.trailerId&&e.push(w.trailerId),w.specializedId&&e.push(w.specializedId),0===e.length&&!w.equipmentSubtype){c({title:"Error.",description:"Please make sure you have selected equipment.",status:"error",duration:5e3,position:"top",isClosable:!0});return}var t,n,r,l,o=w.destination;o||(o={address:"Anywhere",latitude:0,longitude:0,type:"ANYWHERE"});let a=await j({carrierId:h,capacity:{available:w.available,type:w.loadType,origin:w.origin.address,originRadius:parseInt(w.originRadius),originLatitude:w.origin.latitude,originLongitude:w.origin.longitude,originType:w.origin.type,destination:o.address,destinationRadius:parseInt(w.destinationRadius),destinationLatitude:o.latitude,destinationLongitude:o.longitude,destinationType:o.type,length:parseInt(w.length),weight:parseInt(w.weight),notes:w.notes,equipmentIds:e,equipmentType:w.type,equipmentSubtype:w.equipmentSubtype}}),d=null===(t=a.data)||void 0===t?void 0:null===(n=t.createCapacity)||void 0===n?void 0:n.error;(null===(r=a.data)||void 0===r?void 0:null===(l=r.createCapacity)||void 0===l?void 0:l.capacity)?(c({title:"Success!",description:"Capacity created!",status:"success",duration:3e3,position:"top",isClosable:!0}),i(),s.push("/dashboard?view=capacity")):d&&c({title:"Error.",description:d,status:"error",duration:5e3,position:"top",isClosable:!0})};return(0,r.useEffect)(()=>{t||S({type:void 0,equipmentSubtype:void 0,trailerId:void 0,specializedId:void 0,available:new Date,loadType:b.L24.Full,origin:void 0,originRadius:"150",destination:void 0,destinationRadius:"150",length:"",weight:"",notes:""})},[t]),(0,n.jsxs)(B.u_,{isOpen:t,onClose:i,size:["full","2xl"],closeOnOverlayClick:!1,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:[0,6],children:[(0,n.jsx)(G.x,{children:"Add capacity"}),(0,n.jsx)($.o,{onClick:()=>s.back()}),(0,n.jsxs)(ee.f,{children:[(0,n.jsx)(o.x,{mt:4,children:"Equipment Type"}),(0,n.jsx)(I.M,{children:(0,n.jsx)(d.U,{mt:4,children:[{name:C(b.Q2y.Trailer),value:b.Q2y.Trailer,icon:k.uB},{name:C(b.Q2y.Specialized),value:b.Q2y.Specialized,icon:k.XX}].flatMap(e=>(0,n.jsx)(u.z,{w:40,h:40,rounded:"md",outlineColor:w.type===e.value?"teal":void 0,onClick:()=>{S(t=>t.type===e.value?{...t,type:void 0,trailerId:void 0,specializedId:void 0}:{...t,type:e.value,trailerId:void 0,specializedId:void 0})},children:(0,n.jsxs)(O.g,{children:[(0,n.jsx)(y.J,{as:e.icon}),(0,n.jsx)(o.x,{children:e.name})]})},e.value))})}),w.type===b.Q2y.Trailer&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.x,{mt:4,children:"Trailer"}),(0,n.jsx)(H.P,{mt:2,placeholder:"Trailer",autocomplete:!0,options:g,selectedOptionDetails:e=>{S(t=>({...t,trailerId:e.equipmentId,type:e.equipmentType,equipmentSubtype:e.equipmentSubtype}))}})]}),w.type===b.Q2y.Specialized&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.x,{mt:4,children:"Specialized"}),(0,n.jsx)(H.P,{mt:2,placeholder:"Specialized",autocomplete:!0,options:f,selectedOptionDetails:e=>{S(t=>({...t,specializedId:e.equipmentId,type:e.equipmentType,equipmentSubtype:e.equipmentSubtype}))}})]}),w.type&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.x,{mt:4,children:"Available On"}),(0,n.jsx)(M.M,{dateSelected:e=>{S(t=>({...t,available:e}))},children:(0,n.jsx)(L.I,{mt:4,placeholder:"Available On",value:w.available.toLocaleDateString(),onChange:()=>{}})}),(0,n.jsx)(o.x,{mt:4,mb:4,children:"Load Type"}),(0,n.jsx)(K,{id:"loadType",value:w.loadType,onChange:e=>{S(t=>({...t,loadType:e,length:""}))},options:[{name:b.L24.Full,value:b.L24.Full},{name:b.L24.Partial,value:b.L24.Partial}]}),(0,n.jsxs)(a.k,{mt:4,children:[(0,n.jsxs)(o.x,{w:"100%",children:[(0,n.jsx)(o.x,{children:"Origin"}),(0,n.jsx)(H.P,{mt:2,placeholder:"Origin",autocomplete:!0,address:!0,selectedPlace:e=>{S(t=>({...t,origin:e}))}})]}),(0,n.jsxs)(o.x,{ml:4,children:[(0,n.jsx)(o.x,{children:"Radius"}),(0,n.jsx)(H.P,{mt:2,options:er,defaultValue:"150",selectedOption:e=>{S(t=>({...t,originRadius:e}))}})]})]}),(0,n.jsxs)(a.k,{mt:4,children:[(0,n.jsxs)(o.x,{w:"100%",children:[(0,n.jsx)(o.x,{children:"Destination"}),(0,n.jsx)(H.P,{mt:2,placeholder:"Destination",autocomplete:!0,address:!0,anywhere:!0,selectedPlace:e=>{S(t=>({...t,destination:e}))}})]}),(0,n.jsxs)(o.x,{ml:4,children:[(0,n.jsx)(o.x,{children:"Radius"}),(0,n.jsx)(H.P,{mt:2,options:er,defaultValue:"150",selectedOption:e=>{S(t=>({...t,destinationRadius:e}))}})]})]}),w.loadType===b.L24.Partial&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.x,{mt:4,children:"Max Length (ft)"}),(0,n.jsx)(L.I,{mt:2,placeholder:"Max Length",type:"number",value:w.length,onChange:e=>{S(t=>({...t,length:e.target.value}))},onKeyDown:(0,eo.c)(A),onWheel:e=>{e.currentTarget.blur()}})]}),(0,n.jsx)(o.x,{mt:4,children:"Max Weight (K lbs)"}),(0,n.jsx)(L.I,{mt:2,placeholder:"Max Weight",type:"number",value:w.weight,onChange:e=>{S(t=>({...t,weight:e.target.value}))},onKeyDown:(0,eo.c)(A),onWheel:e=>{e.currentTarget.blur()}}),(0,n.jsx)(o.x,{mt:4,children:"Notes (optional)"}),(0,n.jsx)(es.g,{mt:2,placeholder:"Notes...",value:w.notes,onChange:e=>{S(t=>({...t,notes:e.target.value}))},onKeyDown:(0,eo.c)(A)})]})]}),(0,n.jsx)(et.m,{mb:[24,4],children:w.type&&(0,n.jsx)(o.x,{w:"100%",mb:4,children:(0,n.jsx)(u.z,{w:"100%",colorScheme:"teal",onClick:A,isLoading:m,children:w.type?"Add Capacity":"Continue"})})})]})]})},ec=()=>{let e=(0,x.useRouter)(),t=(0,l.p)(),i=(0,m.o)("create"),v=(0,m.o)("edit"),[g,f]=(0,r.useState)(!1),[y,C]=(0,r.useState)(!1),{isOpen:w,onOpen:S,onClose:k}=(0,s.q)(),{carrierId:I}=(0,p.d4)(),[{fetching:A},O]=(0,b.gPB)();(0,r.useEffect)(()=>{scrollTo({top:0}),f(!!i),C(!!v)},[i,v]),(0,r.useEffect)(()=>{g&&S()},[g,S]);let E=async()=>{var e,i,n,r;if(!I)return;let l=await O({carrierId:I}),s=null===(e=l.data)||void 0===e?void 0:null===(i=e.refreshCapacity)||void 0===i?void 0:i.error;(null===(n=l.data)||void 0===n?void 0:null===(r=n.refreshCapacity)||void 0===r?void 0:r.success)?t({t
1itle:"Success!",description:"Capacity updated.",status:"success",duration:3e3,position:"top",isClosable:!0}):s&&t({title:"Error.",description:s,status:"error",duration:5e3,position:"top",isClosable:!0})};return(0,n.jsxs)(o.x,{children:[(0,n.jsxs)(a.k,{justifyContent:"space-between",children:[(0,n.jsxs)(d.U,{children:[(0,n.jsx)(c.X,{size:"lg",children:"Capacity"},"heading"),(0,n.jsx)(j.b,{label:"Capacity is the most important piece of information for you to share with brokers. If brokers know where your trucks are they can offer you better loads. Create an entry for each of your trucks and then keep the available date and locations up to date at all times."},"tooltip")]}),(0,n.jsxs)(d.U,{children:[I&&I===parseInt("1126")&&(0,n.jsx)(u.z,{colorScheme:y?void 0:"teal",onClick:E,isLoading:A,children:"Sync with TMS"}),I&&(0,n.jsx)(u.z,{colorScheme:y?void 0:"teal",onClick:()=>{g||y?e.push("/dashboard?view=capacity"):e.push("/dashboard?view=capacity&create=1")},children:y?"Cancel":"Add Capacity"})]})]}),(0,n.jsx)(h.i,{my:4}),(0,n.jsx)(T,{display:y?"none":"block"}),y&&(0,n.jsx)(el,{}),(0,n.jsx)(ed,{isOpen:w,onClose:k})]})};var eu=i(5658),eh=i(7426);let ex=e=>{let{dot:t,id:i,isOpen:s,onClose:a,onSuccess:d}=e,c=(0,l.p)(),[h,x]=(0,r.useState)(""),{setCarrierId:m}=(0,p.d4)(),[{fetching:j},v]=(0,b.Wd$)(),g=async()=>{var e,n,r,l;let s=h.trim();if(!s)return;if(s!==t.toString()){c({title:"Error.",description:"USDOT number is not the same as the carrier USDOT number.",status:"error",duration:5e3,position:"top",isClosable:!0});return}let o=await v({id:i,dot:t}),u=null===(e=o.data)||void 0===e?void 0:null===(n=e.deleteCarrier)||void 0===n?void 0:n.error;(null===(r=o.data)||void 0===r?void 0:null===(l=r.deleteCarrier)||void 0===l?void 0:l.success)?(c({title:"Success!",description:"Carrier profile deleted successfully!",status:"success",duration:3e3,position:"top",isClosable:!0}),m(void 0),a(),d()):u&&c({title:"Error.",description:u,status:"error",duration:5e3,position:"top",isClosable:!0})};return(0,r.useEffect)(()=>{s||x("")},[s]),(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,isOpen:s,onClose:a,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Delete Carrier"}),(0,n.jsx)($.o,{}),(0,n.jsxs)(ee.f,{children:[(0,n.jsxs)(o.x,{mb:8,children:["Deleting a carrier profile can not be undone. This will also delete all associated contacts, equipment, and capacity. Please confirm that you would like to delete your carrier profile by entering your USDOT number in the box below."," ",(0,n.jsxs)(o.x,{as:"span",children:["USDOT number:"," ",(0,n.jsx)(o.x,{as:"span",color:(0,q.Yg)(),children:t})]})]}),(0,n.jsx)(L.I,{placeholder:"USDOT number",type:"number",value:h,onChange:e=>x(e.target.value),onKeyDown:(0,eo.c)(g),size:"lg",autoFocus:!0})]}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,colorScheme:"red",width:"100%",onClick:g,isLoading:j,children:"Delete"})})})]})]})};var ep=i(7776);let em=()=>{var e,t,i,a;let d=(0,l.p)(),c=(0,x.useRouter)(),h=(0,eu.c)(),{carrierId:m}=(0,p.d4)(),{isOpen:j,onOpen:g,onClose:f}=(0,s.q)(),[,y]=(0,b.B$A)(),[{data:C,fetching:w}]=(0,b.HWK)({variables:{id:m},pause:!m}),S=(0,r.useMemo)(()=>null==C?void 0:C.carrierId,[null==C?void 0:C.carrierId]);return(0,n.jsxs)(o.x,{children:[w&&(0,n.jsx)(v.$,{}),(!w&&!S||!m)&&(0,n.jsx)(A,{}),!w&&S&&m&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ep.Y,{showRefresh:!0,...S}),(0,n.jsx)(z.J9,{enableReinitialize:!0,initialValues:{email:null!==(e=null==S?void 0:S.email)&&void 0!==e?e:"",phone:(null==S?void 0:S.phone)?(0,eh.u)(S.phone):"",website:null!==(t=null==S?void 0:S.website)&&void 0!==t?t:"",scac:null!==(i=null==S?void 0:S.scac)&&void 0!==i?i:"",description:null!==(a=null==S?void 0:S.description)&&void 0!==a?a:""},onSubmit:async(e,t)=>{var i,n;let{setSubmitting:r}=t;if(!S||e.description.length>4e3)return;let l=e.scac.trim();r(!0);let s=await y({id:S.id,carrier:{...e,dot:S.dot,scac:l&&""!==l?l:null}}),o=null===(i=s.data)||void 0===i?void 0:i.updateCarrier.error;r(!1),(null===(n=s.data)||void 0===n?void 0:n.updateCarrier.carrier)?d({title:"Success!",description:"Carrier profile successfully updated.",status:"success",duration:3e3,position:"top",isClosable:!0}):o&&d({title:"Error.",description:o,status:"error",duration:5e3,position:"top",isClosable:!0})},children:e=>{let{isSubmitting:t}=e;return(0,n.jsxs)(z.l0,{children:[(0,n.jsx)(W.y,{name:"email",placeholder:"Email",label:"Email"}),(0,n.jsx)(W.y,{name:"phone",placeholder:"Phone Number",label:"Phone Number"}),(0,n.jsx)(W.y,{name:"website",placeholder:"Website",label:"Website"}),(0,n.jsx)(W.y,{name:"scac",placeholder:"SCAC Code",label:"SCAC Code"}),(0,n.jsx)(W.y,{name:"description",placeholder:"Create a company description to tell your customers a little about your business...",label:"Company Description",textarea:!0,max:4e3}),(0,n.jsx)(u.z,{mt:8,w:"100%",type:"submit",isLoading:t,children:"Save"})]})}}),h&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.x,{mt:6,children:(0,n.jsx)(I.M,{children:(0,n.jsx)(u.z,{variant:"ghost",fontWeight:"normal",colorScheme:"red",onClick:g,children:"Delete carrier"})})}),(0,n.jsx)(ex,{dot:S.dot,id:S.id,isOpen:j,onClose:f,onSuccess:()=>c.push("/dashboard?view=carrier")})]})]})]})},ej=()=>(0,n.jsxs)(o.x,{children:[(0,n.jsx)(a.k,{alignItems:"center",justifyContent:"space-between",children:(0,n.jsxs)(d.U,{minH:"40px",children:[(0,n.jsx)(c.X,{size:"lg",children:"Profile"}
1,"heading"),(0,n.jsx)(j.b,{label:"Your profile displays all of your information in one place. Add your contact information and a brief description so brokers and potential customers can get to know your business."},"tooltip")]})}),(0,n.jsx)(h.i,{my:4}),(0,n.jsx)(em,{})]}),ev=()=>Object.values(b.uCS).flatMap(e=>({value:e,name:e})),eg=e=>{let{isOpen:t,onClose:i}=e,r=(0,x.useRouter)(),s=(0,l.p)(),{carrierId:d}=(0,p.d4)(),[,c]=(0,b.LrK)();return(0,n.jsxs)(B.u_,{isOpen:t,onClose:i,size:["full","2xl"],closeOnOverlayClick:!1,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:[0,6],children:[(0,n.jsx)(G.x,{children:"Add contact"}),(0,n.jsx)($.o,{onClick:()=>r.back()}),(0,n.jsx)(ee.f,{children:(0,n.jsx)(o.x,{children:(0,n.jsx)(z.J9,{initialValues:{name:"",phone:"",phoneExt:"",email:"",type:"",notes:""},onSubmit:async(e,t)=>{var n,l,o;let{setSubmitting:a}=t;if(!d)return;a(!0);let u=await c({contact:{...e,type:e.type,carrierId:d}}),h=null===(n=u.data)||void 0===n?void 0:null===(l=n.createContact)||void 0===l?void 0:l.error;a(!1),(null===(o=u.data)||void 0===o?void 0:o.createContact)?(s({title:"Success!",description:"Contact created.",status:"success",duration:3e3,position:"top",isClosable:!0}),i(),r.push("/dashboard?view=contacts")):h&&s({title:"Error.",description:h,status:"error",duration:5e3,position:"top",isClosable:!0})},children:e=>{let{isSubmitting:t,setFieldValue:i}=e;return(0,n.jsxs)(z.l0,{children:[(0,n.jsx)(W.y,{name:"name",placeholder:"Name",label:"Name",required:!0}),(0,n.jsxs)(a.k,{children:[(0,n.jsx)(o.x,{w:"100%",children:(0,n.jsx)(W.y,{name:"phone",label:"Phone Number",placeholder:"Phone Number",w:"100%"})}),(0,n.jsx)(o.x,{ml:4,children:(0,n.jsx)(W.y,{name:"phoneExt",label:"Extension",placeholder:"Extension"})})]}),(0,n.jsx)(W.y,{name:"email",label:"Email",placeholder:"Email"}),(0,n.jsx)(Y,{name:"type",label:"Role",placeholder:"Role",options:ev(),required:!0,setFieldValue:i}),(0,n.jsx)(W.y,{name:"notes",placeholder:"Notes...",label:"Notes",textarea:!0,max:1e3}),(0,n.jsx)(u.z,{mt:8,w:"100%",type:"submit",isLoading:t,children:"Save"})]})}})})}),(0,n.jsx)(et.m,{mb:[24,4]})]})]})};var ef=i(7215);let ey=e=>{let{...t}=e,{carrierId:i}=(0,p.d4)(),[{data:l,fetching:s,stale:a}]=(0,b.HWN)({variables:{carrierId:i},pause:!i}),d=(0,r.useMemo)(()=>null==l?void 0:l.contactsCarrierId,[null==l?void 0:l.contactsCarrierId]);return(0,n.jsxs)(o.x,{...t,children:[(s||a)&&(0,n.jsx)(v.$,{mb:4}),(!s&&!d||!i)&&(0,n.jsx)(A,{}),!s&&!a&&d&&(0,n.jsxs)(n.Fragment,{children:[d.length<=0&&(0,n.jsx)(o.x,{mt:2,children:"No contacts for carrier..."}),(0,n.jsx)(ef.d,{contacts:d,direction:"column",editable:!0})]})]})},eb=e=>{let{dot:t,carrierId:i,id:r,isOpen:s,onClose:a}=e,d=(0,x.useRouter)(),c=(0,l.p)(),[{fetching:h},p]=(0,b.Ntz)(),m=async()=>{var e,n,l,s;let o=await p({id:r,carrierId:i,dot:t}),u=null===(e=o.data)||void 0===e?void 0:null===(n=e.deleteContact)||void 0===n?void 0:n.error;(null===(l=o.data)||void 0===l?void 0:null===(s=l.deleteContact)||void 0===s?void 0:s.success)===!0?(c({title:"Success!",description:"Contact deleted successfully.",status:"success",duration:3e3,position:"top",isClosable:!0}),a(),d.replace("/dashboard?view=contacts")):u&&c({title:"Error.",description:u,status:"error",duration:5e3,position:"top",isClosable:!0})};return(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,isOpen:s,onClose:a,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Delete Contact"}),(0,n.jsx)($.o,{}),(0,n.jsx)(ee.f,{children:(0,n.jsx)(o.x,{mb:8,children:"Deleting a contact can not be undone. Please confirm that you would like to delete this contact."})}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,colorScheme:"red",width:"100%",onClick:m,isLoading:h,children:"Delete"})})})]})]})},eC=e=>{var t,i,r,d,c,h,j,g,f,y,C,w;let{...S}=e,k=(0,l.p)(),A=(0,x.useRouter)(),T=(0,m.o)("edit"),{carrierId:O}=(0,p.d4)(),{isOpen:E,onOpen:D,onClose:q}=(0,s.q)(),[,L]=(0,b.wvD)(),[{data:R,fetching:U}]=(0,b.yk5)({variables:{id:parseInt(null!=T?T:"0")},pause:!T});return T&&U?(0,n.jsx)(v.$,{}):(0,n.jsxs)(o.x,{...S,children:[(0,n.jsx)(z.J9,{initialValues:{name:null!==(j=null==R?void 0:null===(t=R.contact)||void 0===t?void 0:t.name)&&void 0!==j?j:"",phone:(null==R?void 0:null===(w=R.contact)||void 0===w?void 0:w.phone)?(0,eh.u)(R.contact.phone):"",phoneExt:null!==(g=null==R?void 0:null===(i=R.contact)||void 0===i?void 0:null===(r=i.phoneExt)||void 0===r?void 0:r.toString())&&void 0!==g?g:"",email:null!==(f=null==R?void 0:null===(d=R.contact)||void 0===d?void 0:d.email)&&void 0!==f?f:"",type:null!==(y=null==R?void 0:null===(c=R.contact)||void 0===c?void 0:c.type)&&void 0!==y?y:"",notes:null!==(C=null==R?void 0:null===(h=R.contact)||void 0===h?void 0:h.notes)&&void 0!==C?C:""},onSubmit:async(e,t)=>{var i,n;let{setSubmitting:r}=t;if(!O||!T)return;r(!0);let l=await L({id:parseInt(T),contact:{...e,type:e.type}}),s=null===(i=l.data)||void 0===i?void 0:i.updateContact.error;r(!1),(null===(n=l.data)||void 0===n?void 0:n.updateContact.contact)?(k({title:"Success!",description:"Contact updated.",status:"success",duration:3e3,position:"top",isClosable:!0}),A.push("/dashboard?view=contacts")):s&&k({title:"Error.",description:s,status:"error",duration:5e3,position:"top",isClosable:!0})},children:e=>{let{isSubmitting:t,setFieldValue:i}=e;return(0,n.jsxs)(z.l0,{children:[(0,n.jsx)(W.y,{name:"name",placeholder:"Name",label:"Name",required:!0}),(0,n.jsxs)(a.k,{children:[(0,n.jsx)(o.x,{w:"100%",children:(0,n.jsx)(W.y,{name:"phone",label:"Phone Number",placeholder:"Phone Number",w:"100%"})}),(0,n.jsx)(o.x,{ml:4,children:(0,n.jsx)(W.y,{name:"phoneExt",label:"Extension",placeholder:"Extension"})})]}),(0,n.jsx)(W.y,{name:"email",label:"Email",placeholder:"Email"}),(0,n.jsx)(Y,{name:"type",label:"Role",placeholder:"Role",options:ev(),required:!0,setFieldValue:i}),(0,n.jsx)(W.y,{name:"notes",placeholder:"Notes...",label:"Notes",textarea:!0,max:1e3}),(0,n.jsx)(u.z,{mt:8,w:"100%",type:"submit",isLoading:t,children:"Save"})]})}}),(null==R?void 0:R.contact)&&R.contact.carrier&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.x,{mt:6,children:(0,n.jsx)(I.M,{children:(0,n.jsx)(u.z,{variant:"ghost",fontWeight:"normal",colorScheme:"red",onClick:D,children:"Delete contact"})})}
1),(0,n.jsx)(eb,{dot:R.contact.carrier.dot,carrierId:R.contact.carrierId,id:R.contact.id,isOpen:E,onClose:q})]})]})},ew=()=>{let e=(0,x.useRouter)(),t=(0,m.o)("create"),i=(0,m.o)("edit"),{carrierId:l}=(0,p.d4)(),[v,g]=(0,r.useState)(!1),[f,y]=(0,r.useState)(!1),{isOpen:b,onOpen:C,onClose:w}=(0,s.q)();return(0,r.useEffect)(()=>{scrollTo({top:0}),y(!!t),g(!!i)},[t,i]),(0,r.useEffect)(()=>{f&&C()},[f,C]),(0,n.jsxs)(o.x,{children:[(0,n.jsxs)(a.k,{justifyContent:"space-between",children:[(0,n.jsxs)(d.U,{children:[(0,n.jsx)(c.X,{size:"lg",children:"Contacts"},"heading"),(0,n.jsx)(j.b,{label:"Add all of your contact information for your business so brokers can easily get in touch with the right person."},"tooltip")]}),l&&(0,n.jsx)(u.z,{colorScheme:v?void 0:"teal",onClick:()=>{f||v?e.push("/dashboard?view=contacts"):e.push("/dashboard?view=contacts&create=1")},children:v?"Cancel":"Add Contact"})]}),(0,n.jsx)(h.i,{my:4}),v?(0,n.jsx)(eC,{}):(0,n.jsx)(ey,{}),(0,n.jsx)(eg,{isOpen:b,onClose:w})]})};var eS=i(4270),ek=i(2594),eI=i(933),eA=i(3898),eT=i(345),eO=i(5419),eE=i(10);let eD=e=>{let{id:t,carrierId:i,address:s,isOpen:a,onClose:d}=e,c=(0,l.p)(),h=(0,q.AJ)(),[{fetching:x},p]=(0,b.fZK)(),[{data:m}]=(0,b.spc)({variables:{carrierId:i}}),j=(0,r.useMemo)(()=>null==m?void 0:m.emailTags.flatMap(e=>({name:e.name,value:e.name})),[m]);return(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,isOpen:a,onClose:d,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Add Tag"}),(0,n.jsx)($.o,{}),(0,n.jsxs)(ee.f,{children:[(0,n.jsx)(o.x,{mb:2,textColor:h,children:s}),(0,n.jsx)(o.x,{mb:8,children:(0,n.jsx)(z.J9,{initialValues:{tag:""},onSubmit:async e=>{var n,r,l,s;let{tag:o}=e,a=await p({carrierId:i,emailId:t,tag:o}),u=null===(n=a.data)||void 0===n?void 0:null===(r=n.addTag)||void 0===r?void 0:r.error;(null===(l=a.data)||void 0===l?void 0:null===(s=l.addTag)||void 0===s?void 0:s.success)===!0?(c({title:"Success!",description:"Tag added successfully.",status:"success",duration:3e3,position:"top",isClosable:!0}),d()):u&&c({title:"Error.",description:u,status:"error",duration:5e3,position:"top",isClosable:!0})},children:e=>{let{setFieldValue:t}=e;return(0,n.jsxs)(z.l0,{children:[(0,n.jsx)(Y,{label:"",name:"tag",autocomplete:!0,placeholder:"Tag... (ex. broker, shipper, etc.)",setFieldValue:t,options:j}),(0,n.jsx)(o.x,{width:"100%",mt:8,children:(0,n.jsx)(u.z,{type:"submit",width:"100%",isLoading:x,children:"Add Tag"})})]})}})})]})]})]})},ez=e=>{let{id:t,carrierId:i,address:r,isOpen:s,onClose:a}=e,d=(0,l.p)(),c=(0,q.AJ)(),[{fetching:h},x]=(0,b.qf)(),p=async()=>{var e,n,r,l;let s=await x({id:t,carrierId:i}),o=null===(e=s.data)||void 0===e?void 0:null===(n=e.deleteEmail)||void 0===n?void 0:n.error;(null===(r=s.data)||void 0===r?void 0:null===(l=r.deleteEmail)||void 0===l?void 0:l.success)===!0?(d({title:"Success!",description:"Email deleted successfully.",status:"success",duration:3e3,position:"top",isClosable:!0}),a()):o&&d({title:"Error.",description:o,status:"error",duration:5e3,position:"top",isClosable:!0})};return(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,isOpen:s,onClose:a,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Delete Email"}),(0,n.jsx)($.o,{}),(0,n.jsxs)(ee.f,{children:[(0,n.jsx)(o.x,{mb:2,children:"Please confirm that you would like to delete this email."}),(0,n.jsx)(o.x,{mb:8,textColor:c,children:r})]}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,colorScheme:"red",width:"100%",onClick:p,isLoading:h,children:"Delete"})})})]})]})},eq=e=>{let{tagId:t,tagName:i,carrierId:r,address:s,emailId:a,isOpen:d,onClose:c}=e,h=(0,l.p)(),x=(0,q.AJ)(),[{fetching:p},m]=(0,b.pow)(),j=async()=>{var e,i,n,l;let s=await m({id:t,carrierId:r,emailId:a}),o=null===(e=s.data)||void 0===e?void 0:null===(i=e.removeTag)||void 0===i?void 0:i.error;(null===(n=s.data)||void 0===n?void 0:null===(l=n.removeTag)||void 0===l?void 0:l.success)===!0?(h({title:"Success!",description:"Tag removed successfully.",status:"success",duration:3e3,position:"top",isClosable:!0}),c()):o&&h({title:"Error.",description:o,status:"error",duration:5e3,position:"top",isClosable:!0})};
1return(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,isOpen:d,onClose:c,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Remove Tag"}),(0,n.jsx)($.o,{}),(0,n.jsx)(ee.f,{children:(0,n.jsxs)(o.x,{mb:8,children:["Please confirm that you would like to remove the"," ",(0,n.jsx)(o.x,{as:"span",children:(0,n.jsx)(E.Vp,{children:i})})," ","tag from"," ",(0,n.jsx)(o.x,{as:"span",textColor:x,children:s}),"."]})}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,colorScheme:"red",width:"100%",onClick:j,isLoading:p,children:"Remove Tag"})})})]})]})};var eL=i(2845),eR=i(3093);let eU=e=>{let{id:t,value:i,defaultValue:r,options:l,onChange:s}=e;return(0,n.jsx)(eR.c,{onChange:s,value:i,defaultValue:r,children:(0,n.jsx)(_.K,{direction:["column","row"],children:null==l?void 0:l.flatMap(e=>(0,n.jsx)(g.X,{value:e.value,children:e.name},e.value))})},t)},eF=e=>{let{carrierId:t,id:i,schedule:r,isOpen:s,onClose:a}=e,d=(0,x.useRouter)(),c=(0,l.p)(),[{fetching:h},p]=(0,b.GwJ)(),m=async()=>{var e,n,r,l;a();let s=await p({id:i,carrierId:t}),o=null===(e=s.data)||void 0===e?void 0:null===(n=e.deleteScheduledEmail)||void 0===n?void 0:n.error;(null===(r=s.data)||void 0===r?void 0:null===(l=r.deleteScheduledEmail)||void 0===l?void 0:l.success)===!0?(c({title:"Success!",description:"Scheduled email deleted successfully.",status:"success",duration:3e3,position:"top",isClosable:!0}),a(),d.replace("/dashboard?view=emails")):o&&c({title:"Error.",description:o,status:"error",duration:5e3,position:"top",isClosable:!0})};return(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,isOpen:s,onClose:a,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Delete Scheduled Email"}),(0,n.jsx)($.o,{}),(0,n.jsxs)(ee.f,{children:[(0,n.jsx)(o.x,{mb:4,children:"Deleting a scheduled email can not be undone. Please confirm that you would like to delete this email."}),(0,n.jsx)(o.x,{mb:8,fontWeight:"bold",fontSize:"lg",children:r})]}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,colorScheme:"red",width:"100%",onClick:m,isLoading:h,children:"Delete"})})})]})]})},eM=e=>{let{isOpen:t,onClose:i}=e,d=(0,l.p)(),c=(0,q.AJ)(),{carrierId:x}=(0,p.d4)(),[{fetching:m,data:v}]=(0,b.kOy)({variables:{carrierId:x},pause:!x}),f=(0,r.useMemo)(()=>{var e;return null!==(e=null==v?void 0:v.scheduledEmailsCarrierId)&&void 0!==e?e:[]},[v]),[{fetching:y},C]=(0,b.gHd)(),{isOpen:w,onOpen:S,onClose:I}=(0,s.q)(),[A,T]=(0,r.useState)(),{isOpen:z,onOpen:L,onClose:R}=(0,s.q)(),[U,F]=(0,r.useState)([]),[M,P]=(0,r.useState)(),[W,V]=(0,r.useState)(""),N=()=>{Q(!K)},[K,Q]=(0,r.useState)(!0),[H,Y]=(0,r.useState)(!1),J=(0,r.useCallback)(async()=>{var e,t,n;if(!x||!M||0===U.length){d({title:"Error.",description:"Please select a day and time to send your truck list.",status:"error",duration:5e3,position:"top",isClosable:!0});return}if(K&&!H){S();return}let r=await C({scheduledEmail:{monday:U.includes("monday"),tuesday:U.includes("tuesday"),wednesday:U.includes("wednesday"),thursday:U.includes("thursday"),friday:U.includes("friday"),saturday:U.includes("saturday"),sunday:U.includes("sunday"),hour:M,notes:W,brokers:K},carrierId:x}),l=null===(e=r.data)||void 0===e?void 0:null===(t=e.createScheduledEmail)||void 0===t?void 0:t.error;(null===(n=r.data)||void 0===n?void 0:n.createScheduledEmail.scheduledEmail)?(d({title:"Success!",description:"Truck list scheduled.",status:"success",duration:3e3,position:"top",isClosable:!0}),i()):l&&d({title:"Error.",description:l,status:"error",duration:5e3,position:"top",isClosable:!0})},[x,M,U,K,H,C,W,d,S,i]);(0,r.useEffect)(()=>{H&&(I(),J())},[H,I,J]),(0,r.useEffect)(()=>{t||(P(void 0),F([]),V(""),Q(!1),Y(!1))},[t]);let ei=e=>"".concat(0===e?12:e>12?e-12:e,":00 ").concat(e<12?"AM":"PM"," EST");return(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,size:["full","3xl"],scrollBehavior:"inside",isOpen:t,onClose:i,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:[0,6],children:[(0,n.jsx)(G.x,{children:"Schedule Your Truck List"}),(0,n.jsx)($.o,{}),(0,n.jsxs)(ee.f,{children:[(0,n.jsxs)(O.g,{mb:4,alignItems:"left",children:[m&&!v&&(0,n.jsxs)(_.K,{children:[(0,n.jsx)(o.x,{children:"Fetching scheduled emails..."}),(0,n.jsx)(eS.O,{height:"80px",rounded:"lg"})]}),(null==v?void 0:v.scheduledEmailsCarrierId)&&f.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.x,{children:"Scheduled Emails"}),(0,n.jsx)(_.K,{children:f.flatMap(e=>(0,n.jsxs)(a.k,{justifyContent:"space-between",mb:4,p:4,border:"1px",borderColor:"chakra-border-color",rounded:"md",fontSize:"md",alignItems:"center",children:[(0,n.jsxs)(o.x,{children:[(0,n.jsxs)(o.x,{children:[(0,n.jsx)(o.x,{as:"span",fontWeight:"bold",children:e.scheduledDays})," ",(0,n.jsx)(o.x,{as:"span",fontSize:"sm",textColor:c,children:"@"})," ",ei(e.hour)]}),e.notes&&(0,n.jsxs)(o.x,{children:[(0,n.jsx)(o.x,{as:"span",textColor:c,children:"Notes:"})," ",e.notes]}),e.brokers&&(0,n.jsxs)(a.k,{alignItems:"center",mb:2,fontSize:"sm",mt:2,children:[(0,n.jsx)(g.X,{mr:2,isChecked:e.brokers,isDisabled:!0}),(0,n.jsx)(o.x,{mr:1,onClick:N,cursor:"pointer",children:"Send to preferred brokers"})]}),e.status&&e.lastSendAt&&(0,n.jsxs)(o.x,{mt:2,children:[(0,n.jsxs)(o.x,{justifyItems:"center",children:[(0,n.jsxs)(o.x,{as:"span",textColor:c,children:["Last sent:"," "]}
1),new Date(e.lastSendAt).toLocaleString("en-US",{month:"2-digit",day:"2-digit",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0,timeZone:"America/New_York"})+" EST"]}),(0,n.jsxs)(o.x,{mt:1,children:[(0,n.jsx)(E.Vp,{mr:1,colorScheme:e.status===b.fhD.Success?"green":"red",children:e.status}),e.error&&e.status!==b.fhD.Success&&(0,n.jsx)(o.x,{as:"span",children:e.error})]})]})]}),(0,n.jsx)(u.z,{size:"sm",onClick:()=>{T(e),L()},children:(0,n.jsx)(k.pJ,{})})]},e.id))}),(0,n.jsx)(h.i,{mt:4})]})]}),(0,n.jsxs)(O.g,{mb:4,alignItems:"left",children:[(0,n.jsx)(o.x,{mb:4,children:"Schedule when your available capacity is sent."}),(0,n.jsx)(eU,{options:[{value:"monday",name:"Mon"},{value:"tuesday",name:"Tues"},{value:"wednesday",name:"Wed"},{value:"thursday",name:"Thur"},{value:"friday",name:"Fri"},{value:"saturday",name:"Sat"},{value:"sunday",name:"Sun"}],id:"days",value:U,onChange:e=>{F(e.map(e=>e.toString()))}}),(0,n.jsx)(eL.P,{placeholder:"Select a Time",value:M,onChange:e=>P(parseInt(e.target.value)),children:Array.from({length:24},(e,t)=>(0,n.jsx)("option",{value:t,children:ei(t)},t))}),(0,n.jsx)(o.x,{mt:4,mb:2,children:"Add a note (optional)"}),(0,n.jsx)(es.g,{mb:4,placeholder:"Add a note to your truck list...",value:W,onChange:e=>V(e.target.value)}),(0,n.jsxs)(a.k,{alignItems:"center",mb:2,children:[(0,n.jsx)(g.X,{mr:2,isChecked:K,onChange:N}),(0,n.jsx)(o.x,{mr:1,onClick:N,cursor:"pointer",children:"Send to preferred brokers"}),(0,n.jsx)(j.b,{label:"We're growing a list of reputable brokers that are interested in connecting with new carriers. We recommend sending your truck list to as many brokers as possible to increase your chances of finding the best loads for your trucks."})]}),(0,n.jsx)(o.x,{as:"i",textColor:c,children:"By default, this will send your truck list to all subscribed emails in your emails list."})]}),(0,n.jsx)(h.i,{mt:4})]}),(0,n.jsx)(et.m,{mb:[24,0],children:(0,n.jsxs)(_.K,{width:"100%",spacing:0,mb:6,children:[(0,n.jsx)(u.z,{mb:4,colorScheme:"teal",width:"100%",whiteSpace:"normal",overflowWrap:"break-word",onClick:J,isLoading:y,children:"Schedule Truck List"}),(0,n.jsx)(D.r,{href:"/email-preview?note=".concat(encodeURIComponent(W)),isExternal:!0,children:(0,n.jsxs)(u.z,{variant:"link",fontWeight:"normal",colorScheme:"gray",width:"100%",children:[(0,n.jsx)(o.x,{mr:1,children:(0,n.jsx)(k.tE,{})}),(0,n.jsx)(o.x,{children:"Preview"})]})})]})})]}),(0,n.jsx)(eE.W,{actionTitle:"Schedule send to all",body:"Please confirm that you would like to send your truck list to our list of preferred brokers. This will send your truck list to our entire preferred broker list.",isOpen:w,onAction:()=>Y(!0),onClose:I,title:"Send to interested brokers?"}),x&&A&&(0,n.jsx)(eF,{isOpen:z,onClose:()=>{T(void 0),R()},carrierId:x,id:A.id,schedule:"".concat(A.scheduledDays," @ ").concat(ei(A.hour))})]})};var eP=i(2729),eW=i(1046),eV=i(6997),e_=i(2432),eN={src:"/_next/static/media/logo-dark.e22e928f.svg",height:184,width:1236,blurWidth:0,blurHeight:0},eK={src:"/_next/static/media/logo.260735cf.svg",height:184,width:1236,blurWidth:0,blurHeight:0},eQ=i(5005);function eH(){let e=(0,eP._)(["\n query {\n emails(carrierId: ",") {\n id\n address\n subscribed\n lastContactedAt\n status\n tags {\n id\n name\n }\n }\n }\n"]);return eH=function(){return e},e}let eY=e=>{let{isOpen:t,onClose:i}=e,c=(0,l.p)(),x=(0,q.AJ)(),{carrierId:m}=(0,p.d4)();(0,eW.ff)(eK.src,eN.src);let{isOpen:v,onOpen:f,onClose:y}=(0,s.q)(),[{data:C,fetching:w}]=(0,b.apK)({variables:{carrierId:m},pause:!m}),[{data:S,fetching:I}]=(0,b.spc)({variables:{carrierId:m},pause:!m}),[A,T]=(0,r.useState)(""),[O,z]=(0,r.useState)(!1),R=(0,r.useMemo)(()=>S?S.emailTags.flatMap(e=>({name:e.name,value:e.id.toString()})):[],[S]),[{fetching:U},F]=(0,b.YAO)(),[M,P]=(0,r.useState)([]),[W,V]=(0,r.useState)(""),N=e=>{let t=e.flatMap(e=>{var t,i;return{id:e.id,address:e.address,tagIds:null===(t=e.tags)||void 0===t?void 0:t.flatMap(e=>e.id),tags:null===(i=e.tags)||void 0===i?void 0:i.flatMap(e=>e.name),status:e.status,lastContactedAt:e.lastContactedAt,selected:!0,selectedTag:!1,filtered:!0}});P(t)},K=(0,r.useCallback)(()=>{P(e=>e.map(e=>({...e,filtered:e.address.includes(W)})))},[W]),Q=(0,r.useMemo)(()=>M.every(e=>!0===e.selected),[M]),Y=()=>{let e=M.map(e=>({...e,selected:!Q,selectedTag:!!Q&&e.selectedTag}));z(!Q),P(e)},J=()=>{en(!ei)},[ei,en]=(0,r.useState)(!1),[er,el]=(0,r.useState)(!1),eo=(0,r.useMemo)(()=>M.flatMap((e,t)=>e.selected||e.selectedTag?{address:e.address,index:t}:void 0).filter(e=>void 0!==e),[M]),ea=(0,r.useMemo)(()=>M.flatMap(e=>e.selected||e.selectedTag?e.id:-1).filter(e=>void 0!==e&&-1!==e),[M]),ed=e=>{switch(e){case b.GmZ.Delivered:return"green";case b.GmZ.Opened:return"purple";case b.GmZ.Clicked:return"cyan";case b.GmZ.Failed:return"red";case b.GmZ.Unsubscribed:return"orange";case b.GmZ.Complained:return"yellow"}},ec=(0,r.useCallback)(async()=>{var e,t,n,r;if(!m||!ea)return;if(ei&&!er){f();return}(0,eQ.j)(eQ.zW.Dashboard.Capacity.SendModal.ClickSendCapacity,{recipientCount:M.length});let l=await F({carrierId:m,emails:ea,allBrokers:ei,note:A}),s=null===(e=l.data)||void 0===e?void 0:null===(t=e.sendTruckListEmail)||void 0===t?void 0:t.error;(null===(n=l.data)||void 0===n?void 0:null===(r=n.sendTruckListEmail)||void 0===r?void 0:r.success)==!0?(c({title:"Success!",description:"Emails sent.",status:"success",duration:3e3,position:"top",isClosable:!0}),i()):s&&c({title:"Error.",description:s,status:"error",duration:5e3,position:"top",isClosable:!0})}
1,[m,A,er,M.length,ea,i,f,ei,F,c]),eu=(0,eV.Ps)(eH(),(null!=m?m:0).toString()),[eh,ex]=(0,e_.aM)({query:eu,pause:!m});return(0,r.useEffect)(()=>{t&&m&&ex({requestPolicy:"network-only"})},[t,m,ex]),(0,r.useEffect)(()=>{K()},[W,K]),(0,r.useEffect)(()=>{(null==C?void 0:C.emails)&&N(C.emails)},[null==C?void 0:C.emails]),(0,r.useEffect)(()=>{er&&(y(),ec())},[er,y,ec]),(0,r.useEffect)(()=>{!t&&(V(""),T(""),en(!1),el(!1),(null==C?void 0:C.emails)&&N(C.emails))},[t,null==C?void 0:C.emails]),(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,size:["full","3xl"],scrollBehavior:"inside",isOpen:t,onClose:i,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:[0,6],children:[(0,n.jsx)(G.x,{children:"Send Truck List"}),(0,n.jsx)($.o,{}),(0,n.jsxs)(ee.f,{children:[(0,n.jsxs)(o.x,{mb:4,children:[(0,n.jsx)(o.x,{children:"Send your available capacity to the following emails."}),(0,n.jsx)(o.x,{mt:4,mb:2,children:"Add a note (optional)"}),(0,n.jsx)(es.g,{placeholder:"Add a note to your truck list...",value:A,onChange:e=>T(e.target.value)})]}),(0,n.jsx)(o.x,{maxH:"200px",overflowY:"scroll",children:!Q&&(0,n.jsx)(o.x,{children:eo.flatMap(e=>(0,n.jsxs)(E.Vp,{variant:"solid",colorScheme:"teal",size:"lg",children:[(0,n.jsx)(E.Sn,{children:e.address}),(0,n.jsx)(E.SD,{onClick:()=>
1{M[e.index].selected=!1,M[e.index].selectedTag=!1,P([...M])}})]},e.index))})}),w&&!C&&(0,n.jsxs)(_.K,{children:[(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"}),(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"}),(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"})]}),!w&&C&&M&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(_.K,{direction:{base:"column",sm:"row"},spacing:4,mt:4,mb:2,children:[(0,n.jsxs)(a.k,{children:[(0,n.jsx)(g.X,{mr:2,isChecked:Q,onChange:Y}),(0,n.jsx)(o.x,{onClick:Y,cursor:"pointer",children:"Send to all"})]}),(0,n.jsxs)(a.k,{alignItems:"center",children:[(0,n.jsx)(g.X,{mr:2,isChecked:ei,onChange:J}),(0,n.jsx)(o.x,{mr:1,onClick:J,cursor:"pointer",children:"Send to preferred brokers"}),(0,n.jsx)(j.b,{label:"We're growing a list of reputable brokers that are interested in connecting with new carriers. We recommend sending your truck list to as many brokers as possible to increase your chances of finding the best loads for your trucks."})]})]}),(0,n.jsxs)(o.x,{my:4,children:[I&&(0,n.jsx)(eS.O,{height:"60px",rounded:"lg"}),!I&&R.length>0&&(0,n.jsxs)(o.x,{children:[(0,n.jsx)(o.x,{mb:2,children:"Search Tags"}),(0,n.jsx)(H.P,{options:R,placeholder:"Tag...",multiselect:!0,autocomplete:!0,selectedOption:e=>{z(!1);let t=M,i=e.split(",").flatMap(e=>""!==e.trim()?parseInt(e):[]);if(Q&&i.length>0&&(t=t.map(e=>({...e,selected:!1}))),0===i.length){t.forEach((e,i)=>{e.selectedTag&&(t[i].selectedTag=!1)}),P([...t]);return}t.forEach((e,n)=>{e.tagIds&&(t[n].selectedTag=e.tagIds.some(e=>i.includes(e)))}),P([...t])},shouldReset:O})]})]}),(0,n.jsxs)(o.x,{my:4,children:[(0,n.jsxs)(o.x,{mb:2,children:["Search Emails (",M.length,")"]}),(0,n.jsx)(L.I,{placeholder:"Email...",type:"email",value:W,onChange:e=>V(e.target.value)})]}),(0,n.jsx)(_.K,{spacing:4,children:M.filter(e=>!0==e.filtered).flatMap(e=>(0,n.jsxs)(a.k,{justifyContent:"space-between",alignItems:"center",p:4,border:"1px",borderColor:"chakra-border-color",rounded:"lg",children:[(0,n.jsx)(g.X,{mr:4,isChecked:e.selected||e.selectedTag,onChange:t=>{let i=M.findIndex(t=>t.id==e.id);M[i].selected=t.target.checked,M[i].selectedTag=t.target.checked,P([...M])}}),(0,n.jsxs)(o.x,{w:"100%",children:[(0,n.jsx)(o.x,{w:"100%",children:e.address}),(0,n.jsxs)(d.U,{children:[e.status&&(0,n.jsx)(E.Vp,{mt:1,size:"sm",colorScheme:ed(e.status),children:e.status}),e.lastContactedAt&&(0,n.jsxs)(o.x,{textColor:x,fontSize:"sm",children:[!e.status&&(0,n.jsx)(n.Fragment,{children:"Capacity sent: "}),new Date(e.lastContactedAt).toLocaleString("default",{dateStyle:"medium",timeStyle:"short"})]})]}),e.tags&&e.tags.length>0&&(0,n.jsx)(d.U,{mt:2,overflowX:"scroll",style:{scrollbarWidth:"none"},children:e.tags.flatMap(e=>(0,n.jsx)(o.x,{children:(0,n.jsx)(E.Vp,{children:(0,n.jsx)(E.Sn,{children:e})})},e))})]})]},e.id))})]}),(0,n.jsx)(h.i,{mt:4})]}),(0,n.jsx)(et.m,{mb:[24,0],children:(0,n.jsxs)(_.K,{width:"100%",spacing:0,mb:6,children:[(0,n.jsxs)(u.z,{mb:4,colorScheme:"teal",width:"100%",whiteSpace:"normal",overflowWrap:"break-word",onClick:ec,isLoading:U,isDisabled:ea.length<=0&&!ei,children:["Send Truck List"," ",ea.length>0&&"to ".concat(ea.length," Email").concat(ea.length>1?"s":"")]}),(0,n.jsx)(D.r,{href:"/email-preview?note=".concat(encodeURIComponent(A)),isExternal:!0,children:(0,n.jsxs)(u.z,{variant:"link",fontWeight:"normal",colorScheme:"gray",width:"100%",children:[(0,n.jsx)(o.x,{mr:1,children:(0,n.jsx)(k.tE,{})}),(0,n.jsx)(o.x,{children:"Preview"})]})})]})})]}),(0,n.jsx)(eE.W,{actionTitle:"Send to all",body:"Please confirm that you would like to send your truck list to our list of preferred brokers. This will send your truck list to our entire preferred broker list.",isOpen:v,onAction:()=>el(!0),onClose:y,title:"Send to interested brokers?"})]})},eJ=e=>{let{id:t,name:i,count:r,carrierId:s,isOpen:a,onClose:d,onDelete:c}=e,h=(0,l.p)(),x=(0,q.AJ)(),[{fetching:p},m]=(0,b.BWK)(),j=async()=>{var e,i,n,r;let l=await m({id:t,carrierId:s}),o=null===(e=l.data)||void 0===e?void 0:null===(i=e.deleteTag)||void 0===i?void 0:i.error;(null===(n=l.data)||void 0===n?void 0:null===(r=n.deleteTag)||void 0===r?void 0:r.success)===!0?(h({title:"Success!",description:"Tag deleted.",status:"success",duration:3e3,position:"top",isClosable:!0}),d(),c()):o&&h({title:"Error.",description:o,status:"error",duration:5e3,position:"top",isClosable:!0})};
1return(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,isOpen:a,onClose:d,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Delete Tag"}),(0,n.jsx)($.o,{}),(0,n.jsx)(ee.f,{children:(0,n.jsxs)(o.x,{mb:8,children:["Please confirm that you would like to delete the"," ",(0,n.jsx)(o.x,{as:"span",children:(0,n.jsx)(E.Vp,{children:i})})," ","tag and remove it from"," ",(0,n.jsx)(o.x,{as:"span",textColor:x,children:r})," ","email addresses."]})}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,colorScheme:"red",width:"100%",onClick:j,isLoading:p,children:"Delete Tag"})})})]})]})},eB=e=>{var t,i,a,c,x;let{id:p,name:m,carrierId:j,isOpen:v,onClose:g}=e,f=(0,l.p)(),{isOpen:y,onOpen:C,onClose:w}=(0,s.q)(),{isOpen:S,onOpen:A,onClose:T}=(0,s.q)(),[{data:D,fetching:q}]=(0,b.Wh2)({variables:{id:p,carrierId:j}}),[{fetching:L},R]=(0,b.gow)(),[U,F]=(0,r.useState)(),M=(0,r.useMemo)(()=>{var e,t;return null!==(t=null==D?void 0:null===(e=D.tag)||void 0===e?void 0:e.name)&&void 0!==t?t:""},[D]);return(0,n.jsxs)(B.u_,{isOpen:v,onClose:g,size:["full","lg"],children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:[0,6],children:[(0,n.jsxs)(G.x,{children:["Tag:"," ",(0,n.jsx)(E.Vp,{size:"lg",children:(0,n.jsx)(E.Sn,{children:M})})]}),(0,n.jsx)($.o,{}),(0,n.jsxs)(ee.f,{children:[(0,n.jsxs)(o.x,{children:[(0,n.jsx)(z.J9,{initialValues:{tag:m},onSubmit:async e=>{var t,i,n,r;let{tag:l}=e,s=await R({id:p,tag:l,carrierId:j}),o=null===(t=s.data)||void 0===t?void 0:null===(i=t.updateTag)||void 0===i?void 0:i.error;(null===(n=s.data)||void 0===n?void 0:null===(r=n.updateTag)||void 0===r?void 0:r.success)===!0?f({title:"Success!",description:"Tag successfully updated.",status:"success",duration:3e3,position:"top",isClosable:!0}):o&&f({title:"Error.",description:o,status:"error",duration:5e3,position:"top",isClosable:!0})},children:()=>(0,n.jsx)(z.l0,{children:(0,n.jsxs)(d.U,{alignItems:"end",justifyContent:"stretch",children:[(0,n.jsx)(o.x,{w:"100%",children:(0,n.jsx)(W.y,{name:"tag",label:"Update Tag",placeholder:"Update tag..."})}),(0,n.jsx)(u.z,{mt:8,type:"submit",isLoading:L,children:"Save"})]})})}),(0,n.jsx)(o.x,{mt:4,w:"100%",children:(0,n.jsx)(I.M,{children:(0,n.jsx)(u.z,{variant:"ghost",colorScheme:"red",onClick:A,children:(0,n.jsx)(o.x,{fontWeight:"normal",children:"Delete Tag"})})})})]}),(0,n.jsx)(h.i,{mt:4,mb:6}),(0,n.jsxs)(o.x,{mt:8,children:[q&&!D&&(0,n.jsxs)(_.K,{spacing:4,children:[(0,n.jsx)(o.x,{children:"Tagged Emails"}),(0,n.jsx)(eS.O,{height:"58px",rounded:"lg"})]}),!q&&(null==D?void 0:null===(t=D.tag)||void 0===t?void 0:t.emails)&&D.tag.emails.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(o.x,{children:["Tagged Emails (",D.tag.emails.length,")"]}),(0,n.jsx)(O.g,{mt:4,spacing:4,children:null==D?void 0:null===(i=D.tag)||void 0===i?void 0:i.emails.flatMap(e=>(0,n.jsxs)(d.U,{alignItems:"center",p:4,border:"1px",borderColor:"chakra-border-color",rounded:"lg",w:"100%",children:[(0,n.jsx)(o.x,{w:"100%",children:e.address},e.id),(0,n.jsx)(u.z,{size:"sm",onClick:()=>{F({emailId:e.id,emailAddress:e.address}),C()},children:(0,n.jsx)(k.Tw,{})})]},e.id))})]})]}),U&&(0,n.jsx)(eq,{isOpen:y,onClose:w,tagId:p,tagName:M,emailId:U.emailId,address:U.emailAddress,carrierId:j}),(0,n.jsx)(eJ,{isOpen:S,onClose:T,onDelete:g,id:p,name:M,count:null!==(x=null==D?void 0:null===(a=D.tag)||void 0===a?void 0:null===(c=a.emails)||void 0===c?void 0:c.length)&&void 0!==x?x:0,carrierId:j})]}),(0,n.jsx)(et.m,{mb:[24,4]})]})]})},eZ=()=>{let{carrierId:e}=(0,p.d4)(),t=(0,l.p)(),i=(0,x.useRouter)(),v=(0,q.Yg)(),g=(0,q.AJ)(),f=(0,m.o)("send"),[{fetching:y},C]=(0,b.jN$)(),{isOpen:w,onOpen:S,onClose:I}=(0,s.q)(),{isOpen:T,onOpen:D,onClose:R}=(0,s.q)(),{isOpen:U,onOpen:F,onClose:M}=(0,s.q)(),{isOpen:P,onOpen:V,onClose:N}=(0,s.q)(),[K,Q]=(0,r.useState)(),[H,Y]=(0,r.useState)([]),[,J]=(0,b.mu1)(),[{data:B,fetching:Z}]=(0,b.apK)({variables:{carrierId:e},pause:!e,requestPolicy:"cache-and-network"}),[{data:X,fetching:G}]=(0,b.spc)({variables:{carrierId:e},pause:!e}),[{data:$}]=(0,b.HWK)({variables:{id:e},pause:!e}),[ee,et]=(0,r.useState)(""),ei=(0,r.useCallback)(()=>
1{if(!(null==B?void 0:B.emails))return;let e=B.emails.filter(e=>e.address.includes(ee));Y(e)},[B,ee]),{isOpen:en,onOpen:er,onClose:el}=(0,s.q)(),{isOpen:es,onOpen:eo,onClose:ea}=(0,s.q)(),{isOpen:ed,onOpen:ec,onClose:eu}=(0,s.q)(),{isOpen:eh,onOpen:ex,onClose:ep}=(0,s.q)(),{isOpen:em,onOpen:ej,onClose:ev}=(0,s.q)(),eg=e=>{var t;if((null==$?void 0:null===(t=$.carrierId)||void 0===t?void 0:t.approved)===!1){ej();return}if(0===H.length){ex();return}e()},ef=e=>{switch(e){case b.GmZ.Delivered:return"green";case b.GmZ.Opened:return"purple";case b.GmZ.Clicked:return"cyan";case b.GmZ.Failed:return"red";case b.GmZ.Unsubscribed:return"orange";case b.GmZ.Complained:return"yellow"}};return(0,r.useEffect)(()=>{ei()},[ee,ei]),(0,r.useEffect)(()=>{(null==B?void 0:B.emails)&&Y(B.emails)},[null==B?void 0:B.emails]),(0,r.useEffect)(()=>{f&&ec()},[f,ec]),(0,n.jsxs)(o.x,{children:[(0,n.jsxs)(a.k,{justifyContent:"space-between",children:[(0,n.jsxs)(d.U,{children:[(0,n.jsx)(c.X,{size:"lg",children:"Emails"},"heading"),(0,n.jsx)(j.b,{label:"Add all the emails of brokers that you regularly work with then use the 'Send Truck List' button to send a formatted truck list of your available capacity. We suggest sending a truck list to your broker contacts every day with the most up to date capacity information."},"tooltip")]}),e&&(0,n.jsxs)(d.U,{children:[(0,n.jsx)(u.z,{colorScheme:"teal",onClick:()=>{var e;if((null==$?void 0:null===(e=$.carrierId)||void 0===e?void 0:e.subscription)!==b.w0K.Proplus){eo();return}eg(er)},children:(0,n.jsxs)(d.U,{children:[(0,n.jsx)(k.T3,{}),(0,n.jsx)(o.x,{children:"Schedule"})]})}),(0,n.jsx)(u.z,{colorScheme:"teal",onClick:()=>{eg(ec)},children:"Send Truck List"})]})]}),(0,n.jsx)(h.i,{my:4}),e?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.x,{mb:4,children:(0,n.jsx)(z.J9,{initialValues:{email:""},onSubmit:async(i,n)=>{var r,l,s,o;let{setSubmitting:a,resetForm:d}=n;if(!e)return;a(!0);let c=await J({address:i.email,carrierId:e}),u=null===(r=c.data)||void 0===r?void 0:null===(l=r.addEmail)||void 0===l?void 0:l.error;a(!1),(null===(s=c.data)||void 0===s?void 0:null===(o=s.addEmail)||void 0===o?void 0:o.email)?(t({title:"Success!",description:"Email added.",status:"success",duration:3e3,position:"top",isClosable:!0}),d()):u&&t({title:"Error.",description:u,status:"error",duration:5e3,position:"top",isClosable:!0})},children:e=>{let{isSubmitting:t}=e;return(0,n.jsx)(z.l0,{children:(0,n.jsxs)(d.U,{alignItems:"end",justifyContent:"stretch",children:[(0,n.jsx)(o.x,{w:"100%",children:(0,n.jsx)(W.y,{name:"email",label:"Add Email",placeholder:"Email",size:"md"})}),(0,n.jsx)(u.z,{size:"md",type:"submit",isLoading:t,children:"Add"})]})})}})}),(0,n.jsx)(h.i,{mt:4,mb:6}),G&&!X&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_.K,{children:(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"})}),(0,n.jsx)(h.i,{mt:4,mb:6})]}),!G&&X&&X.emailTags.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.x,{mt:8,mb:4,children:"Tags"}),(0,n.jsx)(d.U,{overflowX:"scroll",style:{scrollbarWidth:"none"},children:X.emailTags.flatMap(e=>(0,n.jsx)(u.z,{variant:"unstyled",onClick:()=>{Q({tagId:e.id,tagName:e.name}),S()},children:(0,n.jsx)(E.Vp,{children:(0,n.jsx)(E.Sn,{children:e.name})})},e.id))}),(0,n.jsx)(h.i,{mt:4,mb:6})]}),Z&&!B&&(0,n.jsxs)(_.K,{children:[(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"}),(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"}),(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"})]}),!Z&&B&&B.emails.length>0&&H&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(o.x,{mt:8,mb:4,children:["Search Emails (",B.emails.length,")"]}),(0,n.jsx)(L.I,{size:"md",mb:4,placeholder:"Email",type:"email",value:ee,onChange:e=>et(e.target.value)}),(0,n.jsx)(_.K,{spacing:4,overflowY:"scroll",children:H.flatMap(e=>(0,n.jsxs)(a.k,{justifyContent:"space-between",alignItems:"center",p:4,border:"1px",borderColor:"chakra-border-color",rounded:"md",fontSize:"md",children:[(0,n.jsxs)(o.x,{w:"80%",children:[(0,n.jsx)(o.x,{w:"100%",fontWeight:"bold",children:e.address}),(0,n.jsxs)(d.U,{children:[e.status&&(0,n.jsx)(E.Vp,{mt:1,size:"sm",colorScheme:ef(e.status),children:e.status}),e.lastContactedAt&&(0,n.jsxs)(o.x,{textColor:g,children:[!e.status&&(0,n.jsx)(n.Fragment,{children:"Capacity sent: "}
1),new Date(e.lastContactedAt).toLocaleString("default",{dateStyle:"medium",timeStyle:"short"})]})]}),e.tags&&e.tags.length>0&&(0,n.jsx)(d.U,{mt:2,overflowX:"scroll",style:{scrollbarWidth:"none"},children:e.tags.flatMap(t=>(0,n.jsx)(o.x,{children:(0,n.jsxs)(E.Vp,{children:[(0,n.jsx)(E.Sn,{children:t.name}),(0,n.jsx)(E.SD,{onClick:()=>{Q({emailAddress:e.address,emailId:e.id,tagId:t.id,tagName:t.name}),F()}})]})},t.id))})]}),(0,n.jsxs)(ek.J,{placement:"bottom-end",children:[(0,n.jsx)(eI.x,{children:(0,n.jsx)(u.z,{size:"sm",children:(0,n.jsx)(k.RI,{})})}),(0,n.jsxs)(eA.y,{w:"140px",children:[(0,n.jsx)(eT.Q,{}),(0,n.jsx)(eO.b,{children:(0,n.jsxs)(O.g,{justifyItems:"left",children:[(0,n.jsx)(o.x,{cursor:"pointer",width:"100%",textAlign:"left",onClick:()=>{Q({emailId:e.id,emailAddress:e.address}),D()},children:"Add tag"}),(0,n.jsx)(h.i,{}),(0,n.jsx)(o.x,{cursor:"pointer",width:"100%",textAlign:"left",textColor:v,onClick:()=>{Q({emailId:e.id,emailAddress:e.address}),V()},children:"Delete"})]})})]})]})]},e.id))})]}),(0,n.jsx)(eY,{isOpen:ed,onClose:eu}),(0,n.jsx)(eM,{isOpen:en,onClose:el}),K&&K.emailId&&K.emailAddress&&e&&(0,n.jsx)(ez,{isOpen:P,onClose:N,id:K.emailId,address:K.emailAddress,carrierId:e}),K&&K.tagId&&K.tagName&&e&&(0,n.jsx)(eB,{isOpen:w,onClose:I,id:K.tagId,name:K.tagName,carrierId:e}),K&&K.emailId&&K.emailAddress&&e&&(0,n.jsx)(eD,{isOpen:T,onClose:R,id:K.emailId,address:K.emailAddress,carrierId:e}),K&&K.emailId&&K.emailAddress&&K.tagId&&K.tagName&&e&&(0,n.jsx)(eq,{isOpen:U,onClose:M,tagId:K.tagId,tagName:K.tagName,emailId:K.emailId,address:K.emailAddress,carrierId:e}),(0,n.jsx)(eE.W,{title:"No Emails",body:"There are no emails in your emails list. You need to add an email before you can send a truck list.",actionTitle:" Add Emails",isOpen:eh,onAction:ep,onClose:ep}),(0,n.jsx)(eE.W,{title:"Profile not approved.",body:"Your profile is not yet approved to send a truck list. Profile's should be reviewed within 24-48 hours once created. If you think this is a mistake please feel free to reach out to [email protected] for an expedited review.",actionTitle:"Close",isOpen:em,onAction:ev,onClose:ev}),(0,n.jsx)(eE.W,{title:"Pro Plus Subscription Required",body:"You need to have a Pro Plus subscription to send a scheduled truck list. Please upgrade your subscription to the 25-200 trucks tier to send a scheduled truck list.",description:"You'll be able to confirm your subscription upgrade on the next page.",actionTitle:"Upgrade Subscription",isOpen:es,isLoading:y,onAction:async()=>{let{data:e}=await C({});(null==e?void 0:e.createPortalSession.url)&&i.push(e.createPortalSession.url)},onClose:ea})]}):(0,n.jsx)(A,{})]})};var eX=i(7837);let eG=e=>{switch(e){case b.Q2y.Tractor:return ea.OU;case b.Q2y.Trailer:return ea.aQ;case b.Q2y.Specialized:return ea.sv}},e$=e=>{switch(e){case b.Q2y.Tractor:return"Tractor#";case b.Q2y.Trailer:return"Trailer#";case b.Q2y.Specialized:return"Truck#"}return"#"},e0=e=>{let{isOpen:t,onClose:i}=e,s=(0,x.useRouter)(),c=(0,l.p)(),h=(0,q.md)(),m=(0,q.Yg)(),{carrierId:j}=(0,p.d4)(),[{fetching:g},f]=(0,b.Ppj)(),[w,S]=(0,r.useState)(!1),[A,T]=(0,r.useState)({type:b.Q2y.Trailer,subtype:b.ifq.V53,number:"",vin:"",year:""}),E=async()=>{w&&z?F():A.vin&&A.year&&S(!0)};(0,r.useEffect)(()=>{t||(T({type:b.Q2y.Trailer,subtype:b.ifq.V53,number:"",vin:"",year:""}),S(!1))},[t]);let D=async()=>{if(!A.vin||!A.year||!w)return{};let e=await fetch("https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVinValues/".concat(A.vin,"?format=json&modelYear=").concat(A.year),{cache:"force-cache"}),t=await e.json();return t.Results[0]},{data:z,isLoading:R,isFetching:U}=(0,eX.a)(["vinData",w],D,{refetchOnWindowFocus:!1}),F=async()=>{var e,t,n;if(!z||!j||!A.subtype||!A.number)return;let r=A.type,l=A.subtype,o=await f({equipment:{carrierId:j,type:r,subtype:l,number:A.number,vin:z.VIN,make:z.Make,model:z.Model,year:z.ModelYear?parseInt(z.ModelYear):void 0}}),a=null===(e=o.data)||void 0===e?void 0:e.createEquipment.error;(null===(t=o.data)||void 0===t?void 0:null===(n=t.createEquipment)||void 0===n?void 0:n.equipment)?(c({title:"Success!",description:"Equipment profile created!",status:"success",duration:3e3,position:"top",isClosable:!0}),i(),s.push("/dashboard?view=equipment")):a&&c({title:"Error.",description:a,status:"error",duration:5e3,position:"top",isClosable:!0})};return(0,n.jsxs)(B.u_,{isOpen:t,onClose:i,size:["full","2xl"],closeOnOverlayClick:!1,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:[0,6],children:[(0,n.jsx)(G.x,{children:"Add equipment"}),(0,n.jsx)($.o,{onClick:()=>s.back()}),(0,n.jsxs)(ee.f,{children:[(0,n.jsx)(o.x,{mt:4,children:"Equipment Type"}),(0,n.jsx)(I.M,{children:(0,n.jsx)(d.U,{mt:4,children:[{name:C(b.Q2y.Tractor),value:b.Q2y.Tractor,selectedSubtype:b.ifq.Trac,icon:k.Yw},{name:C(b.Q2y.Trailer),value:b.Q2y.Trailer,selectedSubtype:b.ifq.V53,icon:k.uB},{name:C(b.Q2y.Specialized),value:b.Q2y.Specialized,selectedSubtype:"",icon:k.XX}].flatMap(e=>(0,n.jsx)(u.z,{w:28,h:28,rounded:"md",outlineColor:A.type===e.value?"teal":void 0,onClick:()=>{T(t=>(S(!1),{...t,type:e.value,subtype:e.selectedSubtype,vin:"",year:""}))},children:(0,n.jsxs)(O.g,{children:[(0,n.jsx)(y.J,{as:e.icon}),(0,n.jsx)(o.x,{children:e.name})]})},e.value))})}),(A.type===b.Q2y.Trailer||A.type===b.Q2y.Specialized)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.x,{mt:4,children:"Equipment Subtype"}),(0,n.jsx)(H.P,{mt:2,placeholder:"Equipment Subtype",autocomplete:!0,options:eG(A.type),defaultValue:A.subtype,selectedOption:e=>{T(t=>({...t,subtype:e}))}})]}),A.type&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.x,{mt:4,children:e$(A.type)}),(0,n.jsx)(L.I,{mt:2,placeholder:e$(A.type),value:A.number,onChange:e=>{S(!1),T(t=>({...t,number:e.target.value}))},onKeyDown:(0,eo.c)(E)}),(0,n.jsx)(o.x,{mt:4,children:"VIN#"}),(0,n.jsx)(L.I,{mt:2,placeholder:"VIN#",value:A.vin,onChange:e=>{S(!1),T(t=>({...t,vin:e.target.value}))},onKeyDown:(0,eo.c)(E)}),(0,n.jsx)(o.x,{mt:4,children:"Model Year"}),(0,n.jsx)(L.I,{mt:2,placeholder:"Model Year",value:A.year,onChange:e=>{S(!1),T(t=>({...t,year:e.target.value}))},onKeyDown:(0,eo.c)(E)}),(0,n.jsx)(()=>R||U?(0,n.jsx)(v.$,{mt:4,display:w?"block":"none"}):z?(0,n.jsxs)(o.x,{mt:4,p:6,bg:h,rounded:"lg",display:w?"block":"none",children:[(0,n.jsxs)(o.x,{children:["Make: ",z.Make]}),(0,n.jsxs)(o.x,{children:["Model: ",z.Model]}),(0,n.jsxs)(o.x,{children:["Year: ",z.ModelYear]}),(0,n.jsx)(a.k,{justifyContent:"flex-end",mt:1,children:(0,n.jsx)(o.x,{as:"i",fontSize:"x-small",children:"Data provided by NHTSA"})})]}):(0,n.jsx)(o.x,{mt:4,textColor:m,display:w?"block":"none",children:"Unable to find information on that VIN #. Either try again or click create to manually input your equipment information."}),{})]})]}),(0,n.jsx)(et.m,{mb:[24,4],children:A.type&&(0,n.jsx)(o.x,{w:"100%",mb:4,children:(0,n.jsx)(u.z,{w:"100%",colorScheme:"teal",onClick:E,isLoading:g,children:w?"Create Equipment Profile":"Continue"})})})]})]})},e1=e=>{let{dot:t,carrierId:i,id:r,isOpen:s,onClose:a}=e,d=(0,x.useRouter)(),c=(0,l.p)(),[{fetching:h},p]=(0,b.o2p)(),m=async()=>{var e,n,l,s;let o=await p({id:r,carrierId:i,dot:t}),u=null===(e=o.data)||void 0===e?void 0:null===(n=e.deleteEquipment)||void 0===n?void 0:n.error;(null===(l=o.data)||void 0===l?void 0:null===(s=l.deleteEquipment)||void 0===s?void 0:s.success)?(c({title:"Success!",description:"Equipment profile deleted successfully!",status:"success",duration:3e3,position:"top",isClosable:!0}),a(),d.replace("/dashboard?view=equipment")):u&&c({title:"Error.",description:u,status:"error",duration:5e3,position:"top",isClosable:!0})};
1return(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,isOpen:s,onClose:a,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Delete Equipment Profile"}),(0,n.jsx)($.o,{}),(0,n.jsx)(ee.f,{children:(0,n.jsx)(o.x,{mb:8,children:"Deleting an equipment profile can not be undone. This will also delete all capacity that is tied to this equipment profile. Please confirm that you would like to delete this equipment profile and related capacity."})}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,colorScheme:"red",width:"100%",onClick:m,isLoading:h,children:"Delete"})})})]})]})},e4=e=>{var t,i,r,a,d,c,h,p,j,g,f,y,C,w,S;let{...k}=e,A=(0,l.p)(),T=(0,x.useRouter)(),O=(0,m.o)("edit"),{isOpen:E,onOpen:D,onClose:q}=(0,s.q)(),[{fetching:L},R]=(0,b._vZ)(),[{data:U,fetching:F}]=(0,b.dO9)({variables:{id:parseInt(null!=O?O:"0")},pause:!O});return O&&F?(0,n.jsx)(v.$,{}):(0,n.jsxs)(o.x,{...k,children:[(0,n.jsx)(z.J9,{initialValues:{type:null!==(j=null==U?void 0:null===(t=U.equipmentId)||void 0===t?void 0:t.type)&&void 0!==j?j:"",subtype:null!==(g=null==U?void 0:U.equipmentId.subtype)&&void 0!==g?g:"",number:null!==(f=null==U?void 0:null===(i=U.equipmentId)||void 0===i?void 0:i.number)&&void 0!==f?f:"",vin:null!==(y=null==U?void 0:null===(r=U.equipmentId)||void 0===r?void 0:r.vin)&&void 0!==y?y:"",make:null!==(C=null==U?void 0:null===(a=U.equipmentId)||void 0===a?void 0:a.make)&&void 0!==C?C:"",model:null!==(w=null==U?void 0:null===(d=U.equipmentId)||void 0===d?void 0:d.model)&&void 0!==w?w:"",year:null!==(S=null==U?void 0:null===(c=U.equipmentId)||void 0===c?void 0:null===(h=c.year)||void 0===h?void 0:h.toString())&&void 0!==S?S:""},onSubmit:async e=>{var t,i;if(!O)return;let n=e.type,r=e.subtype;if(!Object.values(b.ifq).includes(r)){A({title:"Invalid equipment subtype.",description:"Please make sure you select an equipment subtype from the drop down and try again.",status:"error",duration:8e3,position:"top",isClosable:!0});return}let l=await R({id:parseInt(O),equipment:{...e,year:parseInt(e.year),type:n,subtype:r}}),s=(null===(t=l.data)||void 0===t?void 0:t.updateEquipment.equipment)!==void 0,o=null===(i=l.data)||void 0===i?void 0:i.updateEquipment.error;s?(A({title:"Success!",description:"Equipment profile updated.",status:"success",duration:3e3,position:"top",isClosable:!0}),T.push("/dashboard?view=equipment")):o&&A({title:"Error.",description:o,status:"error",duration:5e3,position:"top",isClosable:!0})},children:e=>{let{setFieldValue:t,values:i}=e;return(0,n.jsxs)(z.l0,{children:[(0,n.jsx)(Y,{name:"type",label:"Equipment Type",placeholder:"Equipment Type",options:ea.b7,required:!0,setFieldValue:t}),(0,n.jsx)(Y,{name:"subtype",label:"Equipment Subtype",placeholder:"Equipment Subtype",options:eG(i.type),autocomplete:!0,required:!0,setFieldValue:t}),(0,n.jsx)(W.y,{name:"number",placeholder:e$(i.type),label:e$(i.type)}),(0,n.jsx)(W.y,{name:"vin",label:"VIN#",placeholder:"VIN#"}),(0,n.jsx)(W.y,{name:"make",label:"Make",placeholder:"Make"}),(0,n.jsx)(W.y,{name:"model",label:"Model",placeholder:"Model"}),(0,n.jsx)(W.y,{name:"year",label:"Year",placeholder:"Year"}),(0,n.jsx)(u.z,{mt:8,w:"100%",type:"submit",isLoading:L,children:"Save"})]})}}),(0,n.jsx)(o.x,{mt:6,children:(0,n.jsx)(I.M,{children:(0,n.jsx)(u.z,{variant:"ghost",fontWeight:"normal",colorScheme:"red",onClick:D,children:"Delete equipment profile"})})}),(null==U?void 0:U.equipmentId)&&(null===(p=U.equipmentId.carrier)||void 0===p?void 0:p.dot)&&(0,n.jsx)(e1,{dot:U.equipmentId.carrier.dot,carrierId:U.equipmentId.carrierId,id:U.equipmentId.id,isOpen:E,onClose:q})]})};var e2=i(2531);let e3=e=>{var t;let{...i}=e,{carrierId:l}=(0,p.d4)(),[{data:s,fetching:a,stale:d}]=(0,b.gsW)({variables:{carrierId:l,limit:200},pause:!l}),c=(0,r.useMemo)(()=>{var e;return null==s?void 0:null===(e=s.equipmentCarrierId)||void 0===e?void 0:e.equipment},[null==s?void 0:null===(t=s.equipmentCarrierId)||void 0===t?void 0:t.equipment]);return(0,n.jsxs)(o.x,{...i,children:[(a||d)&&(0,n.jsx)(v.$,{mb:4}),(!a&&!c||!l)&&(0,n.jsx)(A,{}
1),!a&&!d&&c&&(0,n.jsxs)(n.Fragment,{children:[c.length<=0&&(0,n.jsx)(o.x,{mt:2,children:"No equipment for carrier..."}),(0,n.jsx)(e2.F,{equipment:c,direction:"column",editable:!0})]})]})},e5=()=>{let e=(0,x.useRouter)(),t=(0,m.o)("create"),i=(0,m.o)("edit"),{carrierId:l}=(0,p.d4)(),[v,g]=(0,r.useState)(!1),[f,y]=(0,r.useState)(!1),{isOpen:b,onOpen:C,onClose:w}=(0,s.q)();return(0,r.useEffect)(()=>{scrollTo({top:0}),g(!!t),y(!!i)},[t,i]),(0,r.useEffect)(()=>{v&&C()},[v,C]),(0,n.jsxs)(o.x,{children:[(0,n.jsxs)(a.k,{justifyContent:"space-between",children:[(0,n.jsxs)(d.U,{children:[(0,n.jsx)(c.X,{size:"lg",children:"Equipment"},"heading"),(0,n.jsx)(j.b,{label:"Add all of your trucks and trailers to your profile. We suggest adding the VIN numbers for each piece of equipment to make it easier if brokers need this information to work with you."},"tooltip")]}),l&&(0,n.jsx)(u.z,{colorScheme:f?void 0:"teal",onClick:()=>{v||f?e.push("/dashboard?view=equipment"):e.push("/dashboard?view=equipment&create=1")},children:f?"Cancel":"Add Equipment"})]}),(0,n.jsx)(h.i,{my:4}),f?(0,n.jsx)(e4,{}):(0,n.jsx)(e3,{}),(0,n.jsx)(e0,{isOpen:b,onClose:w})]})};var e8=i(6657),e6=i(8843),e9=i(9915),e7=i(90),te=i(9780),tt=i(4540);let ti=()=>{let e=(0,x.useRouter)(),t=(0,q.V1)(),i=(0,q.fG)(),l=(0,q.lK)(),s=(0,q.Xn)(),c=(0,q.md)(),{carrierId:u}=(0,p.d4)(),[{data:m}]=(0,b.E8n)({variables:{id:u},pause:!u}),j=(0,r.useMemo)(()=>null==m?void 0:m.profileComplete.data,[m]),[{data:v}]=(0,b.Fbz)({variables:{carrierId:u},pause:!u}),g=(0,r.useMemo)(()=>null==v?void 0:v.staleCapacity,[null==v?void 0:v.staleCapacity]),f=[{icon:k.pO,label:"Add capacity",linkQuery:{view:"capacity"}},{icon:k.Rd,label:"Send a truck list",linkQuery:{view:"emails",send:1}},{icon:k.W1,label:"Find loads",linkQuery:{view:"loads"}}],y=(0,r.useMemo)(()=>j?[{label:"Last truck list",data:j.mostRecentSend,linkQuery:{view:"emails",send:1},colorScheme:"Today"==j.mostRecentSend?"green":"red"},{label:"Capacity",data:j.capacityCount.toString(),linkQuery:{view:"capacity"},colorScheme:j.capacityCount>0?"green":"red"},{label:"Emails",data:j.emailCount.toString(),linkQuery:{view:"emails"},colorScheme:j.emailCount>4?"green":"red"},{label:"Preferred lanes",data:j.lanesCount.toString(),linkQuery:{view:"lanes"},colorScheme:j.lanesCount>0?"green":"red"}]:[],[j]);return u?(0,n.jsxs)(o.x,{children:[(0,n.jsx)(d.U,{fontWeight:"bold",fontSize:{base:"sm",sm:"sm",md:"md"},textAlign:"center",children:f.map(r=>(0,n.jsx)(a.k,{alignItems:"center",justifyContent:"center",h:{base:"80px",md:"auto"},rounded:"md",bgColor:i,color:t,_hover:{bgColor:l},cursor:"pointer",onClick:()=>{e.push({pathname:"/dashboard",query:r.linkQuery})},p:{base:2,md:6},w:48,children:(0,n.jsxs)(_.K,{direction:{base:"column",md:"row"},alignItems:"center",children:[(0,n.jsx)(o.x,{fontSize:"16px",as:r.icon}),(0,n.jsx)(o.x,{children:r.label})]})},r.label))}),(0,n.jsxs)(o.x,{mt:6,mb:10,children:[j&&j.percentageComplete<100&&(0,n.jsx)(h.i,{mb:4}),(0,n.jsx)(tt.K,{})]}),j&&(0,n.jsxs)(o.x,{mt:6,children:[(0,n.jsx)(h.i,{mb:4}),(0,n.jsx)(o.x,{mb:4,fontWeight:"bold",children:"Profile snapshot"}),(0,n.jsx)(d.U,{overflowX:"scroll",style:{scrollbarWidth:"none"},children:y.map(t=>(0,n.jsx)(a.k,{alignItems:"center",justifyContent:"center",rounded:"md",borderColor:s,borderWidth:"1px",bgColor:c,cursor:"pointer",onClick:()=>{e.push({pathname:"/dashboard",query:t.linkQuery})},p:6,minW:48,children:(0,n.jsxs)(O.g,{alignItems:"center",children:[(0,n.jsx)(E.Vp,{colorScheme:t.colorScheme,p:2,children:(0,n.jsx)(E.Sn,{fontWeight:"semibold",fontSize:"md",children:t.data})}),(0,n.jsx)(o.x,{fontWeight:"bold",children:t.label})]})},t.label))}),(null==g?void 0:g.hasStaleCapacity)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(h.i,{my:4}),(0,n.jsxs)(e8.b,{status:"error",rounded:"lg",children:[(0,n.jsx)(e6.z,{}),(0,n.jsxs)(o.x,{children:[(0,n.jsx)(e9.C,{children:"Your capacity is stale"}),(0,n.jsxs)(e7.X,{children:[(0,n.jsx)(te.D,{textDecoration:"underline",href:"/dashboard?view=capacity",children:"Click here"})," ","to update your capacity."]})]})]})]})]}),(0,n.jsxs)(o.x,{mt:6,mb:10,children:[(0,n.jsx)(h.i,{mb:4}),(0,n.jsx)(o.x,{mb:4,fontWeight:"bold",children:"Things to do next"}),(0,n.jsx)(O.g,{children:[{label:"Send a truck list",linkQuery:{view:"emails",send:1}},{label:"Set your preferred lanes",linkQuery:{view:"lanes"}},{label:"Find relevant opportunities for your capacity",linkQuery:{view:"loads"}},{label:"Update your profile",linkQuery:{view:"profile"}}].map(i=>(0,n.jsx)(o.x,{w:"100%",p:4,rounded:"md",borderColor:s,borderWidth:"1px",bgColor:t,_hover:{bgColor:c},cursor:"pointer",onClick:()=>{e.push({pathname:"/dashboard",query:i.linkQuery})},children:i.label},i.label))})]})]}):(0,n.jsx)(o.x,{children:(0,n.jsx)(A,{})})},tn=e=>{let t=new Date(e),i=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"});return i.format(t)};var tr=i(72);let tl=e=>{let{isOpen:t,onClose:i}=e,s=(0,l.p)(),a=(0,q.AJ)(),{carrierId:d}=(0,p.d4)(),[c,h]=(0,r.useState)(),[{data:x,fetching:m},j]=(0,b.kl7)(),{onCopy:v,setValue:g}=(0,tr.V)("");return(0,r.useEffect)(()=>{(null==x?void 0:x.createToken.token)&&(g(null==x?void 0:x.createToken.token.key),h(x.createToken.token))},[g,null==x?void 0:x.createToken.token]),(0,n.jsxs)(B.u_,{isOpen:t,onClose:()=>{h(void 0),i()},size:["full","lg"],closeOnOverlayClick:!1,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:[0,6],children:[!c&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(G.x,{children:"Create API Key"}),(0,n.jsx)($.o,{}),(0,n.jsx)(ee.f,{children:(0,n.jsxs)(o.x,{children:[(0,n.jsx)(o.x,{mb:8,children:"Creating an API key will provide full access to your account via our APIs."}),(0,n.jsx)(z.J9,{initialValues:{name:""},onSubmit:async e=>{var t,i,n;if(!d)return;let r=await j({name:e.name,carrierId:d}),l=null===(t=r.data)||void 0===t?void 0:t.createToken.token,o=null===(i=r.data)||void 0===i?void 0:null===(n=i.createToken)||void 0===n?void 0:n.error;o?s({title:"Error.",description:o,status:"error",duration:5e3,position:"top",isClosable:!0}):l&&s({title:"Success!",description:"API key created successfully.",status:"success",duration:3e3,position:"top",isClosable:!0})},children:()=>(0,n.jsxs)(z.l0,{children:[(0,n.jsx)(W.y,{name:"name",label:"Name",placeholder:"Give your API key a name...",required:!0}),(0,n.jsx)(u.z,{mt:8,w:"100%",type:"submit",isLoading:m,children:"Save"})]})})]})}),(0,n.jsx)(et.m,{mb:[24,4]})]}),c&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(G.x,{children:"Success!"}),(0,n.jsx)($.o,{}),(0,n.jsx)(ee.f,{children:(0,n.jsxs)(o.x,{children:[(0,n.jsx)(o.x,{children:"Token created successfully. Please copy this token."}),(0,n.jsx)(o.x,{mb:4,fontWeight:"bold",children:"You will not be able to see it again."}),(0,n.jsx)(o.x,{mb:2,border:"dotted",borderColor:a,padding:4,borderRadius:"md",fontWeight:"semibold",children:c.key}),(0,n.jsx)(u.z,{onClick:e=>{e.preventDefault(),v(),s({description:"Copied API token.",status:"success",duration:3e3,position:"bottom-left",isClosable:!0})},children:"Copy"})]})}),(0,n.jsx)(et.m,{mb:[24,4]})]})]})]})},ts=e=>{let{id:t,name:i,isOpen:r,onClose:s}=e,a=(0,l.p)(),d=(0,q.Yg)(),{carrierId:c}=(0,p.d4)(),[{fetching:h},x]=(0,b.$Gb)(),m=async()=>{var e,i,n,r;if(!c)return;let l=await x({id:t,carrierId:c}),o=null===(e=l.data)||void 0===e?void 0:null===(i=e.deleteToken)||void 0===i?void 0:i.error;(null===(n=l.data)||void 0===n?void 0:null===(r=n.deleteToken)||void 0===r?void 0:r.success)===!0?(a({title:"Success!",description:"API key deleted successfully.",status:"success",duration:3e3,position:"top",isClosable:!0}),s()):o&&a({title:"Error.",description:o,status:"error",duration:5e3,position:"top",isClosable:!0})};
1return(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,isOpen:r,onClose:s,closeOnOverlayClick:!1,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Delete API Key"}),(0,n.jsx)($.o,{}),(0,n.jsx)(ee.f,{children:(0,n.jsxs)(o.x,{mb:8,children:["Are you sure that you would like to delete the API key:"," ",(0,n.jsx)(o.x,{as:"span",color:d,fontWeight:"bold",children:i}),"?",(0,n.jsx)(o.x,{mt:2,children:"This can not be undone and will break any integrations that are using this API key."})]})}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,colorScheme:"red",width:"100%",onClick:m,isLoading:h,children:"Delete"})})})]})]})},to=()=>{let e=(0,q.AJ)(),{carrierId:t}=(0,p.d4)(),[i,l]=(0,r.useState)("third_party"),[x,m]=(0,r.useState)(),[{data:v,fetching:g}]=(0,b.Ev3)({variables:{carrierId:t},pause:!t}),{isOpen:f,onOpen:y,onClose:C}=(0,s.q)(),{isOpen:w,onOpen:S,onClose:I}=(0,s.q)();return(0,r.useEffect)(()=>{m(void 0)},[]),(0,n.jsxs)(o.x,{children:[(0,n.jsxs)(a.k,{alignItems:"center",justifyContent:"space-between",children:[(0,n.jsxs)(d.U,{children:[(0,n.jsx)(c.X,{size:"lg",children:"Integrations"},"heading"),(0,n.jsx)(j.b,{label:"Our mission at LOST FR8 is to simplify your capacity management. Just set up your account, schedule your daily truck lists, and let automation handle the rest. With our seamless integrations, keeping your public capacity updated is effortless."},"tooltip")]}),t&&(0,n.jsx)(u.z,{colorScheme:"teal",onClick:()=>{l("api_keys"),y()},children:"Create API Key"})]}),(0,n.jsx)(h.i,{my:4}),(0,n.jsxs)(d.U,{mb:6,children:[(0,n.jsx)(u.z,{onClick:()=>l("third_party"),isActive:"third_party"===i,children:"Third party"}),(0,n.jsx)(u.z,{onClick:()=>l("api_keys"),isActive:"api_keys"==i,children:"API keys"})]}),"third_party"===i&&(0,n.jsxs)(o.x,{children:[(0,n.jsx)(o.x,{mb:8,children:"Effortlessly synchronize your capacity with your TMS using our one-click integrations, keeping your network updated on your trucksâ locations in real time."}),(0,n.jsx)(o.x,{children:"Coming soon..."})]}),"api_keys"===i&&(0,n.jsxs)(o.x,{children:[(0,n.jsx)(o.x,{mb:4,children:(0,n.jsx)(D.r,{isExternal:!0,href:"https://api.lostfr8.com/docs",children:(0,n.jsx)(u.z,{variant:"link",textUnderlineOffset:4,children:(0,n.jsxs)(d.U,{children:[(0,n.jsxs)(o.x,{textDecoration:"underline",textUnderlineOffset:4,children:["API documentation"," "]}),(0,n.jsx)(k.h0,{})]})})})}),g&&!v&&(0,n.jsxs)(_.K,{children:[(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"}),(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"}),(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"})]}),(0,n.jsxs)(_.K,{children:[v&&v.tokensCarrierId.length>0&&v.tokensCarrierId.flatMap(t=>(0,n.jsxs)(a.k,{justifyContent:"space-between",alignItems:"center",p:4,border:"1px",borderColor:"chakra-border-color",rounded:"lg",minH:"90px",fontSize:"md",children:[(0,n.jsxs)(o.x,{ml:2,mr:12,children:[(0,n.jsx)(o.x,{fontWeight:"semibold",children:t.name}),(0,n.jsx)(o.x,{fontSize:"small",color:e,children:tn(t.createdAt)})]}),(0,n.jsx)(u.z,{size:"sm",onClick:()=>{m(t),S()},children:(0,n.jsx)(k.pJ,{})})]},t.id)),v&&0===v.tokensCarrierId.length&&(0,n.jsx)(o.x,{children:(0,n.jsx)(o.x,{children:"No API Keys for carrier..."})})]})]}),(0,n.jsx)(tl,{isOpen:f,onClose:C}),x&&(0,n.jsx)(ts,{id:x.id,name:x.name,isOpen:w,onClose:I})]})};var ta=i(1059);let td=e=>{var t;let{label:i,options:l,setFieldValue:s,defaultValue:a,size:d,...c}=e,[u,{error:h}]=(0,z.U$)(c),[x,p]=(0,r.useState)(null!=a?a:Array(l[0].value));return(0,r.useEffect)(()=>{s(u.name,x)},[u.name,s,x]),(0,n.jsx)(o.x,{mt:null!==(t=c.mt)&&void 0!==t?t:4,children:(0,n.jsxs)(R.NI,{isInvalid:!!h,children:[(0,n.jsx)(U.l,{htmlFor:u.name,fontWeight:"normal",children:i}),(0,n.jsx)(eU,{...u,id:u.name,value:x,options:l,onChange:p}),h?(0,n.jsx)(F.J1,{children:h}):null]})})},tc=e=>{var t,i,s;let{isOpen:a,onClose:d}=e,c=(0,x.useRouter)(),h=(0,l.p)(),{carrierId:j}=(0,p.d4)(),g=(0,m.o)("edit"),[{fetching:f},y]=(0,b.DDW)(),[{fetching:C},w]=(0,b.lhv)(),[{data:S,fetching:k}]=(0,b.ptq)({variables:{id:parseInt(null!=g?g:"0")},pause:!g}),I=(0,r.useMemo)(()=>
1{if(g)return null==S?void 0:S.lane},[null==S?void 0:S.lane,g]),A={subtype:null!==(t=null==I?void 0:I.subtype)&&void 0!==t?t:"",available:null!==(i=null==I?void 0:I.availableBits)&&void 0!==i?i:[""],origin:(null==I?void 0:I.origin)?{address:I.origin,latitude:I.originLatitude,longitude:I.originLongitude,type:"ADDRESS"}:null,destination:(null==I?void 0:I.destination)?{address:I.destination,latitude:I.destinationLatitude,longitude:I.destinationLongitude,type:"ADDRESS"}:null,notes:null!==(s=null==I?void 0:I.notes)&&void 0!==s?s:""};return(0,n.jsxs)(B.u_,{isOpen:a,onClose:d,size:["full","2xl"],closeOnOverlayClick:!1,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:[0,6],children:[(0,n.jsxs)(G.x,{children:[g?"Edit":"Add"," preferred lane"]}),(0,n.jsx)($.o,{onClick:()=>c.back()}),(0,n.jsxs)(ee.f,{children:[k&&(0,n.jsx)(o.x,{children:(0,n.jsx)(v.$,{})}),!k&&(0,n.jsx)(o.x,{children:(0,n.jsx)(z.J9,{initialValues:A,onSubmit:async e=>{var t,i,n,r,l,s,o,a,u,x,p,m,v,f,C,S,k,I,A;if(!j)return;let T=e.subtype;if(!Object.values(b.ifq).includes(T)){h({title:"Invalid equipment type.",description:"Please make sure you select an equipment type from the drop down and try again.",status:"error",duration:8e3,position:"top",isClosable:!0});return}let O=e.available.map(Number).reduce((e,t)=>e+t,0);if(g){let p=await w({id:parseInt(g),carrierId:j,lane:{...e,available:O,origin:null===(t=e.origin)||void 0===t?void 0:t.address,originLatitude:null===(i=e.origin)||void 0===i?void 0:i.latitude,originLongitude:null===(n=e.origin)||void 0===n?void 0:n.longitude,destination:null===(r=e.destination)||void 0===r?void 0:r.address,destinationLatitude:null===(l=e.destination)||void 0===l?void 0:l.latitude,destinationLongitude:null===(s=e.destination)||void 0===s?void 0:s.longitude,subtype:e.subtype}}),m=null===(o=p.data)||void 0===o?void 0:null===(a=o.updateLane)||void 0===a?void 0:a.error;(null===(u=p.data)||void 0===u?void 0:null===(x=u.updateLane)||void 0===x?void 0:x.lane)?(h({title:"Success!",description:"Lane updated.",status:"success",duration:3e3,position:"top",isClosable:!0}),d(),c.push("/dashboard?view=lanes")):m&&h({title:"Error.",description:m,status:"error",duration:5e3,position:"top",isClosable:!0})}else{let t=await y({carrierId:j,lane:{...e,available:O,origin:null===(p=e.origin)||void 0===p?void 0:p.address,originLatitude:null===(m=e.origin)||void 0===m?void 0:m.latitude,originLongitude:null===(v=e.origin)||void 0===v?void 0:v.longitude,destination:null===(f=e.destination)||void 0===f?void 0:f.address,destinationLatitude:null===(C=e.destination)||void 0===C?void 0:C.latitude,destinationLongitude:null===(S=e.destination)||void 0===S?void 0:S.longitude,subtype:e.subtype}}),i=null===(k=t.data)||void 0===k?void 0:null===(I=k.createLane)||void 0===I?void 0:I.error;(null===(A=t.data)||void 0===A?void 0:A.createLane)?(h({title:"Success!",description:"Lane created.",status:"success",duration:3e3,position:"top",isClosable:!0}),d(),c.push("/dashboard?view=lanes")):i&&h({title:"Error.",description:i,status:"error",duration:5e3,position:"top",isClosable:!0})}},children:e=>{let{initialValues:t,setFieldValue:i}=e;return(0,n.jsxs)(z.l0,{children:[(0,n.jsx)(J,{name:"origin",placeholder:"Origin",label:"Origin",required:!0,setFieldValue:i,w:"100%"}),(0,n.jsx)(J,{name:"destination",placeholder:"Destination",label:"Destination",required:!0,setFieldValue:i}),(0,n.jsx)(Y,{name:"subtype",placeholder:"Equipment Type",label:"Equipment Type",required:!0,setFieldValue:i,autocomplete:!0,options:ea.IQ}),(0,n.jsx)(td,{label:"Available Days",name:"available",options:[{value:"2",name:"Mon"}
1,{value:"4",name:"Tues"},{value:"8",name:"Wed"},{value:"16",name:"Thur"},{value:"32",name:"Fri"},{value:"64",name:"Sat"},{value:"1",name:"Sun"}],defaultValue:t.available,setFieldValue:i,required:!0,multiple:!0}),(0,n.jsx)(W.y,{name:"notes",placeholder:"Notes...",label:"Notes",textarea:!0,max:1e3}),(0,n.jsx)(u.z,{mt:8,w:"100%",type:"submit",isLoading:f||C,children:"Save"})]})}})})]}),(0,n.jsx)(et.m,{mb:[24,4]})]})]})},tu=()=>{let e=(0,x.useRouter)(),t=(0,m.o)("create"),i=(0,m.o)("edit"),{carrierId:l}=(0,p.d4)(),[v,g]=(0,r.useState)(!1),[f,y]=(0,r.useState)(!1),{isOpen:C,onOpen:w,onClose:S}=(0,s.q)(),[{data:k,fetching:I}]=(0,b.yC6)({variables:{carrierId:l},pause:!l});return(0,r.useEffect)(()=>{scrollTo({top:0}),y(!!t),g(!!i)},[t,i]),(0,r.useEffect)(()=>{(f||v)&&w()},[f,v,w]),(0,n.jsxs)(o.x,{children:[(0,n.jsxs)(a.k,{alignItems:"center",justifyContent:"space-between",children:[(0,n.jsxs)(d.U,{children:[(0,n.jsx)(c.X,{size:"lg",children:"Preferred Lanes"},"heading"),(0,n.jsx)(j.b,{label:"Preferred lanes is your opportunity to communicate to brokers the lanes that you want to run the most. It won't always result in loads that are offered on these lanes but it's good for brokers to know where you'd like to be operating."},"tooltip")]}),l&&(0,n.jsx)(u.z,{colorScheme:v?void 0:"teal",onClick:()=>{f||v?e.push("/dashboard?view=lanes"):e.push("/dashboard?view=lanes&create=1")},children:"Add Lane"})]}),(0,n.jsx)(h.i,{my:4}),(!I&&!(null==k?void 0:k.lanesCarrierId)||!l)&&(0,n.jsx)(A,{}),I&&!k&&(0,n.jsxs)(_.K,{children:[(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"}),(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"}),(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"})]}),(null==k?void 0:k.lanesCarrierId)&&(0,n.jsxs)(n.Fragment,{children:[(null==k?void 0:k.lanesCarrierId.length)<=0&&(0,n.jsx)(o.x,{mt:2,children:"No lanes for carrier..."}),(0,n.jsx)(ta.s,{lanes:k.lanesCarrierId,editable:!0})]}),(0,n.jsx)(tc,{isOpen:C,onClose:S})]})};var th=i(5675),tx=i.n(th),tp=i(6157);let tm=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"});new Intl.NumberFormat("en-US",{maximumFractionDigits:0});let tj=e=>{let{onLogout:t}=e,i=(0,x.useRouter)(),[{fetching:r},l]=(0,b._y5)(),{setCarrierId:s}=(0,p.d4)(),o=async()=>{var e;await i.replace("/");let n=await l({});(null===(e=n.data)||void 0===e?void 0:e.logout)&&(t&&t(),s(void 0),(0,eQ.oN)())};return(0,n.jsx)(u.z,{isLoading:r,onClick:o,children:"Logout"})};var tv=i(7271);let tg=e=>{let{type:t,isOpen:i,onClose:s}=e,a=(0,l.p)(),[d,c]=(0,r.useState)(""),[h,x]=(0,r.useState)(""),[p,m]=(0,r.useState)(""),[{data:j,fetching:g}]=(0,b.MKG)(),[{fetching:f},y]=(0,b.a3O)(),C=async()=>{var e,t,i;let n=d.trim(),r=h.trim(),l=p.trim();if(!r||!l||(null==j?void 0:null===(e=j.authUser)||void 0===e?void 0:e.hasPassword)&&!n)return;if(r!==l){a({title:"Error.",description:"Passwords do not match.",status:"error",duration:5e3,position:"top",isClosable:!0});return}let o=await y({password:n,newPassword:r}),c=null===(t=o.data)||void 0===t?void 0:t.updatePassword.error;(null===(i=o.data)||void 0===i?void 0:i.updatePassword.success)?(a({title:"Success!",description:"Password changed successfully!",status:"success",duration:3e3,position:"top",isClosable:!0}),s()):c&&a({title:"Error.",description:c,status:"error",duration:5e3,position:"top",isClosable:!0})};(0,r.useEffect)(()=>{i||(c(""),x(""),m(""))},[i]);let w=()=>{var e;return(null==j?void 0:null===(e=j.authUser)||void 0===e?void 0:e.hasPassword)?"Change password":"Set password"};return(0,n.jsxs)(B.u_,{isOpen:i,onClose:s,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:w()}),(0,n.jsx)($.o,{}),(0,n.jsxs)(ee.f,{children:["removeAccount"===t&&(0,n.jsx)(o.x,{children:"Before you can remove your linked account you need to first set a password."}),(0,n.jsxs)(O.g,{pt:8,spacing:4,children:[g&&(0,n.jsx)(v.$,{}),!g&&(null==j?void 0:j.authUser)&&j.authUser.hasPassword&&(0,n.jsx)(L.I,{placeholder:"current password",type:"password",value:d,onChange:e=>c(e.target.value),onKeyDown:(0,eo.c)(C),size:"lg",autoFocus:!0}),(0,n.jsx)(L.I,{placeholder:"new password",type:"password",value:h,onChange:e=>x(e.target.value),onKeyDown:(0,eo.c)(C),size:"lg"}),(0,n.jsx)(L.I,{placeholder:"confirm new password",type:"password",value:p,onChange:e=>m(e.target.value),onKeyDown:(0,eo.c)(C),size:"lg"})]})]}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,colorScheme:"teal",width:"100%",onClick:C,isLoading:f,children:w()})})})]})]})},tf=e=>{let{email:t,source:i,isOpen:r,onClose:s}=e,a=(0,l.p)(),c=(0,q.AJ)(),[{data:h,fetching:x}]=(0,b.MKG)(),[{fetching:p},m]=(0,b.eBv)(),j=async()=>{var e,i,n;if(!(null==h?void 0:null===(e=h.authUser)||void 0===e?void 0:e.hasPassword)){a({title:"Error.",description:"You need to set a password for your account before your can remove a linked account.",status:"error",duration:5e3,position:"top",isClosable:!0});return}let r=await m({email:t}),l=null===(i=r.data)||void 0===i?void 0:i.removeGoogleAuth.error;(null===(n=r.data)||void 0===n?void 0:n.removeGoogleAuth.success)?(a({title:"Success!",description:"Linked account removed successfully!",status:"success",duration:3e3,position:"top",isClosable:!0}),s()):l&&a({title:"Error.",description:l,status:"error",duration:5e3,position:"top",isClosable:!0})};return(0,n.jsxs)(B.u_,{isOpen:r,onClose:s,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Remove linked account"}),(0,n.jsx)($.o,{}),(0,n.jsxs)(ee.f,{children:[(0,n.jsxs)(d.U,{children:[(0,n.jsx)(tx(),{src:tp.Z.src,width:24,height:24,alt:"Google logo"}),(0,n.jsx)(o.x,{textColor:c,children:t})]}),(0,n.jsx)(o.x,{mt:4,children:"You will no longer be able to sign in to LOST FR8 with this linked account."})]}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,colorScheme:"teal",width:"100%",onClick:j,isLoading:p,children:"Remove linked account"})})})]})]})},ty=e=>{let{isOpen:t,onClose:i}=e,r=(0,l.p)(),s=(0,q.AJ)(),[{data:a,fetching:d}]=(0,b.ULu)(),[{fetching:c},h]=(0,b.IrW)(),x=async()=>{var e,t,n;let l=null==a?void 0:null===(e=a.authUser)||void 0===e?void 0:e.email;if(!l)return;let{data:s}=await h({email:l}),o=null!==(n=null==s?void 0:null===(t=s.verifyEmailRequest)||void 0===t?void 0:t.success)&&void 0!==n&&n;r({title:o?"Success!":"Error.",description:o?"Please check your email for a verification link.":"There was an error sending the email verification. Please try again.",status:o?"success":"error",duration:o?3e3:5e3,position:"top",isClosable:!0}),o&&i()};return(0,n.jsxs)(B.u_,{isOpen:t,onClose:i,closeOnOverlayClick:!1,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Verify email"}),(0,n.jsx)($.o,{}),(0,n.jsxs)(ee.f,{children:[(0,n.jsx)(o.x,{children:"Before you can access your LOST FR8 dashboard y
1ou need to verify your email. Please check your email for a verification link."}),(0,n.jsx)(o.x,{mt:4,children:(0,n.jsx)(o.x,{as:"i",color:s,children:"If you did not receive a verification email please check your spam/junk folder or click the link below to resend an email verification link."})})]}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,variant:"link",fontWeight:"normal",colorScheme:"teal",width:"100%",onClick:x,isLoading:c||d,children:"Resend email verification"})})})]})]})},tb=e=>{let{id:t,carrierName:i,isOpen:r,onClose:s}=e,a=(0,x.useRouter)(),d=(0,l.p)(),c=(0,q.Yg)(),{carrierId:h}=(0,p.d4)(),[{fetching:m},j]=(0,b._Oe)(),v=async()=>{var e,i,n,r;if(!h)return;let l=await j({id:t,carrierId:h}),o=null===(e=l.data)||void 0===e?void 0:null===(i=e.deleteInvite)||void 0===i?void 0:i.error;(null===(n=l.data)||void 0===n?void 0:null===(r=n.deleteInvite)||void 0===r?void 0:r.success)===!0?(d({title:"Success!",description:"Successfully declined invite.",status:"success",duration:3e3,position:"top",isClosable:!0}),s(),a.replace("/dashboard?view=settings")):o&&d({title:"Error.",description:o,status:"error",duration:5e3,position:"top",isClosable:!0})};return(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,isOpen:r,onClose:s,closeOnOverlayClick:!1,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Decline Invite"}),(0,n.jsx)($.o,{}),(0,n.jsx)(ee.f,{children:(0,n.jsxs)(o.x,{mb:8,children:["Are you sure that you would like to decline the invite to join the"," ",(0,n.jsx)(o.x,{as:"span",color:c,children:i})," ","team ?"]})}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,colorScheme:"red",width:"100%",onClick:v,isLoading:m,children:"Delete"})})})]})]})},tC=e=>{let{id:t,carrierName:i}=e,r=(0,l.p)(),c=(0,q.md)(),{isOpen:h,onOpen:x,onClose:p}=(0,s.q)(),[{fetching:m},j]=(0,b.P2f)(),v=async()=>{var e,i;let n=await j({id:t}),l=null===(e=n.data)||void 0===e?void 0:e.acceptInvite.error;(null===(i=n.data)||void 0===i?void 0:i.acceptInvite.success)===!0?r({title:"Success!",description:"Invite accepted.",status:"success",duration:3e3,position:"top",isClosable:!0}):l&&r({title:"Error.",description:l,status:"error",duration:5e3,position:"top",isClosable:!0})};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a.k,{p:6,border:"1px",borderColor:"chakra-border-color",rounded:"lg",justifyContent:"space-between",alignItems:"center",bg:c,children:[(0,n.jsx)(o.x,{fontWeight:"bold",children:i}),(0,n.jsxs)(d.U,{children:[(0,n.jsx)(u.z,{isLoading:m,onClick:v,children:"Accept invite"}),(0,n.jsx)(u.z,{onClick:x,children:(0,n.jsx)(k.pJ,{})})]})]}),(0,n.jsx)(tb,{id:t,carrierName:i,isOpen:h,onClose:p})]})};var tw=i(9355);let tS=()=>{let[{data:e,fetching:t}]=(0,b.ger)(),i=(0,r.useMemo)(()=>{var t;return null!==(t=null==e?void 0:e.userInvites)&&void 0!==t?t:[]},[e]);return(0,n.jsxs)(o.x,{children:[(0,n.jsx)(o.x,{mb:4,children:(0,n.jsxs)(d.U,{children:[(0,n.jsx)(o.x,{children:"Invites"}),i.length>0&&(0,n.jsx)(tw.P,{count:i.length})]})}),t?(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"}):i.length>0?(0,n.jsx)(O.g,{align:"stretch",gap:4,children:i.flatMap(e=>(0,n.jsx)(tC,{id:e.id,carrierName:e.carrier.name},e.id))}):(0,n.jsx)(o.x,{children:"No current invites..."})]})},tk=e=>{let{isOpen:t,onClose:i}=e,r=(0,l.p)(),[{fetching:s},a]=(0,b.jf_)(),[{data:d}]=(0,b.ULu)();return(0,n.jsxs)(B.u_,{isOpen:t,onClose:i,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Refer a carrier to LOST FR8!"}),(0,n.jsx)($.o,{}),(0,n.jsxs)(ee.f,{children:[(0,n.jsxs)(o.x,{children:["Send them your referral link and if they sign up and subscribe we'll send you a $50 Amazon gift card. They'll also get 20% off their first month if they use your link."," ",(0,n.jsx)(D.r,{href:"/terms",textDecoration:"underline",children:"Terms"})," ","apply."]}),(0,n.jsx)(z.J9,{initialValues:{name:"",referralEmail:""},onSubmit:async e=>{var t,n,l,s,o;let{name:c,referralEmail:u}=e,h=null==d?void 0:null===(t=d.authUser)||void 0===t?void 0:t.email;if(!h)return;let x=await a({fromEmail:h,toEmail:u,name:c}
1),p=null===(n=x.data)||void 0===n?void 0:null===(l=n.sendReferralEmail)||void 0===l?void 0:l.error;(null===(s=x.data)||void 0===s?void 0:null===(o=s.sendReferralEmail)||void 0===o?void 0:o.success)?(r({title:"Success!",description:"Referral sent. We'll follow up once they subscribe and complete their first payment.",status:"success",duration:9e3,position:"top",isClosable:!0}),i()):p&&r({title:"Error.",description:p,status:"error",duration:5e3,position:"top",isClosable:!0})},children:()=>(0,n.jsxs)(z.l0,{children:[(0,n.jsx)(W.y,{name:"name",placeholder:"Your Name",label:"Your Name",required:!0}),(0,n.jsx)(W.y,{name:"referralEmail",label:"Their Email",placeholder:"Their Email"}),(0,n.jsx)(u.z,{mt:8,w:"100%",type:"submit",isLoading:s,children:"Send"})]})})]}),(0,n.jsx)(et.m,{})]})]})},tI=()=>{var e,t;let i=(0,x.useRouter)(),p=(0,l.p)(),m=(0,q.AJ)(),j=(0,q.fG)(),{hasCopied:v,onCopy:g,value:y,setValue:C}=(0,tr.V)(""),[{data:w,fetching:S}]=(0,b.MKG)(),[{data:I,fetching:A}]=(0,b.WoI)(),[{data:T,fetching:z}]=(0,b._tk)(),{isOpen:R,onOpen:U,onClose:F}=(0,s.q)(),{isOpen:M,onOpen:P,onClose:W}=(0,s.q)(),{isOpen:V,onOpen:N,onClose:K}=(0,s.q)(),{isOpen:Q,onOpen:H,onClose:Y}=(0,s.q)(),[J,B]=(0,r.useState)(),[Z,X]=(0,r.useState)("changePassword"),[G,$]=(0,r.useState)(""),[{fetching:ee},et]=(0,b.xYK)(),[{fetching:ei},en]=(0,b.jN$)(),er=async()=>{var e,t;let i=G.trim();if(!i)return;let n=await et({email:i}),r=null===(e=n.data)||void 0===e?void 0:e.updateEmailRequest.error;(null===(t=n.data)||void 0===t?void 0:t.updateEmailRequest.success)?p({title:"Success!",description:"Check your email to verify.",status:"success",duration:5e3,position:"top",isClosable:!0}):r&&p({title:"Error.",description:r,status:"error",duration:5e3,position:"top",isClosable:!0})},el=async(e,t)=>{var i;if(!(null==w?void 0:null===(i=w.authUser)||void 0===i?void 0:i.hasPassword)){X("removeAccount"),P();return}B({email:e,source:t}),N()},es=e=>{if(!e)return;let t="teal",i=e.toLocaleUpperCase();switch(e){case"active":t="teal";break;case"trialing":t="orange";break;case"canceled":case"unpaid":t="red";break;case"incomplete":t="gray";break;case"past_due":t="red",i="PAST DUE";break;case"incomplete_expired":return}return(0,n.jsx)(E.Vp,{colorScheme:t,children:i})},ea=(e,t,i,r)=>{if(!t||!i||!r)return;let l=new Date(0);l.setUTCSeconds(i);let s=l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),a=(r/100).toFixed(2);return e?(0,n.jsxs)(o.x,{color:m,children:["Cancels on ",s]}):(0,n.jsxs)(o.x,{color:m,children:["Bills ",t,"ly ⢠Next invoice on ",s," for"," ",tm.format(parseInt(a))]})};return(0,r.useEffect)(()=>{(null==w?void 0:w.authUser)&&!w.authUser.emailVerified&&U()},[w,U]),(0,r.useEffect)(()=>{var e;(null==w?void 0:null===(e=w.authUser)||void 0===e?void 0:e.email)&&C("https://lostfr8.com?ref="+w.authUser.email)},[w,C]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(o.x,{children:[(0,n.jsx)(c.X,{size:"lg",children:"Settings"}),(0,n.jsx)(h.i,{my:4}),(0,n.jsxs)(O.g,{align:"stretch",gap:6,children:[S&&(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"}),!S&&(null==w?void 0:w.authUser)&&(0,n.jsxs)(n.Fragment,{children:[w.authUser.authSources.length>0?(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(o.x,{children:[(0,n.jsx)(o.x,{children:"Linked Accounts"}),w.authUser.authSources.flatMap(e=>(0,n.jsxs)(a.k,{alignItems:"center",justifyContent:"space-between",mt:4,children:[(0,n.jsxs)(d.U,{spacing:4,alignItems:"center",mr:2,children:[(0,n.jsx)(tx(),{src:tp.Z.src,width:24,height:24,alt:"Google logo"}),(0,n.jsx)(o.x,{w:["120px","100%"],textColor:m,noOfLines:1,textOverflow:"ellipsis",children:e.email})]}),(0,n.jsx)(u.z,{minW:"auto",onClick:()=>{el(e.email,e.sourceType)},isLoading:ee,children:"Remove Account"})]}))]})}):(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(o.x,{children:[(0,n.jsx)(o.x,{children:"Email"}),(0,n.jsxs)(a.k,{alignItems:"center",mt:4,children:[(0,n.jsx)(L.I,{mr:4,placeholder:null==w?void 0:null===(e=w.authUser)||void 0===e?void 0:e.email,type:"email",value:G,onChange:e=>$(e.target.value),onKeyDown:(0,eo.c)(er)}),(0,n.jsx)(u.z,{minW:"auto",onClick:()=>{er()},isLoading:ee,children:"Change email"})]})]})}),(0,n.jsxs)(o.x,{children:[(0,n.jsx)(o.x,{children:"Password"}),(0,n.jsxs)(a.k,{alignItems:"center",mt:4,children:[(0,n.jsx)(o.x,{mr:4,textColor:m,children:w.authUser.hasPassword?"â¢â¢â¢â¢â¢â¢â¢â¢":"Not set"}),(0,n.jsx)(f.L,{}),(0,n.jsx)(u.z,{minW:"auto",onClick:P,children:w.authUser.hasPassword?"Change password":"Set password"})]})]})]}),(0,n.jsxs)(a.k,{alignItems:"center",children:[(0,n.jsx)(o.x,{children:"Theme "}),(0,n.jsx)(f.L,{}),(0,n.jsx)(tv.b,{size:"md",onClick:()=>{}})]}),(0,n.jsx)(h.i,{}),(0,n.jsx)(tS,{}),(0,n.jsx)(h.i,{}),(0,n.jsxs)(o.x,{children:[(0,n.jsx)(o.x,{children:"Referral Link"}),(0,n.jsxs)(o.x,{mt:4,children:["Do you know a carrier that should be using LOST FR8? Send them your referral link and if they sign up and subscribe we'll send you a"," ",(0,n.jsx)(o.x,{as:"span",fontWeight:"bold",children:"$50 Amazon gift card"}),". They'll also get"," ",(0,n.jsx)(o.x,{as:"span",fontWeight:"bold",textDecoration:"underline",children:"20% off"})," ","their first month if they use your link."," ",(0,n.jsx)(D.r,{href:"/terms",textDecoration:"underline",children:"Terms"})," ","apply."]}),(0,n.jsxs)(_.K,{mt:6,justifyContent:"space-between",alignItems:{base:"start",md:"center"},direction:{base:"column",md:"row"},children:[(0,n.jsx)(o.x,{mr:{base:"0",md:"4"},color:j,children:y}),(0,n.jsx)(u.z,{mt:2,onClick:e=>{e.preventDefault(),g(),p({description:"Copied referral link.",status:"success",duration:3e3,position:"bottom-left",isClosable:!0})},minW:"200px",children:(0,n.jsxs)(d.U,{children:[(0,n.jsx)(o.x,{children:"Copy referral link"}),v?(0,n.jsx)(k.rE,{}):(0,n.jsx)(k.aA,{})]})})]}),(0,n.jsxs)(d.U,{mt:{base:4,md:2},children:[(0,n.jsx)(D.r,{href:encodeURI("https://twitter.com/intent/tweet?text=Easily send and manage your truck list with @lostfr8_. Use my referral link and get 20% off your first month! ".concat(y)),isExternal:!0,children:(0,n.jsx)(u.z,{children:(0,n.jsx)(k.Zm,{})})}),(0,n.jsx)(D.r,{href:encodeURI("https://www.facebook.com/sharer.php?src=sp&u=".concat(y)),isExternal:!0,children:(0,n.jsx)(u.z,{children:(0,n.jsx)(k.
1Vq,{})})}),(0,n.jsx)(u.z,{onClick:H,children:(0,n.jsx)(k.LQ,{})})]})]}),(0,n.jsx)(h.i,{}),(null==w?void 0:null===(t=w.authUser)||void 0===t?void 0:t.stripeCustomerId)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(o.x,{children:[(0,n.jsx)(o.x,{mb:4,children:"Subscriptions"}),(z||A)&&(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"}),(0,n.jsx)(O.g,{align:"stretch",gap:4,children:!z&&!A&&(null==T?void 0:T.subscriptions)&&T.subscriptions.length>0?T.subscriptions.filter(e=>{var t;return!(null===(t=e.status)||void 0===t?void 0:t.includes("incomplete"))}).flatMap(e=>{var t,i,r;return(0,n.jsxs)(o.x,{p:6,border:"1px",borderColor:"chakra-border-color",rounded:"lg",children:[(0,n.jsx)(o.x,{fontWeight:"bold",children:null===(t=null==I?void 0:I.userCarriers.find(t=>t.id===parseInt(null!==(i=e.carrierId)&&void 0!==i?i:"0")))||void 0===t?void 0:t.name}),(0,n.jsxs)(d.U,{mt:2,children:[(0,n.jsx)(o.x,{children:e.name}),es(e.status)]}),(0,n.jsx)(d.U,{mt:2,children:(0,n.jsx)(o.x,{children:ea(null!==(r=e.canceledAtPeriodEnd)&&void 0!==r&&r,e.interval,e.periodEnd,e.price)})})]},e.id)}):(0,n.jsx)(o.x,{children:"No current subscriptions..."})})]}),(0,n.jsx)(a.k,{justifyContent:"flex-end",children:(0,n.jsx)(u.z,{minW:"auto",isLoading:ei,onClick:async()=>{let{data:e}=await en({});(null==e?void 0:e.createPortalSession.url)&&i.push(e.createPortalSession.url)},children:"Manage billing"})}),(0,n.jsx)(h.i,{})]}),(0,n.jsx)(a.k,{justifyContent:"flex-end",children:(0,n.jsx)(tj,{})})]})]}),(0,n.jsx)(tg,{type:Z,isOpen:M,onClose:W}),(0,n.jsx)(ty,{isOpen:R,onClose:F}),J&&(0,n.jsx)(tf,{email:J.email,source:J.source,isOpen:V,onClose:K}),(0,n.jsx)(tk,{isOpen:Q,onClose:Y})]})},tA=e=>{let{id:t,email:i,isOpen:r,onClose:s}=e,a=(0,x.useRouter)(),d=(0,l.p)(),c=(0,q.Yg)(),{carrierId:h}=(0,p.d4)(),[{fetching:m},j]=(0,b._Oe)(),v=async()=>{var e,i,n,r;if(!h)return;let l=await j({id:t,carrierId:h}),o=null===(e=l.data)||void 0===e?void 0:null===(i=e.deleteInvite)||void 0===i?void 0:i.error;(null===(n=l.data)||void 0===n?void 0:null===(r=n.deleteInvite)||void 0===r?void 0:r.success)===!0?(d({title:"Success!",description:"Invite deleted successfully.",status:"success",duration:3e3,position:"top",isClosable:!0}),s(),a.replace("/dashboard?view=team")):o&&d({title:"Error.",description:o,status:"error",duration:5e3,position:"top",isClosable:!0})};return(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,isOpen:r,onClose:s,closeOnOverlayClick:!1,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Delete Invite"}),(0,n.jsx)($.o,{onClick:()=>a.back()}),(0,n.jsx)(ee.f,{children:(0,n.jsxs)(o.x,{mb:8,children:["Are you sure that you would like to delete the invite for"," ",(0,n.jsx)(o.x,{as:"span",color:c,children:i}),"?"]})}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,colorScheme:"red",width:"100%",onClick:v,isLoading:m,children:"Delete"})})})]})]})},tT=e=>{let{id:t,email:i,isOpen:r,onClose:s}=e,a=(0,x.useRouter)(),d=(0,l.p)(),c=(0,q.Yg)(),{carrierId:h}=(0,p.d4)(),[{fetching:m},j]=(0,b.rzy)(),v=async()=>{var e,i,n,r;if(!h)return;let l=await j({id:t,carrierId:h}),o=null===(e=l.data)||void 0===e?void 0:null===(i=e.deleteRole)||void 0===i?void 0:i.error;(null===(n=l.data)||void 0===n?void 0:null===(r=n.deleteRole)||void 0===r?void 0:r.success)===!0?(d({title:"Success!",description:"Teammate deleted successfully.",status:"success",duration:3e3,position:"top",isClosable:!0}),s(),a.replace("/dashboard?view=team")):o&&d({title:"Error.",description:o,status:"error",duration:5e3,position:"top",isClosable:!0})};return(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,isOpen:r,onClose:s,closeOnOverlayClick:!1,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Delete Teammate"}),(0,n.jsx)($.o,{onClick:()=>a.back()}),(0,n.jsx)(ee.f,{children:(0,n.jsxs)(o.x,{mb:8,children:["Are you sure that you would like to remove all access for"," ",(0,n.jsx)(o.x,{as:"span",color:c,children:i}),"?"]})}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,colorScheme:"red",width:"100%",onClick:v,isLoading:m,children:"Delete"})})})]})]})},tO=e=>{let{isOpen:t,onClose:i}=e,s=(0,x.useRouter)(),a=(0,l.p)(),d=(0,r.useRef)(null),{carrierId:c}=(0,p.d4)(),[,h]=(0,b.JFQ)();return(0,n.jsxs)(B.u_,{isOpen:t,onClose:i,initialFocusRef:d,size:["full","lg"],closeOnOverlayClick:!1,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:[0,6],children:[(0,n.jsx)(G.x,{children:"Invite teammate"}),(0,n.jsx)($.o,{onClick:()=>s.back()}),(0,n.jsx)(ee.f,{children:(0,n.jsxs)(o.x,{children:[(0,n.jsx)(o.x,{mb:8,children:"Inviting a teammate will allow the user to add, edit, and delete contacts, equipment, and capacity. The user will also be able to edit carrier profile information but will not be allowed to delete the carrier profile or manage billing details."}),(0,n.jsx)(z.J9,{initialValues:{email:""},onSubmit:async(e,t)=>{var n,r,l,o;let{setSubmitting:d}=t;if(!c)return;d(!0);let u=await h({email:e.email,carrierId:c,roleType:b.GDX.Manager}),x=null===(n=u.data)||void 0===n?void 0:null===(r=n.createInvite)||void 0===r?void 0:r.error;d(!1),(null===(l=u.data)||void 0===l?void 0:null===(o=l.createInvite)||void 0===o?void 0:o.success)===!0?(a({title:"Success!",description:"Teammate invited.",status:"success",duration:3e3,position:"top",isClosable:!0}),i(),s.push("/dashboard?view=team")):x&&a({title:"Error.",description:x,status:"error",duration:5e3,position:"top",isClosable:!0})},children:e=>{let{isSubmitting:t}=e;return(0,n.jsxs)(z.l0,{children:[(0,n.jsx)(W.y,{name:"email",label:"Email",placeholder:"Email"}),(0,n.jsx)(u.z,{mt:8,w:"100%",type:"submit",isLoading:t,children:"Save"})]})}})]})}),(0,n.jsx)(et.m,{mb:[24,4]})]})]})},tE=e=>{let{id:t,isOpen:i,onClose:r}=e,s=(0,x.useRouter)(),a=(0,l.p)(),{carrierId:d}=(0,p.d4)(),[{fetching:c},h]=(0,b.wN_)(),m=async()=>{var e,i,n,l;if(!d)return;let o=await h({id:t}),c=null===(e=o.data)||void 0===e?void 0:null===(i=e.removeAccess)||void 0===i?void 0:i.error;(null===(n=o.data)||void 0===n?void 0:null===(l=n.removeAccess)||void 0===l?void 0:l.success)===!0?(a({title:"Success!",description:"You've been removed from the team.",status:"success",duration:5e3,position:"top",isClosable:!0}),s.replace("/"),r()):c&&a({title:"Error.",description:c,status:"error",duration:5e3,position:"top",isClosable:!0})};
1return(0,n.jsxs)(B.u_,{returnFocusOnClose:!1,isOpen:i,onClose:r,closeOnOverlayClick:!1,children:[(0,n.jsx)(Z.Z,{}),(0,n.jsxs)(X.h,{px:6,children:[(0,n.jsx)(G.x,{children:"Delete Access"}),(0,n.jsx)($.o,{onClick:()=>s.back()}),(0,n.jsx)(ee.f,{children:(0,n.jsx)(o.x,{mb:8,children:"Are you sure that you would like to remove yourself from the team?"})}),(0,n.jsx)(et.m,{justifyContent:"center",children:(0,n.jsx)(o.x,{width:"100%",children:(0,n.jsx)(u.z,{mb:4,colorScheme:"red",width:"100%",onClick:m,isLoading:c,children:"Delete"})})})]})]})},tD=()=>{let e=(0,x.useRouter)(),t=(0,l.p)(),i=(0,m.o)("create"),v=(0,m.o)("deleteInvite"),g=(0,m.o)("deleteRole"),f=(0,m.o)("deleteEmail"),y=(0,m.o)("removeAccess"),{isOpen:C,onOpen:w,onClose:S}=(0,s.q)(),{isOpen:I,onOpen:T,onClose:O}=(0,s.q)(),{isOpen:E,onOpen:D,onClose:z}=(0,s.q)(),{isOpen:q,onOpen:L,onClose:R}=(0,s.q)(),{carrierId:U}=(0,p.d4)(),F=(0,eu.c)(),[{data:M,fetching:P}]=(0,b.ULu)(),[W,V]=(0,r.useState)(),[{fetching:N},K]=(0,b.Emj)(),[{data:Q,fetching:H}]=(0,b.mq1)({variables:{carrierId:U},pause:!U}),[{data:Y,fetching:J}]=(0,b.$AW)({variables:{carrierId:U},pause:!U});return(0,r.useEffect)(()=>{i&&w()},[i,w]),(0,r.useEffect)(()=>{v&&T()},[v,T]),(0,r.useEffect)(()=>{g&&D()},[g,D]),(0,r.useEffect)(()=>{y&&L()},[y,L]),(0,n.jsxs)(o.x,{children:[(0,n.jsxs)(a.k,{alignItems:"center",justifyContent:"space-between",children:[(0,n.jsxs)(d.U,{children:[(0,n.jsx)(c.X,{size:"lg",children:"Team"},"heading"),(0,n.jsx)(j.b,{label:"It takes a team to run your operation. Invite your team here so they can help manage your account. They will be able to update your profile, contacts, equipment, and capacity."},"tooltip")]}),U&&(0,n.jsx)(u.z,{colorScheme:"teal",onClick:()=>{e.push("/dashboard?view=team&create=1")},children:"Invite Teammate"})]}),(0,n.jsx)(h.i,{my:4}),(!H&&!(null==Q?void 0:Q.rolesCarrierId)||!U)&&(0,n.jsx)(A,{}),H&&!Q&&(0,n.jsxs)(_.K,{children:[(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"}),(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"}),(0,n.jsx)(eS.O,{height:"100px",rounded:"lg"})]}),(0,n.jsx)(_.K,{spacing:2,children:null==Q?void 0:Q.rolesCarrierId.flatMap(t=>{var i;return(0,n.jsxs)(a.k,{justifyContent:"space-between",alignItems:"center",p:4,border:"1px",borderColor:"chakra-border-color",rounded:"lg",minH:"90px",fontSize:"md",children:[(0,n.jsx)(o.x,{children:t.user.email}),(0,n.jsxs)(d.U,{spacing:[4,12],children:[t.roleType===b.GDX.Admin&&(0,n.jsx)(o.x,{as:"b",children:t.roleType}),F&&t.roleType!==b.GDX.Admin&&(0,n.jsx)(u.z,{size:"sm",onClick:()=>{e.push("/dashboard?view=team&deleteRole=".concat(t.id,"&deleteEmail=").concat(t.user.email))},children:(0,n.jsx)(k.pJ,{})}),!F&&!P&&t.userId===(null==M?void 0:null===(i=M.authUser)||void 0===i?void 0:i.id)&&(0,n.jsx)(u.z,{size:"sm",onClick:()=>{e.push("/dashboard?view=team&removeAccess=".concat(t.id))},children:(0,n.jsx)(k.pJ,{})})]})]},t.id)})}),!J&&(null==Y?void 0:Y.invitesCarrierId)&&Y.invitesCarrierId.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(h.i,{my:8}),(0,n.jsxs)(o.x,{children:[(0,n.jsx)(c.X,{size:"md",mb:4,children:"Invites"}),(0,n.jsx)(_.K,{children:Y.invitesCarrierId.flatMap(i=>(0,n.jsxs)(a.k,{fontSize:"md",justifyContent:"space-between",alignItems:"center",children:[(0,n.jsx)(o.x,{overflow:"auto",mr:4,children:i.email}),(0,n.jsxs)(d.U,{spacing:2,children:[(0,n.jsx)(u.z,{size:"sm",isLoading:N&&W===i.id,onClick:async()=>{var e,n;V(i.id);let r=await K({id:i.id}),l=null===(e=r.data)||void 0===e?void 0:e.resendInvite.error;(null===(n=r.data)||void 0===n?void 0:n.resendInvite.success)===!0?t({title:"Success!",description:"Invite resent.",status:"success",duration:3e3,position:"top",isClosable:!0}):l&&t({title:"Error.",description:l,status:"error",duration:5e3,position:"top",isClosable:!0})},children:"Resend"}),(0,n.jsx)(u.z,{size:"sm",onClick:()=>{e.push("/dashboard?view=team&deleteInvite=".concat(i.id,"&deleteEmail=").concat(i.email))},children:(0,n.jsx)(k.pJ,{})})]})]},i.id))})]})]}),(0,n.jsx)(tO,{isOpen:C,onClose:S}),v&&f&&(0,n.jsx)(tA,{id:parseInt(v),email:f,isOpen:I,onClose:O}),g&&f&&(0,n.jsx)(tT,{id:parseInt(g),email:f,isOpen:E,onClose:z}),y&&(0,n.jsx)(tE,{id:parseInt(y),isOpen:q,onClose:R})]})},tz=()=>[{name:"Dashboard",icon:k.tv,view:(0,n.jsx)(ti,{}),link:"dashboard",event:eQ.zW.Dashboard.ClickContacts},{name:"Contacts",icon:k.SN,view:(0,n.jsx)(ew,{}),link:"contacts",event:eQ.zW.Dashboard.ClickContacts},{name:"Equipment",icon:k.oE,view:(0,n.jsx)(e5,{}),link:"equipment",event:eQ.zW.Dashboard.ClickEquipment},{name:"Capacity",icon:k.PT,view:(0,n.jsx)(ec,{}),link:"capacity",event:eQ.zW.Dashboard.ClickCapacity},{name:"Lanes",icon:k.No,view:(0,n.jsx)(tu,{}),link:"lanes",event:eQ.zW.Dashboard.ClickLanes},{name:"Truck List",icon:k.Br,view:(0,n.jsx)(eZ,{}),link:"emails",event:eQ.zW.Dashboard.ClickEmails},{name:"Team",icon:k.t0,view:(0,n.jsx)(tD,{}),link:"team",event:eQ.zW.Dashboard.ClickTeam},{name:"Integrations",icon:k.bb,view:(0,n.jsx)(to,{}),link:"integrations",event:eQ.zW.Dashboard.ClickIntegrations},{name:"Edit Profile",icon:k.vd,view:(0,n.jsx)(ej,{}),link:"profile",event:eQ.zW.Dashboard.ClickProfile},{name:"Settings",icon:k.UG,view:(0,n.jsx)(tI,{}),link:"settings",event:eQ.zW.Dashboard.ClickSettings}],tq=()=>{let[e,t]=(0,r.useState)(tz()),[{data:i,fetching:n}]=(0,b.lFd)();return(0,r.useEffect)(()=>{let e=e=>{t(t=>t.map(t=>"Settings"===t.name?{...t,...e}:t))};n?e({fetchingNotifications:!0}):(null==i?void 0:i.notifications)&&i.notifications.count>0?e({notifications:i.notifications.count,fetchingNotifications:!1}):t(tz())},[null==i?void 0:i.notifications,n]),e}},123:function(e,t,i){i.d(t,{c:function(){return n}});function n(e){return t=>{"Enter"===t.key&&e()}}},9252:function(e,t,i){i.d(t,{X:function(){return n}});let n=(e,t)=>{let i=e.pathname,n={...e.query,...t};e.push({pathname:i,query:n})}},8954:function(e,t,i){i.d(t,{o:function(){return r}});var n=i(6885);let r=e=>{let t=(0,n.useRouter)(),i=t.query[e];return"string"==typeof i?i:void 0}},658:function(e,t,i){i.d(t,{_:function(){return n}});let n=e=>new Promise(t=>setTimeout(t,e))},1325:function(e,t,i){i.d(t,{s:function(){return l}});var n=i(7294),r=i(5576);let l=()=>(0,n.useContext)(r.J)},7426:function(e,t,i){i.d(t,{u:function(){return n}});let n=e=>{var t=(""+e).replace(/\D/g,"").match(/^(1|)?(\d{3})(\d{3})(\d{4})$/);return t?[t[1]?"+1 ":"","(",t[2],") ",t[3],"-",t[4]].join(""):e.toString()}},971:function(e,t,i){i.d(t,{K:function(){return l}});var n=i(7294),r=i(9015);let l=()=>
1{let e=(0,r.s)()?void 0:window,[t,i]=(0,n.useState)(!1),[l,s]=(0,n.useState)(null==e?void 0:e.innerWidth),o=(0,n.useCallback)(()=>{s(null==e?void 0:e.innerWidth)},[null==e?void 0:e.innerWidth]);return(0,n.useEffect)(()=>(null==e||e.addEventListener("resize",o),()=>{null==e||e.removeEventListener("resize",o)}),[e,o]),(0,n.useEffect)(()=>{l?i(l<=768):i(!1)},[l]),t}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.