1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/export-table-data-Cl3pEihs.js","assets/jspdf.es.min-5bRvKRqS.js","assets/index-Djrg3rXt.js","assets/index-DxzLCA3b.css","assets/xlsx-BhwfF_WM.js","assets/pdf-utils-CdFn5Y9b.js","assets/pdf-branding-Dq4PqVV3.js","assets/chat-port-map-B7BjVI4_.js","assets/leaflet-CFW7BF0r.js","assets/generic-Dxczd_Y3.js","assets/leaflet-CIGW-MKW.css","assets/country-flag-CVf9_ObC.js","assets/countries-ClO0QLgM.js","assets/use-carto-tiles-DS6mluKa.js","assets/map-pin-BvDFh0XN.js","assets/external-link-CCsq4VDO.js","assets/CircleMarker-0yQcXySy.js","assets/Tooltip-YguovKLX.js","assets/Popup-BIIwOFpm.js"])))=>i.map(i=>d[i]); 2import{r as E,t as la,f as G,p as ma,y as T,j as a,bg as ia,bh as ua,v as ra,w as ha,as as da,bi as pa,bF as Y,bj as I,ar as H,bG as xa,aD as ca,d as ba,$ as na,_ as ga,aM as ya,Z as W,G as Z,B as Q,S as _a,L as O,c as fa,bv as Na}from"./index-Djrg3rXt.js";import{n as K}from"./hs-code-C_UDiIDW.js";import{P as ja}from"./trade-data-proportion-chart-DfK2Tud8.js";import{C as A}from"./country-flag-CVf9_ObC.js";import{u as va}from"./use-white-label-pdf-CGBOY5Nl.js";import{t as Sa,T as wa}from"./pricing-BgCFWN97.js";import{c as J}from"./pricing-Cmigjl_P.js";import{D as Ca}from"./download-Lh6hcQGH.js";import{F as X}from"./file-spreadsheet-CK_gTPFV.js";import{A as aa}from"./anchor-Crd2i_Ck.js";import{M as ka}from"./map-pin-BvDFh0XN.js";import"./countries-ClO0QLgM.js";import"./pdf-branding-Dq4PqVV3.js";const Da={buyers:"Top Customers",suppliers:"Top Suppliers",buyer_countries:"Top Importing Countries",supplier_countries:"Top Exporting Countries",import_ports:"Delivery Ports",export_ports:"Origin Ports",unit_price_buyers:"Customer Unit Prices",unit_price_suppliers:"Supplier Unit Prices",bol_transactions:"Shipment Records",bills_of_lading:"Bills of Lading",market_avg_unit_price:"Monthly Price Trend",market_analytics:"Market Analytics"};function La(s){switch(s){case"buyers":case"suppliers":return[{key:"name",label:"Company",format:"text"},{key:"country",label:"Country",format:"text"},{key:"value_usd",label:"Value (USD)",format:"usd"},{key:"shipments",label:"Shipments",format:"number"}];case"buyer_countries":case"supplier_countries":return[{key:"country",label:"Country",format:"text"},{key:"value_usd",label:"Value (USD)",format:"usd"},{key:"shipments",label:"Shipments",format:"number"}];case"import_ports":case"export_ports":return[{key:"name",label:"Port",format:"text"},{key:"country",label:"Country",format:"text"},{key:"value_usd",label:"Value (USD)",format:"usd"},{key:"shipments",label:"Shipments",format:"number"}];case"unit_price_buyers":case"unit_price_suppliers":return[{key:"name",label:"Company",format:"text"},{key:"country",label:"Country",format:"text"},{key:"avg_unit_price",label:"Avg Unit Price",format:"price"},{key:"shipments",label:"Shipments",format:"number"}];case"market_avg_unit_price":return[{key:"month",label:"Month",format:"text"},{key:"avg_unit_price",label:"Avg Unit Price",format:"price"}];case"bol_transactions":case"bills_of_lading":return[{key:"name",label:"Supplier",format:"text"},{key:"buyer",label:"Buyer",format:"text"},{key:"date",label:"Date",format:"text"},{key:"value_usd",label:"Value (USD)",format:"usd"}];default:return[{key:"name",label:"Name",format:"text"},{key:"value_usd",label:"Value (USD)",format:"usd"},{key:"shipments",label:"Shipments",format:"number"}]}}function $a(s,c){return`${Da[s]??"Trade Data"} â HS ${c}`}const ea=()=>ca(()=>import("./export-table-data-Cl3pEihs.js"),__vite__mapDeps([0,1,2,3,4,5,6]));function Ta({analysisType:s,hsCode:c,hsDescription:r,topResults:m,totalRecords:u,exportCountryCode:t,importCountryCode:F}){const[k,x]=E.useState(!1),M=la(G.trade_data.search_action.exportAllTradeData),D=ma(G.billing.credits.spendCredits),_=va(),i=La(s),L=$a(s,c),j=m.length,y=u>j,f=S=>`adamftd-${s}-HS${c.replace(/[.\s]/g,"")}-${S}`.replace(/[^a-zA-Z0-9_-]/g,""),v=E.useCallback(async(S,N)=>{x(!0);try{let h=m;if(N==="all"&&y){T.info(`Fetching all ${u.toLocaleString()} records...`,{duration:4e3});const b=new Date,$=b.toISOString().slice(0,10),q=new Date(b.getFullYear()-1,b.getMonth(),1).toISOString().slice(0,10),w=await M({analysisType:s,startDate:q,endDate:$,hsCode:K(c),expCountryCode:t,impCountryCode:F,maxRecords:u});if(!w.success||w.data.length===0){T.error(w.error??"Failed to fetch all records. Try exporting the shown records instead."),x(!1);return}h=w.data}const R={title:L,columns:i,rows:h,fileName:f(N==="all"?`all-${h.length}`:`top-${j}`),totalRecords:N==="all"?h.length:u,hsCode:c,hsDescription:r,analysisType:s};if(S==="excel"){const{exportToExcel:b}=await ea();b(R);const $=Sa(h.length);
2T.success(`Excel exported â ${h.length.toLocaleString()} records (${J($)})`)}else{const{exportToPdf:b}=await ea();await b(R,_),T.success(`PDF exported â ${h.length.toLocaleString()} records (${J(wa)})`),D({action:"trade_data_pdf_export",description:`Trade data PDF export: ${s} HS ${c}`}).catch(()=>{})}}catch(h){console.error("Export failed:",h),T.error("Export failed. Please try again.")}finally{x(!1)}},[m,y,u,M,s,c,t,F,L,i,f,j,r]);return a.jsxs(ia,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:160:4","data-hercules-name":"DropdownMenu",children:[a.jsx(ua,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:161:6","data-hercules-name":"DropdownMenuTrigger",asChild:!0,children:a.jsxs(ra,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:162:8","data-hercules-name":"Button",size:"sm",variant:"ghost",className:"h-7 gap-1 text-[11px] text-muted-foreground hover:text-foreground",disabled:k,children:[k?a.jsx(ha,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:169:12","data-hercules-name":"Loader2",className:"size-3 animate-spin"}):a.jsx(Ca,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:171:12","data-hercules-name":"Download",className:"size-3"}
2),k?"Exporting...":"Export",a.jsx(da,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:174:10","data-hercules-name":"ChevronDown",className:"size-3"})]})}),a.jsxs(pa,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:177:6","data-hercules-name":"DropdownMenuContent",align:"start",className:"w-60",children:[a.jsxs(Y,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:178:8","data-hercules-name":"DropdownMenuLabel",className:"text-xs text-muted-foreground",children:["Shown (",j," records)"]}),a.jsxs(I,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:181:8","data-hercules-name":"DropdownMenuItem",onClick:()=>v("excel","shown"),className:"gap-2",children:[a.jsx(X,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:182:10","data-hercules-name":"FileSpreadsheet",className:"size-4 text-emerald-600"}),"Export as Excel"]}),a.jsxs(I,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:185:8","data-hercules-name":"DropdownMenuItem",onClick:()=>v("pdf","shown"),className:"gap-2",children:[a.jsx(H,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:186:10","data-hercules-name":"FileText",className:"size-4 text-red-500"}),"Export as PDF"]}),y&&a.jsxs(a.Fragment,{children:[a.jsx(xa,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:191:12","data-hercules-name":"DropdownMenuSeparator"}),a.jsxs(Y,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:192:12","data-hercules-name":"DropdownMenuLabel",className:"text-xs text-muted-foreground",children:["All ",u.toLocaleString()," records"]}),a.jsxs(I,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:195:12","data-hercules-name":"DropdownMenuItem",onClick:()=>v("excel","all"),className:"gap-2",children:[a.jsx(X,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:196:14","data-hercules-name":"FileSpreadsheet",className:"size-4 text-emerald-600"}),"Export all as Excel"]}),a.jsxs(I,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:199:12","data-hercules-name":"DropdownMenuItem",onClick:()=>v("pdf","all"),className:"gap-2",children:[a.jsx(H,{"data-hercules-id":"src/pages/dashboard/_components/chat-table-export.tsx:200:14","data-hercules-name":"FileText",className:"size-4 text-red-500"}),"Export all as PDF"]})]})]})]})}const Pa=Na(()=>ca(()=>import("./chat-port-map-B7BjVI4_.js"),__vite__mapDeps([7,2,3,8,9,10,11,12,13,14,15,16,17,18]))),sa={buyers:{icon:Q,label:"Customers",entityLabel:"customer"},suppliers:{icon:Q,label:"Suppliers",entityLabel:"supplier"},buyer_countries:{icon:Z,label:"Importing Countries",entityLabel:"country"},supplier_countries:{icon:Z,label:"Exporting Countries",entityLabel:"country"},import_ports:{icon:aa,label:"Delivery Ports",entityLabel:"port"},export_ports:{icon:aa,label:"Origin Ports",entityLabel:"port"},unit_price_buyers:{icon:W,label:"Customer Unit Prices",entityLabel:"customer"},unit_price_suppliers:{icon:W,label:"Supplier Unit Prices",entityLabel:"supplier"},bol_transactions:{icon:ya,label:"Shipment Records",entityLabel:"shipment"},bills_of_lading:{icon:H,label:"Bills of Lading",entityLabel:"record"},market_avg_unit_price:{icon:ga,label:"Monthly Price Trend",entityLabel:"month"},market_analytics:{icon:na,label:"Market Analytics",entityLabel:"metric"}},ta=new Set(["buyers","suppliers","unit_price_buyers","unit_price_suppliers"]);function C(s){if(s===0)return"$0";if(s>=1e6){const c=s/1e6,[r,m]=c.toFixed(2).split(".");return`$${Number(r).toLocaleString("en-US")}.${m}M`}return s>=1e3?`$${(s/1e3).toFixed(1)}K`:`$${s.toFixed(2)}`}function P(s){if(s==null)return"-";const c=Number(s);return isNaN(c)?String(s):c.toLocaleString("en-US",{maximumFractionDigits:2})}function B(s,c){if(s==null)return"N/A";const r=Number(s);if(isNaN(r))return String(s);if(r===0){const m=Number(c.value_usd??0)!==0,u=Number(c.shipments??0)!==0;if(m||u)return"N/A"}return r.toLocaleString("en-US",{maximumFractionDigits:2})}function U(s){return s>=1e3?`$${s.toFixed(0)}`:s>=1?`$${s.toFixed(2)}`:`$${s.toFixed(4)}`}function Ua({entry:s,isBol:c}){const r=[];return s.name&&r.push({label:"Name",value:String(s.name)}),s.buyer&&r.push({label:"Buyer",value:String(s.buyer)}),s.country&&r.push({label:"Country",value:String(s.country)}),s.hs_code&&r.push({label:"HS Code",value:String(s.hs_code)}),s.description&&r.push({label:"Description",value:String(s.description)}),s.date&&r.push({label:"Date",value:String(s.date)}),s.value_usd!=null&&Number(s.value_usd)>0&&r.push({label:"Value (USD)",value:`$${Number(s.value_usd).toLocaleStr
2ing("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}),s.avg_unit_price!=null&&Number(s.avg_unit_price)>0&&r.push({label:"Avg Unit Price",value:U(Number(s.avg_unit_price))+(s.unit?`/${s.unit}`:"")}),s.shipments!=null&&Number(s.shipments)>0&&r.push({label:"Shipments",value:Number(s.shipments).toLocaleString()}),s.weight!=null&&Number(s.weight)>0&&r.push({label:"Weight (kg)",value:Number(s.weight).toLocaleString("en-US",{maximumFractionDigits:2})}),s.quantity!=null&&Number(s.quantity)>0&&r.push({label:"Quantity",value:Number(s.quantity).toLocaleString()}),s.volume!=null&&Number(s.volume)>0&&r.push({label:"Volume",value:Number(s.volume).toLocaleString()}),s.suppliers!=null&&Number(s.suppliers)>0&&r.push({label:"Suppliers",value:Number(s.suppliers).toLocaleString()}),s.buyers!=null&&Number(s.buyers)>0&&r.push({label:"Buyers",value:Number(s.buyers).toLocaleString()}),s.import_port&&r.push({label:"Import Port",value:String(s.import_port)}),(s.unlocode||s.locode)&&r.push({label:"UN/LOCODE",value:String(s.unlocode??s.locode)}),s.percentage_bol!=null&&r.push({label:"% of B/L",value:`${Number(s.percentage_bol).toFixed(1)}%`}),s.growth_rate!=null&&r.push({label:"Growth Rate",value:`${Number(s.growth_rate)>=0?"+":""}${Number(s.growth_rate).toFixed(1)}%`}),s.status&&r.push({label:"Status",value:String(s.status)}),s.last_update&&r.push({label:"Last Update",value:String(s.last_update)}),r.length===0&&c?a.jsx("p",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:153:11","data-hercules-name":"p",className:"text-[10px] text-muted-foreground italic px-1",children:"No additional details available."}):a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:157:4","data-hercules-name":"div",className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[11px]",children:r.map(m=>a.jsxs("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:159:8","data-hercules-name":"div",className:"contents",children:[a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:160:10","data-hercules-name":"span",className:"text-muted-foreground font-medium",children:m.label}),a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:161:10","data-hercules-name":"span",className:"text-foreground break-words",children:m.value})]},m.label))})}function qa({summaryJson:s,onAskFollowUp:c}){const r=ba(),[m,u]=E.useState(null),t=E.useMemo(()=>{try{return JSON.parse(s)}catch{return null}},[s]);if(!t||!t.topResults?.length)return null;const F=t.hsCode==="999999"||t.hsCode==="9999.99",k=t.topResults.every(e=>(e.value_usd||e.avg_unit_price||e.shipments||e.buyers||e.suppliers||0)===0);if(F||k)return null;const x=sa[t.analysisType]??sa.buyers,M=x.icon,D=t.analysisType==="unit_price_buyers"||t.analysisType==="unit_price_suppliers",_=t.analysisType==="bol_transactions"||t.analysisType==="bills_of_lading",i=t.analysisType==="market_avg_unit_price";i&&t.topResults&&t.topResults.sort((e,l)=>{const d=String(e.month??"");return String(l.month??"").localeCompare(d)});const L=t.analysisType!=="buyer_countries"&&t.analysisType!=="supplier_countries"&&!i,j=ta.has(t.analysisType),y=t.analysisType==="buyer_countries"||t.analysisType==="supplier_countries",f=t.analysisType==="import_ports"||t.analysisType==="export_ports",v=t.analysisType==="market_analytics",S=t.displayMode==="proportion_chart",N=t.displayMode==="map"&&f,h=t.topResults.some(e=>Number(e.value_usd??0)>=1e9),R=y?"country":"name",b=y?"country_code":void 0,$=!y&&!f,w=N?ka:M,oa=N?t.analysisType==="import_ports"?"Delivery Ports Map":"Origin Ports Map":S?"Proportion Chart":x.label;return a.jsxs("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:245:4","data-hercules-name":"div",className:"ml-10 mt-2 space-y-2",children:[a.jsxs("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:247:6","data-hercules-name":"div",className:"flex items-center gap-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:[a.jsx(w,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:248:8","data-hercules-name":"HeaderIcon",className:"size-3.5"}),a.jsxs("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:249:8","data-hercules-name":"span",children:[oa," â HS ",t.hsCode]}),a.jsxs("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:252:8","data-hercules-name":"span",className:"ml-auto flex items-center gap-2",children:[a.jsx(Ta,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:253:10","data-hercules-name":"TradeDataExportBar",analysisType:t.analysisType,hsCode:t.hsCode,hsDescription:t.hsDescription,topResults:t.topResults,totalRecords:t.totalRecords,exportCountryCode:t.exportCountryCode,importCountryCode:t.importCountryCode}),a.jsxs("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:262:10","data-hercules-name":"span",className:"text-[11px] font-normal normal-case",children:[t.totalRecords.toLocaleStr
2ing()," total records"]})]})]}),t.hsDescription&&a.jsx("p",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:270:8","data-hercules-name":"p",className:"text-[11px] text-muted-foreground -mt-1 truncate",children:t.hsDescription}),h&&a.jsxs("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:277:8","data-hercules-name":"div",className:"flex items-start gap-2 rounded-lg border border-amber-300/50 bg-amber-50/80 dark:bg-amber-950/20 dark:border-amber-700/40 px-3 py-2.5 text-[11px] text-amber-800 dark:text-amber-300 leading-relaxed",children:[a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:278:10","data-hercules-name":"span",className:"shrink-0 mt-0.5",children:"â "}),a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:279:10","data-hercules-name":"span",children:"These figures are extremely high but come directly from source data (customs declarations). This could mean that the currency is incorrectly declared, they're a related entity transfer, or the unit values are wrong. We retain this information from the original source documents, but please consider these records carefully."})]}),N?a.jsx(E.Suspense,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:287:8","data-hercules-name":"Suspense",fallback:a.jsx(_a,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:287:28","data-hercules-name":"Skeleton",className:"h-[430px] w-full rounded-xl"}),children:a.jsx(Pa,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:288:10","data-hercules-name":"ChatPortMap",ports:t.topResults,hsCode:t.hsCode,analysisType:t.analysisType})}):S?a.jsxs("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:296:8","data-hercules-name":"div",className:"rounded-xl border bg-card/80 p-4 space-y-3",children:[a.jsxs("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:297:10","data-hercules-name":"div",className:"flex items-center gap-2",children:[a.jsx(na,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:298:12","data-hercules-name":"BarChart3",className:"size-4 text-primary"}),a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:299:12","data-hercules-name":"span",className:"font-display font-semibold text-sm",children:"Proportion Chart"})]}),a.jsx(ja,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:301:10","data-hercules-name":"ProportionChart",data:t.topResults,metric:"value_usd",nameKey:R,codeKey:b,isCompanyData:$,height:400})]}):a.jsxs(a.Fragment,{children:[i&&t.marketAvgPrice!==void 0&&a.jsxs("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:314:12","data-hercules-name":"div",className:"flex items-center gap-2 rounded-lg border bg-primary/5 px-3 py-2 text-xs",children:[a.jsx(W,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:315:14","data-hercules-name":"DollarSign",className:"size-3.5 text-primary"}),a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:316:14","data-hercules-name":"span",className:"font-medium",children:"Market avg price:"}),a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:317:14","data-hercules-name":"span",className:"font-bold text-foreground",children:U(t.marketAvgPrice)}),t.unit&&a.jsxs("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:318:31","data-hercules-name":"span",className:"text-muted-foreground",children:["/ ",t.unit]})]}),i&&a.jsxs("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:324:12","data-hercules-name":"div",className:"flex items-start gap-2 rounded-lg border border-muted bg-muted/30 px-3 py-2 text-[11px] text-muted-foreground leading-relaxed",children:[a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:325:14","data-hercules-name":"span",className:"shrink-0 mt-0.5 text-primary/70",children:"i"}),a.jsxs("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:326:14","data-hercules-name":"span",children:["These results are calculated from customs declarations."," ",a.jsx(O,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:328:16","data-hercules-name":"Link",to:`/trade-
2data?hs=${K(t.hsCode)}${t.exportCountryCode?`&exp=${t.exportCountryCode}`:""}${t.importCountryCode?`&imp=${t.importCountryCode}`:""}&src=chat`,className:"text-primary font-medium hover:underline underline-offset-2 cursor-pointer",children:"Access the source data directly on Trade Data"})]})]}),D?a.jsxs("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:340:12","data-hercules-name":"div",className:"rounded-xl border bg-card/80 overflow-hidden",children:[a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:342:14","data-hercules-name":"div",className:"flex items-center gap-2 border-b bg-amber-50/80 dark:bg-amber-950/20 px-3 py-2",children:a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:343:16","data-hercules-name":"span",className:"text-amber-600 dark:text-amber-400 text-[11px]",children:"â US Dollar values are not recorded for the majority of US imports and exports"})}),a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:345:14","data-hercules-name":"div",className:"overflow-x-auto",children:a.jsxs("table",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:346:16","data-hercules-name":"table",className:"w-full text-xs",children:[a.jsx("thead",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:347:18","data-hercules-name":"thead",children:a.jsxs("tr",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:348:20","data-hercules-name":"tr",className:"border-b text-muted-foreground",children:[a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:349:22","data-hercules-name":"th",className:"px-3 py-2 text-left font-medium min-w-[160px]",children:t.analysisType==="unit_price_suppliers"?"Supplier":"Buyer"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:350:22","data-hercules-name":"th",className:"px-3 py-2 text-left font-medium",children:"Country"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:351:22","data-hercules-name":"th",className:"px-3 py-2 text-right font-medium whitespace-nowrap",children:"Avg Unit Price"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:352:22","data-hercules-name":"th",className:"px-3 py-2 text-right font-medium whitespace-nowrap",children:"Total Volume"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:353:22","data-hercules-name":"th",className:"px-3 py-2 text-right font-medium",children:"Transactions"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:354:22","data-hercules-name":"th",className:"px-3 py-2 text-right font-medium whitespace-nowrap",children:"Variance %"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:355:22","data-hercules-name":"th",className:"px-3 py-2 text-left font-medium whitespace-nowrap",children:"Last Update"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:356:22","data-hercules-name":"th",className:"px-3 py-2 text-left font-medium",children:"Status"})]})}),a.jsx("tbody",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:359:18","data-hercules-name":"tbody",children:t.topResults.map((e,l)=>{const d=String(e.entity_name??e.name??"Unknown"),n=e.company_id?String(e.company_id):void 0,o=e.country_code?String(e.country_code).toUpperCase().slice(0,2):"",g=Number(e.variance_pct??0),p=isNaN(g)||g===0?"text-muted-foreground":g>0?"text-emerald-600 dark:text-emerald-400":g<-20?"text-red-600 dark:text-red-400":"text-amber-600 dark:text-amber-400",z=ta.has(t.analysisType)&&(n||d!=="Unknown"),V=n?`/company/${n}${d?`?name=${encodeURIComponent(d)}`:""}${o?`${d?"&":"?"}country=${encodeURIComponent(o)}`:""}`:`/company-data?q=${encodeURIComponent(d)}`;return a.jsxs("tr",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:380:24","data-hercules-name":"tr",className:"border-b last:border-0 hover:bg-muted/30",children:[a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:381:26","data-hercules-name":"td",className:"px-3 py-2 max-w-[200px]",children:a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:382:28","data-hercules-name":"span",className:"truncate font-medium text-sm block",children:z?a.jsx(O,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:384
2:32","data-hercules-name":"Link",to:V,className:"text-primary hover:underline underline-offset-2",title:`View profile for ${d}`,children:d}):d})}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:394:26","data-hercules-name":"td",className:"px-3 py-2",children:a.jsxs("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:395:28","data-hercules-name":"span",className:"inline-flex items-center gap-1.5",children:[o.length>=2&&a.jsx(A,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:396:49","data-hercules-name":"CountryFlag",code:o,size:14,className:"rounded-sm"}),a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:397:30","data-hercules-name":"span",className:"text-muted-foreground",children:String(e.country??o)})]})}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:400:26","data-hercules-name":"td",className:"px-3 py-2 text-right font-medium tabular-nums",children:e.avg_unit_price!=null?U(Number(e.avg_unit_price)):"-"}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:403:26","data-hercules-name":"td",className:"px-3 py-2 text-right tabular-nums",children:e.total_volume!=null?C(Number(e.total_volume)):e.value_usd!=null?C(Number(e.value_usd)):"-"}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:406:26","data-hercules-name":"td",className:"px-3 py-2 text-right tabular-nums",children:e.transactions!=null?Number(e.transactions).toLocaleString():e.shipments!=null?Number(e.shipments).toLocaleString():"-"}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:409:26","data-hercules-name":"td",className:`px-3 py-2 text-right font-medium tabular-nums ${p}`,children:e.variance_pct!=null?`${Number(e.variance_pct).toFixed(1)}%`:"0.0%"}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:412:26","data-hercules-name":"td",className:"px-3 py-2 whitespace-nowrap text-muted-foreground",children:e.last_update?String(e.last_update):"-"}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:415:26","data-hercules-name":"td",className:"px-3 py-2",children:a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:416:28","data-hercules-name":"span",className:`inline-flex rounded-full px-2 py-0.5 text-[10px] font-semibold ${String(e.status)==="Active"?"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400":"bg-muted text-muted-foreground"}`,children:String(e.status??"-")})})]},l)})})]})})]}):y?a.jsxs("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:433:12","data-hercules-name":"div",className:"rounded-xl border bg-card/80 overflow-hidden",children:[a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:435:14","data-hercules-name":"div",className:"flex items-center gap-2 border-b bg-amber-50/80 dark:bg-amber-950/20 px-3 py-2",children:a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:436:16","data-hercules-name":"span",className:"text-amber-600 dark:text-amber-400 text-[11px]",children:"â US Dollar values are not recorded for the majority of US imports and exports"})}),c&&a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:439:16","data-hercules-name":"div",className:"flex items-center gap-2 border-b bg-primary/5 px-3 py-1.5 text-[11px] text-muted-foreground",children:a.jsxs("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:440:18","data-hercules-name":"span",children:["Click a country to ",t.analysisType==="buyer_countries"?"see buyers":"see suppliers"," of HS ",t.hsCode," in that country"]})}),a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:445:14","data-hercules-name":"div",className:"overflow-x-auto",children:a.jsxs("table",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:446:16","data-hercules-name":"table",className:"w-full text-xs",children:[a.jsx("thead",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:447:18","data-hercules-name":"thead",children:a.jsxs("tr",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:448:20","data-hercules-name":"tr",className:"border-b text-muted-foreground",children:[a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:449:22","data-hercules-name":"th",className:"px-3 py-2 text-left font-medium",children:"Country"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:450:22","data-hercules-name":"th",className:"px-3 py-2 text-right font-medium whitespace-nowrap",children:"Bills of Lading"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:451:22","data-hercules-name":"th",className:"px-3 py-2 text-right font-medium whitespace-nowrap",children:"Weight (kg)"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:452:22","data-hercules-name":"th",className:"px-3 py-2 text-right font-medium",children:"Quantity"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:453:22","data-hercules-name":"th",className:"px-3 py-2 text-right font-medium whitespace-nowrap",children:"Value (USD)"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:454:22","data-hercules-name":"th",className:"px-3 py-2 text-right font-medium",children:t.analysisType==="buyer_countries"?"Buyers":"Suppliers"})]})}),a.jsx("tbody",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:459:18","data-hercules-name":"tbody",children:t.topResults.map((e,l)=>{const d=e.country_code?String(e.country_code).toUpperCase().slice(0,2):"",n=String(e.country??d??"").trim(),o=!!c&&n.length>0,g=()=>{if(!o)return;const p=t.analysisType==="buyer_countries"?"buyers":"suppliers";c(`Find ${p} of HS ${t.hsCode} in ${n}`)};return a.jsxs("tr",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:472:24","data-hercules-name":"tr",className:`border-b last:border-0 hover:bg-primary/10 transition-colors ${o?"cursor-pointer":""}`,onClick:g,role:o?"button":void 0,tabIndex:o?0:void 0,onKeyDown:p=>{o&&(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),g())},title:o?`Search ${t.analysisType==="buyer_countries"?"buyers":"suppliers"} of HS ${t.hsCode} in ${n}`:void 0,children:[a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:491:26","data-hercules-name":"td",className:"px-3 py-2",children:a.jsxs("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:492:28","data-hercules-name":"span",className:"inline-flex items-center gap-1.5",children:[d.length>=2&&a.jsx(A,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:493:49","data-hercules-name":"CountryFlag",code:d,size:16,className:"rounded-sm"}),a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:494:30","data-hercules-name":"span",className:`font-medium ${o?"text-primary hover:underline underline-offset-2":""}`,children:n||d})]})}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:499:26","data-hercules-name":"td",className:"px-3 py-2 text-right tabular-nums",children:P(e.shipments)}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:502:26","data-hercules-name":"td",className:"px-3 py-2 text-right tabular-nums",children:B(e.weight,e)}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:505:26","data-hercules-name":"td",className:"px-3 py-2 text-right tabular-nums",children:B(e.quantity,e)}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:508:26","data-hercules-name":"td",className:"px-3 py-2 text-right font-medium tabular-nums",children:C(Number(e.value_usd??0))}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:511:26","data-hercules-name":"td",className:"px-3 py-2 text-right tabular-nums",children:t.analysisType==="buyer_countries"?e.buyers!=null?P(e.buyers):"-":e.suppliers!=null?P(e.suppliers):"-"})]},l)})})]})})]}):f?a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:525:12","data-hercules-name":"div",className:"rounded-xl border bg-card/80 overflow-hidden",children:a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:526:14","data-hercules-name":"div",className:"overflow-x-auto",children:a.jsxs("table",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:527:16","data-hercules-name":"table",className:"w-full text-xs",children:[a.jsx("thead",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:528:18","data-hercules-name":"thead",children:a.jsxs("tr",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:529:20","data-hercules-name":"tr",className:"border-b text-muted-foreground",children:[a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:530:22","data-hercules-name":"th",className:"px-3 py-2 text-left font-medium min-w-[140px]",children:"Port"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:531:22","data-hercules-name":"th",className:"px-3 py-2 text-left font-medium",children:"LOCODE"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:532:22","data-hercules-name":"th",className:"px-3 py-2 text-left font-medium",children:"Country"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:533:22","data-hercules-name":"th",className:"px-3 py-2 text-right font-medium whitespace-nowrap",children:"Bills of Lading"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:534:22","data-hercules-name":"th",className:"px-3 py-2 text-right font-medium whitespace-nowrap",children:"Weight (kg)"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:535:22","data-hercules-name":"th",className:"px-3 py-2 text-right font-medium whitespace-nowrap",children:"Value (USD)"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:536:22","data-hercules-name":"th",className:"px-3 py-2 text-right font-medium whitespace-nowrap",children:"% of BOL"})]})}),a.jsx("tbody",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:539:18","data-hercules-name":"tbody",children:t.topResults.map((e,l)=>{const d=e.country_code?String(e.country_code).toUpperCase().slice(0,2):"";return a.jsxs("tr",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:543:24","data-hercules-name":"tr",className:"border-b last:border-0 hover:bg-muted/30",children:[a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:544:26","data-hercules-name":"td",className:"px-3 py-2 max-w-[200px] truncate font-medium",children:String(e.name??"Unknown")}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:547:26","data-hercules-name":"td",className:"px-3 py-2",children:a.jsx("code",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:548:28","data-hercules-name":"code",className:"text-[11px]",children:e.unlocode?String(e.unlocode):"-"})}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:550:26","data-hercules-name":"td",className:"px-3 py-2",children:a.jsxs("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:551:28","data-hercules-name":"span",className:"inline-flex items-center gap-1.5",children:[d.length>=2&&a.jsx(A,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:552:49","data-hercules-name":"CountryFlag",code:d,size:16,className:"rounded-sm"}),a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:553:30","data-hercules-name":"span",className:"text-muted-foreground",children:String(e.country||d||"-")})]})}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:556:26","data-hercules-name":"td",className:"px-3 py-2 text-right tabular-nums",children:P(e.shipments)}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:559:26","data-hercules-name":"td",className:"px-3 py-2 text-right tabular-nums",children:B(e.weight,e)}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:562:26","data-hercules-name":"td",className:"px-3 py-2 text-right font-medium tabular-nums",children:C(Number(e.value_usd??0))}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:565:26","data-hercules-name":"td",className:"px-3 py-2 text-right tabular-nums",children:e.percentage_bol!=null?`${Number(e.percentage_bol).toFixed(1)}%`:"-"})]},l)})})]})})}):v?a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:577:12","data-hercules-name":"div",className:"rounded-xl border bg-card/80 overflow-hidden",children:a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:578:14","data-hercules-name":"div",className:"overflow-x-auto",children:a.jsxs("table",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:579:16","data-hercules-name":"table",className:"w-full text-xs",children:[a.jsx("thead",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:580:18","data-hercules-name":"thead",children:a.jsxs("tr",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:581:20","data-hercules-name":"tr",className:"border-b text-muted-foreground",children:[a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:582:22","data-hercules-name":"th",className:"px-3 py-2 text-left font-medium",children:"Name"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:583:22","data-hercules-name":"th",className:"px-3 py-2 text-right font-medium whitespace-nowrap",children:"Value (USD)"}),a.jsx("th",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:584:22","data-hercules-name":"th",className:"px-3 py-2 text-right font-medium",children:"Shipments"})]})}),a.jsx("tbody",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:587:18","data-hercules-name":"tbody",children:t.topResults.map((e,l)=>a.jsxs("tr",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:589:22","data-hercules-name":"tr",className:"border-b last:border-0 hover:bg-muted/30",children:[a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:590:24","data-hercules-name":"td",className:"px-3 py-2 font-medium",children:String(e.name??"-")}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:593:24","data-hercules-name":"td",className:"px-3 py-2 text-right font-medium tabular-nums",children:C(Number(e.value_usd??0))}),a.jsx("td",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:596:24","data-hercules-name":"td",className:"px-3 py-2 text-right tabular-nums",children:P(e.shipments)})]},l))})]})})}):a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:607:10","data-hercules-name":"div",className:"grid gap-1.5",children:t.topResults.map((e,l)=>{const d=e.company_id?String(e.company_id):void 0,n=String(e.name??"Unknown"),o=e.country_code?String(e.country_code):"",g=j&&(d||n!=="Unkno
2wn"),p=m===l,z=d?`/company/${d}${n?`?name=${encodeURIComponent(n)}`:""}${o?`${n?"&":"?"}country=${encodeURIComponent(o)}`:""}`:`/company-data?q=${encodeURIComponent(n)}`;return a.jsxs("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:621:16","data-hercules-name":"div",className:"rounded-lg border bg-card/50 text-xs cursor-pointer transition-colors hover:bg-accent/30",onClick:()=>u(p?null:l),children:[a.jsxs("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:626:18","data-hercules-name":"div",className:"flex items-start gap-2 sm:gap-3 px-2 sm:px-3 py-2",children:[a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:627:20","data-hercules-name":"span",className:"flex size-5 shrink-0 items-center justify-center rounded-full bg-primary/10 text-[10px] font-bold text-primary",children:l+1}),a.jsxs("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:630:20","data-hercules-name":"div",className:"min-w-0 flex-1",children:[i?a.jsx("p",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:632:24","data-hercules-name":"p",className:"font-medium text-foreground",children:String(e.month??"")}):L?a.jsx("p",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:634:24","data-hercules-name":"p",className:"font-medium break-words",children:g?a.jsx(O,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:636:28","data-hercules-name":"Link",to:z,className:"text-primary hover:underline underline-offset-2",title:`View profile for ${n}`,onClick:V=>V.stopPropagation(),children:n}):a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:645:28","data-hercules-name":"span",className:"text-foreground",children:n})}):null,!i&&e.country&&a.jsxs("p",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:650:24","data-hercules-name":"p",className:`flex items-center gap-1.5 break-words ${L?"text-muted-foreground":"font-medium text-foreground"}`,children:[e.country_code&&a.jsx(A,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:652:28","data-hercules-name":"CountryFlag",code:e.country_code,size:14,className:"rounded-sm shrink-0"}),String(e.country)]}),_&&e.buyer&&a.jsxs("p",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:658:24","data-hercules-name":"p",className:"text-muted-foreground break-words text-[10px]",children:[a.jsx("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:659:26","data-hercules-name":"span",className:"font-medium",children:"Buyer:"})," ",String(e.buyer)]}),_&&e.date&&a.jsx("p",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:663:24","data-hercules-name":"p",className:"text-muted-foreground text-[10px]",children:String(e.date)})]}),a.jsxs("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:668:20","data-hercules-name":"div",className:"flex items-center gap-1.5 sm:gap-3 shrink-0 text-right",children:[i?a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:670:24","data-hercules-name":"div",children:a.jsxs("p",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:671:26","data-hercules-name":"p",className:"font-semibold tabular-nums text-foreground",children:[U(Number(e.avg_unit_price??0)),e.unit?a.jsxs("span",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:673:42","data-hercules-name":"span",className:"text-muted-foreground font-normal",children:["/",e.unit]}):null]})}):D&&e.avg_unit_price?a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:677:24","data-hercules-name":"div",children:a.jsxs("p",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:678:26","data-hercules-name":"p",className:"font-semibold tabular-nums text-foreground",children:[U(Number(e.avg_unit_price)),"/unit"]})}):a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:683:24","data-hercules-name":"div",children:a.jsx("p",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:684:26","data-hercules-name":"p",className:"font-semibold tabular-nums text-foreground",children:C(Number(e.value_usd??0))})}),!_&&!i&&e.shipments?a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:690:24","data-hercules-name":"div",className:"text-muted-foreground",children:a.jsxs("p",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:691:26","data-hercules-name":"p",className:"tabular-nums",children:[Number(e.shipments).toLocaleStr
2ing()," B/L"]})}):null,!_&&!i&&!D&&e.weight!=null?a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:695:24","data-hercules-name":"div",className:"text-muted-foreground hidden sm:block",children:a.jsxs("p",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:696:26","data-hercules-name":"p",className:"tabular-nums text-[10px]",children:[B(e.weight,e)," kg"]})}):null,e.growth_rate!==void 0&&a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:700:24","data-hercules-name":"div",className:e.growth_rate>=0?"text-emerald-500":"text-red-500",children:a.jsxs("p",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:701:26","data-hercules-name":"p",className:"tabular-nums text-[10px] font-medium",children:[e.growth_rate>=0?"+":"",Number(e.growth_rate).toFixed(1),"%"]})}),a.jsx(da,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:704:22","data-hercules-name":"ChevronDown",className:`size-3.5 shrink-0 text-muted-foreground transition-transform ${p?"rotate-180":""}`})]})]}),p&&a.jsx("div",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:709:20","data-hercules-name":"div",className:"border-t bg-muted/20 px-3 sm:px-4 py-2.5",children:a.jsx(Ua,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:710:22","data-hercules-name":"EntryDetailPanel",entry:e,isBol:_})})]},l)})})]}),t.totalRecords>t.topResults.length&&a.jsxs(ra,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:723:8","data-hercules-name":"Button",variant:"ghost",size:"sm",className:"w-full gap-1.5 text-xs text-primary hover:text-primary",onClick:()=>{const e=new URLSearchParams;e.set("hs",K(t.hsCode)),e.set("type",t.analysisType),t.exportCountryCode&&e.set("exp",t.exportCountryCode),t.importCountryCode&&e.set("imp",t.importCountryCode),e.set("src","chat"),r(`/trade-data?${e.toString()}`)},children:["View all ",t.totalRecords.toLocaleString()," ",x.entityLabel.endsWith("y")?`${x.entityLabel.slice(0,-1)}ies`:`${x.entityLabel}s`,a.jsx(fa,{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:740:10","data-hercules-name":"ArrowRight",className:"size-3"})]}),a.jsx("p",{"data-hercules-id":"src/pages/dashboard/_components/chat-trade-data-summary.tsx:746:6","data-hercules-name":"p",className:"text-[11px] text-muted-foreground/80 leading-relaxed pt-1",children:"This information is based on official shipping and customs declarations data and may not be complete."})]})}export{qa 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.