PageSourceSearch

https://app.truckatlas.com/_next/static/chunks/pages/dispatcher-491fb18aace5cc88.js

js truckatlas.com collected 2026-10-02 00:58:20 UTC 74,863 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8752],{24581:function(e,t,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dispatcher",function(){return l(78033)}])},78033:function(e,t,l){"use strict";l.r(t),l.d(t,{default:function(){return t_}});var a,n,s,r,i,o,d,c,u,p,m=l(52322),x=l(2784),b=l(6277),h=l(39097),v=l.n(h),f=l(35353),g=l(38474),y=l(35710),N=l(5632),j=l(68953),k=l(22782),w=l(65652),E=l(82744),C=l(54484),I=l(39840),M=l(56544),T=l(6590);let S=[M.WK.CARRIER_ACCEPTED,M.WK.READY,M.WK.STARTED,M.WK.EN_ROUTE,M.WK.PICKUP_CONFIRMED,M.WK.DELIVERY_CONFIRMED,M.WK.PICKUP_AND_DELIVERY_CONFIRMED],R=e=>S.includes(e.load.state),D=e=>e.load.delivery.date?e.load.delivery.date.slice(0,10):null,_=e=>[...e].sort((e,t)=>{var l,s;return(null!==(a=null===(l=e.timed)||void 0===l?void 0:l.start.getTime())&&void 0!==a?a:Number.MAX_SAFE_INTEGER)-(null!==(n=null===(s=t.timed)||void 0===s?void 0:s.start.getTime())&&void 0!==n?n:Number.MAX_SAFE_INTEGER)}),A=(e,t,l)=>"contract"===t?e.filter(e=>"DRIVER_1099"===e.driverType):"all"!==t&&l?e.filter(e=>{var t;return(null===(t=e.dispatcher)||void 0===t?void 0:t.id)===l}):e,O=(e,t)=>t?e.filter(e=>{var l;return(null===(l=e.dispatcher)||void 0===l?void 0:l.id)===t}):e,P=(e,t,l)=>"all"===l?e:e.filter(e=>null===e.driverId||t.has(e.driverId)),F=(e,t,l)=>{let a=(0,C.wy)(l,-1),n=e.filter(R);return{loadsOnBoard:n.length,deliveringToday:n.filter(e=>D(e)===l).length,deliveringYesterday:e.filter(e=>D(e)===a).length,unassignedLoads:n.filter(e=>null===e.driverId).length,driversAvailable:t.filter(e=>"available"===(0,E.YE)(e,l,!!e.currentLoad)).length}},L=[M.WK.DELIVERY_CONFIRMED,M.WK.PICKUP_AND_DELIVERY_CONFIRMED,M.WK.COMPLETED,M.WK.PAYMENT_REQUESTED,M.WK.PAYMENT_ON_HOLD,M.WK.INVOICE_SHARED,M.WK.PAID],Z=e=>{if(!L.includes(e.load.state))return!1;let t=e.load.docs;return!!t&&!t.pod},B=e=>null!==(s=e.riskReason)&&void 0!==s?s:Z(e)?"Missing POD":null,U=(e,t)=>{let l=D(e);return null!==l&&(0,C.Qe)(t,l)>=0},W=(e,t)=>e.riskReason?"critical":Z(e)?U(e,t)?"info":"warning":null,K=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}),V=e=>{let t=(0,E.IQ)(e);if(!t)return"TBD";let l=K.format(t.start),a=e.arrivalPolicy===M.Xr.FIRST_COME_FIRST_SERVE;return a?"".concat(l," – ").concat(K.format(t.end)):l},G=[{key:"needs-attention",label:"Load Issues"},{key:"in-transit",label:"In Transit"},{key:"unassigned",label:"Unassigned"},{key:"delivering-today",label:"Delivering Today"}],Y=e=>[e.city,e.state].filter(Boolean).join(", ")||"—",z=e=>"#".concat(null!==(r=e.jobNumber)&&void 0!==r?r:"—","-").concat(e.loadNumber),J=(e,t,l)=>{var a,n,s,r;let i=e.driverId?t.get(e.driverId):void 0;return{id:e.id,jobId:e.load.jobId,loadId:e.load.loadId,loadNumber:e.load.loadNumber,reference:z(e.load),route:"".concat(Y(e.load.pickup)," → ").concat(Y(e.load.delivery)),state:e.load.state,status:e.status,riskReason:B(e),riskSeverity:W(e,l),driverName:null!==(n=null!==(a=e.driverName)&&void 0!==a?a:null==i?void 0:i.name)&&void 0!==n?n:null,truckNumber:null!==(s=null==i?void 0:i.truckNumber)&&void 0!==s?s:null,appointmentLabel:V(e.load.pickup),customer:null!==(r=e.load.posterName)&&void 0!==r?r:null,event:e}},H=(e,t,l)=>{let a=new Map(t.map(e=>[e.id,e])),n=e.filter(R),s=e=>e.map(e=>J(e,a,l));return{"needs-attention":s(e.filter(e=>e.atRisk||Z(e))),"in-transit":s(n.filter(e=>"in-progress"===e.status&&!L.includes(e.load.state))),unassigned:s(n.filter(e=>null===e.driverId)),"delivering-today":s(n.filter(e=>D(e)===l))}},X=e=>e.load.pickup.date?e.load.pickup.date.slice(0,10):null,q=(e,t)=>{var l;return null!==e.startDay&&e.startDay<=t&&(null!==(l=e.endDay)&&void 0!==l?l:e.startDay)>=t},Q=e=>{let t=(0,E.IQ)(e);return t?60*t.start.getHours()+t.start.getMinutes():Number.MAX_SAFE_INTEGER},$=(e,t)=>{let l=[];return e.filter(R).forEach(e=>{let a=z(e.load),n=(t,n)=>{l.push({id:"".concat(e.id,":").concat(t.toLowerCase()),kind:t,timeLabel:V(n),reference:a,place:Y(n),jobId:e.load.jobId,loadId:e.load.loadId,loadNumber:e.load.loadNumber,sort:Q(n)})};X(e)===t&&n("Pickup",e.load.pickup),D(e)===t&&n("Delivery",e.load.delivery)}),l.sort((e,t)=>e.sort-t.sort||e.reference.localeCompare(t.reference)).map(e=>{let{sort:t,...l}=e;return l})},ee={available:"Available","on-load":"On load","time-off":"Time off",maintenance:"In the shop",compliance:"Compliance hold",inactive:"Inactive"},et=["available","on-load","compliance","maintenance","time-off","inactive"],el={[T.BG.PTO]:"PTO",[T.BG.VACATION]:"V
1acation",[T.BG.SICK]:"Sick",[T.BG.UNAVAILABLE]:"Unavailable",[T.BG.MAINTENANCE]:"In the shop"},ea=(e,t)=>e.map(e=>{var l;let a=(0,E.YE)(e,t,!!e.currentLoad),n=(0,E.Y2)(e,t)?(0,E.G1)(e.timeOff,t):null,s=n&&n.type!==T.BG.MAINTENANCE?el[n.type]:ee[a];return{id:e.id,name:e.name,avatar:e.avatar,availability:a,statusLabel:s,truckNumber:null!==(l=e.truckNumber)&&void 0!==l?l:null}}).sort((e,t)=>et.indexOf(e.availability)-et.indexOf(t.availability)||e.name.localeCompare(t.name)),en=e=>e.filter(e=>R(e)&&null===e.driverId).sort((e,t)=>(null!==(i=X(e))&&void 0!==i?i:"9999-12-31").localeCompare(null!==(o=X(t))&&void 0!==o?o:"9999-12-31")).map(e=>({id:e.id,jobId:e.load.jobId,loadId:e.load.loadId,loadNumber:e.load.loadNumber,reference:z(e.load),route:"".concat(Y(e.load.pickup)," → ").concat(Y(e.load.delivery)),price:null!==(d=e.load.totalPrice)&&void 0!==d?d:null})),es=(e,t,l)=>{let a=[...Array(7)].map((e,t)=>(0,C.wy)(l,t-6)),n=0;return t.forEach(t=>{let l=e.filter(e=>e.driverId===t.id);0!==l.length&&a.forEach(e=>{l.some(t=>q(t,e))&&(n+=1)})}),{workedDays:n,totalDays:7*t.length}},er=E.nQ-1,ei=e=>"mine"===e?"mine":"contract"===e?"contract":"all",eo=()=>{var e,t;let l=(0,N.useRouter)(),{user:a}=(0,y.a)(),{drivers:n,loading:s,error:r,refetch:i}=(0,I.T)(),o=(0,C.iW)(),d=(0,x.useMemo)(()=>({from:(0,C.wy)(o,-6),to:(0,C.wy)(o,2)}),[o]),c=null==a?void 0:a.memberRole,u=null!==(e=null==a?void 0:a.roles)&&void 0!==e?e:[],p=u.includes("OWNER")||u.includes("ADMIN")||"FLEET_MANAGER"===c,m=k.Z.DRIVER_ROSTER,b=m&&!p&&"DISPATCHER"===c,h=b?"mine":m?ei(l.query.scope):"all",v=(0,x.useCallback)(e=>{let t=new URLSearchParams(window.location.search);t.set("scope",e),l.replace({pathname:l.pathname,query:Object.fromEntries(t)},void 0,{shallow:!0})},[l]),f=p&&m&&"string"==typeof l.query.dispatcher?l.query.dispatcher:null,g=(0,x.useCallback)(e=>{let t=new URLSearchParams(window.location.search);e?t.set("dispatcher",e):t.delete("dispatcher"),l.replace({pathname:l.pathname,query:Object.fromEntries(t)},void 0,{shallow:!0})},[l]),[M,T]=(0,x.useState)(null),[S,R]=(0,x.useState)([]),[D,_]=(0,x.useState)(!1),[L,Z]=(0,x.useState)(!1),[B,U]=(0,x.useState)(null),W=(0,x.useRef)(0),K=(0,x.useRef)(!1),V=(0,x.useCallback)(async()=>{let e=++W.current;Z(!0),U(null);try{var t,l,a,n;let[s,r]=await Promise.all([j.Tt.handle({from:d.from,to:d.to}),j.Tt.handle({from:(0,C.wy)(d.from,-er),to:d.from}).catch(()=>null)]);if(e!==W.current)return;if(R((null==r?void 0:r.isSuccess)&&null!==(l=null===(t=r.getValue())||void 0===t?void 0:t.loads)&&void 0!==l?l:[]),s.isFailure){(0,w.Z)(s.error),U(null!==(a=s.error)&&void 0!==a?a:Error("Failed to load the board")),T(e=>null!=e?e:[]);return}let i=s.getValue();T(null!==(n=null==i?void 0:i.loads)&&void 0!==n?n:[]),K.current=!0,_(!!(null==i?void 0:i.truncated))}catch(t){e===W.current&&((0,w.Z)(t),U(t),T(e=>null!=e?e:[]))}finally{e===W.current&&Z(!1)}},[d.from,d.to]);(0,x.useEffect)(()=>{V()},[V]);let G=(0,x.useCallback)(()=>{V(),i()},[V,i]),Y=null!==(t=null==a?void 0:a._id)&&void 0!==t?t:null,z=(0,x.useMemo)(()=>A(O(n,f),h,Y),[n,f,h,Y]),J=(0,x.useMemo)(()=>{let e=new Map;return n.forEach(t=>{var l,a;(null===(l=t.dispatcher)||void 0===l?void 0:l.id)&&!e.has(t.dispatcher.id)&&e.set(t.dispatcher.id,null!==(a=t.dispatcher.name)&&void 0!==a?a:"Unnamed dispatcher")}),[...e.entries()].map(e=>{let[t,l]=e;return{id:t,name:l}}).sort((e,t)=>e.name.localeCompare(t.name))},[n]),X=(0,x.useMemo)(()=>{let e=(0,E.JG)((0,E.aX)(null!=M?M:[]),n),t=new Set(z.map(e=>e.id)),l=f?e.filter(e=>null===e.driverId||t.has(e.driverId)):e;return P(l,t,h)},[M,n,z,h,f]),Q=(0,x.useMemo)(()=>{let e=new Set(X.map(e=>e.id)),t=(0,E.JG)((0,E.aX)(S),n).filter(t=>!e.has(t.id));return t.length?[...X,...t]:X},[X,S,n]),ee=(0,x.useMemo)(()=>(0,E.de)(X.filter(e=>q(e,o)),z,{from:o,toExclusive:(0,C.wy)(o,1)}),[X,z,o]);return{loading:null===M||s,refreshing:L,truncated:D,error:null!=B?B:r,hasData:K.current,todayKey:o,scope:h,setScope:v,privileged:p,lockedToOwn:b,scopingAvailable:m,dispatcherFilter:f,setDispatcherFilter:g,dispatcherOptions:J,noDriversAssigned:"mine"===h&&!!Y&&0===z.length,kpis:(0,x.useMemo)(()=>F(X,z,o),[X,z,o]),boardRows:(0,x.useMemo)(()=>H(X,z,o),[X,z,o]),appointments:(0,x.useMemo)(()=>$(X,o),[X,o]),availability:(0,x.useMemo)(()=>ea(z,o),[z,o]),unassigned:(0,x.useMemo)(()=>en((0,E.aX)(null!=M?M:[])),[M]),lanes:ee,events:X,assignmentEvents:Q,drivers:z,refetch:G}},ed=()=>{let[e,t]=(0,x.useState)(null),[l,a]=(0,x.useState)(!0),[n,s]=(0,x.useState)(!1),[r,i]=(0,x.useState)(null),[o,d]=(0,x.useState)(null),c=(0,x.useRef)(0),u=(0,x.useCallback)(async()=>{let e=++c.current;s(!0),i(null);try{let a=await j.dB.handle();if(e!==c.current)return;if(a.isFailure){var l;i(null!==(l=a.error)&&void 0!==l?l:Error("Failed to load the dispatcher dashboard"));return}let n=a.getValue();n&&(t(n),d(new Date))}catch(t){e===c.current&&i(t)}finally{e===c.current&&(s(!1),a(!1))}},[]);return(0,x.useEffect)(()=>{u()},[u]),(0,x.useEffect)(()=>{let e=()=>{u()};return window.addEventListener("focus",e),()=>window.removeEventListener("focus",e)},[u]),{data:e,isLoading:l,refreshing:n,error:r,refetch:u,updatedAt:o}};var ec=l(60037),eu=l(7597),ep=l(99224);let em=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e),ex=(e,t)=>{if(!e)return"unscheduled";let l=(0,C.Qe)(t,e);return 0===l?"today":1===l?"tomorrow":-1===l?"yesterday":l<0?"".concat(-l," days ago"):"in ".concat(l," days")},eb=(e,t)=>{if(t)return t.getTime();let l=Number.MAX_SAFE_INTEGER/2;if(null==e?void 0:e.date){let t=Date.parse(e.date);if(!Number.isNaN(t))return l+t}return Number.MAX_SAFE_INTEGER},eh=e=>"".concat(Y(e.load.pickup)," → ").concat(Y(e.load.delivery)),ev={critical:0,warning:1,info:2},ef=(e,t,l)=>{let a=new Map(t.map(e=>[e.id,e])),n=[];
1return e.forEach(e=>{var t,s,r,i,o,d,c,u;let p=R(e)&&null===e.driverId,m=Z(e);if(!p&&!e.atRisk&&!m)return;let x="".concat(z(e.load)," \xb7 ").concat(eh(e)),b=null!==(i=e.driverName)&&void 0!==i?i:e.driverId&&null!==(r=null===(t=a.get(e.driverId))||void 0===t?void 0:t.name)&&void 0!==r?r:null,h=(0,E.IQ)(e.load.pickup),v={jobId:e.load.jobId,loadNumber:e.load.loadNumber,title:x,event:e,driverName:b};if(p){let t=ex(X(e),l),a=V(e.load.pickup),s=null!=e.load.totalPrice?em(e.load.totalPrice):"no rate";n.push({...v,kind:"unassigned-load",id:"".concat(e.id,":unassigned"),severity:"critical",tag:e.riskReason?"No driver \xb7 ".concat(e.riskReason):"No driver",detail:"Picks up ".concat(t).concat("TBD"===a?", time TBD":" \xb7 ".concat(a)," \xb7 ").concat(s),assignEvent:(0,E.pJ)(e)?e:null,sort:eb(e.load.pickup,null!==(o=null==h?void 0:h.start)&&void 0!==o?o:null)});return}if(e.atRisk){let t=V(e.load.pickup);n.push({...v,kind:"load-risk",id:"".concat(e.id,":risk"),severity:"critical",tag:null!==(d=B(e))&&void 0!==d?d:"At risk",detail:"".concat(null!=b?b:"No driver"," \xb7 pickup ").concat(ex(X(e),l)).concat("TBD"===t?"":" \xb7 ".concat(t)),assignEvent:(0,E.pJ)(e)||(0,E.$C)(e)?e:null,sort:eb(e.load.pickup,null!==(c=null==h?void 0:h.start)&&void 0!==c?c:null)});return}n.push({...v,kind:"missing-pod",id:"".concat(e.id,":pod"),severity:U(e,l)?"info":"warning",tag:"POD missing",detail:"Delivered ".concat(ex(D(e),l)).concat(b?" \xb7 ".concat(b):""),assignEvent:null,sort:eb(e.load.delivery,null!==(u=null===(s=(0,E.IQ)(e.load.delivery))||void 0===s?void 0:s.start)&&void 0!==u?u:null)})}),t.forEach(e=>{var t;let{cdlExpired:a,medicalExpired:s,cdlExpiringSoon:r,medicalExpiringSoon:i}=null!==(t=e.compliance)&&void 0!==t?t:{};if("compliance"===(0,E.YE)(e,l,!!e.currentLoad)){let t=[a&&"CDL",s&&"medical card"].filter(Boolean).join(" and ");n.push({kind:"driver-blocked",id:"driver:".concat(e.id),severity:"warning",tag:"Can’t be dispatched",title:e.name,detail:"".concat(t||"Compliance document"," expired — renew before assigning work."),sort:0});return}if(!a&&!s&&(r||i)){let t=[r&&"CDL",i&&"medical card"].filter(Boolean).join(" and ");n.push({kind:"driver-expiring",id:"driver:".concat(e.id,":expiring"),severity:"info",tag:"Renewal coming up",title:e.name,detail:"".concat(t," expires within 30 days — renew before it blocks dispatch."),sort:0})}}),n.sort((e,t)=>ev[e.severity]-ev[t.severity]||e.sort-t.sort||e.title.localeCompare(t.title))},eg=(e,t,l)=>{let a=new Map(t.map(e=>[e.id,e])),n=[];return e.filter(R).forEach(e=>{var t,s;let r=e.driverId?a.get(e.driverId):void 0,i=null!==(s=null!==(t=e.driverName)&&void 0!==t?t:null==r?void 0:r.name)&&void 0!==s?s:null,o=null===e.driverId?"unassigned":r&&(0,E.Y2)(r,l)?"driver-off":e.atRisk?"at-risk":null,d=(t,l)=>{let a=(0,E.IQ)(l);n.push({id:"".concat(e.id,":").concat(t.toLowerCase()),kind:t,timeLabel:V(l),minutes:a?60*a.start.getHours()+a.start.getMinutes():Number.MAX_SAFE_INTEGER,reference:z(e.load),place:Y(l),jobId:e.load.jobId,loadNumber:e.load.loadNumber,driverName:i,flag:o,assignEvent:(0,E.pJ)(e)?e:null})};X(e)===l&&d("Pickup",e.load.pickup),D(e)===l&&d("Delivery",e.load.delivery)}),n.sort((e,t)=>e.minutes-t.minutes||e.reference.localeCompare(t.reference))},ey=(e,t)=>null!==(c=e.find(e=>e.minutes!==Number.MAX_SAFE_INTEGER&&e.minutes>=t))&&void 0!==c?c:null,eN=(e,t,l)=>{let a=(0,C.wy)(l,1),n=eg(e,t,a),s=n.filter(e=>"Pickup"===e.kind).length,r=new Set(n.filter(e=>"unassigned"===e.flag||"driver-off"===e.flag).map(e=>"".concat(e.jobId,":").concat(e.loadNumber))).size,i=[],o=0,d=0;return t.forEach(t=>{let l=(0,E.Y2)(t,a);if(l){let e=(0,E.G1)(t.timeOff,a);i.push({name:t.name,reason:"inactive"===l?"Inactive":e?(0,E._Y)(e.type):"Unavailable"});return}let n=e.some(e=>e.driverId===t.id&&R(e)&&q(e,a));n?o+=1:d+=1}),{dayKey:a,rows:n,pickups:s,deliveries:n.length-s,toFix:r,fleet:{off:i,rolling:o,free:d}}},ej="dispatcher-snoozes",ek=e=>{let t=Date.now(),l={};return Object.entries(e).forEach(e=>{let[a,n]=e;"number"==typeof n&&n>t&&(l[a]=n)}),l},ew=e=>{try{localStorage.setItem(ej,JSON.stringify(e))}catch(e){}},eE=()=>{let[e,t]=(0,x.useState)({});(0,x.useEffect)(()=>
1{try{let e=localStorage.getItem(ej);e&&t(ek(JSON.parse(e)))}catch(e){}},[]),(0,x.useEffect)(()=>{let e=setInterval(()=>{t(e=>{let t=ek(e);return Object.keys(t).length===Object.keys(e).length?e:t})},6e4);return()=>clearInterval(e)},[]);let l=(0,x.useCallback)(e=>{t(t=>{let l={...ek(t),[e]:Date.now()+72e5};return ew(l),l})},[]),a=(0,x.useCallback)(e=>{t(t=>{let l=ek(t);return delete l[e],ew(l),l})},[]);return{snoozes:e,snooze:l,unsnooze:a}},eC={critical:"text-red-600",warn:"text-amber-600",accent:"text-blue-700",ok:"text-emerald-600",neutral:"text-slate-900"},eI={critical:"border-red-200 bg-red-50/60",warn:"border-amber-200 bg-amber-50/60",accent:"border-slate-200 bg-white",ok:"border-slate-200 bg-white",neutral:"border-slate-200 bg-white"},eM=(e,t)=>{let l=e-t;return 0===l?"Same as yesterday":"".concat(l>0?"↑":"↓"," ").concat(Math.abs(l)," vs yesterday")},eT={"on-board":"On the board",delivering:"Delivering today",unassigned:"Unassigned",available:"Drivers free"},eS=(e,t)=>[{key:"attention",label:"Needs attention",value:String(t.total),sub:0===t.total?"Queue clear":[t.critical>0&&"".concat(t.critical," critical"),t.warning>0&&"".concat(t.warning," warning"),t.info>0&&"".concat(t.info," info")].filter(Boolean).join(" \xb7 "),tone:t.critical>0?"critical":t.warning>0?"warn":t.total>0?"neutral":"ok",target:{kind:"queue"}},{key:"unassigned",label:eT.unassigned,value:String(e.unassignedLoads),sub:e.unassignedLoads>0?"Need a driver":"Everything is covered",tone:e.unassignedLoads>0?"critical":"neutral",target:{kind:"load-tab",tab:"unassigned"}},{key:"on-board",label:eT["on-board"],value:String(e.loadsOnBoard),sub:"Active right now",tone:"accent",target:null},{key:"delivering",label:eT.delivering,value:String(e.deliveringToday),sub:eM(e.deliveringToday,e.deliveringYesterday),tone:"accent",target:{kind:"load-tab",tab:"delivering-today"}},{key:"available",label:eT.available,value:String(e.driversAvailable),sub:"Ready for assignment",tone:"ok",target:{kind:"driver-view"}}],eR=e=>{let{kpis:t,attention:l,loading:a,unavailable:n,onNavigate:s}=e,r=new Set(Object.keys(eT)),i=new Map(n.filter(e=>r.has(e.key)).map(e=>[e.key,e.reason])),o=eS(t,l);return(0,m.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 xl:grid-cols-5",children:o.map(e=>{let t=i.get(e.key),l=t?"—":a?"…":e.value,n=null!=t?t:a?"":e.sub,r=t?"neutral":e.tone,o=!t&&null!==e.target,d=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("span",{className:"flex w-full items-baseline justify-between gap-2",children:[(0,m.jsx)("span",{className:"font-poppins text-xs font-medium text-slate-500",children:e.label}),o&&(0,m.jsx)("span",{className:"shrink-0 font-poppins text-xs font-semibold text-blue-600",children:"View ›"})]}),(0,m.jsx)("span",{className:(0,b.Z)("font-poppins text-lg font-extrabold leading-none tabular-nums",t?"text-slate-300":eC[r]),children:l}),(0,m.jsx)("span",{className:"font-poppins text-xs leading-tight text-slate-400",children:n})]}),c=(0,b.Z)("flex flex-col items-start gap-[3px] rounded-[12px] border px-3 py-2 text-left",t?"border-dashed border-slate-200 bg-slate-50":eI[r]);return o?(0,m.jsx)("button",{type:"button",onClick:()=>s(e.target),className:(0,b.Z)(c,"transition-colors hover:border-blue-400 hover:bg-blue-50/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600"),children:d},e.key):(0,m.jsx)("div",{className:c,children:d},e.key)})})},eD=e=>"".concat(g.Z6.JOB_DETAILS,"/").concat(e.jobId,"/loads/").concat(e.loadNumber),e_={critical:"bg-red-500",warning:"bg-amber-500",info:"bg-sky-400"},eA={critical:"text-red-600",warning:"text-amber-700",info:"text-sky-700"},eO=[{severity:"critical",label:"Critical",dot:"bg-red-500"},{severity:"warning",label:"Needs action soon",dot:"bg-amber-500"},{severity:"info",label:"Good to know",dot:"bg-sky-400"}],eP={critical:"bg-red-600",warning:"bg-amber-500",info:"bg-sky-500"},eF=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}),eL=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e),eZ=(e,t,l)=>{let a=V(e);return"".concat(Y(e)," \xb7 ").concat(ex(t,l)).concat("TBD"===a?"":" \xb7 ".concat(a))},eB=x.forwardRef((e,t)=>
1{var l,a,n,s;let{items:r,snoozed:i,todayKey:o,loading:d,className:c,collapsed:u,onToggleCollapse:p,onAssign:h,onSnooze:f,onUnsnooze:y}=e,N=r.some(e=>"unassigned-load"===e.kind),[j,k]=x.useState(!1),[w,C]=x.useState({}),I=e=>C(t=>({...t,[e]:!t[e]})),[M,T]=x.useState({}),S=e=>T(t=>({...t,[e]:!t[e]})),R=null!==(a=null===(l=eO.find(e=>r.some(t=>t.severity===e.severity)))||void 0===l?void 0:l.severity)&&void 0!==a?a:"info",_=e=>(0,m.jsx)("div",{className:"mt-2 rounded-md bg-slate-50 px-3 py-2",onClick:e=>e.stopPropagation(),children:(0,m.jsx)("dl",{className:"space-y-1 font-poppins text-xs",children:[["Customer",null!==(n=e.event.load.posterName)&&void 0!==n?n:"—"],["Rate",null!=e.event.load.totalPrice?eL(e.event.load.totalPrice):"—"],["Pickup",eZ(e.event.load.pickup,X(e.event),o)],["Delivery",eZ(e.event.load.delivery,D(e.event),o)],["Driver",null!==(s=e.driverName)&&void 0!==s?s:"No driver yet"]].map(e=>{let[t,l]=e;return(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsx)("dt",{className:"w-[60px] shrink-0 text-slate-400",children:t}),(0,m.jsx)("dd",{className:"min-w-0 text-slate-700",children:l})]},t)})})}),A=e=>{let t="unassigned-load"===e.kind||"load-risk"===e.kind||"missing-pod"===e.kind,l=t&&!!M[e.id];return(0,m.jsxs)("li",{onClick:t?()=>S(e.id):void 0,className:(0,b.Z)("relative py-3 pl-4 pr-3",t&&"cursor-pointer hover:bg-slate-50/60"),children:[(0,m.jsx)("span",{className:(0,b.Z)("absolute bottom-3 left-1.5 top-3 w-[3px] rounded-full",e_[e.severity])}),(0,m.jsxs)("div",{className:"flex items-start gap-2",children:[(0,m.jsx)("p",{className:(0,b.Z)("flex-1 font-poppins text-[11px] font-bold uppercase tracking-wide",eA[e.severity]),children:e.tag}),t&&(0,m.jsx)("button",{type:"button","aria-expanded":l,onClick:t=>{t.stopPropagation(),S(e.id)},title:l?"Hide details":"Show details",className:"shrink-0 rounded px-1 font-poppins text-xs text-slate-400 hover:text-slate-600",children:l?"▾":"▸"})]}),"unassigned-load"===e.kind||"load-risk"===e.kind||"missing-pod"===e.kind?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(v(),{href:eD(e),target:"_blank",rel:"noreferrer",onClick:e=>e.stopPropagation(),className:(0,b.Z)("mt-0.5 block font-poppins text-sm font-semibold text-slate-900 hover:text-blue-700 hover:underline",!l&&"line-clamp-2"),children:e.title}),(0,m.jsx)("p",{className:(0,b.Z)("font-poppins text-xs text-slate-500",!l&&"truncate"),children:e.detail}),l&&_(e),(0,m.jsxs)("div",{className:"mt-1.5 flex items-center gap-2",children:[e.assignEvent?(0,m.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),h(e.assignEvent)},className:"inline-flex h-[26px] items-center justify-center whitespace-nowrap rounded-full bg-main-blue px-3 font-poppins text-xs font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-1",children:(0,E.$C)(e.assignEvent)?"Hand over":"unassigned-load"===e.kind?"Assign driver":"Reassign"}):null,(0,m.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),f(e.id)},title:"Hide from the queue for 2 hours — it comes back by itself",className:"ml-auto font-poppins text-xs font-medium text-slate-400 hover:text-slate-600 hover:underline",children:"Snooze 2h"})]})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("p",{className:"mt-0.5 font-poppins text-sm font-semibold text-slate-900",children:e.title}),(0,m.jsx)("p",{className:"font-poppins text-xs text-slate-500",children:e.detail}),(0,m.jsxs)("span",{className:"mt-1.5 flex items-center gap-2",children:[(0,m.jsx)(v(),{href:"".concat(g.Z6.DRIVER_OPERATIONS,"?tab=roster"),className:"inline-flex h-[26px] items-center justify-center whitespace-nowrap rounded-full border border-main-blue bg-white px-3 font-poppins text-xs font-bold text-main-blue hover:bg-blue-50",children:"Open roster"}),(0,m.jsx)("button",{type:"button",onClick:()=>f(e.id),title:"Hide from the queue for 2 hours — it comes back by itself",className:"ml-auto font-poppins text-xs font-medium text-slate-400 hover:text-slate-600 hover:underline",children:"Snooze 2h"})]})]})]},e.id)};return(0,m.jsxs)(m.Fragment,{children:[u&&(0,m.jsxs)("section",{className:(0,b.Z)("hidden flex-col items-center gap-3 rounded-[14px] border border-slate-200 bg-white py-3 shadow-[0_7px_22px_rgba(31,59,95,0.05)] xl:flex",c),children:[(0,m.jsx)("button",{type:"button",onClick:p,title:"Expand the Needs attention queue",className:"rounded-md px-1 font-poppins text-base text-slate-500 hover:bg-slate-100 hover:text-slate-800",children:"\xbb"}),!d&&r.length>0&&(0,m.jsx)("span",{className:(0,b.Z)("rounded-full px-1.5 py-[1px] font-poppins text-xs font-bold text-white tabular-nums",eP[R]),children:r.length}),(0,m.jsx)("span",{className:"font-poppins text-xs font-semibold uppercase tracking-wide text-slate-500 [writing-mode:vertical-rl]",children:"Needs attention"})]}),(0,m.jsxs)("section",{ref:t,className:(0,b.Z)("flex min-h-0 scroll-mt-4 flex-col rounded-[14px] border border-slate-200 bg-white shadow-[0_7px_22px_rgba(31,59,95,0.05)]",u&&"xl:hidden",c),children:[(0,m.jsxs)("header",{className:"flex items-center gap-2 border-b border-slate-100 px-4 py-3",children:[(0,m.jsx)("h2",{className:"font-poppins text-base font-semibold text-slate-900",children:"Needs attention"}),!d&&r.length>0&&(0,m.jsx)("span",{className:(0,b.Z)("rounded-full px-2 py-[1px] font-poppins text-xs font-bold text-white tabular-nums",eP[R]),children:r.length}),(0,m.jsx)("button",{type:"button",onClick:p,title:"Collapse — give the board the space",className:"ml-auto hidden rounded-md px-1 font-poppins text-base text-slate-400 hover:bg-slate-100 hover:text-slate-700 xl:block",children:"\xab"})]}),d?(0,m.jsx)("div",{className:"flex flex-col gap-2 p-4",children:[void 0,void 0,void 0,void 0].map((e,t)=>(0,m.jsx)("div",{className:"h-16 animate-pulse rounded-md bg-slate-100"},t))}):0!==r.length||j&&i.length>0?(0,m.jsx)("div",{className:"relative min-h-[420px] flex-1",children:(0,m.jsxs)("ul",{className:"absolute inset-0 flex flex-col divide-y divide-slate-100 overflow-y-auto",children:[eO.map(e=>{let{severity:t,label:l,dot:a}=e,n=r.filter(e=>e.severity===t);if(0===n.length)return null;let s=!!w[t];return(0,m.jsxs)(x.Fragment,{children:[(0,m.jsx)("li",{className:"bg-slate-50/70",children:(0,m.jsxs)("button",{type:"button",onClick:()=>I(t),"aria-expanded":!s,className:"flex w-full items-center gap-1.5 px-4 py-1.5 text-left hover:bg-slate-100/70",children:[(0,m.jsx)("span",{className:(0,b.Z)("h-2 w-2 rounded-full",a)}),(0,m.jsxs)("span",{className:"font-poppins text-[11px] font-bold uppercase tracking-wide text-slate-500",children:[l," \xb7 ",n.length]}),(0,m.jsx)("span",{className:"ml-auto font-poppins text-xs text-slate-400",children:s?"▸":"▾"})]})}),!s&&n.map(A)]},t)}),j&&i.map(e=>{let{item:t,until:l}=e;return(0,m.jsxs)("li",{className:"relative py-3 pl-4 pr-3 opacity-60",children:[(0,m.jsx)("p",{className:"font-poppins text-[11px] font-bold uppercase tracking-wide text-slate-400",children:t.tag}),(0,m.jsx)("p",{className:"mt-0.5 font-poppins text-sm font-semibold text-slate-700",children:t.title}),(0,m.jsxs)("p",{className:"font-poppins text-xs text-slate-500",children:["Snoozed until ",eF.format(new Date(l))," \xb7"," ",(0,m.jsx)("button",{type:"button",onClick:()=>y(t.id),className:"font-medium text-blue-700 hover:underline",children:"Bring back now"})]})]},t.id)})]})}):(0,m.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-1 px-4 py-10 text-center",children:[(0,m.jsx)("span",{className:"font-poppins text-sm font-semibold text-emerald-700",children:"Queue clear"}),(0,m.jsx)("span",{className:"font-poppins text-xs text-slate-500",children:i.length>0?"Everything left is snoozed.":"Nothing needs you right now."})]}),!d&&i.length>0&&(0,m.jsxs)("button",{type:"button",onClick:()=>k(e=>!e),className:"border-t border-slate-100 px-4 py-2 text-left font-poppins text-xs font-medium text-slate-500 hover:text-slate-700",children:[i.length," snoozed until later \xb7 ",j?"Hide":"Show"]}),!d&&N&&(0,m.jsx)("p",{className:"border-t border-slate-100 px-4 py-2 font-poppins text-xs text-slate-400",children:"Unassigned loads are company-wide."})]})]})});eB.displayName="TriageQueue";var eU=l(95700);let eW=e=>{let t=e.trim().toLowerCase().replace(/^#/,"");return 0===t.length?null:t},eK=(e,t)=>!!e&&e.toLowerCase().replace(/^#/,"").includes(t),eV=(e,t)=>eK(z(e.load),t)||eK(e.load.posterName,t),eG=(e,t)=>eK(e.reference,t)||eK(e.driverName,t)||eK(e.truckNumber,t)||eK(e.route,t)||eK(e.customer,t),eY=(e,t)=>
1{let l=eW(t);return null===l?e:e.filter(e=>{var t;return eK(e.label,l)||eK(null===(t=e.driver)||void 0===t?void 0:t.truckNumber,l)||e.events.some(e=>eV(e,l))})},ez=(e,t)=>{let l=eW(t);if(null===l)return e;let a={};return Object.keys(e).forEach(t=>{a[t]=e[t].filter(e=>eG(e,l))}),a};var eJ=l(33187),eH=l(75719),eX=l(11460);let eq=e=>{let t=e=>String(e).padStart(2,"0");return"".concat(e.getFullYear(),"-").concat(t(e.getMonth()+1),"-").concat(t(e.getDate()))},eQ=e=>60*e.getHours()+e.getMinutes(),e$=(e,t)=>{let l=1/0,a=-1/0;if(e.forEach(e=>{let n=e.timed;if(!n||eq(n.start)!==t)return;let s=eQ(n.start),r=eQ(n.end);l=Math.min(l,s),a=Math.max(a,r>s?r:Math.min(s+60,1440))}),l===1/0)return{startMinutes:360,endMinutes:1200};let n=Math.max(0,30*Math.floor((l-60)/30)),s=Math.min(1440,30*Math.ceil((a+60)/30)),r=480-(s-n);if(r>0){let e=30*Math.ceil(r/2/30);n=Math.max(0,n-e),(s=Math.min(1440,s+e))-n<480&&(0===n?s=480:n=Math.max(0,s-480))}return{startMinutes:n,endMinutes:s}},e0=(e,t,l)=>{let a=Math.max(1,l.endMinutes-l.startMinutes),n=[],s=[];return e.forEach(e=>{let r=e.timed;if(!r||eq(r.start)!==t){s.push(e);return}let i=eQ(r.start),o=eQ(r.end),d=Math.min(97,(i-l.startMinutes)/a*100);n.push({event:e,leftPct:Math.max(0,d),widthPct:Math.min(100-d,Math.max(3,((o>i?o:Math.min(i+60,1440))-i)/a*100))})}),{placed:n,banded:s}},e1=e=>{let t=Math.floor(e/60)%24;return"".concat(t%12==0?12:t%12," ").concat(t>=12?"PM":"AM")},e2=e=>{let t=e.endMinutes-e.startMinutes,l=t>960?180:120,a=Math.ceil(e.startMinutes/l)*l,n=[];for(let s=a;s<=e.endMinutes;s+=l)n.push({minutes:s,leftPct:(s-e.startMinutes)/t*100,label:e1(s)});return n},e5=(e,t)=>e<t.startMinutes||e>t.endMinutes?null:(e-t.startMinutes)/(t.endMinutes-t.startMinutes)*100,e4=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}),e7={available:"bg-emerald-50 text-emerald-700","on-load":"bg-blue-50 text-blue-700","time-off":"bg-violet-50 text-violet-700",maintenance:"bg-amber-50 text-amber-700",compliance:"bg-red-50 text-red-700",inactive:"bg-slate-100 text-slate-500"},e6=(e,t,l)=>{var a;let n=e.driver;if(!n)return null;let s=(0,E.Y2)(n,t);if(s){let e=(0,E.G1)(n.timeOff,t);return{label:"inactive"===s?"Inactive":e?(0,E._Y)(e.type):"Unavailable",className:"border-violet-200 bg-violet-50/70 text-violet-700"}}let{cdlExpired:r,medicalExpired:i}=null!==(a=n.compliance)&&void 0!==a?a:{};if(r||i){let e=[r&&"CDL",i&&"medical card"].filter(Boolean).join(" and ");return{label:"Can’t be dispatched \xb7 ".concat(e," expired"),className:"border-red-200 bg-red-50/70 text-red-700"}}return(null==l?void 0:l.availability)==="on-load"?{label:"On a load \xb7 no stops today",className:"border-blue-200 bg-blue-50/60 text-blue-700"}:{label:"Available for assignment".concat(n.homeTerminal?" \xb7 ".concat(n.homeTerminal):""),className:"border-emerald-200 bg-emerald-50/60 text-emerald-700"}},e3=e=>{var t;return null!==(u=null===(t=e.find(e=>e.atRisk))||void 0===t?void 0:t.riskReason)&&void 0!==u?u:null},e9=e=>{var t,l;let a=eH.pn[e.status],n=["#".concat(null!==(t=e.load.jobNumber)&&void 0!==t?t:"—","-").concat(e.load.loadNumber),"".concat([e.load.pickup.city,e.load.pickup.state].filter(Boolean).join(", ")," → ").concat([e.load.delivery.city,e.load.delivery.state].filter(Boolean).join(", ")),null!==(l=e.riskReason)&&void 0!==l?l:a.label];return e.timed&&n.push("".concat(e4.format(e.timed.start)," – ").concat(e4.format(e.timed.end))),n.join(" \xb7 ")},e8=e=>{let{lanes:t,todayKey:l,availabilityById:a,onEventClick:n,emptyMessage:s}=e,r=[...(0,eX.v9)(t)].sort((e,t)=>Number(t.events.length>0)-Number(e.events.length>0)),i=(0,x.useMemo)(()=>r.flatMap(e=>e.events),[r]),o=(0,x.useMemo)(()=>e$(i,l),[i,l]),d=(0,x.useMemo)(()=>e2(o),[o]),[c,u]=(0,x.useState)(null);(0,x.useEffect)(()=>{u(new Date);let e=setInterval(()=>u(new Date),6e4);return()=>clearInterval(e)},[]);let p=null!==c?e5(60*c.getHours()+c.getMinutes(),o):null;return 0===r.length?(0,m.jsx)("div",{className:"flex h-full min-h-[240px] items-center justify-center px-6 text-center font-poppins text-sm text-slate-500",children:null!=s?s:"Nothing rolling today."}):(0,m.jsxs)("div",{className:"min-w-[640px] px-4 pb-3",children:[(0,m.jsxs)("div",{className:"sticky top-0 z-30 grid grid-cols-[196px_minmax(0,1fr)] items-end gap-3 bg-white",children:[(0,m.jsx)("div",{}),(0,m.jsxs)("div",{className:"relative h-6",children:[d.map(e=>(0,m.jsx)("span",{className:"absolute bottom-0 -translate-x-1/2 font-poppins text-[11px] text-slate-400 tabular-nums",style:{left:"".concat(e.leftPct,"%")},children:e.label},e.minutes)),null!==p&&null!==c&&(0,m.jsx)("span",{className:"absolute bottom-0 z-10 -translate-x-1/2 roun
1ded bg-red-500 px-1 font-poppins text-[10px] font-bold text-white tabular-nums",style:{left:"".concat(p,"%")},children:e4.format(c)})]})]}),(0,m.jsx)("ul",{children:r.map(e=>{var t,s;let r=_(e.events),i=e3(r),c=a.get(e.id),u=0===e.events.length?e6(e,l,c):null,{placed:x,banded:h}=e0(r,l,o);return(0,m.jsxs)("li",{className:"grid grid-cols-[196px_minmax(0,1fr)] items-center gap-3 border-t border-slate-100 py-2",children:[(0,m.jsxs)("div",{className:"min-w-0",children:[(0,m.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,m.jsx)(eJ.b,{name:e.label,avatar:e.avatar,size:26}),(0,m.jsxs)("span",{className:"min-w-0",children:[(0,m.jsx)("span",{className:"block truncate font-poppins text-[13px] font-semibold text-slate-900",children:e.label}),(0,m.jsx)("span",{className:"block truncate font-poppins text-xs text-slate-400",children:(null===(t=e.driver)||void 0===t?void 0:t.truckNumber)?"Truck ".concat(e.driver.truckNumber):"—"}),(null===(s=e.driver)||void 0===s?void 0:s.phone)&&(0,m.jsx)("a",{href:"tel:".concat(e.driver.phone),title:"Call ".concat(e.label),className:"block truncate font-poppins text-xs font-medium text-blue-700 hover:underline",children:e.driver.phone})]})]}),(0,m.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[c&&(0,m.jsx)("span",{className:(0,b.Z)("rounded-full px-2 py-[1px] font-poppins text-[11px] font-bold",e7[c.availability]),children:c.statusLabel}),i&&(0,m.jsxs)("span",{className:"rounded-full border border-red-300 bg-red-50 px-2 py-[1px] font-poppins text-[11px] font-medium text-red-700",children:["⚠ ",i]})]})]}),(0,m.jsx)("div",{className:"min-w-0",children:u?(0,m.jsx)("p",{className:(0,b.Z)("rounded-md border px-2 py-1 text-center font-poppins text-xs",u.className),children:u.label}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"relative h-9 rounded-md bg-slate-50",children:[d.map(e=>(0,m.jsx)("span",{"aria-hidden":!0,className:"absolute bottom-0 top-0 w-px bg-slate-200/70",style:{left:"".concat(e.leftPct,"%")}},e.minutes)),null!==p&&(0,m.jsx)("span",{"aria-hidden":!0,className:"absolute bottom-0 top-0 z-10 w-[2px] rounded bg-red-500/80",style:{left:"".concat(p,"%")}}),x.map(e=>{var t;let{event:l,leftPct:a,widthPct:s}=e,r=eH.pn[l.status];return(0,m.jsx)("button",{type:"button",onClick:()=>n(l),title:e9(l),className:(0,b.Z)("absolute bottom-1 top-1 z-20 flex min-w-[52px] items-center truncate rounded-[7px] px-2 font-poppins text-[11px] font-semibold tabular-nums transition-shadow hover:ring-2 hover:ring-blue-500/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600",l.atRisk?eH.VG:r.chipClass),style:{left:"".concat(a,"%"),width:"".concat(s,"%"),maxWidth:"".concat(100-a,"%")},children:(0,m.jsxs)("span",{className:"truncate",children:[l.atRisk?"⚠ ":"","#",null!==(t=l.load.jobNumber)&&void 0!==t?t:"—","-",l.load.loadNumber]})},l.id)})]}),h.length>0&&(0,m.jsx)("div",{className:"mt-1 flex flex-wrap gap-1.5",children:h.map(e=>{var t;let l=eH.pn[e.status];return(0,m.jsxs)("button",{type:"button",onClick:()=>n(e),title:e9(e),className:(0,b.Z)("rounded-[7px] px-2 py-[2px] font-poppins text-[11px] font-semibold tabular-nums transition-shadow hover:ring-2 hover:ring-blue-500/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600",e.atRisk?eH.VG:l.chipClass),children:[e.atRisk?"⚠ ":"","#",null!==(t=e.load.jobNumber)&&void 0!==t?t:"—","-",e.load.loadNumber,(0,m.jsx)("span",{className:"ml-1 font-normal opacity-70",children:e.timed?"multi-day":l.label})]},e.id)})})]})})]},e.id)})})]})},te=e=>"".concat(g.Z6.JOB_DETAILS,"/").concat(e.jobId,"/loads/").concat(e.loadNumber),tt={"needs-attention":"Nothing needs attention right now.","in-transit":"No loads are rolling at the moment.",unassigned:"Everything is covered.","delivering-today":"Nothing is scheduled to deliver today."},tl=e=>{let{rows:t,loading:l,activeTab:a,onTabChange:n,onAssign:s,emptyMessage:r}=e,i=t[a];return(0,m.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,m.jsx)("div",{role:"tablist",className:"flex gap-4 overflow-x-auto border-b border-slate-100 px-4",children:G.map(e=>(0,m.jsxs)("button",{type:"button",role:"tab","aria-selected":a===e.key,onClick:()=>n(e.key),className:(0,b.Z)("flex shrink-0 items-center gap-2 border-b-2 pb-2 pt-1 font-poppins text-sm transition-colors",a===e.ke
1y?"border-blue-600 font-semibold text-blue-700":"border-transparent text-slate-500 hover:text-slate-700"),children:[e.label,(0,m.jsx)("span",{className:"rounded-full bg-slate-100 px-2 text-xs text-slate-500 tabular-nums",children:l?"…":t[e.key].length})]},e.key))}),(0,m.jsx)("div",{className:"min-h-0 flex-1",children:l?(0,m.jsx)("div",{className:"flex flex-col gap-2 p-4",children:[void 0,void 0,void 0,void 0,void 0].map((e,t)=>(0,m.jsx)("div",{className:"h-10 animate-pulse rounded-md bg-slate-100"},t))}):0===i.length?(0,m.jsx)("p",{className:"p-8 text-center font-poppins text-sm text-slate-500",children:null!=r?r:tt[a]}):(0,m.jsxs)("table",{className:"w-full min-w-[720px] table-fixed border-collapse",children:[(0,m.jsx)("thead",{className:"sticky top-0 z-20 bg-white shadow-[0_1px_0_#e2e8f0]",children:(0,m.jsxs)("tr",{className:"text-left font-poppins text-xs uppercase tracking-wide text-slate-400",children:[(0,m.jsx)("th",{className:"w-[96px] px-4 py-2 font-medium",children:"Load"}),(0,m.jsx)("th",{className:"px-4 py-2 font-medium",children:"Route"}),(0,m.jsx)("th",{className:"w-[128px] px-4 py-2 font-medium",children:"Status"}),(0,m.jsx)("th",{className:"w-[156px] px-4 py-2 font-medium",children:"Driver / Truck"}),(0,m.jsx)("th",{className:"w-[104px] px-4 py-2 font-medium",children:"Appointment"}),(0,m.jsx)("th",{className:"w-[116px] px-3 py-2 font-medium",children:"Actions"})]})}),(0,m.jsx)("tbody",{children:i.map(e=>{let t=eH.pn[e.status];return(0,m.jsxs)("tr",{className:"border-t border-slate-100 font-poppins text-sm",children:[(0,m.jsx)("td",{className:"px-4 py-3 font-medium text-slate-900",children:(0,m.jsx)(v(),{href:te(e),target:"_blank",rel:"noreferrer",className:"hover:text-blue-700 hover:underline",children:e.reference})}),(0,m.jsx)("td",{className:"px-4 py-3 text-slate-600",children:(0,m.jsx)("span",{className:"line-clamp-2",title:e.route,children:e.route})}),(0,m.jsx)("td",{className:"px-4 py-3",children:(()=>{var l;let a="needs-driver"===e.status,n=a?e.riskReason?"No driver \xb7 ".concat(e.riskReason):t.label:null!==(l=e.riskReason)&&void 0!==l?l:t.label,s=a?e.riskReason?eH.VG:t.chipClass:"critical"===e.riskSeverity?eH.VG:"warning"===e.riskSeverity?"border border-amber-300 bg-amber-50 text-amber-800":"info"===e.riskSeverity?"border border-sky-300 bg-sky-50 text-sky-800":t.chipClass;return(0,m.jsx)("span",{className:(0,b.Z)("inline-block max-w-full truncate whitespace-nowrap rounded-full px-2 py-0.5 text-xs font-medium",s),title:n,children:n})})()}),(0,m.jsx)("td",{className:"px-4 py-3 text-slate-600",children:(0,m.jsx)("span",{className:"block truncate",title:e.driverName?"".concat(e.driverName).concat(e.truckNumber?" \xb7 Truck ".concat(e.truckNumber):""):void 0,children:e.driverName?(0,m.jsxs)(m.Fragment,{children:[e.driverName,e.truckNumber&&(0,m.jsxs)("span",{className:"text-slate-400",children:[" \xb7 Truck ",e.truckNumber]})]}):"—"})}),(0,m.jsx)("td",{className:"px-4 py-3 text-slate-600",children:(0,m.jsx)("span",{className:"block truncate",title:e.appointmentLabel,children:e.appointmentLabel})}),(0,m.jsx)("td",{className:"px-3 py-3",children:(0,E.pJ)(e.event)||(0,E.$C)(e.event)?(0,m.jsx)("button",{type:"button",onClick:()=>s(e.event),className:"inline-flex h-[26px] items-center justify-center whitespace-nowrap rounded-full bg-main-blue px-3 font-poppins text-xs font-bold text-white hover:opacity-90",children:(0,E.$C)(e.event)?"Hand over":e.driverName?"Reassign":"Assign"}):(0,m.jsx)(v(),{href:te(e),target:"_blank",rel:"noreferrer",className:"inline-flex h-[26px] items-center justify-center whitespace-nowrap rounded-full border border-main-blue bg-white px-3 font-poppins text-xs font-bold text-main-blue hover:bg-blue-50",children:"Open ↗"})})]},e.id)})})]})})]})},ta=e=>{let{className:t,view:l,onViewChange:a,dayKey:n,lanes:s,availabilityById:r,rows:i,activeTab:o,onTabChange:d,loading:c,onAssignRequest:u,assignDriver:p,emptyRosterMessage:h}=e,[v,f]=(0,x.useState)(null),[g,y]=(0,x.useState)(""),N=g.trim(),j=(0,x.useMemo)(()=>eY(s,g),[s,g]),k=(0,x.useMemo)(()=>ez(i,g),[i,g]),w=e=>{"needs-driver"===e.status?u(e):f(e)};return(0,m.jsxs)("section",{className:(0,b.Z)("flex min-h-0 flex-col rounded-[14px] border border-slate-200 bg-white shadow-[0_7px_22px_rgba(31,59,95,0.05)]",t),children:[(0,m.jsxs)("header",{className:"flex flex-wrap items-center gap-3 px-4 pb-2 pt-4",children:[(0,m.jsxs)("h2",{className:"font-poppins text-base font-semibold text-slate-900",children:["Dispatch Board ",(0,m.jsx)("span",{className:"font-normal text-slate-400",children:"(Today)"})]}),(0,m.jsx)("div",{role:"group","aria-label":"Board view",className:"inline-flex rounded-[10px] border border-slate-200 bg-slate-50 p-0.5",children:[{key:"driver",label:"By driver"},{key:"load",label:"By load"}].map(e=>(0,m.jsx)("button",{type:"button","aria-pressed":l===e.key,onClick:()=>
1a(e.key),className:(0,b.Z)("rounded-[8px] px-2.5 py-1 font-poppins text-xs font-semibold transition-colors",l===e.key?"bg-white text-slate-900 shadow-sm":"text-slate-500 hover:text-slate-700"),children:e.label},e.key))}),(0,m.jsx)("div",{className:"ml-auto flex items-center gap-3",children:(0,m.jsx)("input",{type:"search",value:g,onChange:e=>y(e.target.value),placeholder:"Find driver or load…","aria-label":"Find driver or load",className:"w-44 rounded-[10px] border border-slate-200 px-2.5 py-1.5 font-poppins text-sm text-slate-700 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none"})})]}),N&&(0,m.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-y border-blue-100 bg-blue-50/60 px-4 py-1.5",children:[(0,m.jsxs)("p",{className:"font-poppins text-sm text-blue-800",children:["Showing only matches for “",N,"”."]}),(0,m.jsx)("button",{type:"button",onClick:()=>y(""),className:"rounded-md px-1.5 font-poppins text-sm font-semibold text-blue-700 hover:underline",children:"Show everything"})]}),(0,m.jsx)("div",{className:"relative min-h-[420px] flex-1",children:(0,m.jsx)("div",{className:"absolute inset-0 overflow-auto",children:"driver"===l?c?(0,m.jsx)("div",{className:"flex flex-col gap-2 p-4",children:[void 0,void 0,void 0,void 0,void 0].map((e,t)=>(0,m.jsx)("div",{className:"h-12 animate-pulse rounded-md bg-slate-100"},t))}):(0,m.jsx)(e8,{lanes:j,todayKey:n,availabilityById:r,onEventClick:w,emptyMessage:N?"No drivers or loads match “".concat(N,"”."):h}):(0,m.jsx)(tl,{rows:k,loading:c,activeTab:o,onTabChange:d,onAssign:u,emptyMessage:N?"No loads match “".concat(N,"” on this tab."):void 0})})}),(0,m.jsx)(eU.Q,{event:v,onClose:()=>f(null),onAssign:e=>{f(null),u(e)},onUnassign:e=>{f(null),p(e,null,{undoable:!0})}})]})};var tn=l(44629);let ts={unassigned:{label:()=>"Unassigned",className:"bg-orange-50 text-orange-700"},"driver-off":{label:e=>"".concat(null!==(p=e.driverName)&&void 0!==p?p:"Driver"," is off"),className:"bg-red-50 text-red-700"},"at-risk":{label:()=>"At risk",className:"bg-red-50 text-red-700"}},tr=e=>{let[t,l,a]=e.split("-").map(Number);return new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric"}).format(new Date(t,l-1,a))},ti=e=>"".concat(g.Z6.JOB_DETAILS,"/").concat(e.jobId,"/loads/").concat(e.loadNumber),to=(e,t)=>{var l;if(!(null===(l=e.loadRef)||void 0===l?void 0:l.loadNumber))return e.subtitle;let a=t.get(e.loadRef.jobId);return void 0===a?e.subtitle:"#".concat(a,"-").concat(e.loadRef.loadNumber)},td=e=>{let{upNext:t,upNextLoading:l,tomorrow:a,onAssign:n,activity:s,activityLoading:r,activityError:i,onRetryActivity:o,jobNumberById:d,collapsed:c,onToggleCollapse:u}=e,[p,h]=(0,x.useState)(null);(0,x.useEffect)(()=>{let e=()=>{let e=new Date;h(60*e.getHours()+e.getMinutes())};e();let t=setInterval(e,6e4);return()=>clearInterval(t)},[]);let f=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,m.jsxs)("li",{className:(0,b.Z)("flex gap-3 px-4 py-2",t.past&&"opacity-55"),children:[(0,m.jsx)("span",{className:"w-[74px] shrink-0 pt-[1px] font-poppins text-xs font-bold text-slate-900 tabular-nums",children:e.timeLabel}),(0,m.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,m.jsxs)("p",{className:"flex items-center gap-1.5 font-poppins text-xs",children:[(0,m.jsx)("span",{className:(0,b.Z)("font-semibold","Pickup"===e.kind?"text-violet-600":"text-emerald-600"),children:e.kind}),(0,m.jsx)(v(),{href:ti(e),target:"_blank",rel:"noreferrer",className:"truncate font-medium text-slate-700 hover:text-blue-700 hover:underline",children:e.reference})]}),(0,m.jsxs)("p",{className:"truncate font-poppins text-xs text-slate-500",children:[e.place,e.driverName?" \xb7 ".concat(e.driverName):""]}),e.flag&&(0,m.jsxs)("span",{className:"mt-0.5 flex flex-wrap items-center gap-2",children:[(0,m.jsx)("span",{className:(0,b.Z)("inline-block rounded px-1.5 py-[1px] font-poppins text-[11px] font-bold uppercase tracking-wide",ts[e.flag].className),children:ts[e.flag].label(e)}),t.withAction&&"at-risk"!==e.flag&&e.assignEvent&&(0,m.jsx)("button",{type:"button",onClick:()=>n(e.assignEvent),className:"inline-flex h-[22px] items-center justify-center whitespace-nowrap rounded-full bg-main-blue px-2.5 font-poppins text-[11px] font-bold text-white hover:opacity-90",children:"unassigned"===e.flag?"Assign":"Reassign"})]})]})]},e.id)};return(0,m.jsxs)(m.Fragment,{children:[c&&(0,m.jsxs)("section",{className:"hidden h-full flex-col items-center gap-3 rounded-[14px] border border-slate-200 bg-white py-3 shadow-[0_7px_22px_rgba(31,59,95,0.05)] 2xl:flex",children:[(0,m.jsx)("button",{type:"button",onClick:u,title:"Expand Up Next and Activity",className:"rounded-md px-1 font-poppins text-base text-slate-500 hover:bg-slate-100 hover:text-slate-800",children:"\xab"}),!l&&t.length>0&&(0,m.jsx)("span",{className:"rounded-full bg-slate-200 px-1.5 py-[1px] font-poppins text-xs font-bold text-slate-700 tabular-nums",children:t.length}),!l&&a.toFix>0&&(0,m.jsx)("span",{title:"Tomorrow needs fixes",className:"rounded-full bg-amber-500 px-1.5 py-[1px] font-poppins text-xs font-bold text-white tabular-nums",children:a.toFix}),(0,m.jsx)("span",{className:"font-poppins text-xs font-semibold uppercase tracking-wide text-slate-500 [writing-mode:vertical-rl]",children:"Up Next"})]}),(0,m.jsx)("section",{className:(0,b.Z)("min-h-0 rounded-[14px] border border-slate-200 bg-white shadow-[0_7px_22px_rgba(31,59,95,0.05)] 2xl:h-full",c&&"2xl:hidden"),children:(0,m.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 2xl:flex 2xl:h-full 2xl:min-h-0 2xl:flex-col",children:[(0,m.jsxs)("div",{className:"flex min-w-0 flex-col 2xl:min-h-0 2xl:flex-1",children:[(0,m.jsxs)("header",{className:"flex items-center gap-2 border-b border-slate-100 px-4 py-3",children:[(0,m.jsx)("h2",{className:"font-poppins text-base font-semibold text-slate-900",children:"Up Next"}
1),(0,m.jsx)(v(),{href:"".concat(g.Z6.DRIVER_OPERATIONS,"?tab=schedule&view=day"),className:"ml-auto font-poppins text-sm font-medium text-blue-700 hover:underline",children:"Full Calendar"}),(0,m.jsx)("button",{type:"button",onClick:u,title:"Collapse — give the board the space",className:"hidden rounded-md px-1 font-poppins text-base text-slate-400 hover:bg-slate-100 hover:text-slate-700 2xl:block",children:"\xbb"})]}),l?(0,m.jsx)("div",{className:"flex flex-col gap-2 p-4",children:[void 0,void 0,void 0,void 0].map((e,t)=>(0,m.jsx)("div",{className:"h-9 animate-pulse rounded-md bg-slate-100"},t))}):0===t.length?(0,m.jsx)("p",{className:"px-4 py-8 text-center font-poppins text-sm text-slate-500",children:"No appointments scheduled today."}):(0,m.jsx)("ul",{className:"flex max-h-[320px] flex-col divide-y divide-slate-100 overflow-y-auto 2xl:max-h-none 2xl:min-h-0 2xl:flex-1",children:t.map(e=>f(e,{past:null!==p&&e.minutes!==Number.MAX_SAFE_INTEGER&&e.minutes<p}))})]}),(0,m.jsxs)("div",{className:"flex min-w-0 flex-col border-t border-slate-100 md:border-l md:border-t-0 2xl:border-l-0 2xl:border-t",children:[(0,m.jsxs)("header",{className:"flex items-center gap-2 border-b border-slate-100 px-4 py-3",children:[(0,m.jsx)("h2",{className:"font-poppins text-base font-semibold text-slate-900",children:"Tomorrow"}),(0,m.jsxs)("span",{className:"font-poppins text-xs text-slate-400",children:["\xb7 ",tr(a.dayKey)]}),!l&&a.rows.length>0&&(0,m.jsx)("span",{className:(0,b.Z)("ml-auto rounded-full px-2 py-[1px] font-poppins text-[11px] font-bold",a.toFix>0?"bg-amber-100 text-amber-800":"bg-emerald-100 text-emerald-700"),children:a.toFix>0?"".concat(a.toFix," to fix"):"Covered"})]}),l?(0,m.jsx)("div",{className:"flex flex-col gap-2 p-4",children:[void 0,void 0,void 0].map((e,t)=>(0,m.jsx)("div",{className:"h-9 animate-pulse rounded-md bg-slate-100"},t))}):0===a.rows.length?(0,m.jsx)("p",{className:"px-4 py-6 text-center font-poppins text-sm text-slate-500",children:"Nothing scheduled yet."}):(0,m.jsx)("ul",{className:"flex max-h-[260px] flex-col divide-y divide-slate-100 overflow-y-auto",children:a.rows.map(e=>f(e,{withAction:!0}))}),!l&&(0,m.jsxs)("p",{className:"truncate border-t border-slate-100 px-4 py-2 font-poppins text-xs text-slate-500",title:a.fleet.off.length>0?a.fleet.off.map(e=>"".concat(e.name," (").concat(e.reason,")")).join(", "):void 0,children:[a.fleet.off.length>0?"Off: ".concat(a.fleet.off.map(e=>"".concat(e.name," (").concat(e.reason,")")).join(", ")," \xb7 "):"","Free: ",a.fleet.free," \xb7 Rolling: ",a.fleet.rolling]})]}),(0,m.jsxs)("div",{className:"flex min-w-0 flex-col border-t border-slate-100 md:border-l md:border-t-0 2xl:min-h-0 2xl:flex-1 2xl:border-l-0 2xl:border-t",children:[(0,m.jsx)("header",{className:"border-b border-slate-100 px-4 py-3",children:(0,m.jsx)("h2",{className:"font-poppins text-base font-semibold text-slate-900",children:"Activity"})}),i?(0,m.jsxs)("div",{className:"flex flex-col items-start gap-2 px-4 py-6",children:[(0,m.jsx)("p",{className:"font-poppins text-sm text-slate-500",children:"Activity couldn't be loaded."}),(0,m.jsx)("button",{type:"button",onClick:o,className:"rounded-md border border-slate-200 px-3 py-1 font-poppins text-sm font-medium text-slate-600 hover:border-blue-600 hover:text-blue-700",children:"Retry"})]}):r?(0,m.jsx)("div",{className:"flex flex-col gap-2 p-4",children:[void 0,void 0,void 0,void 0,void 0].map((e,t)=>(0,m.jsx)("div",{className:"h-9 animate-pulse rounded-md bg-slate-100"},t))}):0===s.length?(0,m.jsx)("p",{className:"px-4 py-8 text-center font-poppins text-sm text-slate-500",children:"No recent activity."}):(0,m.jsx)("ul",{className:"flex flex-col divide-y divide-slate-100 2xl:min-h-0 2xl:flex-1 2xl:overflow-y-auto",children:s.map(e=>{let t=to(e,d);return(0,m.jsxs)("li",{className:"flex items-start gap-3 px-4 py-2 font-poppins text-sm",children:[(0,m.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,m.jsx)("p",{className:"truncate font-medium text-slate-900",children:e.title}),t&&(e.loadRef?(0,m.jsx)(v(),{href:"".concat(g.Z6.JOB_DETAILS,"/").concat(e.loadRef.jobId),target:"_blank",rel:"noreferrer",className:"text-xs text-slate-500 hover:text-blue-700 hover:underline",children:t}):(0,m.jsx)("p",{className:"text-xs text-slate-500",children:t}))]}),(0,m.jsx)("span",{className:"shrink-0 text-xs text-slate-400",children:(0,tn.J)(e.at)})]},e.id)})})]})]})})]})},tc={top:10,right:10,bottom:24,left:42},tu=new Intl.DateTimeFormat("en-US",{weekday:"short",timeZone:"UTC"}),tp=[{key:"pickupPct",label:"On-Time Pickups",color:"#2563eb",dashed:!1,emphasized:!0},{key:"deliveryPct",label:"On-Time Deliveries",color:"#60a5fa",dashed:!0,emphasized:!1}],tm=e=>{let{points:t}=e,l=1280-tc.left-tc.right,a=300-tc.top-tc.bottom,n=e=>tc.left+(t.length<=1?l/2:e/(t.length-1)*l),s=e=>tc.top+a-e/100*a,r=e=>{let l=[],a=[],r=[],i=[],o=()=>
1{if(i.length>1){l.push(i.map((e,t)=>"".concat(0===t?"M":"L"," ").concat(e.x," ").concat(e.y)).join(" "));let e=i[0],t=i[i.length-1];a.push("".concat(i.map((e,t)=>"".concat(0===t?"M":"L"," ").concat(e.x," ").concat(e.y)).join(" ")," L ").concat(t.x," ").concat(s(0)," L ").concat(e.x," ").concat(s(0)," Z"))}e.emphasized?r.push(...i):1===i.length&&r.push(i[0]),i=[]};return t.forEach((t,l)=>{let a=t[e.key];if(null===a){o();return}i.push({x:n(l),y:s(a)})}),o(),{paths:l,areas:a,dots:r}};return(0,m.jsxs)("figure",{className:"w-full overflow-x-auto",children:[(0,m.jsxs)("svg",{viewBox:"0 0 ".concat(1280," ").concat(300),className:"h-auto w-full min-w-[560px]",role:"img","aria-label":"On-time pickups and deliveries over the last seven days",children:[[0,50,100].map(e=>(0,m.jsxs)("g",{children:[(0,m.jsx)("line",{x1:tc.left,x2:1280-tc.right,y1:s(e),y2:s(e),stroke:"#e2e8f0",strokeWidth:1}),(0,m.jsxs)("text",{x:0,y:s(e)+4,className:"fill-slate-400 text-[10px]",children:[e,"%"]})]},e)),tp.map(e=>{let{paths:t,areas:l,dots:a}=r(e);return(0,m.jsxs)("g",{children:[e.emphasized&&l.map((t,l)=>(0,m.jsx)("path",{d:t,fill:e.color,fillOpacity:.07,stroke:"none"},"".concat(e.key,"-area-").concat(l))),t.map((t,l)=>(0,m.jsx)("path",{d:t,fill:"none",stroke:e.color,strokeWidth:2,strokeDasharray:e.dashed?"4 3":void 0,strokeLinecap:"round"},"".concat(e.key,"-path-").concat(l))),a.map((t,l)=>(0,m.jsx)("circle",{cx:t.x,cy:t.y,r:3,fill:e.color},"".concat(e.key,"-dot-").concat(l)))]},e.key)}),t.map((e,t)=>(0,m.jsx)("text",{x:n(t),y:296,textAnchor:"middle",className:"fill-slate-400 text-[10px]",children:tu.format(new Date("".concat(e.day,"T00:00:00Z")))},e.day))]}),(0,m.jsx)("figcaption",{className:"mt-2 flex gap-4 font-poppins text-xs text-slate-500",children:tp.map(e=>(0,m.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,m.jsx)("span",{className:"inline-block h-0.5 w-4",style:{backgroundColor:e.dashed?"transparent":e.color,backgroundImage:e.dashed?"repeating-linear-gradient(to right, ".concat(e.color," 0 4px, transparent 4px 7px)"):void 0}}),e.label]},e.key))})]})},tx=e=>null===e?"—":"".concat(Math.round(e),"%"),tb=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e),th=e=>e&&null!=e.deltaPct?0===e.deltaPct?"Same as yesterday":"".concat(e.deltaPct>=0?"↑":"↓"," ").concat(Math.abs(Math.round(e.deltaPct)),"% vs yesterday"):"From loads completed today",tv=e=>e?"".concat(e.onTime," of ").concat(e.total," on time"):null,tf=e=>{if(e<60)return"".concat(e," min");let t=e%60;return"".concat(Math.floor(e/60),"h").concat(t?" ".concat(t,"m"):"")},tg=(e,t,l,a)=>a?null==t?{text:"No data last week",className:"text-slate-400"}:null==e?{text:"Last week: ".concat(l(t)),className:"text-slate-400"}:e>t?{text:"↑ from ".concat(l(t)," last week"),className:"text-emerald-600"}:e<t?{text:"↓ from ".concat(l(t)," last week"),className:"text-red-600"}:{text:"Same as last week",className:"text-slate-400"}:null,ty=e=>"".concat(Math.round(e),"%"),tN=e=>"$".concat(e.toFixed(2)),tj=e=>{let t=[e.pickupCounts?"".concat(e.pickupCounts.onTime," of ").concat(e.pickupCounts.total," pickups"):null,e.deliveryCounts?"".concat(e.deliveryCounts.onTime," of ").concat(e.deliveryCounts.total," deliveries"):null].filter(e=>null!==e);if(0===t.length)return"No loads had scheduled times this week, so nothing was measured.";let l=e.avgLateMinutes,a=[(null==l?void 0:l.pickup)!=null?"Late pickups averaged ".concat(tf(l.pickup)," behind"):null,(null==l?void 0:l.delivery)!=null?(null==l?void 0:l.pickup)!=null?"late deliveries ".concat(tf(l.delivery)):"Late deliveries averaged ".concat(tf(l.delivery)," behind"):null].filter(e=>null!==e),n="On time this week: ".concat(t.join(", "),".");return a.length?"".concat(n," ").concat(a.join("; "),"."):n},tk={revenue:"Revenue Today",hosViolations:"HOS Violations",avgResponseTime:"Avg. Response Time"},tw=e=>{var t,l,a,n,s,r,i,o,d,c,u,p;let{performance:h,revenueToday:v,revenueThisWeek:f,podBacklog:g,podsOnBoard:y,fleetUse:N,loading:j,error:k,onRetry:w,onShowPods:E,unavailable:C}=e,[I,M]=(0,x.useState)(!1),T=new Map(C.filter(e=>void 0!==tk[e.key]).map(e=>[e.key,e.reason])),S=T.get("revenue"),R=[{key:"pickups",label:"On-time pickups",value:tx(null!==(s=null==h?void 0:h.onTimePickupPct)&&void 0!==s?s:null)},{key:"deliveries",label:"On-time deliveries",value:tx(null!==(r=null==h?void 0:h.onTimeDeliveryPct)&&void 0!==r?r:null)},{key:"started",label:"Loads started",value:String(null!==(i=null==h?void 0:h.loadsStarted)&&void 0!==i?i:0)},{key:"revenue",label:"Revenue today",value:S?"—":v?tb(v.amount):"—",dead:!!S,sub:null!=S?S:th(v),suffix:S?void 0:th(v)},{key:"pods",label:"Waiting on PODs",value:g?0===g.count?"None":g.amount>0?tb(g.amount):String(g.count):"—",valueTone:g&&g.count>0?"text-amber-600":"text-emerald-600",sub:g&&g.count>0?"".concat(g.count," delivered load").concat(1===g.count?"":"s"," with no proof of delivery, last 30 days"):"Every delivered load has its POD",suffix:g&&g.count>0?"".concat(g.count," load").concat(1===g.count?"":"s").concat(null!=g.oldestDays&&g.olde
1stDays>0?" \xb7 oldest ".concat(g.oldestDays,"d"):"").concat(null!==y&&y<g.count?" \xb7 ".concat(y," on the board ›"):" \xb7 View ›"):void 0,onClick:g&&g.count>0&&0!==y?E:void 0}];return(0,m.jsxs)("section",{className:"rounded-[14px] border border-slate-200 bg-white shadow-[0_7px_22px_rgba(31,59,95,0.05)]",children:[(0,m.jsxs)("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-2 px-4 py-3",children:[(0,m.jsxs)("span",{className:"font-poppins text-[11px] font-bold uppercase tracking-wide text-slate-400",children:["Insights ",(0,m.jsx)("span",{className:"font-medium normal-case tracking-normal",children:"\xb7 last 7 days"})]}),k?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("p",{className:"font-poppins text-sm text-slate-500",children:"Insights couldn't be loaded."}),(0,m.jsx)("button",{type:"button",onClick:w,className:"rounded-md border border-slate-200 px-3 py-1 font-poppins text-sm font-medium text-slate-600 hover:border-blue-600 hover:text-blue-700",children:"Retry"})]}):(0,m.jsxs)(m.Fragment,{children:[R.map(e=>{var t;let l=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{className:"font-poppins text-xs text-slate-500",children:e.label}),(0,m.jsx)("span",{className:(0,b.Z)("font-poppins text-base font-extrabold tabular-nums",e.dead?"text-slate-300":null!==(t=e.valueTone)&&void 0!==t?t:"text-blue-700"),children:j?"…":e.value}),e.suffix&&!j&&(0,m.jsx)("span",{className:"font-poppins text-xs text-slate-400",children:e.suffix})]});return e.onClick&&!j?(0,m.jsx)("button",{type:"button",onClick:e.onClick,title:e.sub,className:"flex items-baseline gap-1.5 rounded-md text-left transition-opacity hover:opacity-75 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600",children:l},e.key):(0,m.jsx)("span",{className:"flex items-baseline gap-1.5",title:e.sub,children:l},e.key)}),(0,m.jsx)("button",{type:"button",onClick:()=>M(e=>!e),"aria-expanded":I,className:"ml-auto rounded-md border border-slate-200 px-2.5 py-1 font-poppins text-xs font-semibold text-slate-600 transition-colors hover:border-blue-600 hover:text-blue-700",children:I?"Hide details":"Details"})]})]}),I&&!k&&(0,m.jsxs)("div",{className:"border-t border-slate-100 p-4 sm:p-6",children:[(0,m.jsxs)("h3",{className:"font-poppins text-base font-semibold text-slate-900",children:["Dispatch Performance ",(0,m.jsx)("span",{className:"font-normal text-slate-400",children:"(Last 7 days)"})]}),(0,m.jsx)("div",{className:"mt-5 grid grid-cols-2 gap-x-8 gap-y-5 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5",children:[{key:"pickups",label:"On-Time Pickups",value:tx(null!==(o=null==h?void 0:h.onTimePickupPct)&&void 0!==o?o:null),sub:null!==(d=tv(null==h?void 0:h.pickupCounts))&&void 0!==d?d:"No scheduled pickups to measure",valueClass:"text-blue-600",delta:tg(null==h?void 0:h.onTimePickupPct,null==h?void 0:null===(t=h.lastWeek)||void 0===t?void 0:t.onTimePickupPct,ty,!!(null==h?void 0:h.lastWeek))},{key:"deliveries",label:"On-Time Deliveries",value:tx(null!==(c=null==h?void 0:h.onTimeDeliveryPct)&&void 0!==c?c:null),sub:null!==(u=tv(null==h?void 0:h.deliveryCounts))&&void 0!==u?u:"No scheduled deliveries to measure",valueClass:"text-slate-900",delta:tg(null==h?void 0:h.onTimeDeliveryPct,null==h?void 0:null===(l=h.lastWeek)||void 0===l?void 0:l.onTimeDeliveryPct,ty,!!(null==h?void 0:h.lastWeek))},...[...T.entries()].filter(e=>{let[t]=e;return"revenue"!==t}).sort((e,t)=>{let[l]=e,[a]=t;return Number("avgResponseTime"===a)-Number("avgResponseTime"===l)}).map(e=>{let[t,l]=e;return{key:t,label:tk[t],value:"—",sub:l,valueClass:"text-slate-300",delta:null}}),{key:"started",label:"Loads Started",value:String(null!==(p=null==h?void 0:h.loadsStarted)&&void 0!==p?p:0),sub:"Began rolling this week",valueClass:"text-slate-900",delta:tg(null==h?void 0:h.loadsStarted,null==h?void 0:null===(a=h.lastWeek)||void 0===a?void 0:a.loadsStarted,String,!!(null==h?void 0:h.lastWeek))},{key:"rpm",label:"Rate / Mile",value:(null==h?void 0:h.ratePerMile)!=null?tN(h.ratePerMile):"—",sub:"Completed loads \xb7 job-route miles",valueClass:"text-slate-900",delta:tg(null==h?void 0:h.ratePerMile,null==h?void 0:null===(n=h.lastWeek)||void 0===n?void 0:n.ratePerMile,tN,!!(null==h?void 0:h.lastWeek))},{key:"revenue-week",label:"Revenue This Week",value:f?tb(f.amount):"—",sub:"Completed loads, rolling 7 days",valueClass:"text-slate-900",delta:f?tg(f.amount,f.lastWeekAmount,tb,!0):null},{key:"fleet",label:"Fleet In Use",value:N&&N.totalDays>0?"".concat(N.workedDays," of ").concat(N.totalDays):"—",sub:"Driver-days with work, last 7 days",valueClass:"text-slate-900",delta:null},...S?[{key:"revenue",label:"Revenue Today",value:"—",sub:S,valueClass:"text-slate-300",delta:null}]:[]].map(e=>(0,m.jsxs)("div",{className:"min-w-0",children:[(0,m.jsx)("p",{className:"font-poppins text-xs text-slate-500",children:e.label}),(0,m.jsx)("p",{className:(0,b.Z)("mt-1.5 font-poppins text-[22px] font-extrabold leading-none tabular-nums",e.valueClass),children:j?"…":e.value}),(0,m.jsx)("p",{className:"mt-1.5 truncate font-poppins text-xs text-slate-400",title:e.sub,children:j?"":e.sub}),e.delta&&!j&&(0,m.jsx)("p",{className:(0,b.Z)("mt-0.5 truncate font-poppins text-xs",e.delta.className),title:e.delta.text,children:e.delta.text})]},e.key))}),(0,m.jsx)("div",{className:"mt-6",children:j||!h?(0,m.jsx)("div",{className:"h-64 animate-pulse rounded-md bg-slate-100"}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("p",{className:"mb-3 font-poppins text-sm font-medium text-slate-600",children:tj(h)}),h.truncated&&(0,m.jsx)("p",{className:"mb-3 font-poppins text-xs text-amber-700",children:"Too many loads this period to measure them all — these figures are based on the earliest ones."}),(0,m.jsx)(tm,{points:h.trend})]})})]})]})},tE=e=>{let{rows:t,loading:l}=e,[a,n]=(0,x.useState)(null);if((0,x.useEffect)(()=>{let e=()=>{let e=new Date;n(60*e.getHours()+e.getMinutes())};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]),l||null===a)return null;let s=ey(t,a);if(!s)return null;let r=s.minutes-a,i=0===r?"now":r<60?"in ".concat(r," min"):"in ".concat(Math.floor(r/60),"h").concat(r%60?" ".concat(r%60,"m"):"");return(0,m.jsxs)(v(),{href:"".concat(g.Z6.JOB_DETAILS,"/").concat(s.jobId,"/loads/").concat(s.loadNumber),target:"_blank",rel:"noreferrer",className:"flex items-center gap-2 rounded-full border border-slate-200 bg-white px-3 py-1.5 font-poppins text-xs text-slate-500 transition-colors hover:border-blue-600",title:"".concat(s.kind," \xb7 ").concat(s.reference," \xb7 ").concat(s.place),children:[(0,m.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full ".concat(s.flag?"bg-red-500":"bg-amber-500")}),(0,m.jsxs)("span",{className:"truncate",children:["Next: ",(0,m.jsx)("span",{className:"font-semibold text-slate-900",children:s.kind.toLowerCase()})," ",(0,m.jsx)("span",{className:"font-semibold text-slate-900 tabular-nums",children:s.reference})," ",(0,m.jsx)("span",{className:"tabular-nums",children:i}),(0,m.jsxs)("span",{className:"hidden sm:inline",children:[" \xb7 ",s.place]})]})]})},tC=[{value:"all",label:"All drivers"},{value:"mine",label:"My drivers"},{value:"contract",label:"Contract drivers"}],tI=e=>{let{scope:t,onChange:l}=e;return(0,m.jsx)("div",{className:"inline-flex rounded-[10px] border border-slate-200 bg-white p-1",children:tC.map(e=>(0,m.jsx)("button",{type:"button",onClick:()=>l(e.value),"aria-pressed":t===e.value,className:(0,b.Z)("rounded-md px-3 py-1 font-poppins text-sm font-medium transition-colors",t===e.value?"bg-blue-600 text-white":"text-slate-600 hover:bg-slate-50"),children:e.label},e.value))})},tM=e=>{let{updatedAt:t,loading:l,onRefresh:a}=e;return(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsxs)("span",{className:"flex items-center gap-1.5 font-poppins text-xs text-slate-500",title:"This page updates itself every minute while it is open.",children:[(0,m.jsx)("span",{"aria-hidden":!0,
1className:"h-2 w-2 rounded-full bg-emerald-500"}),l?"Updating…":t?"Updated ".concat((0,tn.J)(t.toISOString())):"Live"]}),(0,m.jsx)("button",{type:"button",onClick:a,disabled:l,className:"rounded-[10px] border border-slate-200 bg-white px-3 py-1.5 font-poppins text-sm font-medium text-slate-600 transition-colors hover:border-blue-600 hover:text-blue-700 disabled:opacity-50",children:"Refresh"})]})},tT=[{key:"hosViolations",reason:"Needs an ELD connection to track hours of service"}],tS=()=>{var e,t,l,a,n,s,r,i,o,d,c,u,p;let h=eo(),f=ed(),{user:N}=(0,y.a)({fetchUser:!0}),[j,k]=(0,x.useState)("driver"),[w,C]=(0,x.useState)("needs-attention"),[I,M]=(0,x.useState)(null),[T,S]=(0,x.useState)(!1),[R,D]=(0,x.useState)(!1),_=(0,x.useRef)(null),A=(0,x.useMemo)(()=>{var e;let t=null!==(e=null==N?void 0:N.roles)&&void 0!==e?e:[],l=null==N?void 0:N.memberRole;return t.includes("OWNER")||"SAFETY_MANAGER"===l},[N]),O=(0,x.useMemo)(()=>({drivers:h.drivers,getLiveEvents:()=>h.events,canOverrideConflicts:A,onSettled:h.refetch}),[h.drivers,h.events,A,h.refetch]),P=(0,ec.d)(O),F=(0,x.useMemo)(()=>({drivers:h.drivers,onSettled:h.refetch}),[h.drivers,h.refetch]),L=(0,eu.B)(F),Z=h.refetch,B=f.refetch;(0,x.useEffect)(()=>{let e=setInterval(()=>{"visible"===document.visibilityState&&(B(),Z())},6e4);return()=>clearInterval(e)},[Z,B]);let U=(0,x.useMemo)(()=>{let e=new Map;return h.events.forEach(t=>{void 0!==t.load.jobNumber&&e.set(t.load.jobId,t.load.jobNumber)}),e},[h.events]),W=!!h.error&&!h.hasData,K=h.loading||W,V=(0,x.useMemo)(()=>ef(h.events,h.drivers,h.todayKey),[h.events,h.drivers,h.todayKey]),{snoozes:G,snooze:Y,unsnooze:z}=eE(),J=(0,x.useMemo)(()=>V.filter(e=>!(G[e.id]>Date.now())),[V,G]),H=(0,x.useMemo)(()=>V.filter(e=>G[e.id]>Date.now()).map(e=>({item:e,until:G[e.id]})),[V,G]),X=(0,x.useMemo)(()=>({total:J.length,critical:J.filter(e=>"critical"===e.severity).length,warning:J.filter(e=>"warning"===e.severity).length,info:J.filter(e=>"info"===e.severity).length}),[J]);(0,x.useEffect)(()=>{if(K)return;let e=J.length;return document.title=e>0?"(".concat(e,") Dispatcher \xb7 TruckAtlas"):"Dispatcher \xb7 TruckAtlas",()=>{document.title="TruckAtlas"}},[J.length,K]);let q=(0,x.useMemo)(()=>eg(h.events,h.drivers,h.todayKey),[h.events,h.drivers,h.todayKey]),Q=(0,x.useMemo)(()=>eN(h.events,h.drivers,h.todayKey),[h.events,h.drivers,h.todayKey]),$=(0,x.useMemo)(()=>es(h.events,h.drivers,h.todayKey),[h.events,h.drivers,h.todayKey]),ee=(0,x.useRef)(!1);(0,x.useEffect)(()=>{ee.current=!0;try{let e=localStorage.getItem("dispatcher-prefs");if(!e)return;let t=JSON.parse(e);("driver"===t.view||"load"===t.view)&&k(t.view),!0===t.queueCollapsed&&S(!0),!0===t.railCollapsed&&D(!0),("needs-attention"===t.tab||"in-transit"===t.tab||"unassigned"===t.tab||"delivering-today"===t.tab)&&C(t.tab),"mine"!==t.scope&&"contract"!==t.scope||new URLSearchParams(window.location.search).has("scope")||h.setScope(t.scope)}catch(e){}},[]),(0,x.useEffect)(()=>{if(ee.current)try{localStorage.setItem("dispatcher-prefs",JSON.stringify({view:j,tab:w,scope:h.scope,queueCollapsed:T,railCollapsed:R}))}catch(e){}},[j,w,h.scope,T,R]);let et=(0,x.useMemo)(()=>new Map(h.availability.map(e=>[e.id,e])),[h.availability]),el=(0,x.useCallback)(e=>{C(e),k("load")},[]),ea=e=>{if("queue"===e.kind){S(!1),requestAnimationFrame(()=>{var e;null===(e=_.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"})});return}if("load-tab"===e.kind){el(e.tab);return}k("driver")},en=null!==(r=null===(e=f.data)||void 0===e?void 0:e.unavailable)&&void 0!==r?r:tT;return(0,m.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-4 p-4 sm:p-6",children:[(0,m.jsxs)("header",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h1",{className:"font-poppins text-2xl font-bold text-slate-900",children:"Dispatcher Command Center"}),(0,m.jsx)("p",{className:"font-poppins text-sm text-slate-500",suppressHydrationWarning:!0,children:new Intl.DateTimeFormat(void 0,{weekday:"long",month:"long",day:"numeric"}).format(new Date)})]}),(0,m.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,m.jsx)(tE,{rows:q,loading:K}),(0,m.jsx)(tM,{updatedAt:f.updatedAt,loading:f.refreshing,onRefresh:()=>{f.refetch(),h.refetch()}}),!h.lockedToOwn&&h.scopingAvailable&&(0,m.jsxs)(m.Fragment,{children:[h.privileged&&h.dispatcherOptions.length>0&&(0,m.jsxs)("select",{value:null!==(i=h.dispatcherFilter)&&void 0!==i?i:"",onCh
1ange:e=>h.setDispatcherFilter(e.target.value||null),"aria-label":"Filter by dispatcher",className:"rounded-[10px] border border-slate-200 bg-white px-2.5 py-1.5 font-poppins text-sm text-slate-700 focus:border-blue-500 focus:outline-none",children:[(0,m.jsx)("option",{value:"",children:"All dispatchers"}),h.dispatcherOptions.map(e=>(0,m.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,m.jsx)(tI,{scope:h.scope,onChange:h.setScope})]})]})]}),(0,m.jsx)(eR,{kpis:h.kpis,attention:X,loading:K,unavailable:en,onNavigate:ea}),(0,m.jsx)(tw,{performance:null!==(o=null===(t=f.data)||void 0===t?void 0:t.performance)&&void 0!==o?o:null,revenueToday:null!==(d=null===(l=f.data)||void 0===l?void 0:l.revenueToday)&&void 0!==d?d:null,revenueThisWeek:null!==(c=null===(a=f.data)||void 0===a?void 0:a.revenueThisWeek)&&void 0!==c?c:null,podBacklog:null!==(u=null===(n=f.data)||void 0===n?void 0:n.podBacklog)&&void 0!==u?u:null,podsOnBoard:K?null:h.boardRows["needs-attention"].filter(e=>"Missing POD"===e.riskReason).length,fleetUse:K?null:$,onShowPods:()=>el("needs-attention"),loading:f.isLoading,error:f.data?null:f.error,onRetry:f.refetch,unavailable:en}),h.error&&(0,m.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-red-200 bg-red-50 px-3 py-2",children:[(0,m.jsx)("p",{className:"flex-1 font-poppins text-sm text-red-700",children:"The load board couldn't be loaded."}),(0,m.jsx)("button",{type:"button",onClick:h.refetch,className:"rounded-md border border-red-300 bg-white px-3 py-1 font-poppins text-sm font-medium text-red-700 hover:bg-red-100",children:"Retry"})]}),h.truncated&&(0,m.jsx)("p",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 font-poppins text-sm text-amber-700",children:"Too many loads to show them all — some rows are missing from this view."}),(0,m.jsxs)("div",{className:(0,b.Z)("grid min-h-0 flex-1 grid-cols-1 content-start gap-4 xl:grid-rows-[minmax(0,1fr)_auto] xl:content-normal 2xl:grid-rows-[minmax(0,1fr)]",T?"xl:grid-cols-[44px_minmax(0,1fr)]":"xl:grid-cols-[288px_minmax(0,1fr)]",T?R?"2xl:grid-cols-[44px_minmax(0,1fr)_44px]":"2xl:grid-cols-[44px_minmax(0,1fr)_300px]":R?"2xl:grid-cols-[288px_minmax(0,1fr)_44px]":"2xl:grid-cols-[288px_minmax(0,1fr)_300px]"),children:[(0,m.jsx)(eB,{ref:_,className:"order-2 xl:order-none",items:J,snoozed:H,todayKey:h.todayKey,loading:K,collapsed:T,onToggleCollapse:()=>S(e=>!e),onAssign:M,onSnooze:Y,onUnsnooze:z}),(0,m.jsx)(ta,{className:"order-3 xl:order-none",view:j,onViewChange:k,dayKey:h.todayKey,lanes:h.lanes,availabilityById:et,rows:h.boardRows,activeTab:w,onTabChange:C,loading:K,onAssignRequest:M,assignDriver:P,emptyRosterMessage:h.noDriversAssigned?h.lockedToOwn?(0,m.jsxs)(m.Fragment,{children:["No drivers are assigned to you yet. Ask an owner or fleet manager to set you as their dispatcher on the"," ",(0,m.jsx)(v(),{href:"".concat(g.Z6.DRIVER_OPERATIONS,"?tab=roster"),className:"font-medium text-blue-700 hover:underline",children:"roster"}),"."]}):(0,m.jsxs)(m.Fragment,{children:["No drivers are assigned to you yet."," ",(0,m.jsx)(v(),{href:"".concat(g.Z6.DRIVER_OPERATIONS,"?tab=roster"),className:"font-medium text-blue-700 hover:underline",children:"Open the roster"})," ","to set dispatchers, or switch to All drivers."]}):h.loading||h.error||0!==h.drivers.length||0!==h.events.length?void 0:(0,m.jsxs)("span",{className:"block",children:[(0,m.jsx)("span",{className:"block font-poppins text-base font-semibold text-slate-700",children:"Let's get your board rolling"}),(0,m.jsxs)("span",{className:"mt-2 block",children:["1."," ",(0,m.jsx)(v(),{href:"/company/profile?tab=drivers&invite=true",className:"font-medium text-blue-700 hover:underline",children:"Add your drivers"})]}),(0,m.jsxs)("span",{className:"mt-1 block",children:["2."," ",(0,m.jsx)(v(),{href:g.Z6.POST_JOB,className:"font-medium text-blue-700 hover:underline",children:"Post or dispatch a load"})]}),(0,m.jsx)("span",{className:"mt-2 block font-poppins text-xs text-slate-400",children:"Your drivers and loads show up here automatically."})]})}),(0,m.jsx)("div",{className:"order-1 min-h-0 min-w-0 xl:order-none xl:col-span-2 2xl:col-span-1",children:(0,m.jsx)(td,{upNext:q,upNextLoading:K,tomorrow:Q,onAssign:M,activity:null!==(p=null===(s=f.data)||void 0===s?void 0:s.activity)&&void 0!==p?p:[],activityLoading:f.isLoading,activityError:f.data?null:f.error,onRetryActivity:f.refetch,jobNumberById:U,collapsed:R,onToggleCollapse:()=>D(e=>!e)})})]}),(0,m.jsx)("footer",{className:"pt-2 font-poppins text-xs text-slate-400",children:"Appointment times are shown as scheduled. Daily totals like revenue roll over at midnight universal time, a few hours before local midnight in the US."}),I&&(0,m.jsx)(ep.c,{event:I,drivers:h.drivers,allEvents:h.assignmentEvents,canOverrideConflicts:A,onAssign:(e,t)=>{if(M(null),(0,E.$C)(I)&&(null==t?void 0:t.reason)){L(I,e,{reason:t.reason,notes:t.notes,override:t.override});return}P(I,e,{undoable:!0,override:null==t?void 0:t.override})},onClose:()=>M(null)})]})};var tR=(0,f.Z)(tS,{greeting:!1});let tD=()=>(0,m.jsx)(tR,{});var t_=tD},44629:function(e,t,l){"use strict";l.d(t,{J:function(){return a}});let a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date,l=new Date(e).getTime();if(Number.isNaN(l))return"—";let a=t.getTime()-l;if(a<6e4)return"Just now";if(a<36e5)return"".concat(Math.floor(a/6e4)," min ago");if(a<864e5){let e=Math.floor(a/36e5);return"".concat(e," hr").concat(1===e?"":"s"," ago")}let n=Math.floor(a/864e5);return 1===n?"Yesterday":"".concat(n," days ago")}}},function(e){e.O(0,[5353,4494,887,9774,2888,179],function(){return e(e.s=24581)}),_N_E=e.O()}]);

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.