1import{c as ee}from"./g-TX-49S.js";import{d as N,c as r,g as e,t as i,p as L,e as t,b as n,o as te,C as V,A as T,D as P,F as M,E as I,h as w,r as _,G as q,q as U,f as C,k as R,w as se,H as A,_ as oe,a as ne,u as re,I as ie,J as ae,K as O,x as z,L as E,i as le,M as ce}from"./C_dQXM5n.js";import{u as de,L as ue,_ as xe,f as pe}from"./--iXS_EQ.js";import{A as me}from"./C1RQhD9b.js";import{u as fe}from"./CqWRqAH0.js";import{B as ke}from"./CIzc8nDV.js";import"./BjMWM-Zq.js";import"./DoaeiQCi.js";const he=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],be=ee("search",he),_e={class:"shrink-0 flex flex-col"},ve={class:"h-16 pl-12 pr-6 min-[900px]:px-6 flex flex-col justify-center"},ye={class:"text-[12px] text-ink-3 mt-0.5"},ge={class:"h-10 px-6 flex items-center gap-2 border-b border-line"},we=["value"],$e=N({__name:"BrokerListHeader",props:{count:{},search:{}},emits:["update:search"],setup(a){return(m,p)=>(n(),r("div",_e,[e("header",ve,[p[1]||(p[1]=e("h1",{class:"text-sm font-semibold text-ink"},"Brokers",-1)),e("p",ye,i(a.count)+" "+i(a.count===1?"broker":"brokers"),1)]),e("div",ge,[L(t(be),{size:14,"stroke-width":1.75,class:"shrink-0 text-ink-3"}),e("input",{value:a.search,type:"text",placeholder:"Search brokers...",class:"flex-1 min-w-0 bg-transparent border-0 focus:outline-none text-ink text-[13px] placeholder:text-ink-3",onInput:p[0]||(p[0]=$=>m.$emit("update:search",$.target.value))},null,40,we)])]))}}),Be=Object.assign($e,{__name:"BrokersBrokerListHeader"}),Le={key:0,role:"alert",class:"px-6 py-3 text-[13px] text-red"},Ce={key:1,class:"px-6 py-6 text-[13px] text-ink-3"},Me={key:2,class:"flex flex-col"},Se=["onClick"],je={class:"text-sm font-medium text-ink truncate"},De={class:"flex items-center gap-2 mt-1 h-5"},Re=["src","alt"],Te={key:1,class:"text-[13px] text-ink-3"},Ie={class:"flex items-center justify-between gap-3 mt-1"},Ne={class:"text-[12px] text-ink-3 shrink-0"},qe={key:3,class:"px-6 py-3 text-[13px] text-ink-3"},Ae=N({__name:"BrokerList",props:{brokers:{},activeId:{},search:{},error:{type:Boolean},hasMore:{type:Boolean},isLoadingMore:{type:Boolean}},emits:["select","loadMore"],setup(a,{emit:m}){const p=a,$=m,k=_(null),v=_(null);let y=null;te(()=>{!k.value||!v.value||(y=new IntersectionObserver(f=>{f[0]?.isIntersecting&&p.hasMore&&!p.isLoadingMore&&(V(T.BrokerListPaginated),$("loadMore"))},{root:k.value,rootMargin:"100px 0px",threshold:0}),y.observe(v.value))}),P(()=>{y?.disconnect()});const d={dat_one:"/datone.png",truckstop:"/truckstop.png"};function x(f){return d[f]}function S(f){return`$${f.toFixed(2)}/mi`}return(f,h)=>(n(),r("div",{ref_key:"scrollRoot",ref:k,class:"flex-1 overflow-y-auto"},[a.error?(n(),r("p",Le," Failed to load brokers. ")):a.brokers.length===0?(n(),r("p",Ce,i(a.search.trim()?"No brokers match your search.":"No broker interactions yet."),1)):(n(),r("ul",Me,[(n(!0),r(M,null,I(a.brokers,u=>(n(),r("li",{key:u.id,class:"border-b border-line"},[e("button",{type:"button",class:q(["w-full text-left px-6 py-3 transition-colors duration-80 curs
1or-pointer",a.activeId===u.id?"bg-surface-2":"hover:bg-surface-2"]),onClick:B=>f.$emit("select",u.id)},[e("p",je,i(u.name),1),e("div",De,[x(u.loadboard)?(n(),r("img",{key:0,src:x(u.loadboard),alt:u.loadboard,class:"w-3.5 h-3.5 rounded-sm border border-line shrink-0"},null,8,Re)):w("",!0),u.avgRpm!=null?(n(),r("span",Te,i(S(u.avgRpm)),1)):w("",!0)]),e("div",Ie,[e("p",Ne,i(u.loadCount)+" "+i(u.loadCount===1?"load":"loads"),1)])],10,Se)]))),128))])),e("div",{ref_key:"sentinel",ref:v,class:"h-px","aria-hidden":"true"},null,512),a.isLoadingMore?(n(),r("p",qe,"Loadingâ¦")):w("",!0)],512))}}),Fe=Object.assign(Ae,{__name:"BrokersBrokerList"}),Oe={class:"shrink-0 h-16 pl-12 pr-6 min-[900px]:px-6 flex flex-col justify-center"},ze={class:"text-sm font-semibold text-ink truncate"},Ee={class:"text-[12px] text-ink-3 truncate mt-0.5"},He={class:"shrink-0 px-4 sm:px-6 border-b border-line flex items-center gap-3 sm:gap-6"},Ve=["onClick"],Pe={key:1,class:"flex-1 overflow-y-auto"},Ue={key:0,role:"alert",class:"px-6 py-3 text-[13px] text-red"},Je={key:1,class:"h-full flex items-center justify-center"},Ke={key:2,class:"px-6 py-5 flex flex-col gap-6"},Ge={class:"grid grid-cols-2 min-[900px]:grid-cols-4 border border-line rounded-lg overflow-hidden"},Ze={class:"px-4 py-3 border-r border-b min-[900px]:border-b-0 border-line"},Qe={class:"text-lg font-semibold text-ink"},We={class:"px-4 py-3 border-b min-[900px]:border-b-0 min-[900px]:border-r border-line"},Xe={class:"text-lg font-semibold text-ink"},Ye={class:"px-4 py-3 border-r border-line"},et={class:"text-lg font-semibold text-ink"},tt={class:"px-4 py-3"},st={class:"text-lg font-semibold text-ink"},ot={class:"flex items-center gap-4 text-[13px] text-ink"},nt={class:"flex items-center gap-1.5"},rt={class:"flex items-center gap-1.5"},it={class:"flex items-center gap-1.5"},at={key:0,class:"max-w-lg"},lt={class:"text-ink truncate"},ct={class:"text-ink-3 shrink-0"},dt={key:3,class:"px-6 py-6 text-[13px] text-ink-3"},ut={key:4,class:"flex flex-col"},xt={class:"flex items-center justify-between gap-3"},pt={class:"text-sm font-medium text-ink truncate"},mt={class:"text-[12px] text-ink-3 shrink-0"},ft={key:0,class:"text-[13px] text-ink-3 truncate mt-1"},kt={class:"flex items-center gap-2 mt-1.5"},ht={class:"flex items-center gap-1.5 text-[12px] text-ink-2 shrink-0"},bt={key:0,class:"flex-1 min-w-0 truncate text-[12px] text-ink-3"},_t={key:1,class:"inline-flex items-center justify-center min-w-4.5 h-4.5 px-1 rounded-full bg-red text-[11px] font-medium text-surface shrink-0"},vt=N({__name:"BrokerDetail",props:{broker:{},detail:{},loading:{type:Boolean},error:{type:Boolean}},emits:["back"],setup(a){const m=de(),p=a,$=[{id:"overview",label:"Overview"},{id:"loads",label:"Loads"},{id:"notes",label:"Notes"}],k=_("overview");function v(l){k.value=l,A(T.BrokerTabOpened,{tab:l})}function y(){A(T.BrokerLoadOpened)}const d=R(()=>p.detail?.overview??null),x=R(()=>p.detail?.loads??[]),S=R(()=>d.value?.avgRate!=null?`$${d.value.avgRate.toLocaleString()}`:"â");function f(l){const s=l.loadData;return s.origin&&s.destination?`${s.origin} - ${s.destination}`:s.origin||s.destination||"Load"}function h(l){const s=l.loadData,b=[];return s.rate&&b.push(`$${s.rate.toLocaleString()}`),s.distance&&b.push(`${s.distance.toLocaleString()} mi`),s.equipmentType&&b.push(s.equipmentType),s.weight&&b.push(`${s.weight.toLocaleString()} lbs`),b.join(" · ")}function u(l){return l==="booked"?"bg-green":l==="declined"?"bg-red":"bg-primary"}function B(l){return l.charAt(0).toUpperCase()+l.slice(1)}return(l,s)=>{const b=xe,j=oe;return n(),r(M,null,[e("header",Oe,[e("h2",ze,i(a.broker?.name??"Broker"),1),e("p",Ee,i(a.broker?.loadCount??0)+" "+i(a.broker?.loadCount===1?"load":"loads"),1)]),e("nav",He,[e("button",{class:"flex min-[900px]:hidden shrink-0 sm:-ml-2 p-1 text-ink-3 hover:text-ink transition-colors duration-80 curs
1or-pointer","aria-label":"Back",onClick:s[0]||(s[0]=o=>l.$emit("back"))},[L(t(me),{size:16,"stroke-width":1.75})]),(n(),r(M,null,I($,o=>e("button",{key:o.id,type:"button",class:q(["h-10 text-[13px] font-medium border-b-2 -mb-px transition-colors duration-80 cursor-pointer",t(k)===o.id?"text-ink border-ink":"text-ink-3 border-transparent hover:text-ink"]),onClick:F=>v(o.id)},i(o.label),11,Ve)),64))]),t(k)==="notes"&&a.broker?(n(),U(b,{key:0,"entity-type":"broker","entity-id":a.broker.id,class:"flex-1 min-h-0"},null,8,["entity-id"])):(n(),r("div",Pe,[a.error?(n(),r("p",Ue," Failed to load broker details. ")):a.loading?(n(),r("div",Je,[L(t(ue),{size:20,"stroke-width":1.75,class:"text-ink-3 animate-spin"})])):t(k)==="overview"?(n(),r("div",Ke,[e("div",Ge,[e("div",Ze,[e("p",Qe,i(t(d)?.totalLoads??0),1),s[1]||(s[1]=e("p",{class:"text-[12px] text-ink-3 mt-0.5"},"Loads",-1))]),e("div",We,[e("p",Xe,i(t(d)?.booked??0),1),s[2]||(s[2]=e("p",{class:"text-[12px] text-ink-3 mt-0.5"},"Booked",-1))]),e("div",Ye,[e("p",et,i(t(d)?.bookRate??0)+"%",1),s[3]||(s[3]=e("p",{class:"text-[12px] text-ink-3 mt-0.5"},"Book rate",-1))]),e("div",tt,[e("p",st,i(t(S)),1),s[4]||(s[4]=e("p",{class:"text-[12px] text-ink-3 mt-0.5"},"Avg rate",-1))])]),e("div",null,[s[8]||(s[8]=e("h3",{class:"text-[12px] font-medium text-ink-3 mb-2"},"Status",-1)),e("div",ot,[e("span",nt,[s[5]||(s[5]=e("span",{class:"w-1.5 h-1.5 rounded-full bg-primary"},null,-1)),C(i(t(d)?.active??0)+" Active ",1)]),e("span",rt,[s[6]||(s[6]=e("span",{class:"w-1.5 h-1.5 rounded-full bg-green"},null,-1)),C(i(t(d)?.booked??0)+" Booked ",1)]),e("span",it,[s[7]||(s[7]=e("span",{class:"w-1.5 h-1.5 rounded-full bg-red"},null,-1)),C(i(t(d)?.declined??0)+" Declined ",1)])])]),t(d)&&t(d).topLanes.length>0?(n(),r("div",at,[s[9]||(s[9]=e("h3",{class:"text-[12px] font-medium text-ink-3 mb-1"},"Top lanes",-1)),e("ul",null,[(n(!0),r(M,null,I(t(d).topLanes,o=>(n(),r("li",{key:o.lane,class:"flex items-center justify-between gap-3 py-2 border-t border-line text-[13px]"},[e("span",lt,i(o.lane),1),e("span",ct,[C(i(o.count)+" "+i(o.count===1?"load":"loads"),1),o.avgRate?(n(),r(M,{key:0},[C(" · avg $"+i(o.avgRate.toLocaleString()),1)],64)):w("",!0)])]))),128))])])):w("",!0)])):t(x).length===0?(n(),r("p",dt," No loads with this broker yet. ")):(n(),r("ul",ut,[(n(!0),r(M,null,I(t(x),o=>(n(),r("li",{key:o.id,class:"border-b border-line"},[L(j,{to:o.status==="active"?`/inbox?t=${o.threadId}
1`:o.status==="booked"?`/inbox?t=${o.threadId}&status=booked`:`/inbox?t=${o.threadId}&status=all`,class:"block px-6 py-3 transition-colors duration-80 hover:bg-surface-2",onClick:y},{default:se(()=>[e("div",xt,[e("p",pt,i(f(o)),1),e("p",mt,i(t(pe)(o.lastMessageDate??o.createdAt,t(m))),1)]),h(o)?(n(),r("p",ft,i(h(o)),1)):w("",!0),e("div",kt,[e("span",ht,[e("span",{class:q(["w-1.5 h-1.5 rounded-full",u(o.status)])},null,2),C(" "+i(B(o.status)),1)]),o.snippet?(n(),r("p",bt,i(o.snippet),1)):w("",!0),o.unreadCount>0?(n(),r("span",_t,i(o.unreadCount),1)):w("",!0)])]),_:2},1032,["to"])]))),128))]))]))],64)}}}),yt=Object.assign(vt,{__name:"BrokersBrokerDetail"});function H(a,m){return $fetch("/companies",{query:{offset:a||void 0,search:m||void 0}})}function gt(a){return $fetch(`/companies/${a}`)}const wt={class:"flex-1 min-[900px]:flex-none w-full min-[900px]:w-80 min-[1280px]:w-100 shrink-0 border-r border-line flex flex-col overflow-hidden"},$t={class:"flex-1 min-h-0 flex flex-col overflow-hidden"},Bt={key:1,class:"flex-1 flex flex-col items-center justify-center px-6 text-center"},Lt={class:"flex items-center justify-center w-12 h-12 rounded-full bg-surface-2 text-ink-3 mb-4"},Nt=N({__name:"brokers",async setup(a){let m,p;ne({title:"Brokers"});const{mainStyles:$,isMobile:k}=fe(),v=re(),y=ie(),d=_(!1),x=_(""),S=void 0,{data:f}=([m,p]=ae(()=>ce("/companies",{default:()=>({companies:[],totalCount:0,hasMore:!1}),headers:S,onResponseError(){d.value=!0}},"$ehJ5g0K35x")),m=await m,p(),m),h=_(f.value?.companies??[]),u=_(f.value?.hasMore??!1),B=_(!1),l=R(()=>v.query.c||null),s=R(()=>h.value.find(c=>c.id===l.value)??null),b=_(null),j=_(!1),o=_(!1);function F(c){A(T.BrokerOpened,{from_search:x.value.trim()!==""}),y.replace({query:{...v.query,c}})}function J(){y.replace({query:{...v.query,c:void 0}})}async function K(){try{const c=await H(0,x.value.trim()||void 0);h.value=c.companies,u.value=c.hasMore,d.value=!1}catch(c){d.value=!0,console.error("Failed to load brokers:",c)}}async function G(){if(!(!u.value||B.value)){B.value=!0;try{const c=await H(h.value.length,x.value.trim()||void 0);h.value=[...h.value,...c.companies],u.value=c.hasMore}catch(c){console.error("Failed to load more brokers:",c)}finally{B.value=!1}}}let D=null;O(x,()=>{D&&clearTimeout(D),D=setTimeout(()=>{x.value.trim()&&V(T.BrokerSearched),K()},250)}),P(()=>{D&&clearTimeout(D)});async function Z(c){j.value=!0,o.value=!1,b.value=null;try{b.value=await gt(c)}catch(g){o.value=!0,console.error("Failed to load broker detail:",g)}finally{j.value=!1}}return O(l,c=>{c&&Z(c)},{immediate:!0}),(c,g)=>{const Q=Be,W=Fe,X=yt;return n(),r("main",{class:"h-screen flex flex-col min-[900px]:flex-row",style:le(t($))},[z(e("aside",wt,[L(Q,{count:t(h).length,search:t(x),"onUpdate:search":g[0]||(g[0]=Y=>x.value=Y)},null,8,["count","search"]),L(W,{brokers:t(h),"active-id":t(l),search:t(x),error:t(d),"has-more":t(u),"is-loading-more":t(B),onSelect:F,onLoadMore:G},null,8,["brokers","active-id","search","error","has-more","is-loading-more"])],512),[[E,!t(k)||!t(l)]]),z(e("section",$t,[t(l)?(n(),U(X,{key:0,broker:t(s),detail:t(b),loading:t(j),error:t(o),onBack:J},null,8,["broker","detail","loading","error"])):(n(),r("div",Bt,[e("div",Lt,[L(t(ke),{size:22,"stroke-width":1.75})]),g[1]||(g[1]=e("h2",{class:"text-base font-semibold text-ink"},"No broker selected",-1)),g[2]||(g[2]=e("p",{class:"text-[13px] text-ink-3 mt-1 max-w-xs"}," Pick a broker from the list to see your past loads with them. ",-1))]))],512),[[E,!t(k)||!!t(l)]])],4)}}});export{Nt as default};
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.