1import{u as q,a as l,d as M,p as k,f as A,l as F,b as N,j as t}from"./index-C5TzDFSt.js";import{r as h}from"./vendor-BS2D_vZZ.js";import"./maplibre-BOGZE8_b.js";import"./deck-gl-Ce2nZgZd.js";const L="_badgeLayer_j4rz1_10",Q="_badgeCell_j4rz1_20",W="_constraintCell_j4rz1_21",H="_badge_j4rz1_10",T="_legend_j4rz1_59",E="_legendSwatch_j4rz1_75",d={badgeLayer:L,badgeCell:Q,constraintCell:W,badge:H,legend:T,legendSwatch:E};function O(o,c){const a=new Map;for(const n of c){const p=n.metadata["arcnet:equipmentId"],w=n.metadata["arcnet:machineClass"],u=o.find(r=>r.equipmentIds.includes(p))??o.find(r=>r.machineClasses.includes(w));if(!u)continue;const f=a.get(u.cellId)??[];f.push(n.assetId),a.set(u.cellId,f)}return a}function V({slot:o,sceneAssets:c,scenario:a,onEmitMessage:n,roleOverride:p}){const{session:w}=q(),u=l(e=>e.activeRole),f=l(e=>e.flowWorkCells),r=l(e=>e.flowSnapshotsByCell),_=l(e=>e.flowConstraintAssessment),b=l(e=>e.flowDbrSchedules),x=l(e=>e.flowRecommendations),v=l(e=>e.flowDispositions),R=p??u??M(w?.email),s=h.useMemo(()=>k({flowWorkCells:f,flowSnapshotsByCell:r,flowConstraintAssessment:_,flowDbrSchedules:b,flowRecommendations:x,flowDispositions:v},R),[_,b,v,x,r,f,R]),C=(s?A(s.snapshotsByCell):null)==="degenerate-single-pass",y=h.useMemo(()=>s?F(s.snapshotsByCell):{},[s]),j=h.useMemo(()=>s?O(s.workCells,c):new Map,[s,c]),m=s?.constraintAssessment??null,i=C?null:m?.constraintCellId??null,S=h.useRef(null);if(h.useEffect(()=>{if(o!=="legend"||!n||!m||!i||S.current===m.assessmentId)return;const e=y[i];S.current=m.assessmentId,n(N(a,{cellId:i,assetIds:j.get(i)??[],queueDepth:e?.queueDepth??0,utilization:e?.utilization??0,constraint:!0}))},[m,j,i,y,n,a,o]),!s||s.workCells.length===0)return null;if(o==="legend")return t.jsxs("div",{className:d.legend,"data-testid":"flow-overlay-legend",children:[t.jsx("span",{className:d.legendSwatch,"aria-hidden":"true"}),t.jsx("span",{children:"flow overlay â visual-demo-only"}),t.jsx("small",{children:C?"calibration-only window · no measured flow":"advisory projection · explains flow state, commands nothing"})]});const $=new Map(c.map(e=>[e.assetId,e]));return t.jsx("div",{className:d.badgeLayer,"data-testid":"flow-twin-overlay","aria-hidden":"true",children:s.workCells.map(e=>{const I=y[e.cellId],z=j.get(e.cellId)??[];if(!I||z.length===0)return null;const B=e.cellId===i;return z.map(D=>{const g=$.get(D);return g?t.jsx("div",{className:B?d.constraintCell:d.badgeCell,style:{gridColumn:`${g.floor.gridColumn} / span ${g.floor.gridWidth}`,gridRow:`${g.floor.gridRow} / span ${g.floor.gridHeight}`},"data-testid":B?"flow-constraint-outline":`flow-cell-badge-${e.cellId}`,children:t.jsx("span",{className:d.badge,children:C?t.jsx("em",{children:"cal-only"}):t.jsxs(t.Fragment,{children:[t.jsxs("em",{children:["Q",I.queueDepth]}),t.jsxs("strong",{children:[Math.round(I.utilization*100),"%"]})]})})},`${e.cellId}:${D}`):null})})})}export{V as FlowTwinOverlay,V as default,O as mapAssetsToCells}; 2//# sourceMappingURL=index-CC3DFpUC.js.map
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.