@litmusio/miravo-cli-windows-x64 0.16.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/THIRD_PARTY_LICENSES.txt +138 -355
  2. package/THIRD_PARTY_NOTICES.md +80 -99
  3. package/console-dist/assets/{api-D5UYWJSO.js → api-eIBFsAVZ.js} +1 -1
  4. package/console-dist/assets/{asset-detail-BBk695IB.js → asset-detail-B5PrGmhH.js} +1 -1
  5. package/console-dist/assets/{asset-detail-actions-CheQxauJ.js → asset-detail-actions-Bk6ld_CB.js} +1 -1
  6. package/console-dist/assets/{backup-power-DwpZi08p.js → backup-power-DbINrGRa.js} +1 -1
  7. package/console-dist/assets/{by-path-Ba-e31Js.js → by-path-C9hM5E2c.js} +1 -1
  8. package/console-dist/assets/{commercial-building-DRgnQG18.js → commercial-building-sUirih-T.js} +1 -1
  9. package/console-dist/assets/{console-panel-C7R_MM7P.js → console-panel-B4sP93vp.js} +1 -1
  10. package/console-dist/assets/{district-heating-Bbansn2z.js → district-heating-CORQU6TI.js} +1 -1
  11. package/console-dist/assets/{floor-page-DR0y8_Zk.js → floor-page-BXtyYGgU.js} +1 -1
  12. package/console-dist/assets/{index-Cp12bs7M.js → index-DXy-dmGY.js} +4 -4
  13. package/console-dist/assets/{login-BHuW7tUF.js → login-4nMqm3Cx.js} +1 -1
  14. package/console-dist/assets/{not-found-CxB-VSuf.js → not-found-FWlx51Vd.js} +1 -1
  15. package/console-dist/assets/{pharma-cleanroom-ClrGa8Px.js → pharma-cleanroom-aN7iae9g.js} +1 -1
  16. package/console-dist/assets/{use-engine-command-mutation-Cnafi1c5.js → use-engine-command-mutation-CGYWQMCW.js} +1 -1
  17. package/console-dist/assets/{use-transition-navigate-D1qOd1oZ.js → use-transition-navigate-Dl7F4RzO.js} +2 -2
  18. package/console-dist/assets/{useQuery-D2EdkToj.js → useQuery-DusfMeIp.js} +1 -1
  19. package/console-dist/assets/{validation-CwIpPs-E.js → validation-B5bxoTBm.js} +1 -1
  20. package/console-dist/assets/{water-treatment-DDCQ-bKX.js → water-treatment-D_IplEGE.js} +1 -1
  21. package/console-dist/index.html +8 -8
  22. package/miravo.exe +2 -2
  23. package/native/miravo-s7.node +0 -0
  24. package/nodesets/Opc.Ua.Gds.NodeSet2.xml +691 -30
  25. package/nodesets/Opc.Ua.I4AAS.NodeSet2.xml +5641 -0
  26. package/nodesets/Opc.Ua.NodeSet2.xml +10091 -8984
  27. package/nodesets/Opc.Ua.PADIM.NodeSet2.xml +6 -6
  28. package/package.json +1 -1
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{t}from"./useQuery-D2EdkToj.js";import{A as n,I as r,L as i,M as a,N as o,O as s,P as c,V as l,_ as u,g as d,j as f,k as p,m,p as h,v as g,y as _}from"./index-Cp12bs7M.js";import{t as v}from"./react-DRt7cCXI.js";import{a as y,c as b,i as x,n as S,o as C,r as w,t as ee}from"./vendor-charts-Bquh2dWE.js";import{c as te,l as ne}from"./chunk-6KYCQHYJ-ga3Yekab.js";import{C as re,_ as T,a as ie,b as E,c as D,f as O,g as k,i as ae,n as A,p as j,r as M,u as N}from"./format-YLUJ7AXt.js";import{n as oe,o as P,r as se,t as F}from"./dialog-BYkdndf9.js";import{i as ce,n as le,r as ue,t as de}from"./asset-detail-actions-CheQxauJ.js";import{C as fe,Tt as I,s as pe,y as me}from"./api-D5UYWJSO.js";import{n as he,r as ge}from"./use-engine-command-mutation-Cnafi1c5.js";import{n as L,t as R}from"./utils-D6wrZy-b.js";import{t as z}from"./activity-DruTYzT1.js";import{t as B}from"./triangle-alert-3Ab-dBrN.js";import{i as V,n as H,t as U}from"./tooltip-Dfmuq2yz.js";import{ot as _e}from"./vendor-ui-BGeFlRLR.js";import{t as W}from"./badge-CdRB4Nd_.js";var ve=L(`layers-2`,[[`path`,{d:`M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z`,key:`15q6uc`}],[`path`,{d:`m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845`,key:`byia6g`}]]),ye=L(`signal`,[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}],[`path`,{d:`M12 20v-8`,key:`i3yub9`}],[`path`,{d:`M17 20V8`,key:`1tkaf5`}],[`path`,{d:`M22 4v16`,key:`sih9yq`}]]),be=L(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),G=e(b(),1),K=_e();function xe({detail:e,tick:t,activeFaults:n,memberValues:r,onBack:a}){let c=o(),u=n.length,d=e.isQuarantined,f=`OK`,p=`ok`;u>0?(f=`FAULT`,p=`bad`):d&&(f=`QRTN`,p=`warn`);let m=0;if(r)for(let e of r.values())e.quality!==`good`&&m++;let h=Object.keys(e.members).length,g=r?.get(`availability_state`)?.value,_=e.members.availability_state?.value,v=typeof g==`string`?g:typeof _==`string`?_:`unknown`,y=v===`running`?{dot:`bg-success`,pulse:`bg-success/60`,animate:!0}:v===`faulted`?{dot:`bg-destructive`,pulse:`bg-destructive/60`,animate:!0}:v===`stopped`?{dot:`bg-warning`,pulse:`bg-warning/60`,animate:!0}:{dot:`bg-muted-foreground/60`,pulse:`bg-muted-foreground/50`,animate:!1},b=v===`running`?`Availability state is running — the asset is available and in service.`:v===`faulted`?`Availability state is faulted — the asset is unavailable because a fault is active.`:v===`stopped`?`Availability state is stopped — the asset is available but not running.`:`Availability state is not available for this asset yet.`;return(0,K.jsxs)(`header`,{className:R(ge,`flex w-full min-w-0 flex-col`),children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 px-5 py-4 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:a,className:`transition-colors hover:text-foreground`,children:`Assets`}),(0,K.jsx)(`span`,{"aria-hidden":!0,children:`/`}),(0,K.jsx)(`span`,{className:`truncate`,children:N(e.assetType)})]}),(0,K.jsx)(G.ViewTransition,{name:`asset-${e.id}`,default:`none`,children:(0,K.jsx)(`h1`,{className:`font-heading mt-1 text-2xl font-semibold uppercase leading-tight tracking-wide`,children:c(e.id).label})}),(0,K.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-1.5`,children:[(0,K.jsx)(`p`,{className:`m-0 min-w-0 flex-1 font-mono text-[10px] leading-tight tracking-tight text-muted-foreground`,children:(0,K.jsx)(`span`,{className:`break-all`,children:e.browsePath.join(` / `)})}),(0,K.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,K.jsx)(s,{value:ie(e.browsePath),label:`Copy Topic / UNS path`})})]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 self-end font-mono text-xs sm:self-start`,children:[(0,K.jsx)(i,{className:`size-3.5 animate-pulse text-primary`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`font-medium text-primary`,children:`LIVE`}),(0,K.jsxs)(`span`,{className:`tabular-nums text-muted-foreground`,children:[`t=`,t]}),(0,K.jsxs)(U,{children:[(0,K.jsx)(V,{render:(0,K.jsx)(`span`,{className:`inline-flex size-3.5 items-center justify-center outline-none focus-visible:ring-2 focus-visible:ring-ring`}),children:(0,K.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 shrink-0 items-center justify-center`,children:[(0,K.jsx)(`span`,{className:R(`relative inline-flex size-1.5 rounded-full`,y.dot)}),y.animate&&(0,K.jsx)(`span`,{className:R(`absolute inline-flex size-2.5 animate-ping rounded-full opacity-75`,y.pulse)})]})}),(0,K.jsx)(H,{side:`top`,align:`end`,children:(0,K.jsxs)(`span`,{className:`block max-w-[16rem] text-[11px] leading-snug`,children:[(0,K.jsx)(`span`,{className:`font-medium uppercase tracking-[0.08em]`,children:`Availability`}),` `,(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[`— `,b]})]})})]})]})]}),(0,K.jsxs)(`fieldset`,{"aria-label":`Asset status`,className:`m-0 flex flex-col border-0 border-t border-border/50 p-0`,children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-px bg-transparent`,children:[(0,K.jsx)(q,{variant:`primary`,icon:z,label:`Health`,value:f,tone:p,tooltip:`Rolls up active faults and quarantine into a single status — OK when nothing is asserted, FAULT when any fault is active, QRTN when the asset is excluded from the running factory.`}),(0,K.jsx)(q,{variant:`primary`,icon:B,label:`Active faults`,labelCompact:`Faults`,value:String(u),tone:u>0?`bad`:`neutral`,tooltip:`Fault codes currently asserted on this asset. Clear or inject faults from the Alarms section below.`})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-px border-t border-border/50 bg-transparent sm:grid-cols-4`,children:[(0,K.jsx)(q,{variant:`compact`,icon:ve,label:`Lifecycle`,labelCompact:`Life`,value:D(e.lifecycleStage),tone:E(e.lifecycleStage),tooltip:`Where this asset sits in its operational lifecycle (e.g. commissioning, operating, maintenance, retired).`}),(0,K.jsx)(q,{variant:`compact`,icon:l,label:`Tags`,value:String(h),tone:`neutral`,tooltip:`Total members exposed by this asset — process variables, state flags, counters, commands, and reference fields combined.`}),(0,K.jsx)(q,{variant:`compact`,icon:ye,label:`Bad quality`,value:String(m),tone:m>0?`warn`:`neutral`,tooltip:`Members whose quality stamp is anything other than good (uncertain or bad). A healthy asset reads 0.`}),(0,K.jsx)(q,{variant:`compact`,icon:be,label:`Operating age`,value:j(e.operatingHours),tone:`neutral`,tooltip:`Total operating age on this asset, including any factory-seeded starting hours plus simulated runtime elapsed in this session.`})]})]})]})}function q({icon:e,label:t,labelCompact:n,value:r,suffix:i,tone:a,variant:o=`compact`,tooltip:s}){let c=o===`primary`;return(0,K.jsxs)(`div`,{className:R(`relative flex min-w-0 flex-col justify-center`,c?`min-h-20 gap-1.5 px-4 py-4 sm:min-h-24 sm:px-6 sm:py-5 lg:min-h-28 lg:px-8`:`min-h-12 gap-1 px-3 py-2.5 sm:min-h-13 sm:px-4 lg:min-h-14 lg:px-5`),children:[(0,K.jsx)(`div`,{className:`flex min-h-0 min-w-0 items-center gap-2`,children:(0,K.jsxs)(U,{children:[(0,K.jsxs)(V,{className:`flex min-h-0 min-w-0 flex-1 cursor-default items-center gap-2 text-left`,render:(0,K.jsx)(`div`,{}),children:[(0,K.jsx)(e,{className:R(`shrink-0 text-muted-foreground`,c?`size-4`:`size-3.5`),"aria-hidden":!0}),(0,K.jsxs)(`span`,{className:R(`min-w-0 flex-1 font-medium tracking-wide text-muted-foreground uppercase 2xl:tracking-wider`,c?`text-[11px] leading-snug sm:text-[12px]`:`text-[9px] leading-snug sm:text-[10px]`),children:[(0,K.jsx)(`span`,{className:`block wrap-break-word 2xl:hidden`,children:n??t}),(0,K.jsx)(`span`,{className:`hidden wrap-break-word 2xl:block`,children:t})]})]}),(0,K.jsx)(H,{side:`top`,align:`start`,sideOffset:6,className:`max-w-xs`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:s??t})]})})]})}),(0,K.jsxs)(`p`,{className:R(`min-w-0 wrap-break-word font-mono font-semibold leading-tight tracking-tight tabular-nums`,c?`text-2xl sm:text-3xl lg:text-4xl`:`text-base lg:text-lg`,a===`ok`&&`text-success`,a===`warn`&&`text-warning`,a===`bad`&&`text-destructive`,a===`neutral`&&`text-foreground`),children:[r,i?(0,K.jsx)(`span`,{className:R(`ml-0.5 font-medium text-muted-foreground`,c?`text-base lg:text-lg`:`text-xs lg:text-sm`),children:i}):null]})]})}function J({title:e,subtitle:t,children:n,className:r,id:i}){return(0,K.jsxs)(`section`,{id:i,className:R(he,r),children:[(0,K.jsxs)(`div`,{className:`border-b border-border/60 px-4 py-3`,children:[(0,K.jsx)(`h2`,{className:`blueprint-title text-foreground`,children:e}),t?(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t}):null]}),(0,K.jsx)(`div`,{className:`overflow-hidden p-0`,children:n})]})}var Se=new Set([`pu`,`h`]),Ce=[`_reference`,`_baseline`,`_setpoint`,`_command`],Y=`var(--color-primary)`,we=`var(--color-background)`,Te=60,Ee=1e-4;function X(e,t,n){let r=e?.get(t);return{value:r?.value??n.value,quality:r?.quality??n.quality}}function De(e){return Object.entries(e.members).filter(([e,t])=>t.meta.kind===`variable`&&t.meta.access===`read`&&t.meta.dataType===`Double`&&t.meta.euRange!==null&&!Se.has(t.meta.unit??``)&&!Ce.some(t=>e.endsWith(t)))}function Oe(e,t){if(e.length<2)return!1;let n=t-Te,r;for(let t of e)if(!(t.tick<n)){if(r===void 0)r=t.value;else if(Math.abs(t.value-r)>Ee)return!0}return!1}function ke({data:e,chartHeight:t=34,live:n=!1}){let r=(0,G.useId)(),[i,a]=(0,G.useState)(null),o=1/0,s=-1/0;for(let t of e)t.value<o&&(o=t.value),t.value>s&&(s=t.value);let c=e[e.length-1],l=t+14;return(0,K.jsxs)(`div`,{className:`flex min-h-0 w-full flex-col overflow-hidden`,style:{height:l},children:[(0,K.jsx)(`div`,{style:{height:t,width:`100%`},children:(0,K.jsx)(y,{width:`100%`,height:t,children:(0,K.jsxs)(ee,{data:e,margin:{top:3,right:4,bottom:2,left:0},onMouseMove:e=>{let t=e?.activePayload?.[0]?.value;typeof t==`number`&&a(t)},onMouseLeave:()=>a(null),children:[(0,K.jsx)(`defs`,{children:(0,K.jsxs)(`linearGradient`,{id:r,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,K.jsx)(`stop`,{offset:`0%`,stopColor:Y,stopOpacity:.32}),(0,K.jsx)(`stop`,{offset:`100%`,stopColor:Y,stopOpacity:0})]})}),(0,K.jsx)(S,{domain:[`auto`,`auto`],hide:!0}),(0,K.jsx)(C,{content:()=>null,cursor:!1}),(0,K.jsx)(w,{type:`monotone`,dataKey:`value`,stroke:Y,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`url(#${r})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,fill:Y,stroke:we,strokeWidth:1}}),c?(0,K.jsx)(x,{x:c.tick,y:c.value,r:2.25,fill:Y,stroke:we,strokeWidth:1.25,isFront:!0,ifOverflow:`extendDomain`}):null]})})}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] leading-none tabular-nums text-muted-foreground`,children:[n?(0,K.jsxs)(`span`,{"aria-hidden":!0,className:`relative inline-flex size-1.5 shrink-0 items-center justify-center`,children:[(0,K.jsx)(`span`,{className:`absolute inline-flex size-2 animate-ping rounded-full bg-primary/50`}),(0,K.jsx)(`span`,{className:`relative inline-flex size-1.5 rounded-full bg-primary`})]}):null,i===null?(0,K.jsxs)(`span`,{children:[O(o),`–`,O(s)]}):(0,K.jsx)(`span`,{className:`font-medium text-primary`,children:O(i)})]})]})}function Ae({detail:e,processVariables:t,memberValues:n,historyRef:r,tick:i,showQuality:a}){let{liveMap:o,orderedVariables:c}=(0,G.useMemo)(()=>{let e=new Map,n=[],a=[];for(let o of t){let t=Oe(r.current.get(o[0])??[],i);e.set(o[0],t),(t?n:a).push(o)}return{liveMap:e,orderedVariables:[...n,...a]}},[t,n,i,r]);return t.length===0?(0,K.jsx)(J,{title:`Process`,subtitle:`No continuous analog readings defined for this asset`,className:`opacity-90`,children:(0,K.jsx)(`p`,{className:`px-4 py-6 text-center text-sm text-muted-foreground`,children:`This asset exposes no continuous process variables. Discrete states, flags, and commands are available in the Tags section below.`})}):(0,K.jsx)(J,{title:`Process`,subtitle:`Live tag readings — trend is ~2 min at 1 Hz`,children:(0,K.jsx)(`ul`,{className:`divide-y divide-border/40`,children:c.map(([t,i])=>{let{value:c,quality:l}=X(n,t,i),u=r.current.get(t)??[],d=ae(e.browsePath,t),f=o.get(t)??!1,p=u.length>=2,m=T(i.meta.unit),h=k(t);return(0,K.jsxs)(v.li,{layout:`position`,transition:{duration:.36,ease:[.22,1,.36,1]},className:`flex flex-col gap-2.5 bg-background px-4 py-3 sm:flex-row sm:items-center sm:gap-5 sm:py-3.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 sm:w-44 sm:shrink-0`,children:[(0,K.jsxs)(U,{children:[(0,K.jsx)(V,{className:`min-w-0 flex-1 cursor-default truncate text-left text-[11px] font-medium uppercase tracking-[var(--miravo-tracking-eyebrow)] text-muted-foreground`,render:(0,K.jsx)(`span`,{}),children:h}),(0,K.jsx)(H,{side:`top`,align:`start`,className:`max-w-xs`,children:h})]}),(0,K.jsx)(s,{value:d,label:`Copy Topic / UNS path`})]}),(0,K.jsxs)(`div`,{className:`relative h-[56px] min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-x-0 top-1/2 h-px -translate-y-1/2 bg-border/30`}),p?(0,K.jsx)(ke,{data:u,chartHeight:42,live:f}):(0,K.jsx)(`p`,{className:`flex h-full items-center text-[10px] uppercase tracking-widest text-muted-foreground`,children:`Collecting trend…`})]}),(0,K.jsxs)(`div`,{className:`flex items-baseline gap-2 sm:min-w-36 sm:shrink-0 sm:justify-end`,children:[(0,K.jsx)(`span`,{className:`blueprint-stat text-2xl font-semibold leading-none tabular-nums text-foreground`,children:typeof c==`number`?O(c):String(c)}),m&&(0,K.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:m}),a&&l!==`good`&&(0,K.jsx)(W,{variant:l===`uncertain`?`secondary`:`destructive`,className:`shrink-0 text-[10px]`,children:l})]})]},t)})})})}function je({name:e,value:t,dataType:n,unit:r,access:i}){let a=k(e),o=i===`readwrite`;if(n===`Boolean`||typeof t==`boolean`||r===`pu`&&(t===0||t===1)){let n=t===!0||t===`true`||t===1,r=e.includes(`fault`);return(0,K.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] border px-2 py-1 ${r&&n?`border-destructive/30 bg-transparent`:``}`,children:[(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left text-[10px] leading-snug text-muted-foreground`,children:[a,o&&(0,K.jsx)(`span`,{className:`ml-1 text-[8px] text-primary`,children:`CMD`})]}),(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-xs font-medium tabular-nums ${r&&n?`text-destructive`:n?`text-success`:`text-muted-foreground`}`,children:n?`ON`:`OFF`})]})}if(n===`String`){let n=String(t),r=n===`none`||n===``,i=A.has(n)||e.includes(`fault_code`)&&!r,o=!i&&M.has(n);return(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col justify-center gap-1 rounded-[var(--miravo-radius-tight)] border px-2 py-2 ${i?`border-destructive/30 bg-transparent`:o?`border-warning/30 bg-warning/5`:``}`,children:[(0,K.jsx)(`span`,{className:`wrap-break-word text-[10px] leading-tight text-muted-foreground`,children:a}),r?(0,K.jsx)(`span`,{className:`wrap-break-word font-mono text-sm font-medium leading-snug text-muted-foreground`,children:`—`}):(0,K.jsx)(`span`,{title:n,className:`wrap-break-word font-mono text-sm font-medium leading-snug ${i?`text-destructive`:o?`text-warning`:`text-foreground`}`,children:D(n)})]})}return(0,K.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] border px-2 py-1`,children:[(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left text-[10px] leading-snug text-muted-foreground`,children:[a,o&&(0,K.jsx)(`span`,{className:`ml-1 text-[8px] text-primary`,children:`CMD`})]}),(0,K.jsxs)(`span`,{className:`shrink-0 text-right font-mono text-xs font-medium tabular-nums`,children:[typeof t==`number`?O(t):String(t),r&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:T(r)})]})]})}function Z(e){return[...e].sort((e,t)=>{let n=e[1].meta.access===`readwrite`;return n===(t[1].meta.access===`readwrite`)?e[0].localeCompare(t[0]):n?-1:1})}function Me({stringEnumMembers:e,nonStringOperationalMembers:t,memberValues:n,className:r}){let i=(0,G.useMemo)(()=>Z(e),[e]),a=(0,G.useMemo)(()=>Z(t),[t]),o=`grid min-w-0 gap-2 [grid-template-columns:repeat(auto-fill,minmax(min(100%,12.5rem),1fr))]`;return(0,K.jsx)(J,{title:`Tags`,subtitle:`Mode, status flags, and control tags`,className:r,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5 p-4`,children:[i.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a.length>0&&(0,K.jsx)(`h3`,{className:`blueprint-title text-muted-foreground`,children:`States`}),(0,K.jsx)(`div`,{className:o,children:i.map(([e,t])=>{let{value:r}=X(n,e,t);return(0,K.jsx)(je,{name:e,value:r,dataType:t.meta.dataType,unit:t.meta.unit,access:t.meta.access},e)})})]}),a.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.length>0&&(0,K.jsx)(`h3`,{className:`blueprint-title text-muted-foreground`,children:`Flags & commands`}),(0,K.jsx)(`div`,{className:o,children:a.map(([e,t])=>{let{value:r}=X(n,e,t);return(0,K.jsx)(je,{name:e,value:r,dataType:t.meta.dataType,unit:t.meta.unit,access:t.meta.access},e)})})]})]})})}function Q({className:e,counters:t,memberValues:n}){return(0,K.jsx)(J,{title:`Counters`,subtitle:`Totals, hours, and accumulators`,className:e,children:(0,K.jsx)(`div`,{className:`flex flex-col gap-2 p-4`,children:t.map(([e,t])=>{let{value:r}=X(n,e,t);return(0,K.jsxs)(`div`,{className:`flex items-center justify-between rounded-[var(--miravo-radius-tight)] border border-border/60 bg-transparent px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:k(e)}),(0,K.jsxs)(`span`,{className:`blueprint-stat text-sm font-medium`,children:[typeof r==`number`?O(r):String(r),t.meta.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:T(t.meta.unit)})]})]},e)})})})}function $({className:e,detail:t,referenceMembers:n,memberValues:r}){let i=Object.keys(t.parameters).length>0,a=n.length>0;return!i&&!a?null:(0,K.jsx)(J,{title:`Nameplate & configuration`,subtitle:`Design parameters, identity, and reference values`,className:e,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[i&&(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Object.entries(t.parameters).map(([e,t])=>(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5 py-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:k(e)}),(0,K.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof t.value==`number`?O(t.value):String(t.value),t.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:T(t.unit)})]})]},e))}),a&&(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:n.map(([e,t])=>{let{value:n}=X(r,e,t);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-[var(--miravo-radius-tight)] border border-border/60 bg-transparent p-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:k(e)}),(0,K.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof n==`number`?O(n):String(n),t.meta.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:T(t.meta.unit)})]})]},e)})})]})})}function Ne({detail:e,memberValues:t}){if(!e.members.state_label)return null;let n=n=>t?.get(n)?.value??e.members[n]?.value;return(0,K.jsxs)(`section`,{className:`flex flex-wrap items-center gap-3 text-sm`,"aria-label":`Station production`,children:[(0,K.jsx)(W,{variant:`secondary`,children:String(n(`state_label`)??`idle`)}),(0,K.jsxs)(`span`,{children:[`Good: `,O(Number(n(`good_count`)??0))]}),(0,K.jsxs)(`span`,{children:[`Scrap: `,O(Number(n(`scrap_count`)??0))]}),n(`stop_reason`)&&(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:String(n(`stop_reason`))})]})}var Pe=120,Fe=`gap-4 sm:gap-5 lg:gap-x-6 lg:gap-y-5 xl:gap-x-8`,Ie=`asset-detail-page relative isolate mx-auto flex min-h-full w-full max-w-screen-2xl flex-col gap-6 p-4 sm:gap-8 sm:p-6`;function Le(e){return e instanceof Error&&`code`in e&&e.code===`NOT_FOUND`||e instanceof Error&&/^404\b/.test(e.message.trim())}function Re(){let{id:e}=ne(),i=te(),o=(0,G.useCallback)(()=>{(0,G.startTransition)(()=>{(0,G.addTransitionType)(c),i(`/?tab=assets`)})},[i]),[s,y]=(0,G.useState)(!1),[b,x]=m(`tab`,h([`hmi`,`operate`,`data`,`operations`]).withDefault(`hmi`)),S=b===`data`||b===`operations`?`operate`:b;(0,G.useEffect)(()=>{(b===`data`||b===`operations`)&&x(`operate`)},[b,x]);let C=(0,G.useCallback)(e=>{x(`operate`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})})})},[x]);(0,G.useEffect)(()=>{let e=null,t=!1,n=()=>{t=!1,e&&=(clearTimeout(e),null)},r=r=>{if(r.metaKey||r.ctrlKey||r.altKey)return;let i=r.target;if(i){let e=i.tagName;if(e===`INPUT`||e===`TEXTAREA`||e===`SELECT`||i.isContentEditable)return}t?(r.key===`f`?(C(`faults`),r.preventDefault()):r.key===`c`&&(C(`commands`),r.preventDefault()),n()):r.key===`g`?(t=!0,e=setTimeout(n,1200)):r.key===`b`&&!r.shiftKey?(o(),r.preventDefault()):r.key===`?`&&(y(!0),r.preventDefault())};return window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`keydown`,r),n()}},[o,C]);let w=t({queryKey:me.assets.detail(e??``),queryFn:()=>pe(`/assets/${e}`,fe.assetDetail),enabled:e!==void 0}),ee=w.data??null,T=(0,G.useDeferredValue)(ee),ie=w.isError,E=I(t=>e?t.memberValues.get(e):void 0),D=I(e=>e.models),O=I(e=>e.assets),k=(0,G.useMemo)(()=>O.find(t=>t.id===e),[O,e]),ae=k?.activeFaults,A=(0,G.useRef)(new Map),j=I(e=>e.tick);(0,G.useEffect)(()=>{if(!E||!e)return;let t=A.current;for(let[e,n]of E){if(typeof n.value!=`number`)continue;let r=t.get(e)??[];if(r[r.length-1]?.tick===j)continue;let i=r.length>=Pe?r.slice(r.length-Pe+1):r;t.set(e,[...i,{value:n.value,tick:j}])}},[E,j,e]);let M=(0,G.useMemo)(()=>T?De(T):[],[T]),N=(0,G.useMemo)(()=>{if(!T)return{operational:[],counters:[],reference:[]};let e=new Set(M.map(([e])=>e)),t=Object.entries(T.members).filter(([t])=>!e.has(t)),n=[],r=[],i=[];for(let e of t){let[,t]=e,a=t.meta.dataType,o=t.meta.kind,s=t.meta.unit,c=s===`pu`&&t.meta.euRange?.[0]===0&&t.meta.euRange?.[1]===1;o===`property`?i.push(e):a===`Boolean`||a===`String`||c?n.push(e):s===`count`||a===`UInt16`||a===`UInt32`?r.push(e):t.meta.access===`readwrite`||Ce.some(t=>e[0].endsWith(t))?n.push(e):s===`pu`||s===`h`?r.push(e):i.push(e)}return{operational:n,counters:r,reference:i}},[T,M]),oe=(0,G.useMemo)(()=>T?D.find(e=>e.name===T.assetType)?.faultNames??[]:[],[T,D]),P=ae??T?.activeFaults??[],se=(0,G.useMemo)(()=>{if(!E)return P.length>0;for(let[,e]of E)if(e.quality!==`good`)return!0;return!1},[E,P.length]),F=(0,G.useMemo)(()=>N.operational.filter(([,e])=>e.meta.dataType===`String`),[N.operational]),ge=(0,G.useMemo)(()=>N.operational.filter(([,e])=>e.meta.dataType!==`String`),[N.operational]),L=ce(e,T,()=>w.refetch());if(!T){if(ie)return Le(w.error)?(0,K.jsx)(a,{className:`min-h-full`,children:(0,K.jsx)(`div`,{className:`flex min-h-[40vh] items-center justify-center p-6 sm:p-12`,children:(0,K.jsx)(`div`,{className:`w-full max-w-md`,children:(0,K.jsxs)(n,{eyebrow:`Asset lookup`,stamp:`404`,title:`Asset not found`,detail:e??`Unknown asset id`,detailLabel:`Requested asset`,primaryLabel:`Back to Assets`,onPrimary:o,children:[(0,K.jsx)(`p`,{children:`The requested asset is no longer in the running factory or the URL is wrong.`}),(0,K.jsx)(`p`,{children:`Return to Assets and pick a live asset from the current factory.`})]})})})}):(0,K.jsx)(a,{className:`min-h-full`,children:(0,K.jsxs)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center gap-4 p-6 sm:p-12`,children:[(0,K.jsx)(`div`,{className:`w-full max-w-md`,children:(0,K.jsx)(p,{message:f(w.error,`Could not load asset.`),onRetry:()=>void w.refetch(),isRetrying:w.isFetching})}),(0,K.jsx)(re,{variant:`outline`,size:`sm`,onClick:o,children:`Back to Assets`})]})});if(k){let e={id:k.id,assetType:k.model,browsePath:k.browsePath,lifecycleStage:k.lifecycleStage,operatingHours:k.operatingHours,activeFaults:k.activeFaults,isQuarantined:k.isQuarantined,parameters:{},controls:{members:[],methods:[],faults:[]},inputs:{},members:{},methods:{}};return(0,K.jsx)(`div`,{className:Ie,children:(0,K.jsx)(xe,{detail:e,tick:j,activeFaults:P,memberValues:E,onBack:o})})}return null}let z=N.operational.length>0,B=N.counters.length>0,V=N.reference.length>0||Object.keys(T.parameters).length>0,H=z||B||V,U=Object.keys(T.methods).length>0,_e=z&&!B&&!V,W=z&&B&&V;return(0,K.jsxs)(`div`,{className:Ie,children:[(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 -z-10 hidden select-none overflow-hidden md:block`,children:(0,K.jsx)(`span`,{className:`absolute -top-2 left-0 whitespace-nowrap uppercase leading-none opacity-35 blur-[2px]`,style:{fontFamily:`var(--miravo-font-heading)`,fontSize:`clamp(5rem, 14vw, 12rem)`,fontWeight:`var(--miravo-weight-medium)`,letterSpacing:`var(--miravo-tracking-heading)`,color:`var(--miravo-ghost)`},children:T.assetType.replace(/_/g,` `)})}),(0,K.jsx)(xe,{detail:T,tick:j,activeFaults:P,memberValues:E,onBack:o}),(0,K.jsx)(Ne,{detail:T,memberValues:E}),(0,K.jsx)(G.ViewTransition,{enter:`fade-in`,default:`none`,children:(0,K.jsxs)(d,{value:S,onValueChange:e=>{x(e)},className:`min-h-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,K.jsxs)(g,{variant:`line`,className:`h-10! min-w-max gap-0.5`,children:[(0,K.jsxs)(_,{value:`hmi`,className:`gap-1.5 px-3 text-sm`,children:[(0,K.jsx)(l,{className:`size-3.5 shrink-0`}),`HMI`]}),(0,K.jsxs)(_,{value:`operate`,className:`gap-1.5 px-3 text-sm`,children:[(0,K.jsx)(r,{className:`size-3.5 shrink-0`}),`Operate`]})]})}),(0,K.jsx)(u,{value:`hmi`,className:`flex-1 py-2`,children:(0,K.jsx)(v.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:(0,K.jsx)(Ae,{detail:T,processVariables:M,memberValues:E,historyRef:A,tick:j,showQuality:se})},`hmi`)}),(0,K.jsx)(u,{value:`operate`,className:`flex-1 py-2`,children:(0,K.jsxs)(v.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`flex min-w-0 flex-col gap-4`,children:[H&&(0,K.jsxs)(`section`,{"aria-label":`Data`,className:R(`grid min-w-0 grid-cols-1`,Fe,W&&`lg:grid-cols-2 lg:grid-rows-[auto_auto] lg:items-start`,!W&&z&&(B||V)&&`lg:grid-cols-2 lg:items-start`),children:[z&&(0,K.jsx)(Me,{stringEnumMembers:F,nonStringOperationalMembers:ge,memberValues:E,className:R(`min-h-0 min-w-0 self-stretch`,_e&&`lg:col-span-2`,W&&`lg:row-span-2`)}),!z&&B&&V&&(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-6 lg:col-span-2`,children:[(0,K.jsx)(Q,{counters:N.counters,memberValues:E}),(0,K.jsx)($,{detail:T,referenceMembers:N.reference,memberValues:E})]}),!z&&B&&!V&&(0,K.jsx)(Q,{className:`lg:col-span-2`,counters:N.counters,memberValues:E}),!z&&!B&&V&&(0,K.jsx)($,{className:`lg:col-span-2`,detail:T,referenceMembers:N.reference,memberValues:E}),z&&B&&(0,K.jsx)(Q,{className:`min-h-0 min-w-0 self-stretch lg:col-start-2 lg:row-start-1`,counters:N.counters,memberValues:E}),z&&V&&(0,K.jsx)($,{className:R(`min-h-0 min-w-0 self-stretch lg:col-start-2`,W?`lg:row-start-2`:`lg:row-start-1`),detail:T,referenceMembers:N.reference,memberValues:E})]}),(0,K.jsxs)(`section`,{"aria-label":`Operations`,className:R(he,`grid grid-cols-1`,U&&`lg:grid-cols-2`),children:[(0,K.jsx)(le,{activeFaults:P,availableFaults:oe,onTriggerFault:L.triggerFault,onClearFault:L.clearFault}),U&&(0,K.jsx)(`div`,{className:`border-t border-border/50 lg:border-l lg:border-t-0`,children:(0,K.jsx)(de,{detail:T,methodArgs:L.methodArgs,setMethodArgs:L.setMethodArgs,onInvoke:L.invoke,isPending:L.isPending,pendingMethod:L.pendingMethod})})]}),(0,K.jsx)(ue,{assetId:T.id,onRemoved:o})]},`operate`)})]})}),(0,K.jsx)(ze,{open:s,onOpenChange:y})]})}function ze({open:e,onOpenChange:t}){return(0,K.jsx)(F,{open:e,onOpenChange:t,children:(0,K.jsxs)(oe,{children:[(0,K.jsx)(P,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Keyboard shortcuts`}),(0,K.jsx)(se,{className:`text-sm text-muted-foreground`,children:`Navigate this asset without leaving the keyboard.`}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-2 pt-1`,children:[{keys:[`g`,`f`],label:`Jump to Alarms`},{keys:[`g`,`c`],label:`Jump to Commands`},{keys:[`b`],label:`Back to Assets`},{keys:[`?`],label:`Show this sheet`}].map(e=>(0,K.jsxs)(`li`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`span`,{className:`text-sm text-foreground`,children:e.label}),(0,K.jsx)(`span`,{className:`flex items-center gap-1`,children:e.keys.map((t,n)=>(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`kbd`,{className:`rounded-[var(--miravo-radius-tight)] border border-border bg-muted/40 px-1.5 py-0.5 font-mono text-[11px] font-medium text-foreground`,children:t}),n<e.keys.length-1&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`then`})]},`${e.label}-${t}`))})]},e.label))})]})})}export{Re as AssetDetailPage};
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{t}from"./useQuery-DusfMeIp.js";import{A as n,I as r,L as i,M as a,N as o,O as s,P as c,V as l,_ as u,g as d,j as f,k as p,m,p as h,v as g,y as _}from"./index-DXy-dmGY.js";import{t as v}from"./react-DRt7cCXI.js";import{a as y,c as b,i as x,n as S,o as C,r as w,t as ee}from"./vendor-charts-Bquh2dWE.js";import{c as te,l as ne}from"./chunk-6KYCQHYJ-ga3Yekab.js";import{C as re,_ as T,a as ie,b as E,c as D,f as O,g as k,i as ae,n as A,p as j,r as M,u as N}from"./format-YLUJ7AXt.js";import{n as oe,o as P,r as se,t as F}from"./dialog-BYkdndf9.js";import{i as ce,n as le,r as ue,t as de}from"./asset-detail-actions-Bk6ld_CB.js";import{C as fe,Tt as I,s as pe,y as me}from"./api-eIBFsAVZ.js";import{n as he,r as ge}from"./use-engine-command-mutation-CGYWQMCW.js";import{n as L,t as R}from"./utils-D6wrZy-b.js";import{t as z}from"./activity-DruTYzT1.js";import{t as B}from"./triangle-alert-3Ab-dBrN.js";import{i as V,n as H,t as U}from"./tooltip-Dfmuq2yz.js";import{ot as _e}from"./vendor-ui-BGeFlRLR.js";import{t as W}from"./badge-CdRB4Nd_.js";var ve=L(`layers-2`,[[`path`,{d:`M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z`,key:`15q6uc`}],[`path`,{d:`m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845`,key:`byia6g`}]]),ye=L(`signal`,[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}],[`path`,{d:`M12 20v-8`,key:`i3yub9`}],[`path`,{d:`M17 20V8`,key:`1tkaf5`}],[`path`,{d:`M22 4v16`,key:`sih9yq`}]]),be=L(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),G=e(b(),1),K=_e();function xe({detail:e,tick:t,activeFaults:n,memberValues:r,onBack:a}){let c=o(),u=n.length,d=e.isQuarantined,f=`OK`,p=`ok`;u>0?(f=`FAULT`,p=`bad`):d&&(f=`QRTN`,p=`warn`);let m=0;if(r)for(let e of r.values())e.quality!==`good`&&m++;let h=Object.keys(e.members).length,g=r?.get(`availability_state`)?.value,_=e.members.availability_state?.value,v=typeof g==`string`?g:typeof _==`string`?_:`unknown`,y=v===`running`?{dot:`bg-success`,pulse:`bg-success/60`,animate:!0}:v===`faulted`?{dot:`bg-destructive`,pulse:`bg-destructive/60`,animate:!0}:v===`stopped`?{dot:`bg-warning`,pulse:`bg-warning/60`,animate:!0}:{dot:`bg-muted-foreground/60`,pulse:`bg-muted-foreground/50`,animate:!1},b=v===`running`?`Availability state is running — the asset is available and in service.`:v===`faulted`?`Availability state is faulted — the asset is unavailable because a fault is active.`:v===`stopped`?`Availability state is stopped — the asset is available but not running.`:`Availability state is not available for this asset yet.`;return(0,K.jsxs)(`header`,{className:R(ge,`flex w-full min-w-0 flex-col`),children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 px-5 py-4 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:a,className:`transition-colors hover:text-foreground`,children:`Assets`}),(0,K.jsx)(`span`,{"aria-hidden":!0,children:`/`}),(0,K.jsx)(`span`,{className:`truncate`,children:N(e.assetType)})]}),(0,K.jsx)(G.ViewTransition,{name:`asset-${e.id}`,default:`none`,children:(0,K.jsx)(`h1`,{className:`font-heading mt-1 text-2xl font-semibold uppercase leading-tight tracking-wide`,children:c(e.id).label})}),(0,K.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-1.5`,children:[(0,K.jsx)(`p`,{className:`m-0 min-w-0 flex-1 font-mono text-[10px] leading-tight tracking-tight text-muted-foreground`,children:(0,K.jsx)(`span`,{className:`break-all`,children:e.browsePath.join(` / `)})}),(0,K.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,K.jsx)(s,{value:ie(e.browsePath),label:`Copy Topic / UNS path`})})]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 self-end font-mono text-xs sm:self-start`,children:[(0,K.jsx)(i,{className:`size-3.5 animate-pulse text-primary`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`font-medium text-primary`,children:`LIVE`}),(0,K.jsxs)(`span`,{className:`tabular-nums text-muted-foreground`,children:[`t=`,t]}),(0,K.jsxs)(U,{children:[(0,K.jsx)(V,{render:(0,K.jsx)(`span`,{className:`inline-flex size-3.5 items-center justify-center outline-none focus-visible:ring-2 focus-visible:ring-ring`}),children:(0,K.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 shrink-0 items-center justify-center`,children:[(0,K.jsx)(`span`,{className:R(`relative inline-flex size-1.5 rounded-full`,y.dot)}),y.animate&&(0,K.jsx)(`span`,{className:R(`absolute inline-flex size-2.5 animate-ping rounded-full opacity-75`,y.pulse)})]})}),(0,K.jsx)(H,{side:`top`,align:`end`,children:(0,K.jsxs)(`span`,{className:`block max-w-[16rem] text-[11px] leading-snug`,children:[(0,K.jsx)(`span`,{className:`font-medium uppercase tracking-[0.08em]`,children:`Availability`}),` `,(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[`— `,b]})]})})]})]})]}),(0,K.jsxs)(`fieldset`,{"aria-label":`Asset status`,className:`m-0 flex flex-col border-0 border-t border-border/50 p-0`,children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-px bg-transparent`,children:[(0,K.jsx)(q,{variant:`primary`,icon:z,label:`Health`,value:f,tone:p,tooltip:`Rolls up active faults and quarantine into a single status — OK when nothing is asserted, FAULT when any fault is active, QRTN when the asset is excluded from the running factory.`}),(0,K.jsx)(q,{variant:`primary`,icon:B,label:`Active faults`,labelCompact:`Faults`,value:String(u),tone:u>0?`bad`:`neutral`,tooltip:`Fault codes currently asserted on this asset. Clear or inject faults from the Alarms section below.`})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-px border-t border-border/50 bg-transparent sm:grid-cols-4`,children:[(0,K.jsx)(q,{variant:`compact`,icon:ve,label:`Lifecycle`,labelCompact:`Life`,value:D(e.lifecycleStage),tone:E(e.lifecycleStage),tooltip:`Where this asset sits in its operational lifecycle (e.g. commissioning, operating, maintenance, retired).`}),(0,K.jsx)(q,{variant:`compact`,icon:l,label:`Tags`,value:String(h),tone:`neutral`,tooltip:`Total members exposed by this asset — process variables, state flags, counters, commands, and reference fields combined.`}),(0,K.jsx)(q,{variant:`compact`,icon:ye,label:`Bad quality`,value:String(m),tone:m>0?`warn`:`neutral`,tooltip:`Members whose quality stamp is anything other than good (uncertain or bad). A healthy asset reads 0.`}),(0,K.jsx)(q,{variant:`compact`,icon:be,label:`Operating age`,value:j(e.operatingHours),tone:`neutral`,tooltip:`Total operating age on this asset, including any factory-seeded starting hours plus simulated runtime elapsed in this session.`})]})]})]})}function q({icon:e,label:t,labelCompact:n,value:r,suffix:i,tone:a,variant:o=`compact`,tooltip:s}){let c=o===`primary`;return(0,K.jsxs)(`div`,{className:R(`relative flex min-w-0 flex-col justify-center`,c?`min-h-20 gap-1.5 px-4 py-4 sm:min-h-24 sm:px-6 sm:py-5 lg:min-h-28 lg:px-8`:`min-h-12 gap-1 px-3 py-2.5 sm:min-h-13 sm:px-4 lg:min-h-14 lg:px-5`),children:[(0,K.jsx)(`div`,{className:`flex min-h-0 min-w-0 items-center gap-2`,children:(0,K.jsxs)(U,{children:[(0,K.jsxs)(V,{className:`flex min-h-0 min-w-0 flex-1 cursor-default items-center gap-2 text-left`,render:(0,K.jsx)(`div`,{}),children:[(0,K.jsx)(e,{className:R(`shrink-0 text-muted-foreground`,c?`size-4`:`size-3.5`),"aria-hidden":!0}),(0,K.jsxs)(`span`,{className:R(`min-w-0 flex-1 font-medium tracking-wide text-muted-foreground uppercase 2xl:tracking-wider`,c?`text-[11px] leading-snug sm:text-[12px]`:`text-[9px] leading-snug sm:text-[10px]`),children:[(0,K.jsx)(`span`,{className:`block wrap-break-word 2xl:hidden`,children:n??t}),(0,K.jsx)(`span`,{className:`hidden wrap-break-word 2xl:block`,children:t})]})]}),(0,K.jsx)(H,{side:`top`,align:`start`,sideOffset:6,className:`max-w-xs`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:s??t})]})})]})}),(0,K.jsxs)(`p`,{className:R(`min-w-0 wrap-break-word font-mono font-semibold leading-tight tracking-tight tabular-nums`,c?`text-2xl sm:text-3xl lg:text-4xl`:`text-base lg:text-lg`,a===`ok`&&`text-success`,a===`warn`&&`text-warning`,a===`bad`&&`text-destructive`,a===`neutral`&&`text-foreground`),children:[r,i?(0,K.jsx)(`span`,{className:R(`ml-0.5 font-medium text-muted-foreground`,c?`text-base lg:text-lg`:`text-xs lg:text-sm`),children:i}):null]})]})}function J({title:e,subtitle:t,children:n,className:r,id:i}){return(0,K.jsxs)(`section`,{id:i,className:R(he,r),children:[(0,K.jsxs)(`div`,{className:`border-b border-border/60 px-4 py-3`,children:[(0,K.jsx)(`h2`,{className:`blueprint-title text-foreground`,children:e}),t?(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t}):null]}),(0,K.jsx)(`div`,{className:`overflow-hidden p-0`,children:n})]})}var Se=new Set([`pu`,`h`]),Ce=[`_reference`,`_baseline`,`_setpoint`,`_command`],Y=`var(--color-primary)`,we=`var(--color-background)`,Te=60,Ee=1e-4;function X(e,t,n){let r=e?.get(t);return{value:r?.value??n.value,quality:r?.quality??n.quality}}function De(e){return Object.entries(e.members).filter(([e,t])=>t.meta.kind===`variable`&&t.meta.access===`read`&&t.meta.dataType===`Double`&&t.meta.euRange!==null&&!Se.has(t.meta.unit??``)&&!Ce.some(t=>e.endsWith(t)))}function Oe(e,t){if(e.length<2)return!1;let n=t-Te,r;for(let t of e)if(!(t.tick<n)){if(r===void 0)r=t.value;else if(Math.abs(t.value-r)>Ee)return!0}return!1}function ke({data:e,chartHeight:t=34,live:n=!1}){let r=(0,G.useId)(),[i,a]=(0,G.useState)(null),o=1/0,s=-1/0;for(let t of e)t.value<o&&(o=t.value),t.value>s&&(s=t.value);let c=e[e.length-1],l=t+14;return(0,K.jsxs)(`div`,{className:`flex min-h-0 w-full flex-col overflow-hidden`,style:{height:l},children:[(0,K.jsx)(`div`,{style:{height:t,width:`100%`},children:(0,K.jsx)(y,{width:`100%`,height:t,children:(0,K.jsxs)(ee,{data:e,margin:{top:3,right:4,bottom:2,left:0},onMouseMove:e=>{let t=e?.activePayload?.[0]?.value;typeof t==`number`&&a(t)},onMouseLeave:()=>a(null),children:[(0,K.jsx)(`defs`,{children:(0,K.jsxs)(`linearGradient`,{id:r,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,K.jsx)(`stop`,{offset:`0%`,stopColor:Y,stopOpacity:.32}),(0,K.jsx)(`stop`,{offset:`100%`,stopColor:Y,stopOpacity:0})]})}),(0,K.jsx)(S,{domain:[`auto`,`auto`],hide:!0}),(0,K.jsx)(C,{content:()=>null,cursor:!1}),(0,K.jsx)(w,{type:`monotone`,dataKey:`value`,stroke:Y,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`url(#${r})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,fill:Y,stroke:we,strokeWidth:1}}),c?(0,K.jsx)(x,{x:c.tick,y:c.value,r:2.25,fill:Y,stroke:we,strokeWidth:1.25,isFront:!0,ifOverflow:`extendDomain`}):null]})})}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] leading-none tabular-nums text-muted-foreground`,children:[n?(0,K.jsxs)(`span`,{"aria-hidden":!0,className:`relative inline-flex size-1.5 shrink-0 items-center justify-center`,children:[(0,K.jsx)(`span`,{className:`absolute inline-flex size-2 animate-ping rounded-full bg-primary/50`}),(0,K.jsx)(`span`,{className:`relative inline-flex size-1.5 rounded-full bg-primary`})]}):null,i===null?(0,K.jsxs)(`span`,{children:[O(o),`–`,O(s)]}):(0,K.jsx)(`span`,{className:`font-medium text-primary`,children:O(i)})]})]})}function Ae({detail:e,processVariables:t,memberValues:n,historyRef:r,tick:i,showQuality:a}){let{liveMap:o,orderedVariables:c}=(0,G.useMemo)(()=>{let e=new Map,n=[],a=[];for(let o of t){let t=Oe(r.current.get(o[0])??[],i);e.set(o[0],t),(t?n:a).push(o)}return{liveMap:e,orderedVariables:[...n,...a]}},[t,n,i,r]);return t.length===0?(0,K.jsx)(J,{title:`Process`,subtitle:`No continuous analog readings defined for this asset`,className:`opacity-90`,children:(0,K.jsx)(`p`,{className:`px-4 py-6 text-center text-sm text-muted-foreground`,children:`This asset exposes no continuous process variables. Discrete states, flags, and commands are available in the Tags section below.`})}):(0,K.jsx)(J,{title:`Process`,subtitle:`Live tag readings — trend is ~2 min at 1 Hz`,children:(0,K.jsx)(`ul`,{className:`divide-y divide-border/40`,children:c.map(([t,i])=>{let{value:c,quality:l}=X(n,t,i),u=r.current.get(t)??[],d=ae(e.browsePath,t),f=o.get(t)??!1,p=u.length>=2,m=T(i.meta.unit),h=k(t);return(0,K.jsxs)(v.li,{layout:`position`,transition:{duration:.36,ease:[.22,1,.36,1]},className:`flex flex-col gap-2.5 bg-background px-4 py-3 sm:flex-row sm:items-center sm:gap-5 sm:py-3.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 sm:w-44 sm:shrink-0`,children:[(0,K.jsxs)(U,{children:[(0,K.jsx)(V,{className:`min-w-0 flex-1 cursor-default truncate text-left text-[11px] font-medium uppercase tracking-[var(--miravo-tracking-eyebrow)] text-muted-foreground`,render:(0,K.jsx)(`span`,{}),children:h}),(0,K.jsx)(H,{side:`top`,align:`start`,className:`max-w-xs`,children:h})]}),(0,K.jsx)(s,{value:d,label:`Copy Topic / UNS path`})]}),(0,K.jsxs)(`div`,{className:`relative h-[56px] min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-x-0 top-1/2 h-px -translate-y-1/2 bg-border/30`}),p?(0,K.jsx)(ke,{data:u,chartHeight:42,live:f}):(0,K.jsx)(`p`,{className:`flex h-full items-center text-[10px] uppercase tracking-widest text-muted-foreground`,children:`Collecting trend…`})]}),(0,K.jsxs)(`div`,{className:`flex items-baseline gap-2 sm:min-w-36 sm:shrink-0 sm:justify-end`,children:[(0,K.jsx)(`span`,{className:`blueprint-stat text-2xl font-semibold leading-none tabular-nums text-foreground`,children:typeof c==`number`?O(c):String(c)}),m&&(0,K.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:m}),a&&l!==`good`&&(0,K.jsx)(W,{variant:l===`uncertain`?`secondary`:`destructive`,className:`shrink-0 text-[10px]`,children:l})]})]},t)})})})}function je({name:e,value:t,dataType:n,unit:r,access:i}){let a=k(e),o=i===`readwrite`;if(n===`Boolean`||typeof t==`boolean`||r===`pu`&&(t===0||t===1)){let n=t===!0||t===`true`||t===1,r=e.includes(`fault`);return(0,K.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] border px-2 py-1 ${r&&n?`border-destructive/30 bg-transparent`:``}`,children:[(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left text-[10px] leading-snug text-muted-foreground`,children:[a,o&&(0,K.jsx)(`span`,{className:`ml-1 text-[8px] text-primary`,children:`CMD`})]}),(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-xs font-medium tabular-nums ${r&&n?`text-destructive`:n?`text-success`:`text-muted-foreground`}`,children:n?`ON`:`OFF`})]})}if(n===`String`){let n=String(t),r=n===`none`||n===``,i=A.has(n)||e.includes(`fault_code`)&&!r,o=!i&&M.has(n);return(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col justify-center gap-1 rounded-[var(--miravo-radius-tight)] border px-2 py-2 ${i?`border-destructive/30 bg-transparent`:o?`border-warning/30 bg-warning/5`:``}`,children:[(0,K.jsx)(`span`,{className:`wrap-break-word text-[10px] leading-tight text-muted-foreground`,children:a}),r?(0,K.jsx)(`span`,{className:`wrap-break-word font-mono text-sm font-medium leading-snug text-muted-foreground`,children:`—`}):(0,K.jsx)(`span`,{title:n,className:`wrap-break-word font-mono text-sm font-medium leading-snug ${i?`text-destructive`:o?`text-warning`:`text-foreground`}`,children:D(n)})]})}return(0,K.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] border px-2 py-1`,children:[(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left text-[10px] leading-snug text-muted-foreground`,children:[a,o&&(0,K.jsx)(`span`,{className:`ml-1 text-[8px] text-primary`,children:`CMD`})]}),(0,K.jsxs)(`span`,{className:`shrink-0 text-right font-mono text-xs font-medium tabular-nums`,children:[typeof t==`number`?O(t):String(t),r&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:T(r)})]})]})}function Z(e){return[...e].sort((e,t)=>{let n=e[1].meta.access===`readwrite`;return n===(t[1].meta.access===`readwrite`)?e[0].localeCompare(t[0]):n?-1:1})}function Me({stringEnumMembers:e,nonStringOperationalMembers:t,memberValues:n,className:r}){let i=(0,G.useMemo)(()=>Z(e),[e]),a=(0,G.useMemo)(()=>Z(t),[t]),o=`grid min-w-0 gap-2 [grid-template-columns:repeat(auto-fill,minmax(min(100%,12.5rem),1fr))]`;return(0,K.jsx)(J,{title:`Tags`,subtitle:`Mode, status flags, and control tags`,className:r,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5 p-4`,children:[i.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a.length>0&&(0,K.jsx)(`h3`,{className:`blueprint-title text-muted-foreground`,children:`States`}),(0,K.jsx)(`div`,{className:o,children:i.map(([e,t])=>{let{value:r}=X(n,e,t);return(0,K.jsx)(je,{name:e,value:r,dataType:t.meta.dataType,unit:t.meta.unit,access:t.meta.access},e)})})]}),a.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.length>0&&(0,K.jsx)(`h3`,{className:`blueprint-title text-muted-foreground`,children:`Flags & commands`}),(0,K.jsx)(`div`,{className:o,children:a.map(([e,t])=>{let{value:r}=X(n,e,t);return(0,K.jsx)(je,{name:e,value:r,dataType:t.meta.dataType,unit:t.meta.unit,access:t.meta.access},e)})})]})]})})}function Q({className:e,counters:t,memberValues:n}){return(0,K.jsx)(J,{title:`Counters`,subtitle:`Totals, hours, and accumulators`,className:e,children:(0,K.jsx)(`div`,{className:`flex flex-col gap-2 p-4`,children:t.map(([e,t])=>{let{value:r}=X(n,e,t);return(0,K.jsxs)(`div`,{className:`flex items-center justify-between rounded-[var(--miravo-radius-tight)] border border-border/60 bg-transparent px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:k(e)}),(0,K.jsxs)(`span`,{className:`blueprint-stat text-sm font-medium`,children:[typeof r==`number`?O(r):String(r),t.meta.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:T(t.meta.unit)})]})]},e)})})})}function $({className:e,detail:t,referenceMembers:n,memberValues:r}){let i=Object.keys(t.parameters).length>0,a=n.length>0;return!i&&!a?null:(0,K.jsx)(J,{title:`Nameplate & configuration`,subtitle:`Design parameters, identity, and reference values`,className:e,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[i&&(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Object.entries(t.parameters).map(([e,t])=>(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5 py-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:k(e)}),(0,K.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof t.value==`number`?O(t.value):String(t.value),t.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:T(t.unit)})]})]},e))}),a&&(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:n.map(([e,t])=>{let{value:n}=X(r,e,t);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-[var(--miravo-radius-tight)] border border-border/60 bg-transparent p-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:k(e)}),(0,K.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof n==`number`?O(n):String(n),t.meta.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:T(t.meta.unit)})]})]},e)})})]})})}function Ne({detail:e,memberValues:t}){if(!e.members.state_label)return null;let n=n=>t?.get(n)?.value??e.members[n]?.value;return(0,K.jsxs)(`section`,{className:`flex flex-wrap items-center gap-3 text-sm`,"aria-label":`Station production`,children:[(0,K.jsx)(W,{variant:`secondary`,children:String(n(`state_label`)??`idle`)}),(0,K.jsxs)(`span`,{children:[`Good: `,O(Number(n(`good_count`)??0))]}),(0,K.jsxs)(`span`,{children:[`Scrap: `,O(Number(n(`scrap_count`)??0))]}),n(`stop_reason`)&&(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:String(n(`stop_reason`))})]})}var Pe=120,Fe=`gap-4 sm:gap-5 lg:gap-x-6 lg:gap-y-5 xl:gap-x-8`,Ie=`asset-detail-page relative isolate mx-auto flex min-h-full w-full max-w-screen-2xl flex-col gap-6 p-4 sm:gap-8 sm:p-6`;function Le(e){return e instanceof Error&&`code`in e&&e.code===`NOT_FOUND`||e instanceof Error&&/^404\b/.test(e.message.trim())}function Re(){let{id:e}=ne(),i=te(),o=(0,G.useCallback)(()=>{(0,G.startTransition)(()=>{(0,G.addTransitionType)(c),i(`/?tab=assets`)})},[i]),[s,y]=(0,G.useState)(!1),[b,x]=m(`tab`,h([`hmi`,`operate`,`data`,`operations`]).withDefault(`hmi`)),S=b===`data`||b===`operations`?`operate`:b;(0,G.useEffect)(()=>{(b===`data`||b===`operations`)&&x(`operate`)},[b,x]);let C=(0,G.useCallback)(e=>{x(`operate`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})})})},[x]);(0,G.useEffect)(()=>{let e=null,t=!1,n=()=>{t=!1,e&&=(clearTimeout(e),null)},r=r=>{if(r.metaKey||r.ctrlKey||r.altKey)return;let i=r.target;if(i){let e=i.tagName;if(e===`INPUT`||e===`TEXTAREA`||e===`SELECT`||i.isContentEditable)return}t?(r.key===`f`?(C(`faults`),r.preventDefault()):r.key===`c`&&(C(`commands`),r.preventDefault()),n()):r.key===`g`?(t=!0,e=setTimeout(n,1200)):r.key===`b`&&!r.shiftKey?(o(),r.preventDefault()):r.key===`?`&&(y(!0),r.preventDefault())};return window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`keydown`,r),n()}},[o,C]);let w=t({queryKey:me.assets.detail(e??``),queryFn:()=>pe(`/assets/${e}`,fe.assetDetail),enabled:e!==void 0}),ee=w.data??null,T=(0,G.useDeferredValue)(ee),ie=w.isError,E=I(t=>e?t.memberValues.get(e):void 0),D=I(e=>e.models),O=I(e=>e.assets),k=(0,G.useMemo)(()=>O.find(t=>t.id===e),[O,e]),ae=k?.activeFaults,A=(0,G.useRef)(new Map),j=I(e=>e.tick);(0,G.useEffect)(()=>{if(!E||!e)return;let t=A.current;for(let[e,n]of E){if(typeof n.value!=`number`)continue;let r=t.get(e)??[];if(r[r.length-1]?.tick===j)continue;let i=r.length>=Pe?r.slice(r.length-Pe+1):r;t.set(e,[...i,{value:n.value,tick:j}])}},[E,j,e]);let M=(0,G.useMemo)(()=>T?De(T):[],[T]),N=(0,G.useMemo)(()=>{if(!T)return{operational:[],counters:[],reference:[]};let e=new Set(M.map(([e])=>e)),t=Object.entries(T.members).filter(([t])=>!e.has(t)),n=[],r=[],i=[];for(let e of t){let[,t]=e,a=t.meta.dataType,o=t.meta.kind,s=t.meta.unit,c=s===`pu`&&t.meta.euRange?.[0]===0&&t.meta.euRange?.[1]===1;o===`property`?i.push(e):a===`Boolean`||a===`String`||c?n.push(e):s===`count`||a===`UInt16`||a===`UInt32`?r.push(e):t.meta.access===`readwrite`||Ce.some(t=>e[0].endsWith(t))?n.push(e):s===`pu`||s===`h`?r.push(e):i.push(e)}return{operational:n,counters:r,reference:i}},[T,M]),oe=(0,G.useMemo)(()=>T?D.find(e=>e.name===T.assetType)?.faultNames??[]:[],[T,D]),P=ae??T?.activeFaults??[],se=(0,G.useMemo)(()=>{if(!E)return P.length>0;for(let[,e]of E)if(e.quality!==`good`)return!0;return!1},[E,P.length]),F=(0,G.useMemo)(()=>N.operational.filter(([,e])=>e.meta.dataType===`String`),[N.operational]),ge=(0,G.useMemo)(()=>N.operational.filter(([,e])=>e.meta.dataType!==`String`),[N.operational]),L=ce(e,T,()=>w.refetch());if(!T){if(ie)return Le(w.error)?(0,K.jsx)(a,{className:`min-h-full`,children:(0,K.jsx)(`div`,{className:`flex min-h-[40vh] items-center justify-center p-6 sm:p-12`,children:(0,K.jsx)(`div`,{className:`w-full max-w-md`,children:(0,K.jsxs)(n,{eyebrow:`Asset lookup`,stamp:`404`,title:`Asset not found`,detail:e??`Unknown asset id`,detailLabel:`Requested asset`,primaryLabel:`Back to Assets`,onPrimary:o,children:[(0,K.jsx)(`p`,{children:`The requested asset is no longer in the running factory or the URL is wrong.`}),(0,K.jsx)(`p`,{children:`Return to Assets and pick a live asset from the current factory.`})]})})})}):(0,K.jsx)(a,{className:`min-h-full`,children:(0,K.jsxs)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center gap-4 p-6 sm:p-12`,children:[(0,K.jsx)(`div`,{className:`w-full max-w-md`,children:(0,K.jsx)(p,{message:f(w.error,`Could not load asset.`),onRetry:()=>void w.refetch(),isRetrying:w.isFetching})}),(0,K.jsx)(re,{variant:`outline`,size:`sm`,onClick:o,children:`Back to Assets`})]})});if(k){let e={id:k.id,assetType:k.model,browsePath:k.browsePath,lifecycleStage:k.lifecycleStage,operatingHours:k.operatingHours,activeFaults:k.activeFaults,isQuarantined:k.isQuarantined,parameters:{},controls:{members:[],methods:[],faults:[]},inputs:{},members:{},methods:{}};return(0,K.jsx)(`div`,{className:Ie,children:(0,K.jsx)(xe,{detail:e,tick:j,activeFaults:P,memberValues:E,onBack:o})})}return null}let z=N.operational.length>0,B=N.counters.length>0,V=N.reference.length>0||Object.keys(T.parameters).length>0,H=z||B||V,U=Object.keys(T.methods).length>0,_e=z&&!B&&!V,W=z&&B&&V;return(0,K.jsxs)(`div`,{className:Ie,children:[(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 -z-10 hidden select-none overflow-hidden md:block`,children:(0,K.jsx)(`span`,{className:`absolute -top-2 left-0 whitespace-nowrap uppercase leading-none opacity-35 blur-[2px]`,style:{fontFamily:`var(--miravo-font-heading)`,fontSize:`clamp(5rem, 14vw, 12rem)`,fontWeight:`var(--miravo-weight-medium)`,letterSpacing:`var(--miravo-tracking-heading)`,color:`var(--miravo-ghost)`},children:T.assetType.replace(/_/g,` `)})}),(0,K.jsx)(xe,{detail:T,tick:j,activeFaults:P,memberValues:E,onBack:o}),(0,K.jsx)(Ne,{detail:T,memberValues:E}),(0,K.jsx)(G.ViewTransition,{enter:`fade-in`,default:`none`,children:(0,K.jsxs)(d,{value:S,onValueChange:e=>{x(e)},className:`min-h-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,K.jsxs)(g,{variant:`line`,className:`h-10! min-w-max gap-0.5`,children:[(0,K.jsxs)(_,{value:`hmi`,className:`gap-1.5 px-3 text-sm`,children:[(0,K.jsx)(l,{className:`size-3.5 shrink-0`}),`HMI`]}),(0,K.jsxs)(_,{value:`operate`,className:`gap-1.5 px-3 text-sm`,children:[(0,K.jsx)(r,{className:`size-3.5 shrink-0`}),`Operate`]})]})}),(0,K.jsx)(u,{value:`hmi`,className:`flex-1 py-2`,children:(0,K.jsx)(v.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:(0,K.jsx)(Ae,{detail:T,processVariables:M,memberValues:E,historyRef:A,tick:j,showQuality:se})},`hmi`)}),(0,K.jsx)(u,{value:`operate`,className:`flex-1 py-2`,children:(0,K.jsxs)(v.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`flex min-w-0 flex-col gap-4`,children:[H&&(0,K.jsxs)(`section`,{"aria-label":`Data`,className:R(`grid min-w-0 grid-cols-1`,Fe,W&&`lg:grid-cols-2 lg:grid-rows-[auto_auto] lg:items-start`,!W&&z&&(B||V)&&`lg:grid-cols-2 lg:items-start`),children:[z&&(0,K.jsx)(Me,{stringEnumMembers:F,nonStringOperationalMembers:ge,memberValues:E,className:R(`min-h-0 min-w-0 self-stretch`,_e&&`lg:col-span-2`,W&&`lg:row-span-2`)}),!z&&B&&V&&(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-6 lg:col-span-2`,children:[(0,K.jsx)(Q,{counters:N.counters,memberValues:E}),(0,K.jsx)($,{detail:T,referenceMembers:N.reference,memberValues:E})]}),!z&&B&&!V&&(0,K.jsx)(Q,{className:`lg:col-span-2`,counters:N.counters,memberValues:E}),!z&&!B&&V&&(0,K.jsx)($,{className:`lg:col-span-2`,detail:T,referenceMembers:N.reference,memberValues:E}),z&&B&&(0,K.jsx)(Q,{className:`min-h-0 min-w-0 self-stretch lg:col-start-2 lg:row-start-1`,counters:N.counters,memberValues:E}),z&&V&&(0,K.jsx)($,{className:R(`min-h-0 min-w-0 self-stretch lg:col-start-2`,W?`lg:row-start-2`:`lg:row-start-1`),detail:T,referenceMembers:N.reference,memberValues:E})]}),(0,K.jsxs)(`section`,{"aria-label":`Operations`,className:R(he,`grid grid-cols-1`,U&&`lg:grid-cols-2`),children:[(0,K.jsx)(le,{activeFaults:P,availableFaults:oe,onTriggerFault:L.triggerFault,onClearFault:L.clearFault}),U&&(0,K.jsx)(`div`,{className:`border-t border-border/50 lg:border-l lg:border-t-0`,children:(0,K.jsx)(de,{detail:T,methodArgs:L.methodArgs,setMethodArgs:L.setMethodArgs,onInvoke:L.invoke,isPending:L.isPending,pendingMethod:L.pendingMethod})})]}),(0,K.jsx)(ue,{assetId:T.id,onRemoved:o})]},`operate`)})]})}),(0,K.jsx)(ze,{open:s,onOpenChange:y})]})}function ze({open:e,onOpenChange:t}){return(0,K.jsx)(F,{open:e,onOpenChange:t,children:(0,K.jsxs)(oe,{children:[(0,K.jsx)(P,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Keyboard shortcuts`}),(0,K.jsx)(se,{className:`text-sm text-muted-foreground`,children:`Navigate this asset without leaving the keyboard.`}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-2 pt-1`,children:[{keys:[`g`,`f`],label:`Jump to Alarms`},{keys:[`g`,`c`],label:`Jump to Commands`},{keys:[`b`],label:`Back to Assets`},{keys:[`?`],label:`Show this sheet`}].map(e=>(0,K.jsxs)(`li`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`span`,{className:`text-sm text-foreground`,children:e.label}),(0,K.jsx)(`span`,{className:`flex items-center gap-1`,children:e.keys.map((t,n)=>(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`kbd`,{className:`rounded-[var(--miravo-radius-tight)] border border-border bg-muted/40 px-1.5 py-0.5 font-mono text-[11px] font-medium text-foreground`,children:t}),n<e.keys.length-1&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`then`})]},`${e.label}-${t}`))})]},e.label))})]})})}export{Re as AssetDetailPage};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{c as t}from"./vendor-charts-Bquh2dWE.js";import{ot as n}from"./vendor-ui-BGeFlRLR.js";import{Tt as r}from"./api-D5UYWJSO.js";import{i,n as a,o,r as s,t as c}from"./dialog-BYkdndf9.js";import{C as l,S as u,c as d}from"./format-YLUJ7AXt.js";import{t as f}from"./utils-D6wrZy-b.js";import{n as p,t as m}from"./circle-x-BRkh0A1P.js";import{t as h}from"./loader-circle-w3T2fxvn.js";import{d as g,t as _}from"./use-engine-command-mutation-Cnafi1c5.js";import{t as v}from"./trash-2-BAh5-hxl.js";import{t as y}from"./triangle-alert-3Ab-dBrN.js";import{a as b,i as x,o as S}from"./validation-CwIpPs-E.js";import{i as C,n as w,t as T}from"./tooltip-Dfmuq2yz.js";import{t as E}from"./badge-CdRB4Nd_.js";import{r as D}from"./runtime-link-D88Db2wY.js";var O=e(t(),1);function k(e,t,n){let[r,i]=(0,O.useState)({}),[a,o]=(0,O.useState)(null),s=_();(0,O.useEffect)(()=>{s.isPending||o(null)},[s.isPending]);let c=e=>{s.mutateAsync(e).then(n).catch(()=>{})};return{methodArgs:r,setMethodArgs:i,pendingMethod:a,isPending:s.isPending,invoke:n=>{if(!e)return;let i={},a=t?.methods[n];if(a)for(let e of a.inputArguments){let t=r[n]?.[e.name]??``,a=x(e.name,t,e.dataType);if(!a)return;i[e.name]=a.value}o(n),c({type:`invokeMethod`,assetId:e,method:n,arguments:i})},triggerFault:t=>{e&&c({type:`triggerFault`,assetId:e,fault:t})},clearFault:t=>{e&&c({type:`clearFault`,assetId:e,fault:t})}}}var A=n(),j=`bg-transparent bg-transparent`,M=`blueprint-title text-foreground`;function N(e,t){return t.includes(`rpm`)||t.includes(`speed`)?`e.g. 2500`:t.includes(`temp`)?`e.g. 70.0`:t.includes(`pressure`)?`e.g. 4.5`:e===`Boolean`?`true / false`:e===`String`?`value`:`e.g. 100`}function P({detail:e,methodArgs:t,setMethodArgs:n,onInvoke:i,isPending:a=!1,pendingMethod:o=null}){let s=r(e=>D(e.connectionState)!==null),c=Object.entries(e.methods);if(c.length===0)return null;let p=c.filter(([,e])=>e.inputArguments.length===0),m=c.filter(([,e])=>e.inputArguments.length>0);return(0,A.jsxs)(`div`,{id:`commands`,className:`flex min-w-0 flex-col gap-3 p-4`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,A.jsx)(`h2`,{className:M,children:`Commands`}),(0,A.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:`Executable methods on this asset`})]}),p.length>0&&(0,A.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:p.map(([e,t])=>{let n=o===e&&a,r=n?h:g;return t.description?(0,A.jsxs)(T,{children:[(0,A.jsx)(C,{render:(0,A.jsxs)(l,{size:`sm`,variant:`outline`,disabled:a||s,title:e,className:f(`h-8 gap-1.5 font-mono text-xs`,j),onClick:()=>i(e),children:[(0,A.jsx)(r,{className:f(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),d(e)]})}),(0,A.jsx)(w,{side:`bottom`,className:`max-w-xs`,children:t.description})]},e):(0,A.jsxs)(l,{size:`sm`,variant:`outline`,disabled:a||s,title:e,className:f(`h-8 gap-1.5 font-mono text-xs`,j),onClick:()=>i(e),children:[(0,A.jsx)(r,{className:f(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),d(e)]},e)})}),m.length>0&&p.length>0&&(0,A.jsx)(S,{className:`bg-border/60`}),m.map(([e,r])=>{let c=o===e&&a;return(0,A.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{title:e,className:`font-mono text-sm font-medium`,children:d(e)}),r.description&&(0,A.jsx)(`p`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:r.description})]}),(0,A.jsxs)(l,{size:`sm`,variant:`default`,disabled:a||s,className:`shrink-0`,onClick:()=>i(e),children:[c?(0,A.jsx)(h,{className:`mr-1 size-3 animate-spin`,"aria-hidden":!0}):(0,A.jsx)(g,{className:`mr-1 size-3`,"aria-hidden":!0}),`Execute`]})]}),(0,A.jsx)(`div`,{className:`mt-3 flex flex-col gap-1.5 border-t border-border/50 pt-3`,children:r.inputArguments.map(r=>(0,A.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,A.jsx)(`span`,{title:r.name,className:`w-28 shrink-0 truncate pt-1.5 font-mono text-[10px] leading-tight text-muted-foreground`,children:d(r.name)}),(0,A.jsx)(u,{className:`h-7 flex-1 font-mono text-xs`,placeholder:N(r.dataType,r.name),value:t[e]?.[r.name]??``,onChange:t=>n(n=>({...n,[e]:{...n[e],[r.name]:t.target.value}}))})]},r.name))})]},e)})]})}function F({activeFaults:e,availableFaults:t,onTriggerFault:n,onClearFault:u}){let h=r(e=>D(e.connectionState)!==null),g=e.length>0,[_,v]=(0,O.useState)(null);return(0,A.jsxs)(`div`,{id:`faults`,className:`flex min-w-0 flex-col gap-3 p-4`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,A.jsx)(`h2`,{className:M,children:`Alarms`}),(0,A.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:`Active faults and injectable failure modes (factory)`})]}),g?(0,A.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(e=>(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[var(--miravo-radius-tight)] border border-destructive/30 bg-transparent py-2.5 pl-3 pr-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(y,{className:`size-4 shrink-0 text-destructive`}),(0,A.jsx)(`span`,{title:e,className:`font-mono text-sm font-medium text-destructive`,children:d(e)})]}),(0,A.jsxs)(l,{size:`sm`,variant:`outline`,className:f(`h-8 shrink-0 gap-1 border-destructive/30 px-2.5 font-mono text-[0.75rem] text-destructive shadow-none`,`hover:border-destructive/45 hover:bg-destructive/5 hover:text-destructive`,`focus-visible:border-destructive/40 focus-visible:ring-destructive/20`,j),disabled:h,onClick:()=>u(e),children:[(0,A.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),`Clear`]})]},e))}):(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,A.jsx)(p,{className:`size-4 text-success`}),`All clear — no active faults`]}),t.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(S,{className:`bg-border/60`}),(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`p`,{className:f(M,`mb-2`),children:[`Inject fault`,(0,A.jsxs)(E,{variant:`secondary`,className:`ml-2 text-[10px]`,children:[t.filter(t=>!e.includes(t)).length,` available`]})]}),(0,A.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.filter(t=>!e.includes(t)).map(e=>(0,A.jsx)(l,{size:`sm`,variant:`outline`,title:e,className:f(`h-7 font-mono text-[10px]`,j),onClick:()=>v(e),children:d(e)},e))})]})]}),(0,A.jsx)(c,{open:_!==null,onOpenChange:e=>{e||v(null)},children:(0,A.jsxs)(a,{children:[(0,A.jsx)(o,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Inject fault?`}),(0,A.jsxs)(s,{className:`text-sm text-muted-foreground`,children:[`This asserts`,` `,(0,A.jsx)(`span`,{title:_??void 0,className:`font-mono text-foreground`,children:_?d(_):``}),` `,`on the running factory. Downstream consumers will see the fault immediately. Clear it from the active list when you're done.`]}),(0,A.jsx)(b,{}),(0,A.jsxs)(i,{children:[(0,A.jsx)(l,{variant:`outline`,onClick:()=>v(null),children:`Cancel`}),(0,A.jsxs)(l,{variant:`destructive`,onClick:()=>{_&&n(_),v(null)},disabled:h,children:[(0,A.jsx)(y,{className:`mr-1 size-3.5`,"aria-hidden":!0}),`Inject fault`]})]})]})})]})}function I({assetId:e,onRemoved:t}){let[n,u]=(0,O.useState)(!1),[d,f]=(0,O.useState)(!1),p=_(),m=r(t=>t.templates.find(t=>t.assetIds.includes(e))),h=r(t=>t.lines.find(t=>t.stations.some(t=>t.id===e))?.line);return h?(0,A.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border p-4`,children:[(0,A.jsx)(`h2`,{className:M,children:`Remove asset`}),(0,A.jsxs)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:[`This asset is a station on line `,h,`. Unload`,` `,m?.templateName??`its template`,` to remove the line.`]})]}):(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`h2`,{className:M,children:`Remove asset`}),(0,A.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:m?`Removes this asset from the running factory. ${m.templateName} stays loaded without it.`:`Removes this standalone asset from the running factory.`})]}),(0,A.jsxs)(l,{size:`sm`,variant:`destructive`,className:`shrink-0`,onClick:()=>u(!0),children:[(0,A.jsx)(v,{className:`mr-1 size-3.5`,"aria-hidden":!0}),`Remove`]}),(0,A.jsx)(c,{open:n,onOpenChange:u,children:(0,A.jsxs)(a,{children:[(0,A.jsxs)(o,{className:`font-heading text-lg font-semibold tracking-tight`,children:[`Remove `,e,`?`]}),(0,A.jsx)(s,{className:`text-sm text-muted-foreground`,children:`The asset and its live values are removed from the factory. With persistence on, the change is saved.`}),(0,A.jsx)(b,{}),(0,A.jsxs)(i,{children:[(0,A.jsx)(l,{variant:`outline`,onClick:()=>u(!1),disabled:d,children:`Cancel`}),(0,A.jsx)(l,{variant:`destructive`,onClick:async()=>{f(!0);try{await p.mutateAsync({type:`removeAsset`,assetId:e}),u(!1),t()}catch{}finally{f(!1)}},disabled:p.isDisabled||d,children:`Remove asset`})]})]})})]})}export{k as i,F as n,I as r,P as t};
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{c as t}from"./vendor-charts-Bquh2dWE.js";import{ot as n}from"./vendor-ui-BGeFlRLR.js";import{Tt as r}from"./api-eIBFsAVZ.js";import{i,n as a,o,r as s,t as c}from"./dialog-BYkdndf9.js";import{C as l,S as u,c as d}from"./format-YLUJ7AXt.js";import{t as f}from"./utils-D6wrZy-b.js";import{n as p,t as m}from"./circle-x-BRkh0A1P.js";import{t as h}from"./loader-circle-w3T2fxvn.js";import{d as g,t as _}from"./use-engine-command-mutation-CGYWQMCW.js";import{t as v}from"./trash-2-BAh5-hxl.js";import{t as y}from"./triangle-alert-3Ab-dBrN.js";import{a as b,i as x,o as S}from"./validation-B5bxoTBm.js";import{i as C,n as w,t as T}from"./tooltip-Dfmuq2yz.js";import{t as E}from"./badge-CdRB4Nd_.js";import{r as D}from"./runtime-link-D88Db2wY.js";var O=e(t(),1);function k(e,t,n){let[r,i]=(0,O.useState)({}),[a,o]=(0,O.useState)(null),s=_();(0,O.useEffect)(()=>{s.isPending||o(null)},[s.isPending]);let c=e=>{s.mutateAsync(e).then(n).catch(()=>{})};return{methodArgs:r,setMethodArgs:i,pendingMethod:a,isPending:s.isPending,invoke:n=>{if(!e)return;let i={},a=t?.methods[n];if(a)for(let e of a.inputArguments){let t=r[n]?.[e.name]??``,a=x(e.name,t,e.dataType);if(!a)return;i[e.name]=a.value}o(n),c({type:`invokeMethod`,assetId:e,method:n,arguments:i})},triggerFault:t=>{e&&c({type:`triggerFault`,assetId:e,fault:t})},clearFault:t=>{e&&c({type:`clearFault`,assetId:e,fault:t})}}}var A=n(),j=`bg-transparent bg-transparent`,M=`blueprint-title text-foreground`;function N(e,t){return t.includes(`rpm`)||t.includes(`speed`)?`e.g. 2500`:t.includes(`temp`)?`e.g. 70.0`:t.includes(`pressure`)?`e.g. 4.5`:e===`Boolean`?`true / false`:e===`String`?`value`:`e.g. 100`}function P({detail:e,methodArgs:t,setMethodArgs:n,onInvoke:i,isPending:a=!1,pendingMethod:o=null}){let s=r(e=>D(e.connectionState)!==null),c=Object.entries(e.methods);if(c.length===0)return null;let p=c.filter(([,e])=>e.inputArguments.length===0),m=c.filter(([,e])=>e.inputArguments.length>0);return(0,A.jsxs)(`div`,{id:`commands`,className:`flex min-w-0 flex-col gap-3 p-4`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,A.jsx)(`h2`,{className:M,children:`Commands`}),(0,A.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:`Executable methods on this asset`})]}),p.length>0&&(0,A.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:p.map(([e,t])=>{let n=o===e&&a,r=n?h:g;return t.description?(0,A.jsxs)(T,{children:[(0,A.jsx)(C,{render:(0,A.jsxs)(l,{size:`sm`,variant:`outline`,disabled:a||s,title:e,className:f(`h-8 gap-1.5 font-mono text-xs`,j),onClick:()=>i(e),children:[(0,A.jsx)(r,{className:f(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),d(e)]})}),(0,A.jsx)(w,{side:`bottom`,className:`max-w-xs`,children:t.description})]},e):(0,A.jsxs)(l,{size:`sm`,variant:`outline`,disabled:a||s,title:e,className:f(`h-8 gap-1.5 font-mono text-xs`,j),onClick:()=>i(e),children:[(0,A.jsx)(r,{className:f(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),d(e)]},e)})}),m.length>0&&p.length>0&&(0,A.jsx)(S,{className:`bg-border/60`}),m.map(([e,r])=>{let c=o===e&&a;return(0,A.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{title:e,className:`font-mono text-sm font-medium`,children:d(e)}),r.description&&(0,A.jsx)(`p`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:r.description})]}),(0,A.jsxs)(l,{size:`sm`,variant:`default`,disabled:a||s,className:`shrink-0`,onClick:()=>i(e),children:[c?(0,A.jsx)(h,{className:`mr-1 size-3 animate-spin`,"aria-hidden":!0}):(0,A.jsx)(g,{className:`mr-1 size-3`,"aria-hidden":!0}),`Execute`]})]}),(0,A.jsx)(`div`,{className:`mt-3 flex flex-col gap-1.5 border-t border-border/50 pt-3`,children:r.inputArguments.map(r=>(0,A.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,A.jsx)(`span`,{title:r.name,className:`w-28 shrink-0 truncate pt-1.5 font-mono text-[10px] leading-tight text-muted-foreground`,children:d(r.name)}),(0,A.jsx)(u,{className:`h-7 flex-1 font-mono text-xs`,placeholder:N(r.dataType,r.name),value:t[e]?.[r.name]??``,onChange:t=>n(n=>({...n,[e]:{...n[e],[r.name]:t.target.value}}))})]},r.name))})]},e)})]})}function F({activeFaults:e,availableFaults:t,onTriggerFault:n,onClearFault:u}){let h=r(e=>D(e.connectionState)!==null),g=e.length>0,[_,v]=(0,O.useState)(null);return(0,A.jsxs)(`div`,{id:`faults`,className:`flex min-w-0 flex-col gap-3 p-4`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,A.jsx)(`h2`,{className:M,children:`Alarms`}),(0,A.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:`Active faults and injectable failure modes (factory)`})]}),g?(0,A.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(e=>(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[var(--miravo-radius-tight)] border border-destructive/30 bg-transparent py-2.5 pl-3 pr-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(y,{className:`size-4 shrink-0 text-destructive`}),(0,A.jsx)(`span`,{title:e,className:`font-mono text-sm font-medium text-destructive`,children:d(e)})]}),(0,A.jsxs)(l,{size:`sm`,variant:`outline`,className:f(`h-8 shrink-0 gap-1 border-destructive/30 px-2.5 font-mono text-[0.75rem] text-destructive shadow-none`,`hover:border-destructive/45 hover:bg-destructive/5 hover:text-destructive`,`focus-visible:border-destructive/40 focus-visible:ring-destructive/20`,j),disabled:h,onClick:()=>u(e),children:[(0,A.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),`Clear`]})]},e))}):(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,A.jsx)(p,{className:`size-4 text-success`}),`All clear — no active faults`]}),t.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(S,{className:`bg-border/60`}),(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`p`,{className:f(M,`mb-2`),children:[`Inject fault`,(0,A.jsxs)(E,{variant:`secondary`,className:`ml-2 text-[10px]`,children:[t.filter(t=>!e.includes(t)).length,` available`]})]}),(0,A.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.filter(t=>!e.includes(t)).map(e=>(0,A.jsx)(l,{size:`sm`,variant:`outline`,title:e,className:f(`h-7 font-mono text-[10px]`,j),onClick:()=>v(e),children:d(e)},e))})]})]}),(0,A.jsx)(c,{open:_!==null,onOpenChange:e=>{e||v(null)},children:(0,A.jsxs)(a,{children:[(0,A.jsx)(o,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Inject fault?`}),(0,A.jsxs)(s,{className:`text-sm text-muted-foreground`,children:[`This asserts`,` `,(0,A.jsx)(`span`,{title:_??void 0,className:`font-mono text-foreground`,children:_?d(_):``}),` `,`on the running factory. Downstream consumers will see the fault immediately. Clear it from the active list when you're done.`]}),(0,A.jsx)(b,{}),(0,A.jsxs)(i,{children:[(0,A.jsx)(l,{variant:`outline`,onClick:()=>v(null),children:`Cancel`}),(0,A.jsxs)(l,{variant:`destructive`,onClick:()=>{_&&n(_),v(null)},disabled:h,children:[(0,A.jsx)(y,{className:`mr-1 size-3.5`,"aria-hidden":!0}),`Inject fault`]})]})]})})]})}function I({assetId:e,onRemoved:t}){let[n,u]=(0,O.useState)(!1),[d,f]=(0,O.useState)(!1),p=_(),m=r(t=>t.templates.find(t=>t.assetIds.includes(e))),h=r(t=>t.lines.find(t=>t.stations.some(t=>t.id===e))?.line);return h?(0,A.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border p-4`,children:[(0,A.jsx)(`h2`,{className:M,children:`Remove asset`}),(0,A.jsxs)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:[`This asset is a station on line `,h,`. Unload`,` `,m?.templateName??`its template`,` to remove the line.`]})]}):(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`h2`,{className:M,children:`Remove asset`}),(0,A.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:m?`Removes this asset from the running factory. ${m.templateName} stays loaded without it.`:`Removes this standalone asset from the running factory.`})]}),(0,A.jsxs)(l,{size:`sm`,variant:`destructive`,className:`shrink-0`,onClick:()=>u(!0),children:[(0,A.jsx)(v,{className:`mr-1 size-3.5`,"aria-hidden":!0}),`Remove`]}),(0,A.jsx)(c,{open:n,onOpenChange:u,children:(0,A.jsxs)(a,{children:[(0,A.jsxs)(o,{className:`font-heading text-lg font-semibold tracking-tight`,children:[`Remove `,e,`?`]}),(0,A.jsx)(s,{className:`text-sm text-muted-foreground`,children:`The asset and its live values are removed from the factory. With persistence on, the change is saved.`}),(0,A.jsx)(b,{}),(0,A.jsxs)(i,{children:[(0,A.jsx)(l,{variant:`outline`,onClick:()=>u(!1),disabled:d,children:`Cancel`}),(0,A.jsx)(l,{variant:`destructive`,onClick:async()=>{f(!0);try{await p.mutateAsync({type:`removeAsset`,assetId:e}),u(!1),t()}catch{}finally{f(!1)}},disabled:p.isDisabled||d,children:`Remove asset`})]})]})})]})}export{k as i,F as n,I as r,P as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{n as t,t as n}from"./by-path-Ba-e31Js.js";import{A as r,D as i,E as a,F as o,H as s,L as c,O as l,P as u,V as d,X as f,a as p,b as m,g as h,i as ee,j as te,k as g,n as ne,o as _,r as re,t as ie}from"./status-DQYLUbXs.js";import{c as ae}from"./vendor-charts-Bquh2dWE.js";import{r as oe,t as se}from"./chiller-r7DzAhJq.js";import{n as ce,t as le}from"./compressor-ChZLMC94.js";import{a as ue,i as v,n as de,o as fe,r as pe,s as me,t as he}from"./genset-C6_EUoFo.js";import{i as ge,n as _e,r as ve,t as ye}from"./tank-Btg5piqB.js";import{b as be,d as xe,f as Se,l as y,m as Ce}from"./dom-BxZbg3NX.js";import{t as we}from"./stages-EYRT12Yp.js";import{ot as Te}from"./vendor-ui-BGeFlRLR.js";var Ee=[[`genA`,`diesel-generator`,`power`,`gensets`,0],[`genB`,`diesel-generator`,`power`,`gensets`,1],[`genC`,`diesel-generator`,`power`,`gensets`,2],[`bulk`,`storage-tank`,`fuel`,`storage`,0],[`day`,`storage-tank`,`fuel`,`storage`,1],[`chillerA`,`industrial-chiller`,`cooling`,`chiller-plant`,0],[`chillerB`,`industrial-chiller`,`cooling`,`chiller-plant`,1],[`pumpA`,`centrifugal-pump`,`cooling`,`chilled-water`,0],[`pumpB`,`centrifugal-pump`,`cooling`,`chilled-water`,1],[`compressor`,`air-compressor`,`support`,`start-air`,0],[`fan`,`ac-induction-motor`,`support`,`ventilation`,0]],De=e=>n(Ee,e);function Oe(e){let t=(e,t,n)=>({key:e,assetId:e,name:t,kind:`utility`,area:n});return[t(e.genA,`Genset A (primary)`,`Power`),t(e.genB,`Genset B`,`Power`),t(e.genC,`Genset C (reserve)`,`Power`),t(e.bulk,`Bulk fuel tank`,`Fuel`),t(e.day,`Day tank`,`Fuel`),t(e.chillerA,`Chiller A`,`Cooling`),t(e.chillerB,`Chiller B`,`Cooling`),t(e.pumpA,`Chilled-water pump 1`,`Cooling`),t(e.pumpB,`Chilled-water pump 2`,`Cooling`),t(e.compressor,`Start-air compressor`,`Support`),t(e.fan,`Hall ventilation fan`,`Support`)]}var ke=e(ae(),1),b=64,Ae=2.2;function je(e,t,n){let{k:r,G:i,P:a,S:o,L:s,D:c,slab:l,cyl:u}=e,d=[],f=t.y+t.d,p=t.x+t.w,m=e=>s(e,{tone:`faint`}),h=[];for(let e=t.x+11;e<p-4;e+=11)h.push(r.segment([e,f,3],[e,f,55],a));for(let e=t.y+11;e<f-4;e+=11)h.push(r.segment([p,e,3],[p,e,55],a));let ee=[];for(let e of[57,59,61])ee.push(r.segment([t.x+4,f,e],[p-4,f,e],a)),ee.push(r.segment([p,t.y+4,e],[p,f-4,e],a));d.push(l({x:t.x-1.6,y:t.y-1.6,w:t.w+3.2,d:t.d+3.2,r:2},0,3,{tone:`lo`},2,.3)),d.push(o(r.slabOf(t,0,b,a,2,.6),{tone:`lo`,inner:m(h.join(``))+s(ee.join(``),{tone:`lo`})+m(r.sideSeam(t,3,a,2))})),d.push(s(r.planOutline(r.insetPlan(t,2),b,a,2),{tone:`lo`}));let te=(e,t,n,i,o)=>{d.push(l({x:e-1,y:t-1,w:n+2,d:i+2,r:1},b,3,{tone:`lo`},2,.3)),d.push(l({x:e,y:t,w:n,d:i,r:1},67,o,{tone:`mid`},2,.3));let c=[];for(let s=69;s<67+o-1;s+=2.4)c.push(r.segment([e+2,t+i,s],[e+n-2,t+i,s],a));d.push(s(c.join(``),{tone:`faint`}));let u=67+o;for(let o of[e+n*.3,e+n*.7]){let e=t+i/2,n=[r.ring(o,e,i*.36,u,a,24),r.ring(o,e,i*.16,u,a,16)];for(let t=0;t<4;t++){let s=t/4*Math.PI*2+.4;n.push(r.segment([o+Math.cos(s)*i*.16,e+Math.sin(s)*i*.16,u],[o+Math.cos(s)*i*.36,e+Math.sin(s)*i*.36,u],a))}d.push(s(n.join(``),{tone:`mid`}))}};te(t.x+12,t.y+t.d-52,34,18,10),te(t.x+60,t.y+t.d-44,34,18,10),d.push(u(t.x+t.w-16,t.y+22,4,b,11,{tone:`mid`},20),u(t.x+t.w-16,t.y+22,5,74.4,1.6,{tone:`mid`},20),l({x:t.x+14,y:t.y+14,w:14,d:10,r:.8},b,5,{tone:`mid`},2,.3));let g=t.x+6;d.push(l({x:g-1.4,y:f,w:24.8,d:.8,r:.2},0,31.8,{tone:`lo`},2,0),`<g transform="${e.front(f+.9)}"><path class="sf-plate" d="M${g} -30H${g+22}V0H${g}Z"/>${Array.from({length:9},(e,t)=>`<path class="iso-line" data-tone="faint" d="M${g} ${-(3+t*3)}H${g+22}"/>`).join(``)}<path class="iso-line" data-tone="mid" d="M${g} -30H${g+22}V0H${g}Z"/></g>`,l({x:g,y:f+.8,w:22,d:1,r:.2},0,2.4,{tone:`mid`},2,0)),d.push(l({x:g-1,y:f,w:24,d:.9,r:.2},38,16,{tone:`lo`},2,0));let ne=[];for(let e=40;e<53.5;e+=1.8)ne.push(r.segment([g+.6,f+.9,e],[g+22-.6,f+.9,e],a));d.push(s(ne.join(``),{tone:`mid`})),d.push(u(g+22+3.6,f+1.2,1.2,28,2.2,{tone:`mid`},10));let _=t.y+36;d.push(l({x:p,y:_-1.2,w:.9,d:12.4,r:.2},0,25,{tone:`lo`},2,0),l({x:p+.9,y:_,w:.5,d:10,r:.2},0,22.4,{tone:`mid`},2,0),l({x:p,y:_-3,w:4.4,d:16,r:.4},26,1.4,{tone:`mid`},2,.2),u(p+1.4,_+12.4,1.1,14,2,{tone:`mid`},10)),d.push(s(r.segment([p+1.4,_+1.2,13],[p+1.4,_+1.2,19],a)+r.segment([p+1.4,_+2,3],[p+1.4,_+9,3],a),{tone:`hi`}));let re=t.y+72;d.push(l({x:p,y:re,w:.9,d:30,r:.2},22,26,{tone:`lo`},2,0));let ie=[];for(let e=24;e<47.5;e+=1.8)ie.push(r.segment([p+.9,re+1.4,e],[p+.9,re+28.6,e],a));d.push(s(ie.join(``),{tone:`mid`}));for(let{x:t,z:r,r:s}of n){let n=i.frameAlong([t,f,r],[0,1,0]);d.push(o(i.disc(0,1.2,s+2.8,n,a),{tone:`mid`}),o(i.disc(1.2,Ae,s+1.4,n,a),{tone:`mid`}),c([0,1,2,3,4,5].map(n=>e.at([t+Math.cos(n*1.047)*(s+2),f+1.2,r+Math.sin(n*1.047)*(s+2)])),{size:.4}))}return d.join(``)}function Me(e,t){let{k:n,P:r,L:i,slab:a}=e,o=[];for(let e of t){o.push(a(e,0,1.4,{tone:`lo`},2,.2));let t=[];if(e.w>=e.d)for(let i=e.x+9;i<e.x+e.w-2;i+=9)t.push(n.lineOnTop([i,e.y+.8],[i,e.y+e.d-.8],1.5,r));else for(let i=e.y+9;i<e.y+e.d-2;i+=9)t.push(n.lineOnTop([e.x+.8,i],[e.x+e.w-.8,i],1.5,r));o.push(i(t.join(``)+n.planOutline(n.insetPlan(e,.8),1.5,r,2),{tone:`faint`}))}return o.join(``)}function Ne(e,t,n,r){let{k:i,P:a,S:o,L:s,slab:c}=e,l=[],u=t.y+t.d;for(let e=t.x+14;e<t.x+t.w-4;e+=14)l.push(i.segment([e,u,3],[e,u,n-5],a));let d=[o(i.slabOf(t,0,n,a,2,.4),{tone:`lo`,inner:s(l.join(``)+i.sideSeam(t,4,a,2),{tone:`faint`})}),c({x:t.x-1.5,y:t.y-1.5,w:t.w+3,d:t.d+3,r:.4},n,2.2,{tone:`mid`},2,.2)];for(let t of r){let r=[];for(let e=22;e<=n-12;e+=3)r.push(`<path class="iso-line" data-tone="lo" d="M${t-20} ${-e}H${t+20}"/>`);d.push(`<g transform="${e.front(u+.1)}"><path class="sf-plate" d="M${t-21} ${-(n-9)}H${t+21}V-18H${t-21}Z"/>${r.join(``)}</g>`)}return d.join(``)}function Pe(e,t,n){let{k:r,P:i,slab:a,L:o}=e,s=(n===`back`?[{x:t.x,y:t.y,w:t.w,d:3,r:.4},{x:t.x,y:t.y+3,w:3,d:t.d-6,r:.4}]:[{x:t.x,y:t.y+t.d-3,w:t.w,d:3,r:.4},{x:t.x+t.w-3,y:t.y+3,w:3,d:t.d-6,r:.4}]).map(e=>a(e,0,9,{tone:`mid`},2,.3));return n===`front`&&s.push(o(r.segment([t.x+3,t.y+t.d,4.4],[t.x+t.w,t.y+t.d,4.4],i)+r.segment([t.x+t.w,t.y+3,4.4],[t.x+t.w,t.y+t.d,4.4],i),{tone:`faint`})),s.join(``)}function Fe(e,[t,n,r]){let{G:i,P:a,S:o,cyl:s,slab:c,screws:l}=e,u=i.frameAlong([t,n,r],[0,1,0]);return[o(i.solidOf([[0,3.8],[1.6,5.2],[2.6,5.2],[3.6,4.2],[10.4,4.2],[11.4,5.2],[12.4,5.2],[14,3.8]],u,a),{tone:`mid`}),s(t,n+7,2.4,r+3.6,6,{tone:`mid`,crease:`none`},14),c({x:t-4.6,y:n+7-3.6,w:9.2,d:7.2,r:1},r+9.6,9,{tone:`mid`},2,.4),s(t,n+7,2.6,r+18.6,1.8,{tone:`lo`},14),l([[t-3.4,n+7+3.7],[t+3.4,n+7+3.7]],r+15)].join(``)}var x=16,Ie=56,Le=3;function Re(e,t,n,r){let{faceRule:i}=e,a=n+1.5,o=`<g transform="${e.front(t)}"><path class="iso-line" data-tone="lo" d="M${a} -44H${a+13}V-5H${a}Z"/>`,s=``;if(r===0)s+=`<path class="sf-plate" d="M${a+2} -41H${a+13-2}V-25H${a+2}Z"/>`,s+=`<path class="iso-line" data-tone="mid" d="M${a+4} -38H${a+13/2}M${a+13-4} -38H${a+13/2}M${a+13/2} -38V-28"/>`;else if(r===1)for(let e=0;e<3;e++)s+=`<path class="sf-plate" d="M${a+2} ${-(40-e*9)}H${a+13-2}V${-(34-e*9)}H${a+2}Z"/><path class="iso-line" data-tone="mid" d="M${a+13/2-2} ${-(37-e*9)}H${a+13/2+2}"/>`;else for(let e=0;e<8;e++)s+=`<path class="iso-line" data-tone="faint" d="M${a+2} ${-(41-e*2.4)}H${a+13-2}"/>`;let c=`<path class="iso-line" data-tone="hi" d="M${a+13-2.6} -19V-27"/>`;return`${o}${s}${c}</g>${i(t,a+2,7,9,4)}`}function ze(e,t,n){let{k:r,P:i,L:a,slab:o,cyl:s,screws:c}=e,l=[],u=t.y+t.d;l.push(o({x:t.x-2,y:t.y-2,w:t.w+4,d:t.d+4,r:1},0,2,{tone:`lo`},2,.2));for(let n=0;n<Le;n++){let d=t.x+n*x,f={x:d,y:t.y,w:x,d:t.d,r:.6};l.push(o(f,2,54,{tone:`mid`},2,.4)),l.push(o({x:d+1,y:t.y+1,w:14,d:t.d-2,r:.6},Ie,3,{tone:`mid`},2,.3)),l.push(a(r.segment([d+4,u-4,59.2],[d+x-4,u-4,59.2],i),{tone:`faint`}),s(d+3,t.y+4,1,59,2,{tone:`mid`},10),s(d+x-3,t.y+4,1,59,2,{tone:`mid`},10)),l.push(Re(e,u,d,n)),l.push(c([[d+1.4,u-.2],[d+x-1.4,u-.2]],54))}let d=t.x+t.w-8,f=t.y+t.d/2-4,p=59.4,m=[];for(let e=d+2;e<n-1;e+=3)m.push(r.segment([e,f+.6,60],[e,f+7.4,60],i));return l.push(o({x:d,y:f,w:n-d,d:.9,r:.2},p,2,{tone:`mid`},2,.1),o({x:d,y:f+7.1,w:n-d,d:.9,r:.2},p,2,{tone:`mid`},2,.1),a(m.join(``),{tone:`mid`}),s(n-6,f+4,.9,0,p,{tone:`mid`,crease:`none`},10),o({x:n-8.6,y:f+1.4,w:5.2,d:5.2,r:.5},0,1.2,{tone:`lo`},2,.1),o({x:n-1.6,y:f-.6,w:1.6,d:9.2,r:.3},58.4,4,{tone:`mid`},2,.1)),l.join(``)}var Be={x:-15,y:0,w:30,d:14,r:1.5},S=30,Ve=12.5,He=2.2,C=11;function Ue(e,t){let{k:n,G:r,P:i,L:a,D:o,S:s,slab:c,cyl:l,screws:u,faceRule:d}=e,f=[],p=r.frameAlong([0,0,S],[0,1,0]);f.push(c({x:-15,y:0,w:30,d:9,r:1},0,1.4,{tone:`lo`},2,.3)),f.push(u(n.corners({x:-15,y:0,w:30,d:9},1.6),1.4));for(let e of[-11,8])f.push(c({x:e,y:0,w:3,d:7,r:.5},1.4,14,{tone:`mid`},2,.2));f.push(c({x:-14.5,y:0,w:29,d:He,r:1},15,30,{tone:`mid`},2,.3)),f.push(o([[-12.4,13.2],[12.4,13.2],[-12.4,-13.2],[12.4,-13.2]].map(([e=0,t=0])=>n.iso([e,2.3000000000000003,S+t],i)),{size:.45})),f.push(s(r.disc(He,C,Ve,p,i),{tone:`mid`}));for(let e of[5.4,8.2])f.push(a(n.sideRing([0,e,S],Ve,`y`,i,32),{tone:`faint`}));f.push(s(r.disc(9.2,C,13.7,p,i),{tone:`mid`})),f.push(s(r.disc(10.6,C,10.9,p,i),{tone:`lo`})),f.push(`<path class="gs-blade" data-vfan="0,11.3,${S},9.9" data-top="0,${C},46.5" data-bearing="0,8,42.5" d=""/>`),f.push(s(r.disc(C,13.4,3,p,i),{tone:`mid`}),s(r.disc(13.2,14,1.6,p,i),{tone:`lo`}));let m=[],h=12.6;for(let e of[5.5,10.5])m.push(n.sideRing([0,h,S],e,`y`,i,28));for(let e=0;e<8;e++){let t=e/8*Math.PI*2;m.push(n.segment([Math.cos(t)*3,h,S+Math.sin(t)*3],[Math.cos(t)*10.5,h,S+Math.sin(t)*10.5],i))}return f.push(a(m.join(``),{tone:`mid`})),f.push(c({x:-4.5,y:3,w:9,d:6,r:.8},41.9,6,{tone:`mid`},2,.3),l(0,6,1.1,47.9,2.2,{tone:`mid`},10),d(9.1,-3,43.5,6,2.4)),f.join(``)}var We=1e3,Ge={x:-500,y:-395,w:810,d:189,r:8},Ke={x:-380,y:-120,w:680,d:180,r:8},qe={x:-520,y:-415,w:850,d:495,r:16},Je=be([...Ce(qe,-21,-14),...Ce(Ge,-14,140),...Ce(Ke,-14,100)],We,620,{pad:22,azimuth:60}),Ye=-300,w=[[-268,Ye],[-108,Ye],[52,Ye]],Xe=(e,t)=>[e[0]+t[0],e[1]+t[1],t[2]],Ze=e=>Xe(w[e]??[0,0],ue),Qe=e=>Xe(w[e]??[0,0],pe),$e={x:-340,y:-338,w:470,d:4,r:0},T=[-434,-340],et={r:32,h:104,nozzles:[{angle:90,z:14,r:2,role:`outlet`}]},E={x:-486,y:-392,w:104,d:104,r:0},D=[-434,-232],O={r:17,h:62,windowX:8,panelX:-26,nozzles:[{angle:270,z:14,r:2,role:`inlet`},{angle:0,z:7,r:2,role:`outlet`}]},k=D[0],tt=-284,A={x:132,y:-330,w:48,d:25,r:1},j={x:204,y:-395,w:104,d:145,r:2},nt=[293,j.y+j.d],rt=[-202,-135,0],it=[[-65,-62],[-169,-62]],at=[-34,36.6,40],ot=[-20,36.6,40],st=[94,-130,0],M=.8,ct=[[47,36],[157,36]],lt=e=>[(e[0]-st[0])*M,(e[1]-st[1])*M,e[2]*M],ut=lt(u),dt=lt(r),ft=[{x:-318,y:-262,w:462,d:8,r:0},...w.map(([e])=>({x:e-48,y:-290,w:6,d:32,r:0})),{x:137,y:-308,w:6,d:54,r:0}],pt=[-67,-132,0],mt=[-292,-62],ht=[-110,-114,24],gt=[...w.map((e,t)=>({key:`gen${t}`,at:e,h:126})),{key:`bund-back`,at:[T[0],E.y+2],h:12},{key:`bulk`,at:T,h:et.h+12},{key:`bund-front`,at:[T[0],E.y+E.d-2],h:12},{key:`valve`,at:[k,-277],h:30},{key:`day`,at:D,h:O.h+12},{key:`vent`,at:[nt[0],nt[1]+6],h:50},{key:`lineup`,at:[A.x+A.w/2,A.y+A.d/2],h:62},{key:`hall`,at:[j.x+j.w/2,j.y+j.d/2],h:76},...it.map((e,t)=>({key:`chiller${t}`,at:e,h:56})),...ct.map((e,t)=>({key:`pump${t}`,at:e,h:45*M})),{key:`compressor`,at:mt,h:46}],_t=we(gt,Je),vt=_t.order,yt=_t.slotDepths,bt=_t.depth,N=(e,t)=>[e[0]+t[0],e[1]+t[1],t[2]],P=(e,t,n,r)=>[t??e[0],n??e[1],r??e[2]],xt=(e,t,n)=>{let r=e.nozzles[n];return r?N(t,ve(e,r)):[0,0,0]},F=6,St=xt(et,T,0),Ct=xt(O,D,0),wt=xt(O,D,1),I=wt[1],[Tt,Et,Dt]=[0,1,2].map(Ze),[L,Ot,kt]=[0,1,2].map(Qe),At=tt+14,jt=-366,R=-250,z=L[2],Mt=16,Nt=[mt[0]+ht[0]-pt[0],mt[1]+ht[1]-pt[1],ht[2]],Pt=Nt[1]+Mt,[B=[0,0],Ft=[0,0]]=it,[V=[0,0],H=[0,0]]=ct,U=e=>N(e,dt),W=e=>N(e,ut),G=e=>N(e,at),K=e=>N(e,ot),q=W(V)[2],J=B[1]+61,Y=72,X=B[1]+48,It=84,Lt=V[1]-34,Rt=W(H)[0]+13,zt=W(V)[0]+8,Bt=6,Vt=K(B)[0]+40,Ht=j.y+j.d+Ae,Ut=[{id:`xfer:a`,medium:`fuel`,r:2,pts:[St,[k,tt,14]]},{id:`xfer:b`,medium:`fuel`,r:2,pts:[[k,At,14],Ct]},{id:`fuel:all`,medium:`fuel`,r:2,pts:[wt,[Tt[0],I,F]]},{id:`fuel:bc`,medium:`fuel`,r:2,pts:[[Tt[0],I,F],[Et[0],I,F]]},{id:`fuel:c`,medium:`fuel`,r:2,pts:[[Et[0],I,F],[Dt[0],I,F],Dt]},{id:`fuel:a`,medium:`fuel`,r:2,pts:[[Tt[0],I,F],Tt]},{id:`fuel:b`,medium:`fuel`,r:2,pts:[[Et[0],I,F],Et]},{id:`air:main`,medium:`air`,r:v,bend:8,pts:[Nt,P(Nt,null,Pt,null),[jt,Pt,Nt[2]],[jt,Pt,z],[jt,R,z],[L[0],R,z]]},{id:`air:ab`,medium:`air`,r:v,pts:[[L[0],R,z],[Ot[0],R,z]]},{id:`air:c`,medium:`air`,r:v,pts:[[Ot[0],R,z],[kt[0],R,z],kt]},{id:`air:a`,medium:`air`,r:v,pts:[[L[0],R,z],L]},{id:`air:b`,medium:`air`,r:v,pts:[[Ot[0],R,z],Ot]},{id:`suction`,medium:`coolantret`,r:2.6,pts:[[265,Ht,q],[265,Lt,q],[Rt,Lt,q]]},{id:`suction:standby`,medium:`coolantret`,r:2.6,pts:[[Rt,Lt,q],P(W(H),Rt,null,null),W(H)]},{id:`suction:duty`,medium:`coolantret`,r:2.6,pts:[[Rt,Lt,q],[zt,Lt,q],P(W(V),zt,null,null),W(V)]},...[[`a`,B],[`b`,Ft]].map(([e,t])=>({id:`out:${e}`,medium:`coolant`,r:2.2,pts:[K(t),P(K(t),null,X,null),P(K(t),null,X,It)]})),{id:`chws:b`,medium:`coolant`,r:2.6,blind:[!0,!1],pts:[[K(Ft)[0]-Bt,X,It],[K(B)[0],X,It]]},{id:`chws`,medium:`coolant`,r:2.6,pts:[[K(B)[0],X,It],[Vt,X,It],[Vt,X,40],[240,X,40],[240,Ht,40]]},...[[`duty`,V],[`standby`,H]].map(([e,t])=>({id:`discharge:${e}`,medium:`coolantret`,r:2.6,fromStub:!0,pts:[U(t),P(U(t),null,null,Y),P(U(t),null,J,Y)]})),{id:`header:standby`,medium:`coolantret`,r:2.6,blind:[!0,!1],pts:[[U(H)[0]+Bt,J,Y],[U(V)[0],J,Y]]},{id:`header`,medium:`coolantret`,r:2.6,pts:[[U(V)[0],J,Y],[G(B)[0],J,Y]]},{id:`header:b`,medium:`coolantret`,r:2.6,blind:[!1,!0],pts:[[G(B)[0],J,Y],[G(Ft)[0]-Bt,J,Y]]},...[[`a`,B],[`b`,Ft]].map(([e,t])=>({id:`in:${e}`,medium:`coolantret`,r:2.2,pts:[P(G(t),null,J,Y),P(G(t),null,J,null),G(t)]}))],Wt=(e,t)=>[Ge,Ke].some(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.d),Z=(e,t,n,r)=>[e,t,n,r,Wt(e,t)?0:-14],Gt={z:10,flanged:!0,routes:Ut,posts:[...[-395,-330,-215,-60].map(e=>Z(e,I,2,F)),Z(k,-294,2,14),...[-70,-140,-190,R].map(e=>Z(jt,e,v,z)),...[-300,-155,10].map(e=>Z(e,R,v,z)),...[-225,-150,-90,-35].map(e=>Z(240,e,2.6,40)),...[-225,-150,-90,-35,20].map(e=>Z(265,e,2.6,q)),...[-20,100,215].map(e=>Z(e,X,2.6,40)),...[-150,-20,130].map(e=>Z(e,J,2.6,Y))]},Q=Te(),Kt={x:-248,y:-164,w:92,d:58,r:3},qt={x:-136,y:-152,w:138,d:40,r:3},Jt=_e(et),Yt=_e(O),Xt=(e,t)=>o(e,t,`coolantret`,!0),Zt=(e,t)=>ge(e,t,et),Qt=(e,t)=>ge(e,t,O),$t=(e,t)=>ce(e,t,{barFull:10,dialFull:12}),en=e=>je(e,j,[{x:240,z:40,r:2.6},{x:265,z:ut[2],r:2.6}]),tn=e=>ze(e,A,j.x),nn=e=>Fe(e,[k,tt,14]),rn=e=>Pe(e,E,`back`),an=e=>Pe(e,E,`front`);function on({ids:e}){let t=Se(),n=a(Gt,bt),r=(0,ke.useMemo)(()=>c(t,qe)+t.plinth(Ge)+t.plinth(Ke)+Me(t,ft)+Ne(t,$e,62,w.map(([e])=>e)),[t]),o=e=>(0,Q.jsx)(xe,{html:`${n.layers[e]??``}<g data-flows="${e}" data-depth="${e===0?-1e9:yt[e-1]??0}"></g>`,data:{pipes:``}},`pipes-${e}`),s=[e.genA,e.genB,e.genC],u={"bund-back":(0,Q.jsx)(l,{build:rn,intro:1}),bulk:(0,Q.jsx)(`g`,{className:`fuel-tank`,children:(0,Q.jsx)(i,{to:g(T),children:(0,Q.jsx)(y,{id:e.bulk,plan:Jt,intro:2,draw:Zt})})}),"bund-front":(0,Q.jsx)(l,{build:an,intro:2}),valve:(0,Q.jsx)(l,{build:nn,intro:3}),day:(0,Q.jsx)(`g`,{className:`fuel-tank`,children:(0,Q.jsx)(i,{to:g(D),children:(0,Q.jsx)(y,{id:e.day,plan:Yt,intro:3,draw:Qt})})}),vent:(0,Q.jsx)(i,{to:g(nt),children:(0,Q.jsx)(y,{id:e.fan,plan:Be,intro:9,draw:Ue})}),lineup:(0,Q.jsx)(l,{build:tn,intro:8}),hall:(0,Q.jsx)(l,{build:en,intro:8}),compressor:(0,Q.jsx)(i,{from:pt,to:g(mt),children:(0,Q.jsx)(y,{id:e.compressor,plan:qt,intro:13,draw:$t})})};for(let[e,t]of w.entries())u[`gen${e}`]=(0,Q.jsx)(`g`,{className:`gen-set`,children:(0,Q.jsx)(i,{to:g(t),children:(0,Q.jsx)(y,{id:s[e]??``,plan:fe,intro:4+e,draw:me})})});for(let[t,n]of it.entries())u[`chiller${t}`]=(0,Q.jsx)(i,{from:rt,to:g(n),children:(0,Q.jsx)(y,{id:t?e.chillerB:e.chillerA,plan:Kt,intro:10+t,draw:oe})});for(let[t,n]of ct.entries())u[`pump${t}`]=(0,Q.jsx)(i,{from:st,to:g(n),scale:M,children:(0,Q.jsx)(y,{id:t?e.pumpB:e.pumpA,plan:te,intro:12+t,draw:Xt})});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xe,{html:r,data:{plinth:``}}),o(0),vt.flatMap((e,t)=>[(0,Q.jsx)(`g`,{children:u[e.key]},e.key),o(t+1)])]})}var $=e=>e>.002?6+26*h(e*2):0,sn=e=>{let{svg:t,feed:n,ids:r}=e,i=m(t),a=he(e,i),o=ye(e),s=se(e,i),c=re(e,i),l=le(e,i),u=[a,o,s,c,l,de(e,i)],d=ee(e,e=>ne(n,e,`availability`)),f=_(e,{needle:e=>l.needle(e)??s.needle(e)??0,bar:e=>u.reduce((t,n)=>t??n.bar(e),void 0)??0,alertsHigh:()=>!0,ready:()=>!0}),te=()=>{let e=n.param(r.day,`max_inflow_lps`,0);return e>0?h(n.num(r.day,`inflow_rate`)/e):0},g=(...e)=>h(e.reduce((e,t)=>e+a.fuelPu(t),0)),ae=()=>c.flowPu(r.pumpA)+c.flowPu(r.pumpB),oe=e=>{let t=[r.chillerA,r.chillerB].filter(e=>n.num(e,`coolant_flow_rate`)>0);return t.includes(e)?ae()/t.length:0},ce=p(e,({id:e})=>{switch(e){case`xfer:a`:case`xfer:b`:return $(te());case`fuel:all`:return $(g(r.genA,r.genB,r.genC));case`fuel:bc`:return $(g(r.genB,r.genC));case`fuel:c`:return $(g(r.genC));case`fuel:a`:return $(g(r.genA));case`fuel:b`:return $(g(r.genB));case`air:main`:case`air:ab`:case`air:c`:case`air:a`:case`air:b`:return $(l.deliveredPu(r.compressor));case`suction`:case`chws`:case`header`:return $(ae());case`suction:duty`:case`discharge:duty`:return $(c.flowPu(r.pumpA));case`suction:standby`:case`discharge:standby`:case`header:standby`:return $(c.flowPu(r.pumpB));case`in:a`:case`out:a`:return $(oe(r.chillerA));case`in:b`:case`out:b`:case`header:b`:case`chws:b`:return $(oe(r.chillerB));default:return 0}});return{data(e){d.draw(e)},draw({sdt:e,t,introDone:n}){ce.draw(e),f.draw(e,t);for(let r of u)r.draw(e,t,n)},resync(){},status:e=>ie(n,e,`availability`)}},cn=d(Je),ln=s(cn,Gt,bt),un={width:We,height:620,label:`Isometric model of the Backup Power facility: along the back, the fuel yard with its bulk tank in a bund and the day tank, three diesel gen sets side by side with their exhaust stacks and radiators, the electrical lineup and the data hall they back up; along the front, the start-air compressor, two chillers and two chilled-water pumps whose loop runs to the hall. Pipes carry fuel, start air and chilled water between them. Every moving part follows live values from the running engine.`,kit:cn,flows:ln.flows,joints:ln.joints,Scene:on,compose:sn},dn=f({layout:un,resolve:De,things:Oe,caption:`generation · fuel · cooling`,mismatch:`This floor expects the Backup Power facility: three diesel gensets, the bulk and day fuel tanks, two chillers with two chilled-water pumps, the start-air compressor and the hall ventilation motor, by area and line.`,statusBasis:`availability`,Overview:t,tab:`Plant`});export{dn as backupFloor};
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{n as t,t as n}from"./by-path-C9hM5E2c.js";import{A as r,D as i,E as a,F as o,H as s,L as c,O as l,P as u,V as d,X as f,a as p,b as m,g as h,i as ee,j as te,k as g,n as ne,o as _,r as re,t as ie}from"./status-DQYLUbXs.js";import{c as ae}from"./vendor-charts-Bquh2dWE.js";import{r as oe,t as se}from"./chiller-r7DzAhJq.js";import{n as ce,t as le}from"./compressor-ChZLMC94.js";import{a as ue,i as v,n as de,o as fe,r as pe,s as me,t as he}from"./genset-C6_EUoFo.js";import{i as ge,n as _e,r as ve,t as ye}from"./tank-Btg5piqB.js";import{b as be,d as xe,f as Se,l as y,m as Ce}from"./dom-BxZbg3NX.js";import{t as we}from"./stages-EYRT12Yp.js";import{ot as Te}from"./vendor-ui-BGeFlRLR.js";var Ee=[[`genA`,`diesel-generator`,`power`,`gensets`,0],[`genB`,`diesel-generator`,`power`,`gensets`,1],[`genC`,`diesel-generator`,`power`,`gensets`,2],[`bulk`,`storage-tank`,`fuel`,`storage`,0],[`day`,`storage-tank`,`fuel`,`storage`,1],[`chillerA`,`industrial-chiller`,`cooling`,`chiller-plant`,0],[`chillerB`,`industrial-chiller`,`cooling`,`chiller-plant`,1],[`pumpA`,`centrifugal-pump`,`cooling`,`chilled-water`,0],[`pumpB`,`centrifugal-pump`,`cooling`,`chilled-water`,1],[`compressor`,`air-compressor`,`support`,`start-air`,0],[`fan`,`ac-induction-motor`,`support`,`ventilation`,0]],De=e=>n(Ee,e);function Oe(e){let t=(e,t,n)=>({key:e,assetId:e,name:t,kind:`utility`,area:n});return[t(e.genA,`Genset A (primary)`,`Power`),t(e.genB,`Genset B`,`Power`),t(e.genC,`Genset C (reserve)`,`Power`),t(e.bulk,`Bulk fuel tank`,`Fuel`),t(e.day,`Day tank`,`Fuel`),t(e.chillerA,`Chiller A`,`Cooling`),t(e.chillerB,`Chiller B`,`Cooling`),t(e.pumpA,`Chilled-water pump 1`,`Cooling`),t(e.pumpB,`Chilled-water pump 2`,`Cooling`),t(e.compressor,`Start-air compressor`,`Support`),t(e.fan,`Hall ventilation fan`,`Support`)]}var ke=e(ae(),1),b=64,Ae=2.2;function je(e,t,n){let{k:r,G:i,P:a,S:o,L:s,D:c,slab:l,cyl:u}=e,d=[],f=t.y+t.d,p=t.x+t.w,m=e=>s(e,{tone:`faint`}),h=[];for(let e=t.x+11;e<p-4;e+=11)h.push(r.segment([e,f,3],[e,f,55],a));for(let e=t.y+11;e<f-4;e+=11)h.push(r.segment([p,e,3],[p,e,55],a));let ee=[];for(let e of[57,59,61])ee.push(r.segment([t.x+4,f,e],[p-4,f,e],a)),ee.push(r.segment([p,t.y+4,e],[p,f-4,e],a));d.push(l({x:t.x-1.6,y:t.y-1.6,w:t.w+3.2,d:t.d+3.2,r:2},0,3,{tone:`lo`},2,.3)),d.push(o(r.slabOf(t,0,b,a,2,.6),{tone:`lo`,inner:m(h.join(``))+s(ee.join(``),{tone:`lo`})+m(r.sideSeam(t,3,a,2))})),d.push(s(r.planOutline(r.insetPlan(t,2),b,a,2),{tone:`lo`}));let te=(e,t,n,i,o)=>{d.push(l({x:e-1,y:t-1,w:n+2,d:i+2,r:1},b,3,{tone:`lo`},2,.3)),d.push(l({x:e,y:t,w:n,d:i,r:1},67,o,{tone:`mid`},2,.3));let c=[];for(let s=69;s<67+o-1;s+=2.4)c.push(r.segment([e+2,t+i,s],[e+n-2,t+i,s],a));d.push(s(c.join(``),{tone:`faint`}));let u=67+o;for(let o of[e+n*.3,e+n*.7]){let e=t+i/2,n=[r.ring(o,e,i*.36,u,a,24),r.ring(o,e,i*.16,u,a,16)];for(let t=0;t<4;t++){let s=t/4*Math.PI*2+.4;n.push(r.segment([o+Math.cos(s)*i*.16,e+Math.sin(s)*i*.16,u],[o+Math.cos(s)*i*.36,e+Math.sin(s)*i*.36,u],a))}d.push(s(n.join(``),{tone:`mid`}))}};te(t.x+12,t.y+t.d-52,34,18,10),te(t.x+60,t.y+t.d-44,34,18,10),d.push(u(t.x+t.w-16,t.y+22,4,b,11,{tone:`mid`},20),u(t.x+t.w-16,t.y+22,5,74.4,1.6,{tone:`mid`},20),l({x:t.x+14,y:t.y+14,w:14,d:10,r:.8},b,5,{tone:`mid`},2,.3));let g=t.x+6;d.push(l({x:g-1.4,y:f,w:24.8,d:.8,r:.2},0,31.8,{tone:`lo`},2,0),`<g transform="${e.front(f+.9)}"><path class="sf-plate" d="M${g} -30H${g+22}V0H${g}Z"/>${Array.from({length:9},(e,t)=>`<path class="iso-line" data-tone="faint" d="M${g} ${-(3+t*3)}H${g+22}"/>`).join(``)}<path class="iso-line" data-tone="mid" d="M${g} -30H${g+22}V0H${g}Z"/></g>`,l({x:g,y:f+.8,w:22,d:1,r:.2},0,2.4,{tone:`mid`},2,0)),d.push(l({x:g-1,y:f,w:24,d:.9,r:.2},38,16,{tone:`lo`},2,0));let ne=[];for(let e=40;e<53.5;e+=1.8)ne.push(r.segment([g+.6,f+.9,e],[g+22-.6,f+.9,e],a));d.push(s(ne.join(``),{tone:`mid`})),d.push(u(g+22+3.6,f+1.2,1.2,28,2.2,{tone:`mid`},10));let _=t.y+36;d.push(l({x:p,y:_-1.2,w:.9,d:12.4,r:.2},0,25,{tone:`lo`},2,0),l({x:p+.9,y:_,w:.5,d:10,r:.2},0,22.4,{tone:`mid`},2,0),l({x:p,y:_-3,w:4.4,d:16,r:.4},26,1.4,{tone:`mid`},2,.2),u(p+1.4,_+12.4,1.1,14,2,{tone:`mid`},10)),d.push(s(r.segment([p+1.4,_+1.2,13],[p+1.4,_+1.2,19],a)+r.segment([p+1.4,_+2,3],[p+1.4,_+9,3],a),{tone:`hi`}));let re=t.y+72;d.push(l({x:p,y:re,w:.9,d:30,r:.2},22,26,{tone:`lo`},2,0));let ie=[];for(let e=24;e<47.5;e+=1.8)ie.push(r.segment([p+.9,re+1.4,e],[p+.9,re+28.6,e],a));d.push(s(ie.join(``),{tone:`mid`}));for(let{x:t,z:r,r:s}of n){let n=i.frameAlong([t,f,r],[0,1,0]);d.push(o(i.disc(0,1.2,s+2.8,n,a),{tone:`mid`}),o(i.disc(1.2,Ae,s+1.4,n,a),{tone:`mid`}),c([0,1,2,3,4,5].map(n=>e.at([t+Math.cos(n*1.047)*(s+2),f+1.2,r+Math.sin(n*1.047)*(s+2)])),{size:.4}))}return d.join(``)}function Me(e,t){let{k:n,P:r,L:i,slab:a}=e,o=[];for(let e of t){o.push(a(e,0,1.4,{tone:`lo`},2,.2));let t=[];if(e.w>=e.d)for(let i=e.x+9;i<e.x+e.w-2;i+=9)t.push(n.lineOnTop([i,e.y+.8],[i,e.y+e.d-.8],1.5,r));else for(let i=e.y+9;i<e.y+e.d-2;i+=9)t.push(n.lineOnTop([e.x+.8,i],[e.x+e.w-.8,i],1.5,r));o.push(i(t.join(``)+n.planOutline(n.insetPlan(e,.8),1.5,r,2),{tone:`faint`}))}return o.join(``)}function Ne(e,t,n,r){let{k:i,P:a,S:o,L:s,slab:c}=e,l=[],u=t.y+t.d;for(let e=t.x+14;e<t.x+t.w-4;e+=14)l.push(i.segment([e,u,3],[e,u,n-5],a));let d=[o(i.slabOf(t,0,n,a,2,.4),{tone:`lo`,inner:s(l.join(``)+i.sideSeam(t,4,a,2),{tone:`faint`})}),c({x:t.x-1.5,y:t.y-1.5,w:t.w+3,d:t.d+3,r:.4},n,2.2,{tone:`mid`},2,.2)];for(let t of r){let r=[];for(let e=22;e<=n-12;e+=3)r.push(`<path class="iso-line" data-tone="lo" d="M${t-20} ${-e}H${t+20}"/>`);d.push(`<g transform="${e.front(u+.1)}"><path class="sf-plate" d="M${t-21} ${-(n-9)}H${t+21}V-18H${t-21}Z"/>${r.join(``)}</g>`)}return d.join(``)}function Pe(e,t,n){let{k:r,P:i,slab:a,L:o}=e,s=(n===`back`?[{x:t.x,y:t.y,w:t.w,d:3,r:.4},{x:t.x,y:t.y+3,w:3,d:t.d-6,r:.4}]:[{x:t.x,y:t.y+t.d-3,w:t.w,d:3,r:.4},{x:t.x+t.w-3,y:t.y+3,w:3,d:t.d-6,r:.4}]).map(e=>a(e,0,9,{tone:`mid`},2,.3));return n===`front`&&s.push(o(r.segment([t.x+3,t.y+t.d,4.4],[t.x+t.w,t.y+t.d,4.4],i)+r.segment([t.x+t.w,t.y+3,4.4],[t.x+t.w,t.y+t.d,4.4],i),{tone:`faint`})),s.join(``)}function Fe(e,[t,n,r]){let{G:i,P:a,S:o,cyl:s,slab:c,screws:l}=e,u=i.frameAlong([t,n,r],[0,1,0]);return[o(i.solidOf([[0,3.8],[1.6,5.2],[2.6,5.2],[3.6,4.2],[10.4,4.2],[11.4,5.2],[12.4,5.2],[14,3.8]],u,a),{tone:`mid`}),s(t,n+7,2.4,r+3.6,6,{tone:`mid`,crease:`none`},14),c({x:t-4.6,y:n+7-3.6,w:9.2,d:7.2,r:1},r+9.6,9,{tone:`mid`},2,.4),s(t,n+7,2.6,r+18.6,1.8,{tone:`lo`},14),l([[t-3.4,n+7+3.7],[t+3.4,n+7+3.7]],r+15)].join(``)}var x=16,Ie=56,Le=3;function Re(e,t,n,r){let{faceRule:i}=e,a=n+1.5,o=`<g transform="${e.front(t)}"><path class="iso-line" data-tone="lo" d="M${a} -44H${a+13}V-5H${a}Z"/>`,s=``;if(r===0)s+=`<path class="sf-plate" d="M${a+2} -41H${a+13-2}V-25H${a+2}Z"/>`,s+=`<path class="iso-line" data-tone="mid" d="M${a+4} -38H${a+13/2}M${a+13-4} -38H${a+13/2}M${a+13/2} -38V-28"/>`;else if(r===1)for(let e=0;e<3;e++)s+=`<path class="sf-plate" d="M${a+2} ${-(40-e*9)}H${a+13-2}V${-(34-e*9)}H${a+2}Z"/><path class="iso-line" data-tone="mid" d="M${a+13/2-2} ${-(37-e*9)}H${a+13/2+2}"/>`;else for(let e=0;e<8;e++)s+=`<path class="iso-line" data-tone="faint" d="M${a+2} ${-(41-e*2.4)}H${a+13-2}"/>`;let c=`<path class="iso-line" data-tone="hi" d="M${a+13-2.6} -19V-27"/>`;return`${o}${s}${c}</g>${i(t,a+2,7,9,4)}`}function ze(e,t,n){let{k:r,P:i,L:a,slab:o,cyl:s,screws:c}=e,l=[],u=t.y+t.d;l.push(o({x:t.x-2,y:t.y-2,w:t.w+4,d:t.d+4,r:1},0,2,{tone:`lo`},2,.2));for(let n=0;n<Le;n++){let d=t.x+n*x,f={x:d,y:t.y,w:x,d:t.d,r:.6};l.push(o(f,2,54,{tone:`mid`},2,.4)),l.push(o({x:d+1,y:t.y+1,w:14,d:t.d-2,r:.6},Ie,3,{tone:`mid`},2,.3)),l.push(a(r.segment([d+4,u-4,59.2],[d+x-4,u-4,59.2],i),{tone:`faint`}),s(d+3,t.y+4,1,59,2,{tone:`mid`},10),s(d+x-3,t.y+4,1,59,2,{tone:`mid`},10)),l.push(Re(e,u,d,n)),l.push(c([[d+1.4,u-.2],[d+x-1.4,u-.2]],54))}let d=t.x+t.w-8,f=t.y+t.d/2-4,p=59.4,m=[];for(let e=d+2;e<n-1;e+=3)m.push(r.segment([e,f+.6,60],[e,f+7.4,60],i));return l.push(o({x:d,y:f,w:n-d,d:.9,r:.2},p,2,{tone:`mid`},2,.1),o({x:d,y:f+7.1,w:n-d,d:.9,r:.2},p,2,{tone:`mid`},2,.1),a(m.join(``),{tone:`mid`}),s(n-6,f+4,.9,0,p,{tone:`mid`,crease:`none`},10),o({x:n-8.6,y:f+1.4,w:5.2,d:5.2,r:.5},0,1.2,{tone:`lo`},2,.1),o({x:n-1.6,y:f-.6,w:1.6,d:9.2,r:.3},58.4,4,{tone:`mid`},2,.1)),l.join(``)}var Be={x:-15,y:0,w:30,d:14,r:1.5},S=30,Ve=12.5,He=2.2,C=11;function Ue(e,t){let{k:n,G:r,P:i,L:a,D:o,S:s,slab:c,cyl:l,screws:u,faceRule:d}=e,f=[],p=r.frameAlong([0,0,S],[0,1,0]);f.push(c({x:-15,y:0,w:30,d:9,r:1},0,1.4,{tone:`lo`},2,.3)),f.push(u(n.corners({x:-15,y:0,w:30,d:9},1.6),1.4));for(let e of[-11,8])f.push(c({x:e,y:0,w:3,d:7,r:.5},1.4,14,{tone:`mid`},2,.2));f.push(c({x:-14.5,y:0,w:29,d:He,r:1},15,30,{tone:`mid`},2,.3)),f.push(o([[-12.4,13.2],[12.4,13.2],[-12.4,-13.2],[12.4,-13.2]].map(([e=0,t=0])=>n.iso([e,2.3000000000000003,S+t],i)),{size:.45})),f.push(s(r.disc(He,C,Ve,p,i),{tone:`mid`}));for(let e of[5.4,8.2])f.push(a(n.sideRing([0,e,S],Ve,`y`,i,32),{tone:`faint`}));f.push(s(r.disc(9.2,C,13.7,p,i),{tone:`mid`})),f.push(s(r.disc(10.6,C,10.9,p,i),{tone:`lo`})),f.push(`<path class="gs-blade" data-vfan="0,11.3,${S},9.9" data-top="0,${C},46.5" data-bearing="0,8,42.5" d=""/>`),f.push(s(r.disc(C,13.4,3,p,i),{tone:`mid`}),s(r.disc(13.2,14,1.6,p,i),{tone:`lo`}));let m=[],h=12.6;for(let e of[5.5,10.5])m.push(n.sideRing([0,h,S],e,`y`,i,28));for(let e=0;e<8;e++){let t=e/8*Math.PI*2;m.push(n.segment([Math.cos(t)*3,h,S+Math.sin(t)*3],[Math.cos(t)*10.5,h,S+Math.sin(t)*10.5],i))}return f.push(a(m.join(``),{tone:`mid`})),f.push(c({x:-4.5,y:3,w:9,d:6,r:.8},41.9,6,{tone:`mid`},2,.3),l(0,6,1.1,47.9,2.2,{tone:`mid`},10),d(9.1,-3,43.5,6,2.4)),f.join(``)}var We=1e3,Ge={x:-500,y:-395,w:810,d:189,r:8},Ke={x:-380,y:-120,w:680,d:180,r:8},qe={x:-520,y:-415,w:850,d:495,r:16},Je=be([...Ce(qe,-21,-14),...Ce(Ge,-14,140),...Ce(Ke,-14,100)],We,620,{pad:22,azimuth:60}),Ye=-300,w=[[-268,Ye],[-108,Ye],[52,Ye]],Xe=(e,t)=>[e[0]+t[0],e[1]+t[1],t[2]],Ze=e=>Xe(w[e]??[0,0],ue),Qe=e=>Xe(w[e]??[0,0],pe),$e={x:-340,y:-338,w:470,d:4,r:0},T=[-434,-340],et={r:32,h:104,nozzles:[{angle:90,z:14,r:2,role:`outlet`}]},E={x:-486,y:-392,w:104,d:104,r:0},D=[-434,-232],O={r:17,h:62,windowX:8,panelX:-26,nozzles:[{angle:270,z:14,r:2,role:`inlet`},{angle:0,z:7,r:2,role:`outlet`}]},k=D[0],tt=-284,A={x:132,y:-330,w:48,d:25,r:1},j={x:204,y:-395,w:104,d:145,r:2},nt=[293,j.y+j.d],rt=[-202,-135,0],it=[[-65,-62],[-169,-62]],at=[-34,36.6,40],ot=[-20,36.6,40],st=[94,-130,0],M=.8,ct=[[47,36],[157,36]],lt=e=>[(e[0]-st[0])*M,(e[1]-st[1])*M,e[2]*M],ut=lt(u),dt=lt(r),ft=[{x:-318,y:-262,w:462,d:8,r:0},...w.map(([e])=>({x:e-48,y:-290,w:6,d:32,r:0})),{x:137,y:-308,w:6,d:54,r:0}],pt=[-67,-132,0],mt=[-292,-62],ht=[-110,-114,24],gt=[...w.map((e,t)=>({key:`gen${t}`,at:e,h:126})),{key:`bund-back`,at:[T[0],E.y+2],h:12},{key:`bulk`,at:T,h:et.h+12},{key:`bund-front`,at:[T[0],E.y+E.d-2],h:12},{key:`valve`,at:[k,-277],h:30},{key:`day`,at:D,h:O.h+12},{key:`vent`,at:[nt[0],nt[1]+6],h:50},{key:`lineup`,at:[A.x+A.w/2,A.y+A.d/2],h:62},{key:`hall`,at:[j.x+j.w/2,j.y+j.d/2],h:76},...it.map((e,t)=>({key:`chiller${t}`,at:e,h:56})),...ct.map((e,t)=>({key:`pump${t}`,at:e,h:45*M})),{key:`compressor`,at:mt,h:46}],_t=we(gt,Je),vt=_t.order,yt=_t.slotDepths,bt=_t.depth,N=(e,t)=>[e[0]+t[0],e[1]+t[1],t[2]],P=(e,t,n,r)=>[t??e[0],n??e[1],r??e[2]],xt=(e,t,n)=>{let r=e.nozzles[n];return r?N(t,ve(e,r)):[0,0,0]},F=6,St=xt(et,T,0),Ct=xt(O,D,0),wt=xt(O,D,1),I=wt[1],[Tt,Et,Dt]=[0,1,2].map(Ze),[L,Ot,kt]=[0,1,2].map(Qe),At=tt+14,jt=-366,R=-250,z=L[2],Mt=16,Nt=[mt[0]+ht[0]-pt[0],mt[1]+ht[1]-pt[1],ht[2]],Pt=Nt[1]+Mt,[B=[0,0],Ft=[0,0]]=it,[V=[0,0],H=[0,0]]=ct,U=e=>N(e,dt),W=e=>N(e,ut),G=e=>N(e,at),K=e=>N(e,ot),q=W(V)[2],J=B[1]+61,Y=72,X=B[1]+48,It=84,Lt=V[1]-34,Rt=W(H)[0]+13,zt=W(V)[0]+8,Bt=6,Vt=K(B)[0]+40,Ht=j.y+j.d+Ae,Ut=[{id:`xfer:a`,medium:`fuel`,r:2,pts:[St,[k,tt,14]]},{id:`xfer:b`,medium:`fuel`,r:2,pts:[[k,At,14],Ct]},{id:`fuel:all`,medium:`fuel`,r:2,pts:[wt,[Tt[0],I,F]]},{id:`fuel:bc`,medium:`fuel`,r:2,pts:[[Tt[0],I,F],[Et[0],I,F]]},{id:`fuel:c`,medium:`fuel`,r:2,pts:[[Et[0],I,F],[Dt[0],I,F],Dt]},{id:`fuel:a`,medium:`fuel`,r:2,pts:[[Tt[0],I,F],Tt]},{id:`fuel:b`,medium:`fuel`,r:2,pts:[[Et[0],I,F],Et]},{id:`air:main`,medium:`air`,r:v,bend:8,pts:[Nt,P(Nt,null,Pt,null),[jt,Pt,Nt[2]],[jt,Pt,z],[jt,R,z],[L[0],R,z]]},{id:`air:ab`,medium:`air`,r:v,pts:[[L[0],R,z],[Ot[0],R,z]]},{id:`air:c`,medium:`air`,r:v,pts:[[Ot[0],R,z],[kt[0],R,z],kt]},{id:`air:a`,medium:`air`,r:v,pts:[[L[0],R,z],L]},{id:`air:b`,medium:`air`,r:v,pts:[[Ot[0],R,z],Ot]},{id:`suction`,medium:`coolantret`,r:2.6,pts:[[265,Ht,q],[265,Lt,q],[Rt,Lt,q]]},{id:`suction:standby`,medium:`coolantret`,r:2.6,pts:[[Rt,Lt,q],P(W(H),Rt,null,null),W(H)]},{id:`suction:duty`,medium:`coolantret`,r:2.6,pts:[[Rt,Lt,q],[zt,Lt,q],P(W(V),zt,null,null),W(V)]},...[[`a`,B],[`b`,Ft]].map(([e,t])=>({id:`out:${e}`,medium:`coolant`,r:2.2,pts:[K(t),P(K(t),null,X,null),P(K(t),null,X,It)]})),{id:`chws:b`,medium:`coolant`,r:2.6,blind:[!0,!1],pts:[[K(Ft)[0]-Bt,X,It],[K(B)[0],X,It]]},{id:`chws`,medium:`coolant`,r:2.6,pts:[[K(B)[0],X,It],[Vt,X,It],[Vt,X,40],[240,X,40],[240,Ht,40]]},...[[`duty`,V],[`standby`,H]].map(([e,t])=>({id:`discharge:${e}`,medium:`coolantret`,r:2.6,fromStub:!0,pts:[U(t),P(U(t),null,null,Y),P(U(t),null,J,Y)]})),{id:`header:standby`,medium:`coolantret`,r:2.6,blind:[!0,!1],pts:[[U(H)[0]+Bt,J,Y],[U(V)[0],J,Y]]},{id:`header`,medium:`coolantret`,r:2.6,pts:[[U(V)[0],J,Y],[G(B)[0],J,Y]]},{id:`header:b`,medium:`coolantret`,r:2.6,blind:[!1,!0],pts:[[G(B)[0],J,Y],[G(Ft)[0]-Bt,J,Y]]},...[[`a`,B],[`b`,Ft]].map(([e,t])=>({id:`in:${e}`,medium:`coolantret`,r:2.2,pts:[P(G(t),null,J,Y),P(G(t),null,J,null),G(t)]}))],Wt=(e,t)=>[Ge,Ke].some(n=>e>=n.x&&e<=n.x+n.w&&t>=n.y&&t<=n.y+n.d),Z=(e,t,n,r)=>[e,t,n,r,Wt(e,t)?0:-14],Gt={z:10,flanged:!0,routes:Ut,posts:[...[-395,-330,-215,-60].map(e=>Z(e,I,2,F)),Z(k,-294,2,14),...[-70,-140,-190,R].map(e=>Z(jt,e,v,z)),...[-300,-155,10].map(e=>Z(e,R,v,z)),...[-225,-150,-90,-35].map(e=>Z(240,e,2.6,40)),...[-225,-150,-90,-35,20].map(e=>Z(265,e,2.6,q)),...[-20,100,215].map(e=>Z(e,X,2.6,40)),...[-150,-20,130].map(e=>Z(e,J,2.6,Y))]},Q=Te(),Kt={x:-248,y:-164,w:92,d:58,r:3},qt={x:-136,y:-152,w:138,d:40,r:3},Jt=_e(et),Yt=_e(O),Xt=(e,t)=>o(e,t,`coolantret`,!0),Zt=(e,t)=>ge(e,t,et),Qt=(e,t)=>ge(e,t,O),$t=(e,t)=>ce(e,t,{barFull:10,dialFull:12}),en=e=>je(e,j,[{x:240,z:40,r:2.6},{x:265,z:ut[2],r:2.6}]),tn=e=>ze(e,A,j.x),nn=e=>Fe(e,[k,tt,14]),rn=e=>Pe(e,E,`back`),an=e=>Pe(e,E,`front`);function on({ids:e}){let t=Se(),n=a(Gt,bt),r=(0,ke.useMemo)(()=>c(t,qe)+t.plinth(Ge)+t.plinth(Ke)+Me(t,ft)+Ne(t,$e,62,w.map(([e])=>e)),[t]),o=e=>(0,Q.jsx)(xe,{html:`${n.layers[e]??``}<g data-flows="${e}" data-depth="${e===0?-1e9:yt[e-1]??0}"></g>`,data:{pipes:``}},`pipes-${e}`),s=[e.genA,e.genB,e.genC],u={"bund-back":(0,Q.jsx)(l,{build:rn,intro:1}),bulk:(0,Q.jsx)(`g`,{className:`fuel-tank`,children:(0,Q.jsx)(i,{to:g(T),children:(0,Q.jsx)(y,{id:e.bulk,plan:Jt,intro:2,draw:Zt})})}),"bund-front":(0,Q.jsx)(l,{build:an,intro:2}),valve:(0,Q.jsx)(l,{build:nn,intro:3}),day:(0,Q.jsx)(`g`,{className:`fuel-tank`,children:(0,Q.jsx)(i,{to:g(D),children:(0,Q.jsx)(y,{id:e.day,plan:Yt,intro:3,draw:Qt})})}),vent:(0,Q.jsx)(i,{to:g(nt),children:(0,Q.jsx)(y,{id:e.fan,plan:Be,intro:9,draw:Ue})}),lineup:(0,Q.jsx)(l,{build:tn,intro:8}),hall:(0,Q.jsx)(l,{build:en,intro:8}),compressor:(0,Q.jsx)(i,{from:pt,to:g(mt),children:(0,Q.jsx)(y,{id:e.compressor,plan:qt,intro:13,draw:$t})})};for(let[e,t]of w.entries())u[`gen${e}`]=(0,Q.jsx)(`g`,{className:`gen-set`,children:(0,Q.jsx)(i,{to:g(t),children:(0,Q.jsx)(y,{id:s[e]??``,plan:fe,intro:4+e,draw:me})})});for(let[t,n]of it.entries())u[`chiller${t}`]=(0,Q.jsx)(i,{from:rt,to:g(n),children:(0,Q.jsx)(y,{id:t?e.chillerB:e.chillerA,plan:Kt,intro:10+t,draw:oe})});for(let[t,n]of ct.entries())u[`pump${t}`]=(0,Q.jsx)(i,{from:st,to:g(n),scale:M,children:(0,Q.jsx)(y,{id:t?e.pumpB:e.pumpA,plan:te,intro:12+t,draw:Xt})});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xe,{html:r,data:{plinth:``}}),o(0),vt.flatMap((e,t)=>[(0,Q.jsx)(`g`,{children:u[e.key]},e.key),o(t+1)])]})}var $=e=>e>.002?6+26*h(e*2):0,sn=e=>{let{svg:t,feed:n,ids:r}=e,i=m(t),a=he(e,i),o=ye(e),s=se(e,i),c=re(e,i),l=le(e,i),u=[a,o,s,c,l,de(e,i)],d=ee(e,e=>ne(n,e,`availability`)),f=_(e,{needle:e=>l.needle(e)??s.needle(e)??0,bar:e=>u.reduce((t,n)=>t??n.bar(e),void 0)??0,alertsHigh:()=>!0,ready:()=>!0}),te=()=>{let e=n.param(r.day,`max_inflow_lps`,0);return e>0?h(n.num(r.day,`inflow_rate`)/e):0},g=(...e)=>h(e.reduce((e,t)=>e+a.fuelPu(t),0)),ae=()=>c.flowPu(r.pumpA)+c.flowPu(r.pumpB),oe=e=>{let t=[r.chillerA,r.chillerB].filter(e=>n.num(e,`coolant_flow_rate`)>0);return t.includes(e)?ae()/t.length:0},ce=p(e,({id:e})=>{switch(e){case`xfer:a`:case`xfer:b`:return $(te());case`fuel:all`:return $(g(r.genA,r.genB,r.genC));case`fuel:bc`:return $(g(r.genB,r.genC));case`fuel:c`:return $(g(r.genC));case`fuel:a`:return $(g(r.genA));case`fuel:b`:return $(g(r.genB));case`air:main`:case`air:ab`:case`air:c`:case`air:a`:case`air:b`:return $(l.deliveredPu(r.compressor));case`suction`:case`chws`:case`header`:return $(ae());case`suction:duty`:case`discharge:duty`:return $(c.flowPu(r.pumpA));case`suction:standby`:case`discharge:standby`:case`header:standby`:return $(c.flowPu(r.pumpB));case`in:a`:case`out:a`:return $(oe(r.chillerA));case`in:b`:case`out:b`:case`header:b`:case`chws:b`:return $(oe(r.chillerB));default:return 0}});return{data(e){d.draw(e)},draw({sdt:e,t,introDone:n}){ce.draw(e),f.draw(e,t);for(let r of u)r.draw(e,t,n)},resync(){},status:e=>ie(n,e,`availability`)}},cn=d(Je),ln=s(cn,Gt,bt),un={width:We,height:620,label:`Isometric model of the Backup Power facility: along the back, the fuel yard with its bulk tank in a bund and the day tank, three diesel gen sets side by side with their exhaust stacks and radiators, the electrical lineup and the data hall they back up; along the front, the start-air compressor, two chillers and two chilled-water pumps whose loop runs to the hall. Pipes carry fuel, start air and chilled water between them. Every moving part follows live values from the running engine.`,kit:cn,flows:ln.flows,joints:ln.joints,Scene:on,compose:sn},dn=f({layout:un,resolve:De,things:Oe,caption:`generation · fuel · cooling`,mismatch:`This floor expects the Backup Power facility: three diesel gensets, the bulk and day fuel tanks, two chillers with two chilled-water pumps, the start-air compressor and the hall ventilation motor, by area and line.`,statusBasis:`availability`,Overview:t,tab:`Plant`});export{dn as backupFloor};
@@ -1 +1 @@
1
- import{ot as e}from"./vendor-ui-BGeFlRLR.js";import{Tt as t}from"./api-D5UYWJSO.js";import{C as n,b as r,w as i,x as a}from"./index-Cp12bs7M.js";var o=e(),s={g:`live`,a:`idle`,r:`fault`,"":`off`};function c({name:e,level:t}){return(0,o.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,o.jsx)(`span`,{className:`w-28 shrink-0 truncate text-xs text-muted-foreground`,children:e}),(0,o.jsx)(`span`,{className:`h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,o.jsx)(`span`,{className:`block h-full rounded-full bg-info`,style:{width:`${Math.max(0,Math.min(100,t))}%`}})}),(0,o.jsxs)(`span`,{className:`w-10 shrink-0 text-right font-mono text-[11px] tabular-nums`,children:[t.toFixed(0),` %`]})]})}function l({things:e,status:l,onSelect:u}){let d=t(e=>e.memberValues),f=e.map(e=>({thing:e,status:l(e.key)})),p=f.filter(e=>e.status[1]===`r`).length,m=f.filter(e=>e.status[0]===`stopped`).length,h=f.length-p-m,g=e.flatMap(e=>{let t=d.get(e.assetId)?.get(`level_percent`)?.value;return typeof t==`number`?[{name:e.name,level:t}]:[]}),_=[...new Set(e.map(e=>e.area??``))];return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 px-4 pt-4 pb-5`,children:[(0,o.jsx)(r,{label:`Online`,value:String(h)}),(0,o.jsx)(r,{label:`Stopped`,value:String(m)}),(0,o.jsx)(r,{label:`Faulted`,value:String(p)})]}),g.length>0?(0,o.jsx)(n,{title:`Levels`,note:`live`,children:(0,o.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:g.map(e=>(0,o.jsx)(c,{name:e.name,level:e.level},e.name))})}):null,_.map(e=>(0,o.jsx)(n,{title:e,note:`flow order`,children:(0,o.jsx)(`ul`,{className:`-mx-2 flex flex-col`,children:f.filter(t=>(t.thing.area??``)===e).map(({thing:e,status:[t,n]})=>(0,o.jsx)(a,{tone:s[n],name:e.name,note:i(t),onSelect:()=>u(e.key)},e.key))})},e))]})}function u(e,{template:t,assets:n}){let r=new Set(t.assetIds),i=n.filter(e=>r.has(e.id)),a=new Map;for(let[,t,n,r]of e){let e=`${t}|${n}|${r}`;a.set(e,(a.get(e)??0)+1)}let o={};for(let[t,n,r,s,c]of e){let e=i.filter(e=>e.model===n&&e.browsePath?.[2]===r&&e.browsePath?.[3]===s).map(e=>e.id).sort(),l=e[c];if(!l||e.length!==a.get(`${n}|${r}|${s}`))return{status:`mismatch`};o[t]=l}return{status:`ready`,ids:o}}export{l as n,u as t};
1
+ import{ot as e}from"./vendor-ui-BGeFlRLR.js";import{Tt as t}from"./api-eIBFsAVZ.js";import{C as n,b as r,w as i,x as a}from"./index-DXy-dmGY.js";var o=e(),s={g:`live`,a:`idle`,r:`fault`,"":`off`};function c({name:e,level:t}){return(0,o.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,o.jsx)(`span`,{className:`w-28 shrink-0 truncate text-xs text-muted-foreground`,children:e}),(0,o.jsx)(`span`,{className:`h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,o.jsx)(`span`,{className:`block h-full rounded-full bg-info`,style:{width:`${Math.max(0,Math.min(100,t))}%`}})}),(0,o.jsxs)(`span`,{className:`w-10 shrink-0 text-right font-mono text-[11px] tabular-nums`,children:[t.toFixed(0),` %`]})]})}function l({things:e,status:l,onSelect:u}){let d=t(e=>e.memberValues),f=e.map(e=>({thing:e,status:l(e.key)})),p=f.filter(e=>e.status[1]===`r`).length,m=f.filter(e=>e.status[0]===`stopped`).length,h=f.length-p-m,g=e.flatMap(e=>{let t=d.get(e.assetId)?.get(`level_percent`)?.value;return typeof t==`number`?[{name:e.name,level:t}]:[]}),_=[...new Set(e.map(e=>e.area??``))];return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 px-4 pt-4 pb-5`,children:[(0,o.jsx)(r,{label:`Online`,value:String(h)}),(0,o.jsx)(r,{label:`Stopped`,value:String(m)}),(0,o.jsx)(r,{label:`Faulted`,value:String(p)})]}),g.length>0?(0,o.jsx)(n,{title:`Levels`,note:`live`,children:(0,o.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:g.map(e=>(0,o.jsx)(c,{name:e.name,level:e.level},e.name))})}):null,_.map(e=>(0,o.jsx)(n,{title:e,note:`flow order`,children:(0,o.jsx)(`ul`,{className:`-mx-2 flex flex-col`,children:f.filter(t=>(t.thing.area??``)===e).map(({thing:e,status:[t,n]})=>(0,o.jsx)(a,{tone:s[n],name:e.name,note:i(t),onSelect:()=>u(e.key)},e.key))})},e))]})}function u(e,{template:t,assets:n}){let r=new Set(t.assetIds),i=n.filter(e=>r.has(e.id)),a=new Map;for(let[,t,n,r]of e){let e=`${t}|${n}|${r}`;a.set(e,(a.get(e)??0)+1)}let o={};for(let[t,n,r,s,c]of e){let e=i.filter(e=>e.model===n&&e.browsePath?.[2]===r&&e.browsePath?.[3]===s).map(e=>e.id).sort(),l=e[c];if(!l||e.length!==a.get(`${n}|${r}|${s}`))return{status:`mismatch`};o[t]=l}return{status:`ready`,ids:o}}export{l as n,u as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{n as t,t as n}from"./by-path-Ba-e31Js.js";import{A as r,D as i,E as a,F as o,H as s,L as c,N as l,P as u,T as d,V as f,X as p,a as m,b as ee,g as h,i as te,j as ne,k as g,n as re,o as ie,r as ae,s as oe,t as se}from"./status-DQYLUbXs.js";import{c as ce}from"./vendor-charts-Bquh2dWE.js";import{a as le,i as ue,n as de,o as fe,s as pe,t as me}from"./rtu-ByogcRPI.js";import{a as he,i as ge,n as _e,o as ve,r as ye,t as be}from"./boiler-s_q0j7rz.js";import{r as xe,t as Se}from"./chiller-r7DzAhJq.js";import{n as Ce,o as we,s as Te,t as Ee}from"./genset-C6_EUoFo.js";import{C as De,a as Oe,b as ke,c as Ae,d as _,f as je,l as v,m as y,n as Me,s as Ne}from"./dom-BxZbg3NX.js";import{t as Pe}from"./stages-EYRT12Yp.js";import{ot as Fe}from"./vendor-ui-BGeFlRLR.js";var Ie=[[`rtu1`,`hvac-rtu`,`hvac`,`floor-1`,0],[`rtu2`,`hvac-rtu`,`hvac`,`floor-2`,0],[`rtu3`,`hvac-rtu`,`hvac`,`floor-3`,0],[`chiller`,`industrial-chiller`,`chilled-water`,`plant`,0],[`chwPump`,`centrifugal-pump`,`chilled-water`,`plant`,0],[`boiler`,`hot-water-boiler`,`heating`,`boiler-room`,0],[`hwPump`,`centrifugal-pump`,`heating`,`boiler-room`,0],[`fanA`,`ac-induction-motor`,`electrical`,`ahu-fans`,0],[`fanB`,`ac-induction-motor`,`electrical`,`ahu-fans`,1],[`genset`,`diesel-generator`,`electrical`,`emergency-power`,0]],Le=e=>n(Ie,e);function Re(e){let t=(e,t,n)=>({key:e,assetId:e,name:t,kind:`utility`,area:n});return[t(e.rtu1,`Rooftop unit · floor 1`,`HVAC`),t(e.rtu2,`Rooftop unit · floor 2`,`HVAC`),t(e.rtu3,`Rooftop unit · floor 3`,`HVAC`),t(e.chiller,`Chiller`,`Chilled water`),t(e.chwPump,`Chilled-water pump`,`Chilled water`),t(e.boiler,`Hot-water boiler`,`Heating`),t(e.hwPump,`Heating circulation pump`,`Heating`),t(e.fanA,`AHU supply fan 1`,`Electrical`),t(e.fanB,`AHU supply fan 2`,`Electrical`),t(e.genset,`Emergency generator`,`Electrical`)]}var b=e(ce(),1),x={x:-332,y:-228,w:232,d:74,r:2},ze=29,S=1,Be={x:-86,y:-192,w:44,d:36,r:1.5},C={x:-79,y:-184,w:30,d:20,r:1.5},Ve=26;function He(e){let{k:t,P:n,L:r,slab:i,cyl:a}=e,o=[];for(let e=x.x+ze;e<x.x+x.w-1;e+=ze)o.push(t.segment([e,x.y,S],[e,x.y+x.d,S],n));for(let e=x.y+ze;e<x.y+x.d-1;e+=ze)o.push(t.segment([x.x,e,S],[x.x+x.w,e,S],n));let s=[i(x,0,S,{tone:`mid`,inner:r(o.join(``),{tone:`faint`})},3,.3)];for(let e of[-322,-124])s.push(i({x:e,y:-216,w:22,d:10,r:1},S,5,{tone:`mid`},2,.3),i({x:e+1.6,y:-214.4,w:18.8,d:6.8,r:.6},6,.6,{tone:`lo`},2,0));for(let e=-316;e<x.x+x.w-8;e+=46)s.push(a(e,x.y+x.d-4,1.3,S,7,{tone:`mid`},12));return s.join(``)}function Ue(e,t){let{k:n,P:r,L:i,slab:a}=e,o=Be.x+Be.w,s=[];for(let e=o+12;e<t-4;e+=12)s.push(n.segment([e,-153,.6],[e,-147,.6],r));return a({x:o,y:-153.5,w:t-o,d:7,r:.4},0,.6,{tone:`mid`,inner:i(s.join(``),{tone:`faint`})},2,.1)}function We(e){let{k:t,P:n,L:r,slab:i,cyl:a}=e,{x:o,y:s,w:c,d:l}=C,u=1.5,d=[];for(let e=1;e<12;e++)d.push(t.segment([o+3+e*2,s+l+5,5.5],[o+3+e*2,s+l+5,22],n));let f=[i(Be,0,u,{tone:`mid`},3,.3),i(C,u,Ve,{tone:`mid`},2,.5),i({x:o+3,y:s+l,w:c-6,d:5,r:.6},4.5,19,{tone:`mid`,inner:r(d.join(``),{tone:`faint`})},2,.2),i({x:o-.8,y:s-.8,w:c+1.6,d:l+1.6,r:1.5},27.5,1.4,{tone:`mid`},2,.2)];for(let e of[o+7,o+15,o+23])f.push(a(e,s+5,1.4,28.9,7,{tone:`mid`},12),a(e,s+5,2.2,28.9,1.4,{tone:`mid`},12));for(let e of[s+5,s+10,s+15])f.push(a(o+c-3,e,1,28.9,3,{tone:`lo`},10));return f.join(``)}function Ge(e,t,n=1.6){let{k:r,P:i,L:a,slab:o,screws:s}=e;return o(t,0,n,{tone:`mid`},3,.4)+a(r.planOutline(r.insetPlan(t,3),n,i,3),{tone:`faint`})+s(r.corners(t,4),n)}function w(e,t,n,r,{louvres:i=[],doors:a=[]}={}){let{k:o,P:s,L:c,slab:l}=e,u=[l(t,0,n,{tone:`mid`},2,.3),l({x:t.x-.6,y:t.y-.6,w:t.w+1.2,d:t.d+1.2,r:.3},n,1.4,{tone:`mid`},2,.2)],d=r===`south`?e.front(t.y+t.d):o.sideMatrix([t.x+t.w,t.y+t.d],0,s,`right`),f=[];for(let[e,t]of i){let[r,i]=[e,t];f.push(`<path class="cr-grille" d="M${r} ${-(n-9)}H${i}V-13H${r}Z"/>`);let a=[];for(let e=16;e<n-9;e+=3)a.push(`M${r+1} ${-e}H${i-1}`);f.push(c(a.join(``),{tone:`lo`}))}for(let[e,t]of a){let[r,i]=[e,t];f.push(`<path class="cr-door" d="M${r} -1H${i}V${-(n-16)}H${r}Z"/>`),f.push(c(`M${r-1.2} 0V${-(n-14.8)}H${i+1.2}V0M${r-1.2} -1H${i+1.2}`,{tone:`lo`})),f.push(`<circle class="sf-screw" cx="${i-2.4}" cy="${-(n/2-4)}" r="0.7"/>`)}return f.length&&u.push(`<g transform="${d}">${f.join(``)}</g>`),u.join(``)}function Ke(e,t,n,r){let{k:i,P:a,L:o,slab:s,screws:c}=e,l=t.x+t.w,u=[w(e,t,n,`south`,{doors:[[t.x+8,t.x+22]],louvres:[[t.x+30,t.x+46]]})];u.push(s({x:t.x+t.w-18,y:t.y+8,w:10,d:8,r:.8},n+1.4,4,{tone:`mid`},2,.3));let d=i.sideMatrix([l,t.y+t.d],0,a,`right`),f=t.y+t.d-r.y;return u.push(`<g transform="${d}"><path class="sf-plate" d="M${f-7} ${-(r.z+7)}H${f+7}V${-(r.z-7)}H${f-7}Z"/>${o(`M${f-7} ${-(r.z+7)}H${f+7}V${-(r.z-7)}H${f-7}Z`,{tone:`lo`})}</g>`,c([[l+.05,r.y-5.6],[l+.05,r.y+5.6]],r.z+5.6),c([[l+.05,r.y-5.6],[l+.05,r.y+5.6]],r.z-5.6)),u.join(``)}function qe(e,[t,n],r,i,a,o){let{k:s,P:c,L:l,slab:u,cyl:d}=e,f=[],p=[];for(let e=i+48;e<a-12;e+=48)p.push(e);let m=p.map(e=>s.sideArc(t,n,r,e,c,24)).join(``);f.push(d(t,n,r,i,a-i,{tone:`mid`,inner:l(m,{tone:`faint`})},28));for(let e of p)f.push(d(t,n,r+1.2,e-.8,1.6,{tone:`mid`},28));for(let e of o)f.push(u({x:e.toX,y:n-.9,w:t-r-e.toX,d:1.8,r:.3},e.z-.9,1.8,{tone:`mid`},2,.1),u({x:e.toX-1.2,y:n-3.5,w:1.2,d:7,r:.3},e.z-3.5,7,{tone:`mid`},2,.1),d(t,n,r+.9,e.z-1.1,2.2,{tone:`mid`},28));for(let e of[0,2.1,4.2])f.push(d(t+Math.cos(e)*(r-1.4),n+Math.sin(e)*(r-1.4),.5,a,3,{tone:`lo`,crease:`none`},8));return f.push(d(t,n,r+2.2,a+3,1.2,{tone:`mid`},28)),f.join(``)}var T={x:-300,y:-268,w:290,d:32,r:.6},E=[4,64,124],D=3,O={x:-334,y:-268,w:34,d:32,r:.6},k=e=>(E[e+1]??184)-4,Je={x:O.x-3,y:T.y-3,w:T.w+O.w+3+7,d:T.d+3+8,r:1.5},A={x:T.x+D,y:T.y+D,w:T.w-D,d:T.d-D,r:0},Ye=A.x+A.w,Xe=A.y+A.d,Ze=[-247,-185,-123,-61,-13],Qe=2.2,j=2.6,M=E[0],N=-247,$e=-255,et=11,tt=e=>k(e)-et,nt=[-246,-162,-78],rt=-251,it=.8,at=[46*it,20*it],ot=e=>[(nt[e]??0)-9,(nt[e]??0)+9],st=e=>{let[t,n]=ot(e);return{x:t-5,y:-259.5,w:n-t+10,d:9,r:.3}},ct=e=>nt.map((e,t)=>t).filter(t=>t<e),P=4,F=1.6,lt=.6;function ut(e){let{k:t,P:n,L:r,slab:i}=e;return i(Je,0,M,{tone:`mid`,inner:r(t.planOutline({x:T.x-.5,y:T.y-.5,w:T.w+1,d:T.d+1,r:0},M,n,2),{tone:`faint`})},4,.5)}function dt(e){let{k:t,P:n,L:r,S:i}=e,a=190-M,o=(e,r,i)=>t.segment([r[0],r[1],E[e]??0],[i[0],i[1],E[e]??0],n),s={x:T.x,y:T.y,w:T.w,d:D,r:.3},c={x:T.x,y:T.y+D,w:D,d:T.d-D,r:.3};return[i(t.slabOf(s,M,a,n,2,.3),{tone:`mid`,inner:r([1,2].map(e=>o(e,[s.x,s.y+s.d],[s.x+s.w,s.y+s.d])).join(``),{tone:`faint`})}),i(t.slabOf(c,M,a,n,2,.3),{tone:`mid`}),ft(e)].join(``)}function ft(e){let{k:t,P:n,L:r,S:i,front:a}=e,o=O.y+O.d,s=O.x+O.w/2,c=[],l=[];for(let[e,t]of E.entries()){for(let e of[s-8,s+.4])c.push(`<path class="cr-door" d="M${e} ${-(t+1)}h7.6v-23h-7.6Z"/>`);l.push(`M${s-9} ${-t}V${-(t+25)}H${s+9}V${-t}`),c.push(`<path class="cr-grille" d="M${s-2.4} ${-(t+28)}h4.8v-2.4h-4.8Z"/>`),e<E.length-1&&l.push(`M${O.x} ${-(k(e)+4)}H${O.x+O.w}`)}return i(t.slabOf(O,M,184-M,n,2,.4),{tone:`mid`})+`<g transform="${a(o)}">${c.join(``)}${r(l.join(``),{tone:`lo`})}</g>`}var pt=Array.from({length:6},(e,t)=>[-284+t*36,-284+t*36+32]),mt=21,ht=8;function gt(e,t){let{k:n,P:r,L:i,front:a}=e,o=(E[t]??0)+mt,s=k(t)-ht,c=(e,n)=>`<path class="bd-win bt-pane" data-occ="${t}" d="M${e} ${-s}H${n}V${-o}H${e}Z"/>`,l=(e,t)=>`M${e-1} ${-(o-1.6)}H${t+1}M${(e+t)/2} ${-s}V${-o}`,u=pt.map(([e,t])=>c(e,t)).join(``),d=pt.map(([e,t])=>l(e,t)).join(``),f=n.sideMatrix([T.x+D,T.y+T.d],0,r,`right`);return`<g transform="${a(T.y+D)}">${u}${i(d,{tone:`lo`})}</g><g transform="${f}">${c(4,20)}${i(l(4,20),{tone:`lo`})}</g>`}function _t(e,t){let{k:n,P:r,L:i,slab:a}=e,o=(E[t]??0)-4,s=[a(A,o,4,{tone:`mid`,inner:i(n.segment([A.x,A.y+A.d,o+1.4],[A.x+A.w,A.y+A.d,o+1.4],r),{tone:`faint`})},2,.4)],c=E[t]??0;for(let e of ct(t)){let t=st(e);s.push(a({...t,d:F},c,P,{tone:`mid`},2,.2),a({...t,w:F},c,P,{tone:`mid`},2,.2))}return s.join(``)}function vt(e,t,n,r){let{cyl:i}=e,a=st(t),o=(E[n]??0)+P,s=r===`back`?a.y+lt+.4:a.y+a.d-lt-.4;return[a.x+.8,a.x+a.w-.8].map(e=>i(e,s,lt,o,k(n)-o,{tone:`mid`,crease:`none`},8))}function yt(e,t){return ct(t).flatMap(n=>vt(e,n,t,`back`)).join(``)}function bt(e,t){let{cyl:n,slab:r}=e,i=E[t]??0,a=k(t)-i,o=Xe-j,s=Ze.map(e=>n(e,o,Qe,i,a,{tone:`mid`},14));s.push(n(Ye-j,-251,Qe,i,a,{tone:`mid`},14));for(let n of ct(t)){let a=st(n);s.push(r({...a,y:a.y+a.d-F,d:F},i,P,{tone:`mid`},2,.2),r({...a,x:a.x+a.w-F,w:F},i,P,{tone:`mid`},2,.2),...vt(e,n,t,`front`))}return s.join(``)}function xt(e){let{k:t,P:n,L:r,S:i,slab:a}=e,o=[.25,.5,.75].map(e=>t.segment([A.x+A.w*e,A.y,184],[A.x+A.w*e,A.y+A.d,184],n)).join(``),s=A.y+A.d,c=A.x+A.w;return[i(t.slabOf(A,180,4,n,2,.4),{tone:`mid`,inner:r(o,{tone:`faint`})}),a({x:A.x,y:s-j,w:A.w,d:j,r:.3},184,5,{tone:`mid`},2,.3),a({x:c-j,y:A.y,w:j,d:A.d-j,r:.3},184,5,{tone:`mid`},2,.3),...nt.map(e=>a({x:e-at[0]-1.5,y:rt-at[1]-1.5,w:at[0]*2+3,d:at[1]*2+3,r:.6},184,3,{tone:`mid`},2,.2)),a({x:O.x+4,y:O.y+8,w:O.w-8,d:O.d-16,r:.6},184,14,{tone:`mid`},2,.3)].join(``)}var St={w:16,d:10,h:4},Ct=18,wt=1.8,Tt=[[-190,-100],[-120,-65],[-120,-204]],I={x:-24,y:N,w:16,d:14,h:12,top:32},Et={w:10,d:8,h:4},Dt=-262,Ot=-264.4,kt=5.5,At=1.5,jt=1.1,Mt=[-282,-246,-210,-174,-138,-102],Nt=8.5,Pt=-292,Ft=(e,t)=>[e,N,k(t)-Ct+wt],It=[I.x,I.y,I.top+wt],Lt=e=>[ot(e)[1],$e,k(e)-Ct+wt];function Rt(e,t,n,r,i,a,o,s,c){let{k:l,P:u,L:d,D:f,slab:p,cyl:m,at:ee}=e,h=o-a,te=[[t-r/2+1.5,n-i/2+1.5],[t+r/2-1.5,n-i/2+1.5],[t-r/2+1.5,n+i/2-1.5],[t+r/2-1.5,n+i/2-1.5]].map(([e=0,t=0])=>m(e,t,.5,o,s-o,{tone:`lo`,crease:`none`},8)),ne=[.3,.55,.8].map(e=>l.segment([t-r/2+1.5,n+i/2,h+a*e],[t+r/2-1.5,n+i/2,h+a*e],u)).join(``),g=[];for(let e=0;e<6;e++)g.push([t-r/2+2+e*(r-4)/5,n+i/2,h+1.2]);return[...te,p({x:t-r/2,y:n-i/2,w:r,d:i,r:.8},h,a,{tone:`mid`,inner:d(ne,{tone:`faint`})},2,.3),m(t,n,Math.min(5.2,i/2-1.2),o,wt,{tone:`mid`},24),f(g.map(e=>ee(e)),{size:.3}),c?`<g data-diffuser="${t},${n},${h},${r/2}"></g>`:``].join(``)}var zt=(e,t,n)=>Rt(e,t,N,St.w,St.d,St.h,k(n)-Ct,k(n),!0),Bt=e=>Rt(e,I.x,I.y,I.w,I.d,I.h,I.top,k(0),!0),Vt=(e,t)=>Rt(e,ot(t)[1],$e,Et.w,Et.d,Et.h,k(t)-Ct,k(t),!1);function Ht(e,t,n){let{k:r,P:i,L:a,slab:o}=e,s=n+11,c=s+Nt,l=Array.from({length:7},(e,n)=>r.segment([t+3.5+n*3.5,-261.4,s+1],[t+3.5+n*3.5,-261.4,c-1],i)).join(``);return[...[t+5,t+28-5].map(e=>o({x:e-1,y:-265,w:2,d:.9,r:.2},s+2,4,{tone:`lo`},2,0)),o({x:t,y:-265,w:28,d:3.6,r:.5},s,Nt,{tone:`mid`,inner:a(l,{tone:`faint`})},2,.3)].join(``)}function Ut(e,t,n){let{G:r,P:i,S:a}=e,o=r.frameAlong([Pt,t,n],[-1,0,0]);return a(r.disc(0,1.4,1.8,o,i),{tone:`mid`})}function Wt(e,t,n,r,i){let{slab:a,cyl:o,front:s}=e,c=r+8,l=[a({x:t+.8,y:n+.6,w:1.2,d:6.8,r:.2},r,8,{tone:`lo`},2,0),a({x:t+22-2,y:n+.6,w:1.2,d:6.8,r:.2},r,8,{tone:`lo`},2,0),a({x:t,y:n,w:22,d:8,r:.6},c,1.4,{tone:`mid`},2,.3),o(t+11,n+3.2,1.1,c+1.4,2.4,{tone:`lo`,crease:`none`},10),a({x:t+11-4.2,y:n+3.2-.5,w:8.4,d:1,r:.3},c+3.8,5.4,{tone:`lo`},2,0)],u=n+3.2+.5;return l.push(`<g transform="${s(u)}"><path class="bd-win" data-occ="${i}" d="M${t+11-3.6} ${-(c+4.2)}h7.2v-4.4h-7.2Z"/></g>`),l.join(``)}function Gt(e,t,n,r){let{slab:i,cyl:a}=e;return[a(t,n,3,r,.8,{tone:`lo`},14),a(t,n,.6,r+.8,3.6,{tone:`lo`,crease:`none`},8),a(t,n,3.2,r+4.4,1.4,{tone:`mid`},16),i({x:t-3,y:n+2.6,w:6,d:.9,r:.3},r+5.6,5.4,{tone:`mid`},2,.2)].join(``)}function Kt(e,t,n,r){let{slab:i}=e;return[Wt(e,t,-249,n,r),Wt(e,t+25,-249,n,r),i({x:t+22.6,y:-249.5,w:1,d:7,r:.2},n+1.2,12,{tone:`mid`},2,.2),Gt(e,t+11,-239.6,n),Gt(e,t+36,-239.6,n)].join(``)}function qt(e,t){let{slab:n,cyl:r}=e,i=[];i.push(n({x:-250,y:-251,w:46,d:8,r:1},t,10,{tone:`mid`},3,.4),n({x:-214,y:-243,w:10,d:7,r:1},t,10,{tone:`mid`},3,.4),n({x:-250.8,y:-251.8,w:47.6,d:9.6,r:1},t+10,1.4,{tone:`mid`},3,.2),n({x:-214.8,y:-243.8,w:11.6,d:8.6,r:1},t+10,1.4,{tone:`mid`},3,.2));for(let e of[-170,-144])i.push(n({x:e,y:-250,w:20,d:6,r:.8},t+3.2,3,{tone:`mid`},2,.3),n({x:e,y:-252,w:20,d:2,r:.4},t+6.2,6,{tone:`mid`},2,.2),r(e+2.4,-245.4,.9,t,3.2,{tone:`lo`,crease:`none`},8),r(e+17.6,-245.4,.9,t,3.2,{tone:`lo`,crease:`none`},8));return i.join(``)}function Jt(e,t){let n=E[t]??0,r=Mt.map(t=>Ht(e,t,n));r.push(Ut(e,Dt,n+kt),Ut(e,Ot,n+At));let i=Tt[t]??[];r.push(yt(e,t));for(let n of i)r.push(zt(e,n,t));if(r.push(Vt(e,t)),t===0)r.push(qt(e,n));else for(let a of i)r.push(Kt(e,a-23.5,n,t));return r.join(``)}var Yt=1e3,Xt={x:-352,y:-286,w:652,d:170,r:8},Zt={x:-14,y:-516,w:314,d:220,r:8},Qt={x:-374,y:-538,w:690,d:444,r:16},$t=[34,-242],en=ke([...y(Qt,-21,-14),...y(Xt,-14,20),...y(Zt,-14,20),...y(Je,0,214),...y({x:26,y:-250,w:16,d:16,r:0},0,244)],Yt,620,{pad:22,azimuth:60}),tn=-325,nn=[70,205],rn=le(100,!0),an=[-202,-135,0],on=[-34,36.6,40],sn=[-20,36.6,40],cn=[94,-130,0],L=[.55,.5],ln=-385,un=-462,dn=(e,t)=>[(e[0]-cn[0])*t,(e[1]-cn[1])*t,e[2]*t],fn=e=>{let t=nn[e],n=fe(100,7),r=e=>[t+e[0],tn+e[1],e[2]];return{supply:r(n.chwSupply),ret:r(n.chwReturn),discharge:r(n.discharge)}},pn=[fn(0),fn(1)],R=[pn[0].supply[0]-sn[0],un],z=[$t[0]-ge[0],$t[1]],mn=[z[0]+he[0],z[1]+he[1],he[2]],hn=[z[0]+ye[0],z[1]+ye[1],ye[2]],gn=(e,t,n)=>[e-dn(r,L[n])[0],t],_n=[gn(R[0]+on[0],ln,0),gn(hn[0],-204,1)],vn=(e,t)=>{let[n,r]=_n[e]??[0,0],[i,a,o]=dn(t,L[e]);return[n+i,r+a,o]},yn=[{suction:vn(0,u),riser:vn(0,r)},{suction:vn(1,u),riser:vn(1,r)}],bn=[190,-150],B={x:24,y:-160,w:56,d:44,r:1},xn={x:108,y:-192,w:164,d:72,r:2},Sn={x:108,y:-194,w:164,d:3,r:.3},Cn={x:108,y:-194,w:3,d:76,r:.3},wn=[-49,0,60.8],Tn={x:0,y:-272,w:252,d:76,r:2},En={x:2,y:-270,w:250,d:3,r:.3},Dn={x:-10,y:-512,w:306,d:4,r:.3},On={x:-12,y:-512,w:4,d:214,r:.3},kn=[..._n.map((e,t)=>({key:`pump${t}`,at:e,h:45*L[t]})),{key:`chiller`,at:R,h:56},{key:`boiler`,at:z,h:he[2]-8},{key:`flue`,at:$t,h:236},...nn.map((e,t)=>({key:`ahu${t}`,at:[e,tn],h:36})),{key:`xfmr`,at:[C.x+C.w/2,C.y+C.d/2],h:36},{key:`genset`,at:bn,h:126},{key:`elec`,at:[B.x+B.w/2,B.y+B.d/2],h:46},{key:`gen-back`,at:[Sn.x+Sn.w/2,Sn.y],h:36},{key:`gen-west`,at:[Cn.x,Cn.y+Cn.d/2],h:36}],An=Pe(kn,en),jn=An.order,Mn=E.length,Nn=([e,t])=>e<14&&t>-269&&t<-232,Pn=([e,t])=>e<-8&&t<-269,Fn=([e,t])=>e<-8&&t<-256.5,In=e=>E.filter((t,n)=>n>0&&e>=t).length,Ln={layer:e=>Pn(e)?0:Nn(e)&&e[2]>=184?Mn+1:Nn(e)&&Fn(e)?Rn+In(e[2]):Nn(e)?1+In(e[2]):Mn+1+An.depth.layer(e),glide:()=>!0},Rn=Mn+1+jn.length+1,zn={y:bn[1],z:26};function Bn(e,t){return[e,...[...E].filter(n=>n>0&&n<e&&n>t).sort((e,t)=>t-e),t]}var Vn=3.2,Hn=2.2,Un=180;function Wn(e,t,n,r){let i=Bn(Un,n);return i.slice(0,-1).map((n,a)=>{let o=[[t,$e,n],[t,$e,i[a+1]??0]];return a===i.length-2&&o.push(...r),{id:`${e}${a}`,medium:`duct`,r:Vn,bend:2,bare:[a===0,!1],pts:o}})}var Gn=[0,1,2].flatMap(e=>{let t=tt(e),[n,r]=ot(e),i=[...Tt[e]??[]].sort((e,t)=>Math.abs(e-n)-Math.abs(t-n)),a=i[i.length-1]??n,o=i.slice(0,-1).map((n,r)=>({id:`sup${e}-n${r}`,medium:`duct`,r:Hn,pts:[[n,N,t],Ft(n,e)]}));return[...Wn(`sup${e}-`,n,t,[[n,N,t],[a,N,t],Ft(a,e)]),...o,...Wn(`ret${e}-`,r,Lt(e)[2],[])]}),[V,H]=pn,U=-279,Kn=It[0],W=40,qn=[{id:`ahu-a`,medium:`duct`,r:3.5,pts:[V.discharge,[V.discharge[0],U,V.discharge[2]],[V.discharge[0],U,W]]},{id:`ahu-b`,medium:`duct`,r:3.5,pts:[H.discharge,[H.discharge[0],U,H.discharge[2]],[H.discharge[0],U,W],[Kn,U,W],[Kn,-266.5,W]]},{id:`ahu-in`,medium:`duct`,r:3.5,pts:[[Kn,-265,W],[Kn,It[1],W],It]}],G=[R[0]+sn[0],R[1]+sn[1],sn[2]],Jn=[R[0]+on[0],R[1]+on[1],on[2]],[K,q]=yn,Yn=46,Xn=-360,Zn=K.suction[2],Qn=K.suction[1],$n=V.supply[1],er=e=>[[e,$n,Yn],[e,Qn,Yn],[e,Qn,Zn]],tr=[{id:`chw-dis`,medium:`coolantret`,r:l*L[0],fromStub:!0,pts:[K.riser,[K.riser[0],K.riser[1],Jn[2]],Jn]},{id:`chw-sup`,medium:`coolant`,r:2.6,pts:[G,[G[0],$n,G[2]],V.supply]},{id:`chw-sup-b`,medium:`coolant`,r:2.6,pts:[[G[0],Xn,G[2]],[H.supply[0],Xn,G[2]],[H.supply[0],$n,G[2]],H.supply]},{id:`chw-ret-b`,medium:`coolantret`,r:2.6,pts:[H.ret,...er(H.ret[0]),K.suction]},{id:`chw-ret`,medium:`coolantret`,r:2.6,pts:[V.ret,...er(V.ret[0])]}],J=-6,Y=Dt,nr=-258,rr=-18,ir=-180,ar=q.suction[0]+40,or=70,sr=hn[2]+20,cr=(e,t,n,r,i,a)=>Bn(a,i).slice(0,-1).map((o,s,c)=>{let l=s===c.length-1?i:Bn(a,i)[s+1]??i;return{id:`${e}${s}`,medium:n,r,blind:[s===c.length-1,s===0],pts:[[J,t,l],[J,t,o]]}}),lr=E.flatMap((e,t)=>{let n=e+kt,r=e+At;return[{id:`hw-s${t}`,medium:`heat`,r:jt,blind:[!1,!0],pts:[[J,Y,n],[Pt,Y,n]]},{id:`hw-r${t}`,medium:`hotret`,r:jt,blind:[!0,!1],pts:[[Pt,Ot,r],[rr,Ot,r],[rr,nr,r],[J,nr,r]]},...Mt.flatMap((i,a)=>[{id:`hw-st${t}-${a}`,medium:`heat`,r:1,bare:[!1,!0],pts:[[i+28-3,Y,n],[i+28-3,Y,e+11]]},{id:`hw-rt${t}-${a}`,medium:`hotret`,r:1,bare:[!0,!1],pts:[[i+3,Ot,e+11],[i+3,Ot,r]]}])]}),ur=[...cr(`hw-sr`,Y,`heat`,2.2,5,E[2]+kt+6),...cr(`hw-rr`,nr,`hotret`,2.2,3,E[2]+At+6),{id:`hw-feed-s`,medium:`heat`,r:2.2,pts:[mn,[mn[0],mn[1],or],[mn[0],Y,or],[J,Y,or]]},{id:`hw-feed-r`,medium:`hotret`,r:2.2,pts:[[J,nr,q.suction[2]],[J,ir,q.suction[2]],[ar,ir,q.suction[2]],[ar,q.suction[1],q.suction[2]],q.suction]},{id:`hw-dis`,medium:`hotret`,r:l*L[1],fromStub:!0,pts:[q.riser,[q.riser[0],q.riser[1],sr],[hn[0],hn[1],sr],hn]}],X=[bn[0]+wn[0],bn[1]+wn[1],wn[2]],dr=B.x+B.w,fr=[{id:`gen-cable`,medium:`cable`,r:1.6,pts:[X,[X[0],X[1],72],[dr+12,X[1],72],[dr+12,X[1],zn.z],[dr,X[1],zn.z]]}],pr=[...lr,...Gn,...tr,...qn,...ur,...fr],Z=(e,t,n,r,i=0)=>[e,t,n,r,i],mr={z:10,flanged:!0,routes:pr,posts:[Z(180,U,3.5,W),Z(60,U,3.5,W),Z(20,U,3.5,W),Z(40,Y,2.2,or,4),Z(G[0],-416,2.6,G[2]),Z(Jn[0],-405,2.6,G[2]),...[110,150,190].flatMap(e=>[Z(e,Xn,2.6,G[2]),Z(e,Qn,2.6,Zn)]),Z(X[0]-20,X[1],1.6,72,1.6)]},Q=Fe(),hr={x:-248,y:-164,w:92,d:58,r:3},gr=0,_r=(e,t)=>ue(e,t,`downshot`),vr=(e,t)=>ve(e,t,7,236-gr),yr=(e,t)=>o(e,t,`coolantret`,!0),br=(e,t)=>o(e,t,`hotret`,!0),xr=(e,t)=>pe(e,t,100,{humidifier:!1,filterGauge:!1,fanHook:`data-vfan`,stubHalf:7,motor:!0}),Sr=[E[1]-2,E[2]-2,182];function Cr(e){return c(e,Qt)+e.plinth(Xt)+e.plinth(Zt)+He(e)+Ue(e,B.x)+Ge(e,Tn)+Ge(e,xn)+w(e,En,34,`south`,{louvres:[[30,50],[100,120],[170,190]]})+w(e,Dn,64,`south`,{louvres:[[60,90],[130,160],[200,230],[260,290]]})+w(e,On,64,`east`,{doors:[[60,80]]})}var wr=e=>qe(e,$t,6,112,236,Sr.map(e=>({z:e,toX:Ye}))),Tr=e=>Ke(e,B,40,zn),Er=e=>w(e,Sn,36,`south`,{louvres:[[128,158],[200,230]]}),Dr=e=>w(e,Cn,36,`east`,{louvres:[[20,50]],doors:[[56,74]]});function Or({ids:e}){let t=je(),n=a(mr,Ln),r=(0,b.useMemo)(()=>Cr(t),[t]),o=(0,b.useMemo)(()=>ut(t)+dt(t),[t]),s=e=>(0,Q.jsx)(_,{html:`${n.layers[e]??``}<g data-flows="${e}" data-depth="${e}"></g>`,data:{pipes:``}},`pipes-${e}`),c=[e.rtu1,e.rtu2,e.rtu3],l=[];for(let[n,r]of c.entries())l.push(n>0?(0,Q.jsx)(_,{html:_t(t,n)},`slab${n}`):null,(0,Q.jsx)(_,{html:gt(t,n)},`win${n}`),s(Rn+n),(0,Q.jsx)(_,{asset:r,intro:2+n,html:Jt(t,n)},`in${n}`),n===0?(0,Q.jsx)(_,{asset:e.fanA,intro:5,html:Bt(t)},`ahu-box`):null,s(1+n),(0,Q.jsx)(_,{html:bt(t,n)},`col${n}`));let u={chiller:(0,Q.jsx)(i,{from:an,to:g(R),children:(0,Q.jsx)(v,{id:e.chiller,plan:hr,intro:12,draw:xe})}),boiler:(0,Q.jsx)(i,{to:g(z),children:(0,Q.jsx)(v,{id:e.boiler,plan:_e,intro:13,draw:vr})}),flue:(0,Q.jsx)(_,{html:(0,b.useMemo)(()=>wr(t),[t]),intro:13}),xfmr:(0,Q.jsx)(_,{html:(0,b.useMemo)(()=>We(t),[t]),intro:16}),elec:(0,Q.jsx)(_,{html:(0,b.useMemo)(()=>Tr(t),[t]),intro:16}),"gen-back":(0,Q.jsx)(_,{html:(0,b.useMemo)(()=>Er(t),[t]),intro:15}),"gen-west":(0,Q.jsx)(_,{html:(0,b.useMemo)(()=>Dr(t),[t]),intro:15}),genset:(0,Q.jsx)(`g`,{className:`gen-set`,children:(0,Q.jsx)(i,{to:g(bn),children:(0,Q.jsx)(v,{id:e.genset,plan:we,intro:16,draw:Te})})})};for(let[t,[n,r]]of _n.entries())u[`pump${t}`]=(0,Q.jsx)(i,{from:cn,to:g([n,r]),scale:L[t],children:(0,Q.jsx)(v,{id:t?e.hwPump:e.chwPump,plan:ne,intro:14+t,draw:t?br:yr})});for(let[t,n]of nn.entries())u[`ahu${t}`]=(0,Q.jsx)(i,{to:g([n,tn]),children:(0,Q.jsx)(v,{id:t?e.fanB:e.fanA,plan:rn,intro:10+t,draw:xr})});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_,{html:r,data:{plinth:``}}),s(0),(0,Q.jsx)(_,{html:o}),l,(0,Q.jsx)(_,{html:xt(t)}),nt.map((e,t)=>(0,Q.jsx)(i,{to:[e,rt,187],scale:it,children:(0,Q.jsx)(v,{id:c[t]??``,plan:de,intro:6+t,draw:_r})},e)),s(4),jn.flatMap((e,t)=>[(0,Q.jsx)(`g`,{children:u[e.key]},e.key),s(5+t)])]})}var kr=10,Ar=17,jr=.55;function Mr(e,t,n){let{svg:r,P:i,feed:a}=e,o=Me(r,`[data-occ]`).map(e=>({el:e,id:t[Number(e.dataset.occ)]??oe(e)})),s=Me(r,`[data-diffuser]`).map(e=>({id:oe(e),at:Ne(e.dataset.diffuser),streaks:d(e,kr,`path`,`cr-stream`),phase:0}));return{draw(t,r,c){for(let e of o)Ae(e.el,`data-on`,a.num(e.id,`occupied`)>0?``:null);let l=e.reducedMotion();for(let e of s){let r=h(n(e.id));e.phase=(e.phase+r*jr*t)%1;let[a=0,o=0,s=0,u=0]=e.at;for(let[t,n]of e.streaks.entries()){if(!c||l||r<.02||n.seed>.25+r){Oe(n.el,`0`);continue}let d=(e.phase+n.seed*3.1)%1,f=((t+.5)/kr-.5)*2*(u-1.5),p=(n.seed-.5)*8,m=s-.5-d*Ar,ee=[a+f,o+p,m],h=[a+f,o+p,m-3],[te,ne]=De(ee,i),[g,re]=De(h,i);Ae(n.el,`d`,`M${te.toFixed(1)} ${ne.toFixed(1)}L${g.toFixed(1)} ${re.toFixed(1)}`),Oe(n.el,(Math.sin(Math.PI*d)*.5).toFixed(2))}}},bar(){}}}var $=e=>e>.002?6+26*h(e*2):0,Nr=e=>{let{svg:t,feed:n,ids:r}=e,i=ee(t),a=me(e,i),o=Se(e,i),s=ae(e,i),c=be(e,i),l=Ce(e,i),u=Ee(e,i),d=e=>h(n.num(e,`speed_feedback`)/n.param(e,`rated_rpm`,1450)),f=e=>e===r.fanA?(d(r.fanA)+d(r.fanB))/2:a.airPu(e),p=[a,o,s,c,l,u,Mr(e,[r.rtu1,r.rtu2,r.rtu3],f)],ne=te(e,e=>re(n,e,`availability`)),g=ie(e,{needle:e=>o.needle(e)??c.needle(e)??0,bar:e=>p.reduce((t,n)=>t??n.bar(e),void 0)??0,alertsHigh:()=>!0,ready:()=>!0}),oe=[r.rtu1,r.rtu2,r.rtu3],ce=()=>s.flowPu(r.chwPump),le=()=>s.flowPu(r.hwPump),ue=()=>{let e=n.param(r.genset,`rated_power_kva`,500)*.8;return e>0?h(n.num(r.genset,`load_actual`)/e):0},de=m(e,({id:e})=>{let t=/^(?:sup|ret)(\d)-/.exec(e);if(t)return $(a.airPu(oe[Number(t[1])]??``));if(e.startsWith(`hw-s`)||e.startsWith(`hw-r`))return $(/^hw-[sr]\d$/.test(e)?le()/3:le());switch(e){case`ahu-a`:return $(d(r.fanA));case`ahu-b`:return $(d(r.fanB));case`ahu-in`:return $(f(r.fanA));case`chw-dis`:case`chw-sup`:case`chw-ret`:return $(ce());case`chw-sup-b`:case`chw-ret-b`:return $(ce()/2);case`hw-feed-s`:case`hw-feed-r`:case`hw-dis`:return $(le());case`gen-cable`:return $(ue());default:return 0}});return{data(e){ne.draw(e)},draw({sdt:e,t,introDone:n}){de.draw(e),g.draw(e,t);for(let r of p)r.draw(e,t,n)},resync(){},status:e=>se(n,e,`availability`)}},Pr=f(en),Fr=s(Pr,mr,Ln),Ir={width:Yt,height:620,label:`Isometric model of the Commercial Building: a three-storey office tower with a rooftop unit on each roof curb whose supply and return ducts drop through a chase to that storey's ceiling diffusers, and a loop of radiators along the back wall; behind it the mechanical room with the chiller, the chilled-water pump and two air handlers with their fan motors; beside it the boiler with its flue stack and heating pump, the transformer, and the standby diesel generator with its feeder to the electrical room. Pipes and ducts carry chilled water, hot water and air between them. Every moving part follows live values from the running engine.`,kit:Pr,flows:Fr.flows,joints:Fr.joints,Scene:Or,compose:Nr},Lr=p({layout:Ir,resolve:Le,things:Re,caption:`rooftop units · plant · standby power`,mismatch:`This floor expects the Commercial Building: three rooftop units, the chiller with its chilled-water pump, the hot-water boiler with its heating pump, two air handler fan motors and the standby diesel generator, by area and line.`,statusBasis:`availability`,Overview:t,tab:`Building`});export{Lr as buildingFloor};
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{n as t,t as n}from"./by-path-C9hM5E2c.js";import{A as r,D as i,E as a,F as o,H as s,L as c,N as l,P as u,T as d,V as f,X as p,a as m,b as ee,g as h,i as te,j as ne,k as g,n as re,o as ie,r as ae,s as oe,t as se}from"./status-DQYLUbXs.js";import{c as ce}from"./vendor-charts-Bquh2dWE.js";import{a as le,i as ue,n as de,o as fe,s as pe,t as me}from"./rtu-ByogcRPI.js";import{a as he,i as ge,n as _e,o as ve,r as ye,t as be}from"./boiler-s_q0j7rz.js";import{r as xe,t as Se}from"./chiller-r7DzAhJq.js";import{n as Ce,o as we,s as Te,t as Ee}from"./genset-C6_EUoFo.js";import{C as De,a as Oe,b as ke,c as Ae,d as _,f as je,l as v,m as y,n as Me,s as Ne}from"./dom-BxZbg3NX.js";import{t as Pe}from"./stages-EYRT12Yp.js";import{ot as Fe}from"./vendor-ui-BGeFlRLR.js";var Ie=[[`rtu1`,`hvac-rtu`,`hvac`,`floor-1`,0],[`rtu2`,`hvac-rtu`,`hvac`,`floor-2`,0],[`rtu3`,`hvac-rtu`,`hvac`,`floor-3`,0],[`chiller`,`industrial-chiller`,`chilled-water`,`plant`,0],[`chwPump`,`centrifugal-pump`,`chilled-water`,`plant`,0],[`boiler`,`hot-water-boiler`,`heating`,`boiler-room`,0],[`hwPump`,`centrifugal-pump`,`heating`,`boiler-room`,0],[`fanA`,`ac-induction-motor`,`electrical`,`ahu-fans`,0],[`fanB`,`ac-induction-motor`,`electrical`,`ahu-fans`,1],[`genset`,`diesel-generator`,`electrical`,`emergency-power`,0]],Le=e=>n(Ie,e);function Re(e){let t=(e,t,n)=>({key:e,assetId:e,name:t,kind:`utility`,area:n});return[t(e.rtu1,`Rooftop unit · floor 1`,`HVAC`),t(e.rtu2,`Rooftop unit · floor 2`,`HVAC`),t(e.rtu3,`Rooftop unit · floor 3`,`HVAC`),t(e.chiller,`Chiller`,`Chilled water`),t(e.chwPump,`Chilled-water pump`,`Chilled water`),t(e.boiler,`Hot-water boiler`,`Heating`),t(e.hwPump,`Heating circulation pump`,`Heating`),t(e.fanA,`AHU supply fan 1`,`Electrical`),t(e.fanB,`AHU supply fan 2`,`Electrical`),t(e.genset,`Emergency generator`,`Electrical`)]}var b=e(ce(),1),x={x:-332,y:-228,w:232,d:74,r:2},ze=29,S=1,Be={x:-86,y:-192,w:44,d:36,r:1.5},C={x:-79,y:-184,w:30,d:20,r:1.5},Ve=26;function He(e){let{k:t,P:n,L:r,slab:i,cyl:a}=e,o=[];for(let e=x.x+ze;e<x.x+x.w-1;e+=ze)o.push(t.segment([e,x.y,S],[e,x.y+x.d,S],n));for(let e=x.y+ze;e<x.y+x.d-1;e+=ze)o.push(t.segment([x.x,e,S],[x.x+x.w,e,S],n));let s=[i(x,0,S,{tone:`mid`,inner:r(o.join(``),{tone:`faint`})},3,.3)];for(let e of[-322,-124])s.push(i({x:e,y:-216,w:22,d:10,r:1},S,5,{tone:`mid`},2,.3),i({x:e+1.6,y:-214.4,w:18.8,d:6.8,r:.6},6,.6,{tone:`lo`},2,0));for(let e=-316;e<x.x+x.w-8;e+=46)s.push(a(e,x.y+x.d-4,1.3,S,7,{tone:`mid`},12));return s.join(``)}function Ue(e,t){let{k:n,P:r,L:i,slab:a}=e,o=Be.x+Be.w,s=[];for(let e=o+12;e<t-4;e+=12)s.push(n.segment([e,-153,.6],[e,-147,.6],r));return a({x:o,y:-153.5,w:t-o,d:7,r:.4},0,.6,{tone:`mid`,inner:i(s.join(``),{tone:`faint`})},2,.1)}function We(e){let{k:t,P:n,L:r,slab:i,cyl:a}=e,{x:o,y:s,w:c,d:l}=C,u=1.5,d=[];for(let e=1;e<12;e++)d.push(t.segment([o+3+e*2,s+l+5,5.5],[o+3+e*2,s+l+5,22],n));let f=[i(Be,0,u,{tone:`mid`},3,.3),i(C,u,Ve,{tone:`mid`},2,.5),i({x:o+3,y:s+l,w:c-6,d:5,r:.6},4.5,19,{tone:`mid`,inner:r(d.join(``),{tone:`faint`})},2,.2),i({x:o-.8,y:s-.8,w:c+1.6,d:l+1.6,r:1.5},27.5,1.4,{tone:`mid`},2,.2)];for(let e of[o+7,o+15,o+23])f.push(a(e,s+5,1.4,28.9,7,{tone:`mid`},12),a(e,s+5,2.2,28.9,1.4,{tone:`mid`},12));for(let e of[s+5,s+10,s+15])f.push(a(o+c-3,e,1,28.9,3,{tone:`lo`},10));return f.join(``)}function Ge(e,t,n=1.6){let{k:r,P:i,L:a,slab:o,screws:s}=e;return o(t,0,n,{tone:`mid`},3,.4)+a(r.planOutline(r.insetPlan(t,3),n,i,3),{tone:`faint`})+s(r.corners(t,4),n)}function w(e,t,n,r,{louvres:i=[],doors:a=[]}={}){let{k:o,P:s,L:c,slab:l}=e,u=[l(t,0,n,{tone:`mid`},2,.3),l({x:t.x-.6,y:t.y-.6,w:t.w+1.2,d:t.d+1.2,r:.3},n,1.4,{tone:`mid`},2,.2)],d=r===`south`?e.front(t.y+t.d):o.sideMatrix([t.x+t.w,t.y+t.d],0,s,`right`),f=[];for(let[e,t]of i){let[r,i]=[e,t];f.push(`<path class="cr-grille" d="M${r} ${-(n-9)}H${i}V-13H${r}Z"/>`);let a=[];for(let e=16;e<n-9;e+=3)a.push(`M${r+1} ${-e}H${i-1}`);f.push(c(a.join(``),{tone:`lo`}))}for(let[e,t]of a){let[r,i]=[e,t];f.push(`<path class="cr-door" d="M${r} -1H${i}V${-(n-16)}H${r}Z"/>`),f.push(c(`M${r-1.2} 0V${-(n-14.8)}H${i+1.2}V0M${r-1.2} -1H${i+1.2}`,{tone:`lo`})),f.push(`<circle class="sf-screw" cx="${i-2.4}" cy="${-(n/2-4)}" r="0.7"/>`)}return f.length&&u.push(`<g transform="${d}">${f.join(``)}</g>`),u.join(``)}function Ke(e,t,n,r){let{k:i,P:a,L:o,slab:s,screws:c}=e,l=t.x+t.w,u=[w(e,t,n,`south`,{doors:[[t.x+8,t.x+22]],louvres:[[t.x+30,t.x+46]]})];u.push(s({x:t.x+t.w-18,y:t.y+8,w:10,d:8,r:.8},n+1.4,4,{tone:`mid`},2,.3));let d=i.sideMatrix([l,t.y+t.d],0,a,`right`),f=t.y+t.d-r.y;return u.push(`<g transform="${d}"><path class="sf-plate" d="M${f-7} ${-(r.z+7)}H${f+7}V${-(r.z-7)}H${f-7}Z"/>${o(`M${f-7} ${-(r.z+7)}H${f+7}V${-(r.z-7)}H${f-7}Z`,{tone:`lo`})}</g>`,c([[l+.05,r.y-5.6],[l+.05,r.y+5.6]],r.z+5.6),c([[l+.05,r.y-5.6],[l+.05,r.y+5.6]],r.z-5.6)),u.join(``)}function qe(e,[t,n],r,i,a,o){let{k:s,P:c,L:l,slab:u,cyl:d}=e,f=[],p=[];for(let e=i+48;e<a-12;e+=48)p.push(e);let m=p.map(e=>s.sideArc(t,n,r,e,c,24)).join(``);f.push(d(t,n,r,i,a-i,{tone:`mid`,inner:l(m,{tone:`faint`})},28));for(let e of p)f.push(d(t,n,r+1.2,e-.8,1.6,{tone:`mid`},28));for(let e of o)f.push(u({x:e.toX,y:n-.9,w:t-r-e.toX,d:1.8,r:.3},e.z-.9,1.8,{tone:`mid`},2,.1),u({x:e.toX-1.2,y:n-3.5,w:1.2,d:7,r:.3},e.z-3.5,7,{tone:`mid`},2,.1),d(t,n,r+.9,e.z-1.1,2.2,{tone:`mid`},28));for(let e of[0,2.1,4.2])f.push(d(t+Math.cos(e)*(r-1.4),n+Math.sin(e)*(r-1.4),.5,a,3,{tone:`lo`,crease:`none`},8));return f.push(d(t,n,r+2.2,a+3,1.2,{tone:`mid`},28)),f.join(``)}var T={x:-300,y:-268,w:290,d:32,r:.6},E=[4,64,124],D=3,O={x:-334,y:-268,w:34,d:32,r:.6},k=e=>(E[e+1]??184)-4,Je={x:O.x-3,y:T.y-3,w:T.w+O.w+3+7,d:T.d+3+8,r:1.5},A={x:T.x+D,y:T.y+D,w:T.w-D,d:T.d-D,r:0},Ye=A.x+A.w,Xe=A.y+A.d,Ze=[-247,-185,-123,-61,-13],Qe=2.2,j=2.6,M=E[0],N=-247,$e=-255,et=11,tt=e=>k(e)-et,nt=[-246,-162,-78],rt=-251,it=.8,at=[46*it,20*it],ot=e=>[(nt[e]??0)-9,(nt[e]??0)+9],st=e=>{let[t,n]=ot(e);return{x:t-5,y:-259.5,w:n-t+10,d:9,r:.3}},ct=e=>nt.map((e,t)=>t).filter(t=>t<e),P=4,F=1.6,lt=.6;function ut(e){let{k:t,P:n,L:r,slab:i}=e;return i(Je,0,M,{tone:`mid`,inner:r(t.planOutline({x:T.x-.5,y:T.y-.5,w:T.w+1,d:T.d+1,r:0},M,n,2),{tone:`faint`})},4,.5)}function dt(e){let{k:t,P:n,L:r,S:i}=e,a=190-M,o=(e,r,i)=>t.segment([r[0],r[1],E[e]??0],[i[0],i[1],E[e]??0],n),s={x:T.x,y:T.y,w:T.w,d:D,r:.3},c={x:T.x,y:T.y+D,w:D,d:T.d-D,r:.3};return[i(t.slabOf(s,M,a,n,2,.3),{tone:`mid`,inner:r([1,2].map(e=>o(e,[s.x,s.y+s.d],[s.x+s.w,s.y+s.d])).join(``),{tone:`faint`})}),i(t.slabOf(c,M,a,n,2,.3),{tone:`mid`}),ft(e)].join(``)}function ft(e){let{k:t,P:n,L:r,S:i,front:a}=e,o=O.y+O.d,s=O.x+O.w/2,c=[],l=[];for(let[e,t]of E.entries()){for(let e of[s-8,s+.4])c.push(`<path class="cr-door" d="M${e} ${-(t+1)}h7.6v-23h-7.6Z"/>`);l.push(`M${s-9} ${-t}V${-(t+25)}H${s+9}V${-t}`),c.push(`<path class="cr-grille" d="M${s-2.4} ${-(t+28)}h4.8v-2.4h-4.8Z"/>`),e<E.length-1&&l.push(`M${O.x} ${-(k(e)+4)}H${O.x+O.w}`)}return i(t.slabOf(O,M,184-M,n,2,.4),{tone:`mid`})+`<g transform="${a(o)}">${c.join(``)}${r(l.join(``),{tone:`lo`})}</g>`}var pt=Array.from({length:6},(e,t)=>[-284+t*36,-284+t*36+32]),mt=21,ht=8;function gt(e,t){let{k:n,P:r,L:i,front:a}=e,o=(E[t]??0)+mt,s=k(t)-ht,c=(e,n)=>`<path class="bd-win bt-pane" data-occ="${t}" d="M${e} ${-s}H${n}V${-o}H${e}Z"/>`,l=(e,t)=>`M${e-1} ${-(o-1.6)}H${t+1}M${(e+t)/2} ${-s}V${-o}`,u=pt.map(([e,t])=>c(e,t)).join(``),d=pt.map(([e,t])=>l(e,t)).join(``),f=n.sideMatrix([T.x+D,T.y+T.d],0,r,`right`);return`<g transform="${a(T.y+D)}">${u}${i(d,{tone:`lo`})}</g><g transform="${f}">${c(4,20)}${i(l(4,20),{tone:`lo`})}</g>`}function _t(e,t){let{k:n,P:r,L:i,slab:a}=e,o=(E[t]??0)-4,s=[a(A,o,4,{tone:`mid`,inner:i(n.segment([A.x,A.y+A.d,o+1.4],[A.x+A.w,A.y+A.d,o+1.4],r),{tone:`faint`})},2,.4)],c=E[t]??0;for(let e of ct(t)){let t=st(e);s.push(a({...t,d:F},c,P,{tone:`mid`},2,.2),a({...t,w:F},c,P,{tone:`mid`},2,.2))}return s.join(``)}function vt(e,t,n,r){let{cyl:i}=e,a=st(t),o=(E[n]??0)+P,s=r===`back`?a.y+lt+.4:a.y+a.d-lt-.4;return[a.x+.8,a.x+a.w-.8].map(e=>i(e,s,lt,o,k(n)-o,{tone:`mid`,crease:`none`},8))}function yt(e,t){return ct(t).flatMap(n=>vt(e,n,t,`back`)).join(``)}function bt(e,t){let{cyl:n,slab:r}=e,i=E[t]??0,a=k(t)-i,o=Xe-j,s=Ze.map(e=>n(e,o,Qe,i,a,{tone:`mid`},14));s.push(n(Ye-j,-251,Qe,i,a,{tone:`mid`},14));for(let n of ct(t)){let a=st(n);s.push(r({...a,y:a.y+a.d-F,d:F},i,P,{tone:`mid`},2,.2),r({...a,x:a.x+a.w-F,w:F},i,P,{tone:`mid`},2,.2),...vt(e,n,t,`front`))}return s.join(``)}function xt(e){let{k:t,P:n,L:r,S:i,slab:a}=e,o=[.25,.5,.75].map(e=>t.segment([A.x+A.w*e,A.y,184],[A.x+A.w*e,A.y+A.d,184],n)).join(``),s=A.y+A.d,c=A.x+A.w;return[i(t.slabOf(A,180,4,n,2,.4),{tone:`mid`,inner:r(o,{tone:`faint`})}),a({x:A.x,y:s-j,w:A.w,d:j,r:.3},184,5,{tone:`mid`},2,.3),a({x:c-j,y:A.y,w:j,d:A.d-j,r:.3},184,5,{tone:`mid`},2,.3),...nt.map(e=>a({x:e-at[0]-1.5,y:rt-at[1]-1.5,w:at[0]*2+3,d:at[1]*2+3,r:.6},184,3,{tone:`mid`},2,.2)),a({x:O.x+4,y:O.y+8,w:O.w-8,d:O.d-16,r:.6},184,14,{tone:`mid`},2,.3)].join(``)}var St={w:16,d:10,h:4},Ct=18,wt=1.8,Tt=[[-190,-100],[-120,-65],[-120,-204]],I={x:-24,y:N,w:16,d:14,h:12,top:32},Et={w:10,d:8,h:4},Dt=-262,Ot=-264.4,kt=5.5,At=1.5,jt=1.1,Mt=[-282,-246,-210,-174,-138,-102],Nt=8.5,Pt=-292,Ft=(e,t)=>[e,N,k(t)-Ct+wt],It=[I.x,I.y,I.top+wt],Lt=e=>[ot(e)[1],$e,k(e)-Ct+wt];function Rt(e,t,n,r,i,a,o,s,c){let{k:l,P:u,L:d,D:f,slab:p,cyl:m,at:ee}=e,h=o-a,te=[[t-r/2+1.5,n-i/2+1.5],[t+r/2-1.5,n-i/2+1.5],[t-r/2+1.5,n+i/2-1.5],[t+r/2-1.5,n+i/2-1.5]].map(([e=0,t=0])=>m(e,t,.5,o,s-o,{tone:`lo`,crease:`none`},8)),ne=[.3,.55,.8].map(e=>l.segment([t-r/2+1.5,n+i/2,h+a*e],[t+r/2-1.5,n+i/2,h+a*e],u)).join(``),g=[];for(let e=0;e<6;e++)g.push([t-r/2+2+e*(r-4)/5,n+i/2,h+1.2]);return[...te,p({x:t-r/2,y:n-i/2,w:r,d:i,r:.8},h,a,{tone:`mid`,inner:d(ne,{tone:`faint`})},2,.3),m(t,n,Math.min(5.2,i/2-1.2),o,wt,{tone:`mid`},24),f(g.map(e=>ee(e)),{size:.3}),c?`<g data-diffuser="${t},${n},${h},${r/2}"></g>`:``].join(``)}var zt=(e,t,n)=>Rt(e,t,N,St.w,St.d,St.h,k(n)-Ct,k(n),!0),Bt=e=>Rt(e,I.x,I.y,I.w,I.d,I.h,I.top,k(0),!0),Vt=(e,t)=>Rt(e,ot(t)[1],$e,Et.w,Et.d,Et.h,k(t)-Ct,k(t),!1);function Ht(e,t,n){let{k:r,P:i,L:a,slab:o}=e,s=n+11,c=s+Nt,l=Array.from({length:7},(e,n)=>r.segment([t+3.5+n*3.5,-261.4,s+1],[t+3.5+n*3.5,-261.4,c-1],i)).join(``);return[...[t+5,t+28-5].map(e=>o({x:e-1,y:-265,w:2,d:.9,r:.2},s+2,4,{tone:`lo`},2,0)),o({x:t,y:-265,w:28,d:3.6,r:.5},s,Nt,{tone:`mid`,inner:a(l,{tone:`faint`})},2,.3)].join(``)}function Ut(e,t,n){let{G:r,P:i,S:a}=e,o=r.frameAlong([Pt,t,n],[-1,0,0]);return a(r.disc(0,1.4,1.8,o,i),{tone:`mid`})}function Wt(e,t,n,r,i){let{slab:a,cyl:o,front:s}=e,c=r+8,l=[a({x:t+.8,y:n+.6,w:1.2,d:6.8,r:.2},r,8,{tone:`lo`},2,0),a({x:t+22-2,y:n+.6,w:1.2,d:6.8,r:.2},r,8,{tone:`lo`},2,0),a({x:t,y:n,w:22,d:8,r:.6},c,1.4,{tone:`mid`},2,.3),o(t+11,n+3.2,1.1,c+1.4,2.4,{tone:`lo`,crease:`none`},10),a({x:t+11-4.2,y:n+3.2-.5,w:8.4,d:1,r:.3},c+3.8,5.4,{tone:`lo`},2,0)],u=n+3.2+.5;return l.push(`<g transform="${s(u)}"><path class="bd-win" data-occ="${i}" d="M${t+11-3.6} ${-(c+4.2)}h7.2v-4.4h-7.2Z"/></g>`),l.join(``)}function Gt(e,t,n,r){let{slab:i,cyl:a}=e;return[a(t,n,3,r,.8,{tone:`lo`},14),a(t,n,.6,r+.8,3.6,{tone:`lo`,crease:`none`},8),a(t,n,3.2,r+4.4,1.4,{tone:`mid`},16),i({x:t-3,y:n+2.6,w:6,d:.9,r:.3},r+5.6,5.4,{tone:`mid`},2,.2)].join(``)}function Kt(e,t,n,r){let{slab:i}=e;return[Wt(e,t,-249,n,r),Wt(e,t+25,-249,n,r),i({x:t+22.6,y:-249.5,w:1,d:7,r:.2},n+1.2,12,{tone:`mid`},2,.2),Gt(e,t+11,-239.6,n),Gt(e,t+36,-239.6,n)].join(``)}function qt(e,t){let{slab:n,cyl:r}=e,i=[];i.push(n({x:-250,y:-251,w:46,d:8,r:1},t,10,{tone:`mid`},3,.4),n({x:-214,y:-243,w:10,d:7,r:1},t,10,{tone:`mid`},3,.4),n({x:-250.8,y:-251.8,w:47.6,d:9.6,r:1},t+10,1.4,{tone:`mid`},3,.2),n({x:-214.8,y:-243.8,w:11.6,d:8.6,r:1},t+10,1.4,{tone:`mid`},3,.2));for(let e of[-170,-144])i.push(n({x:e,y:-250,w:20,d:6,r:.8},t+3.2,3,{tone:`mid`},2,.3),n({x:e,y:-252,w:20,d:2,r:.4},t+6.2,6,{tone:`mid`},2,.2),r(e+2.4,-245.4,.9,t,3.2,{tone:`lo`,crease:`none`},8),r(e+17.6,-245.4,.9,t,3.2,{tone:`lo`,crease:`none`},8));return i.join(``)}function Jt(e,t){let n=E[t]??0,r=Mt.map(t=>Ht(e,t,n));r.push(Ut(e,Dt,n+kt),Ut(e,Ot,n+At));let i=Tt[t]??[];r.push(yt(e,t));for(let n of i)r.push(zt(e,n,t));if(r.push(Vt(e,t)),t===0)r.push(qt(e,n));else for(let a of i)r.push(Kt(e,a-23.5,n,t));return r.join(``)}var Yt=1e3,Xt={x:-352,y:-286,w:652,d:170,r:8},Zt={x:-14,y:-516,w:314,d:220,r:8},Qt={x:-374,y:-538,w:690,d:444,r:16},$t=[34,-242],en=ke([...y(Qt,-21,-14),...y(Xt,-14,20),...y(Zt,-14,20),...y(Je,0,214),...y({x:26,y:-250,w:16,d:16,r:0},0,244)],Yt,620,{pad:22,azimuth:60}),tn=-325,nn=[70,205],rn=le(100,!0),an=[-202,-135,0],on=[-34,36.6,40],sn=[-20,36.6,40],cn=[94,-130,0],L=[.55,.5],ln=-385,un=-462,dn=(e,t)=>[(e[0]-cn[0])*t,(e[1]-cn[1])*t,e[2]*t],fn=e=>{let t=nn[e],n=fe(100,7),r=e=>[t+e[0],tn+e[1],e[2]];return{supply:r(n.chwSupply),ret:r(n.chwReturn),discharge:r(n.discharge)}},pn=[fn(0),fn(1)],R=[pn[0].supply[0]-sn[0],un],z=[$t[0]-ge[0],$t[1]],mn=[z[0]+he[0],z[1]+he[1],he[2]],hn=[z[0]+ye[0],z[1]+ye[1],ye[2]],gn=(e,t,n)=>[e-dn(r,L[n])[0],t],_n=[gn(R[0]+on[0],ln,0),gn(hn[0],-204,1)],vn=(e,t)=>{let[n,r]=_n[e]??[0,0],[i,a,o]=dn(t,L[e]);return[n+i,r+a,o]},yn=[{suction:vn(0,u),riser:vn(0,r)},{suction:vn(1,u),riser:vn(1,r)}],bn=[190,-150],B={x:24,y:-160,w:56,d:44,r:1},xn={x:108,y:-192,w:164,d:72,r:2},Sn={x:108,y:-194,w:164,d:3,r:.3},Cn={x:108,y:-194,w:3,d:76,r:.3},wn=[-49,0,60.8],Tn={x:0,y:-272,w:252,d:76,r:2},En={x:2,y:-270,w:250,d:3,r:.3},Dn={x:-10,y:-512,w:306,d:4,r:.3},On={x:-12,y:-512,w:4,d:214,r:.3},kn=[..._n.map((e,t)=>({key:`pump${t}`,at:e,h:45*L[t]})),{key:`chiller`,at:R,h:56},{key:`boiler`,at:z,h:he[2]-8},{key:`flue`,at:$t,h:236},...nn.map((e,t)=>({key:`ahu${t}`,at:[e,tn],h:36})),{key:`xfmr`,at:[C.x+C.w/2,C.y+C.d/2],h:36},{key:`genset`,at:bn,h:126},{key:`elec`,at:[B.x+B.w/2,B.y+B.d/2],h:46},{key:`gen-back`,at:[Sn.x+Sn.w/2,Sn.y],h:36},{key:`gen-west`,at:[Cn.x,Cn.y+Cn.d/2],h:36}],An=Pe(kn,en),jn=An.order,Mn=E.length,Nn=([e,t])=>e<14&&t>-269&&t<-232,Pn=([e,t])=>e<-8&&t<-269,Fn=([e,t])=>e<-8&&t<-256.5,In=e=>E.filter((t,n)=>n>0&&e>=t).length,Ln={layer:e=>Pn(e)?0:Nn(e)&&e[2]>=184?Mn+1:Nn(e)&&Fn(e)?Rn+In(e[2]):Nn(e)?1+In(e[2]):Mn+1+An.depth.layer(e),glide:()=>!0},Rn=Mn+1+jn.length+1,zn={y:bn[1],z:26};function Bn(e,t){return[e,...[...E].filter(n=>n>0&&n<e&&n>t).sort((e,t)=>t-e),t]}var Vn=3.2,Hn=2.2,Un=180;function Wn(e,t,n,r){let i=Bn(Un,n);return i.slice(0,-1).map((n,a)=>{let o=[[t,$e,n],[t,$e,i[a+1]??0]];return a===i.length-2&&o.push(...r),{id:`${e}${a}`,medium:`duct`,r:Vn,bend:2,bare:[a===0,!1],pts:o}})}var Gn=[0,1,2].flatMap(e=>{let t=tt(e),[n,r]=ot(e),i=[...Tt[e]??[]].sort((e,t)=>Math.abs(e-n)-Math.abs(t-n)),a=i[i.length-1]??n,o=i.slice(0,-1).map((n,r)=>({id:`sup${e}-n${r}`,medium:`duct`,r:Hn,pts:[[n,N,t],Ft(n,e)]}));return[...Wn(`sup${e}-`,n,t,[[n,N,t],[a,N,t],Ft(a,e)]),...o,...Wn(`ret${e}-`,r,Lt(e)[2],[])]}),[V,H]=pn,U=-279,Kn=It[0],W=40,qn=[{id:`ahu-a`,medium:`duct`,r:3.5,pts:[V.discharge,[V.discharge[0],U,V.discharge[2]],[V.discharge[0],U,W]]},{id:`ahu-b`,medium:`duct`,r:3.5,pts:[H.discharge,[H.discharge[0],U,H.discharge[2]],[H.discharge[0],U,W],[Kn,U,W],[Kn,-266.5,W]]},{id:`ahu-in`,medium:`duct`,r:3.5,pts:[[Kn,-265,W],[Kn,It[1],W],It]}],G=[R[0]+sn[0],R[1]+sn[1],sn[2]],Jn=[R[0]+on[0],R[1]+on[1],on[2]],[K,q]=yn,Yn=46,Xn=-360,Zn=K.suction[2],Qn=K.suction[1],$n=V.supply[1],er=e=>[[e,$n,Yn],[e,Qn,Yn],[e,Qn,Zn]],tr=[{id:`chw-dis`,medium:`coolantret`,r:l*L[0],fromStub:!0,pts:[K.riser,[K.riser[0],K.riser[1],Jn[2]],Jn]},{id:`chw-sup`,medium:`coolant`,r:2.6,pts:[G,[G[0],$n,G[2]],V.supply]},{id:`chw-sup-b`,medium:`coolant`,r:2.6,pts:[[G[0],Xn,G[2]],[H.supply[0],Xn,G[2]],[H.supply[0],$n,G[2]],H.supply]},{id:`chw-ret-b`,medium:`coolantret`,r:2.6,pts:[H.ret,...er(H.ret[0]),K.suction]},{id:`chw-ret`,medium:`coolantret`,r:2.6,pts:[V.ret,...er(V.ret[0])]}],J=-6,Y=Dt,nr=-258,rr=-18,ir=-180,ar=q.suction[0]+40,or=70,sr=hn[2]+20,cr=(e,t,n,r,i,a)=>Bn(a,i).slice(0,-1).map((o,s,c)=>{let l=s===c.length-1?i:Bn(a,i)[s+1]??i;return{id:`${e}${s}`,medium:n,r,blind:[s===c.length-1,s===0],pts:[[J,t,l],[J,t,o]]}}),lr=E.flatMap((e,t)=>{let n=e+kt,r=e+At;return[{id:`hw-s${t}`,medium:`heat`,r:jt,blind:[!1,!0],pts:[[J,Y,n],[Pt,Y,n]]},{id:`hw-r${t}`,medium:`hotret`,r:jt,blind:[!0,!1],pts:[[Pt,Ot,r],[rr,Ot,r],[rr,nr,r],[J,nr,r]]},...Mt.flatMap((i,a)=>[{id:`hw-st${t}-${a}`,medium:`heat`,r:1,bare:[!1,!0],pts:[[i+28-3,Y,n],[i+28-3,Y,e+11]]},{id:`hw-rt${t}-${a}`,medium:`hotret`,r:1,bare:[!0,!1],pts:[[i+3,Ot,e+11],[i+3,Ot,r]]}])]}),ur=[...cr(`hw-sr`,Y,`heat`,2.2,5,E[2]+kt+6),...cr(`hw-rr`,nr,`hotret`,2.2,3,E[2]+At+6),{id:`hw-feed-s`,medium:`heat`,r:2.2,pts:[mn,[mn[0],mn[1],or],[mn[0],Y,or],[J,Y,or]]},{id:`hw-feed-r`,medium:`hotret`,r:2.2,pts:[[J,nr,q.suction[2]],[J,ir,q.suction[2]],[ar,ir,q.suction[2]],[ar,q.suction[1],q.suction[2]],q.suction]},{id:`hw-dis`,medium:`hotret`,r:l*L[1],fromStub:!0,pts:[q.riser,[q.riser[0],q.riser[1],sr],[hn[0],hn[1],sr],hn]}],X=[bn[0]+wn[0],bn[1]+wn[1],wn[2]],dr=B.x+B.w,fr=[{id:`gen-cable`,medium:`cable`,r:1.6,pts:[X,[X[0],X[1],72],[dr+12,X[1],72],[dr+12,X[1],zn.z],[dr,X[1],zn.z]]}],pr=[...lr,...Gn,...tr,...qn,...ur,...fr],Z=(e,t,n,r,i=0)=>[e,t,n,r,i],mr={z:10,flanged:!0,routes:pr,posts:[Z(180,U,3.5,W),Z(60,U,3.5,W),Z(20,U,3.5,W),Z(40,Y,2.2,or,4),Z(G[0],-416,2.6,G[2]),Z(Jn[0],-405,2.6,G[2]),...[110,150,190].flatMap(e=>[Z(e,Xn,2.6,G[2]),Z(e,Qn,2.6,Zn)]),Z(X[0]-20,X[1],1.6,72,1.6)]},Q=Fe(),hr={x:-248,y:-164,w:92,d:58,r:3},gr=0,_r=(e,t)=>ue(e,t,`downshot`),vr=(e,t)=>ve(e,t,7,236-gr),yr=(e,t)=>o(e,t,`coolantret`,!0),br=(e,t)=>o(e,t,`hotret`,!0),xr=(e,t)=>pe(e,t,100,{humidifier:!1,filterGauge:!1,fanHook:`data-vfan`,stubHalf:7,motor:!0}),Sr=[E[1]-2,E[2]-2,182];function Cr(e){return c(e,Qt)+e.plinth(Xt)+e.plinth(Zt)+He(e)+Ue(e,B.x)+Ge(e,Tn)+Ge(e,xn)+w(e,En,34,`south`,{louvres:[[30,50],[100,120],[170,190]]})+w(e,Dn,64,`south`,{louvres:[[60,90],[130,160],[200,230],[260,290]]})+w(e,On,64,`east`,{doors:[[60,80]]})}var wr=e=>qe(e,$t,6,112,236,Sr.map(e=>({z:e,toX:Ye}))),Tr=e=>Ke(e,B,40,zn),Er=e=>w(e,Sn,36,`south`,{louvres:[[128,158],[200,230]]}),Dr=e=>w(e,Cn,36,`east`,{louvres:[[20,50]],doors:[[56,74]]});function Or({ids:e}){let t=je(),n=a(mr,Ln),r=(0,b.useMemo)(()=>Cr(t),[t]),o=(0,b.useMemo)(()=>ut(t)+dt(t),[t]),s=e=>(0,Q.jsx)(_,{html:`${n.layers[e]??``}<g data-flows="${e}" data-depth="${e}"></g>`,data:{pipes:``}},`pipes-${e}`),c=[e.rtu1,e.rtu2,e.rtu3],l=[];for(let[n,r]of c.entries())l.push(n>0?(0,Q.jsx)(_,{html:_t(t,n)},`slab${n}`):null,(0,Q.jsx)(_,{html:gt(t,n)},`win${n}`),s(Rn+n),(0,Q.jsx)(_,{asset:r,intro:2+n,html:Jt(t,n)},`in${n}`),n===0?(0,Q.jsx)(_,{asset:e.fanA,intro:5,html:Bt(t)},`ahu-box`):null,s(1+n),(0,Q.jsx)(_,{html:bt(t,n)},`col${n}`));let u={chiller:(0,Q.jsx)(i,{from:an,to:g(R),children:(0,Q.jsx)(v,{id:e.chiller,plan:hr,intro:12,draw:xe})}),boiler:(0,Q.jsx)(i,{to:g(z),children:(0,Q.jsx)(v,{id:e.boiler,plan:_e,intro:13,draw:vr})}),flue:(0,Q.jsx)(_,{html:(0,b.useMemo)(()=>wr(t),[t]),intro:13}),xfmr:(0,Q.jsx)(_,{html:(0,b.useMemo)(()=>We(t),[t]),intro:16}),elec:(0,Q.jsx)(_,{html:(0,b.useMemo)(()=>Tr(t),[t]),intro:16}),"gen-back":(0,Q.jsx)(_,{html:(0,b.useMemo)(()=>Er(t),[t]),intro:15}),"gen-west":(0,Q.jsx)(_,{html:(0,b.useMemo)(()=>Dr(t),[t]),intro:15}),genset:(0,Q.jsx)(`g`,{className:`gen-set`,children:(0,Q.jsx)(i,{to:g(bn),children:(0,Q.jsx)(v,{id:e.genset,plan:we,intro:16,draw:Te})})})};for(let[t,[n,r]]of _n.entries())u[`pump${t}`]=(0,Q.jsx)(i,{from:cn,to:g([n,r]),scale:L[t],children:(0,Q.jsx)(v,{id:t?e.hwPump:e.chwPump,plan:ne,intro:14+t,draw:t?br:yr})});for(let[t,n]of nn.entries())u[`ahu${t}`]=(0,Q.jsx)(i,{to:g([n,tn]),children:(0,Q.jsx)(v,{id:t?e.fanB:e.fanA,plan:rn,intro:10+t,draw:xr})});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_,{html:r,data:{plinth:``}}),s(0),(0,Q.jsx)(_,{html:o}),l,(0,Q.jsx)(_,{html:xt(t)}),nt.map((e,t)=>(0,Q.jsx)(i,{to:[e,rt,187],scale:it,children:(0,Q.jsx)(v,{id:c[t]??``,plan:de,intro:6+t,draw:_r})},e)),s(4),jn.flatMap((e,t)=>[(0,Q.jsx)(`g`,{children:u[e.key]},e.key),s(5+t)])]})}var kr=10,Ar=17,jr=.55;function Mr(e,t,n){let{svg:r,P:i,feed:a}=e,o=Me(r,`[data-occ]`).map(e=>({el:e,id:t[Number(e.dataset.occ)]??oe(e)})),s=Me(r,`[data-diffuser]`).map(e=>({id:oe(e),at:Ne(e.dataset.diffuser),streaks:d(e,kr,`path`,`cr-stream`),phase:0}));return{draw(t,r,c){for(let e of o)Ae(e.el,`data-on`,a.num(e.id,`occupied`)>0?``:null);let l=e.reducedMotion();for(let e of s){let r=h(n(e.id));e.phase=(e.phase+r*jr*t)%1;let[a=0,o=0,s=0,u=0]=e.at;for(let[t,n]of e.streaks.entries()){if(!c||l||r<.02||n.seed>.25+r){Oe(n.el,`0`);continue}let d=(e.phase+n.seed*3.1)%1,f=((t+.5)/kr-.5)*2*(u-1.5),p=(n.seed-.5)*8,m=s-.5-d*Ar,ee=[a+f,o+p,m],h=[a+f,o+p,m-3],[te,ne]=De(ee,i),[g,re]=De(h,i);Ae(n.el,`d`,`M${te.toFixed(1)} ${ne.toFixed(1)}L${g.toFixed(1)} ${re.toFixed(1)}`),Oe(n.el,(Math.sin(Math.PI*d)*.5).toFixed(2))}}},bar(){}}}var $=e=>e>.002?6+26*h(e*2):0,Nr=e=>{let{svg:t,feed:n,ids:r}=e,i=ee(t),a=me(e,i),o=Se(e,i),s=ae(e,i),c=be(e,i),l=Ce(e,i),u=Ee(e,i),d=e=>h(n.num(e,`speed_feedback`)/n.param(e,`rated_rpm`,1450)),f=e=>e===r.fanA?(d(r.fanA)+d(r.fanB))/2:a.airPu(e),p=[a,o,s,c,l,u,Mr(e,[r.rtu1,r.rtu2,r.rtu3],f)],ne=te(e,e=>re(n,e,`availability`)),g=ie(e,{needle:e=>o.needle(e)??c.needle(e)??0,bar:e=>p.reduce((t,n)=>t??n.bar(e),void 0)??0,alertsHigh:()=>!0,ready:()=>!0}),oe=[r.rtu1,r.rtu2,r.rtu3],ce=()=>s.flowPu(r.chwPump),le=()=>s.flowPu(r.hwPump),ue=()=>{let e=n.param(r.genset,`rated_power_kva`,500)*.8;return e>0?h(n.num(r.genset,`load_actual`)/e):0},de=m(e,({id:e})=>{let t=/^(?:sup|ret)(\d)-/.exec(e);if(t)return $(a.airPu(oe[Number(t[1])]??``));if(e.startsWith(`hw-s`)||e.startsWith(`hw-r`))return $(/^hw-[sr]\d$/.test(e)?le()/3:le());switch(e){case`ahu-a`:return $(d(r.fanA));case`ahu-b`:return $(d(r.fanB));case`ahu-in`:return $(f(r.fanA));case`chw-dis`:case`chw-sup`:case`chw-ret`:return $(ce());case`chw-sup-b`:case`chw-ret-b`:return $(ce()/2);case`hw-feed-s`:case`hw-feed-r`:case`hw-dis`:return $(le());case`gen-cable`:return $(ue());default:return 0}});return{data(e){ne.draw(e)},draw({sdt:e,t,introDone:n}){de.draw(e),g.draw(e,t);for(let r of p)r.draw(e,t,n)},resync(){},status:e=>se(n,e,`availability`)}},Pr=f(en),Fr=s(Pr,mr,Ln),Ir={width:Yt,height:620,label:`Isometric model of the Commercial Building: a three-storey office tower with a rooftop unit on each roof curb whose supply and return ducts drop through a chase to that storey's ceiling diffusers, and a loop of radiators along the back wall; behind it the mechanical room with the chiller, the chilled-water pump and two air handlers with their fan motors; beside it the boiler with its flue stack and heating pump, the transformer, and the standby diesel generator with its feeder to the electrical room. Pipes and ducts carry chilled water, hot water and air between them. Every moving part follows live values from the running engine.`,kit:Pr,flows:Fr.flows,joints:Fr.joints,Scene:Or,compose:Nr},Lr=p({layout:Ir,resolve:Le,things:Re,caption:`rooftop units · plant · standby power`,mismatch:`This floor expects the Commercial Building: three rooftop units, the chiller with its chilled-water pump, the hot-water boiler with its heating pump, two air handler fan motors and the standby diesel generator, by area and line.`,statusBasis:`availability`,Overview:t,tab:`Building`});export{Lr as buildingFloor};
@@ -1 +1 @@
1
- import{a as e}from"./use-engine-command-mutation-Cnafi1c5.js";import{t}from"./utils-D6wrZy-b.js";import{ot as n}from"./vendor-ui-BGeFlRLR.js";var r=n(),i=`inline-flex items-center gap-1 rounded-[var(--miravo-radius-tight)] outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,a={live:`bg-success shadow-[0_0_0_1px_color-mix(in_srgb,var(--success)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--success)_42%,transparent)]`,idle:`bg-warning/85 shadow-[0_0_0_1px_color-mix(in_srgb,var(--warning)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--warning)_38%,transparent)]`,fault:`bg-destructive shadow-[0_0_0_1px_color-mix(in_srgb,var(--destructive)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--destructive)_38%,transparent)]`,off:`bg-muted-foreground/55`};function o({tone:e,children:n,className:i}){return(0,r.jsxs)(`div`,{className:t(`flex shrink-0 items-center gap-2 rounded-[var(--miravo-radius-pill)] border border-border/60 bg-background/60 px-2.5 py-1 backdrop-blur-sm`,i),children:[(0,r.jsxs)(`span`,{className:`relative flex size-1.5 items-center justify-center`,children:[(0,r.jsx)(`span`,{className:t(`size-1.5 rounded-full`,a[e])}),e===`live`&&(0,r.jsx)(`span`,{className:`absolute inset-0 animate-ping rounded-full bg-success/60`})]}),(0,r.jsx)(`span`,{className:`text-[11px] leading-none text-muted-foreground`,children:n})]})}function s({children:e}){return(0,r.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.14em]`,children:e})}function c({icon:n,title:i,description:a,aside:o,footer:s,children:c,id:l,className:u,bodyClassName:d}){return(0,r.jsxs)(`section`,{id:l,tabIndex:l?-1:void 0,"aria-label":typeof i==`string`?i:void 0,className:t(e,`flex min-w-0 scroll-mt-4 flex-col outline-none hover:border-border`,u),children:[(0,r.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-border/60 px-4 py-3`,children:[(0,r.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,r.jsx)(`div`,{className:`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] border border-border/60 bg-background/70 text-muted-foreground`,"aria-hidden":!0,children:(0,r.jsx)(n,{className:`size-3.5`})}),(0,r.jsxs)(`div`,{className:`min-w-0`,children:[(0,r.jsx)(`h2`,{className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:i}),a?(0,r.jsx)(`p`,{className:`mt-0.5 text-pretty text-xs text-muted-foreground`,children:a}):null]})]}),o?(0,r.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:o}):null]}),c===void 0?null:(0,r.jsx)(`div`,{className:t(`flex min-w-0 flex-col px-4 py-4`,d),children:c}),s?(0,r.jsx)(`div`,{className:`mt-auto flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2 border-t border-border/60 bg-background/40 px-4 py-2.5 text-xs text-muted-foreground`,children:s}):null]})}export{o as i,i as n,s as r,c as t};
1
+ import{a as e}from"./use-engine-command-mutation-CGYWQMCW.js";import{t}from"./utils-D6wrZy-b.js";import{ot as n}from"./vendor-ui-BGeFlRLR.js";var r=n(),i=`inline-flex items-center gap-1 rounded-[var(--miravo-radius-tight)] outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,a={live:`bg-success shadow-[0_0_0_1px_color-mix(in_srgb,var(--success)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--success)_42%,transparent)]`,idle:`bg-warning/85 shadow-[0_0_0_1px_color-mix(in_srgb,var(--warning)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--warning)_38%,transparent)]`,fault:`bg-destructive shadow-[0_0_0_1px_color-mix(in_srgb,var(--destructive)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--destructive)_38%,transparent)]`,off:`bg-muted-foreground/55`};function o({tone:e,children:n,className:i}){return(0,r.jsxs)(`div`,{className:t(`flex shrink-0 items-center gap-2 rounded-[var(--miravo-radius-pill)] border border-border/60 bg-background/60 px-2.5 py-1 backdrop-blur-sm`,i),children:[(0,r.jsxs)(`span`,{className:`relative flex size-1.5 items-center justify-center`,children:[(0,r.jsx)(`span`,{className:t(`size-1.5 rounded-full`,a[e])}),e===`live`&&(0,r.jsx)(`span`,{className:`absolute inset-0 animate-ping rounded-full bg-success/60`})]}),(0,r.jsx)(`span`,{className:`text-[11px] leading-none text-muted-foreground`,children:n})]})}function s({children:e}){return(0,r.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.14em]`,children:e})}function c({icon:n,title:i,description:a,aside:o,footer:s,children:c,id:l,className:u,bodyClassName:d}){return(0,r.jsxs)(`section`,{id:l,tabIndex:l?-1:void 0,"aria-label":typeof i==`string`?i:void 0,className:t(e,`flex min-w-0 scroll-mt-4 flex-col outline-none hover:border-border`,u),children:[(0,r.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-border/60 px-4 py-3`,children:[(0,r.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,r.jsx)(`div`,{className:`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] border border-border/60 bg-background/70 text-muted-foreground`,"aria-hidden":!0,children:(0,r.jsx)(n,{className:`size-3.5`})}),(0,r.jsxs)(`div`,{className:`min-w-0`,children:[(0,r.jsx)(`h2`,{className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:i}),a?(0,r.jsx)(`p`,{className:`mt-0.5 text-pretty text-xs text-muted-foreground`,children:a}):null]})]}),o?(0,r.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:o}):null]}),c===void 0?null:(0,r.jsx)(`div`,{className:t(`flex min-w-0 flex-col px-4 py-4`,d),children:c}),s?(0,r.jsx)(`div`,{className:`mt-auto flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2 border-t border-border/60 bg-background/40 px-4 py-2.5 text-xs text-muted-foreground`,children:s}):null]})}export{o as i,i as n,s as r,c as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{n as t,t as n}from"./by-path-Ba-e31Js.js";import{A as r,B as i,C as a,D as o,E as s,F as c,H as l,L as u,P as d,V as f,X as p,_ as ee,a as m,b as te,c as h,g,h as _,i as v,j as y,k as b,n as x,o as ne,r as re,s as S,t as ie,w as ae,x as oe}from"./status-DQYLUbXs.js";import{a as se,n as ce,o as le,r as ue,t as de}from"./boiler-s_q0j7rz.js";import{T as fe,b as pe,c as me,d as he,f as ge,l as _e,m as ve,n as ye,s as be}from"./dom-BxZbg3NX.js";import{i as xe,n as Se,r as Ce,t as we}from"./tank-Btg5piqB.js";import{c as Te}from"./vendor-charts-Bquh2dWE.js";import{t as Ee}from"./stages-EYRT12Yp.js";import{ot as De}from"./vendor-ui-BGeFlRLR.js";var Oe=[[`boilerA`,`hot-water-boiler`,`heat-plant`,`boilers`,0],[`boilerB`,`hot-water-boiler`,`heat-plant`,`boilers`,1],[`boilerC`,`hot-water-boiler`,`heat-plant`,`boilers`,2],[`primaryA`,`centrifugal-pump`,`heat-plant`,`primary-loop`,0],[`primaryB`,`centrifugal-pump`,`heat-plant`,`primary-loop`,1],[`accumulator`,`storage-tank`,`heat-plant`,`primary-loop`,0],[`networkA`,`centrifugal-pump`,`network`,`trunk-main`,0],[`networkB`,`centrifugal-pump`,`network`,`trunk-main`,1],[`hospital`,`heat-substation`,`customers`,`hospital`,0],[`university`,`heat-substation`,`customers`,`university`,0],[`residential`,`heat-substation`,`customers`,`residential`,0],[`office`,`heat-substation`,`customers`,`office-park`,0]],ke=e=>n(Oe,e);function Ae(e){let t=(e,t,n)=>({key:e,assetId:e,name:t,kind:`utility`,area:n});return[t(e.boilerA,`Boiler 1 (lead)`,`Heat plant`),t(e.boilerB,`Boiler 2`,`Heat plant`),t(e.boilerC,`Boiler 3`,`Heat plant`),t(e.accumulator,`Thermal accumulator`,`Heat plant`),t(e.primaryA,`Primary pump A`,`Heat plant`),t(e.primaryB,`Primary pump B`,`Heat plant`),t(e.networkA,`Network pump A`,`Network`),t(e.networkB,`Network pump B`,`Network`),t(e.hospital,`Hospital substation`,`Customers`),t(e.university,`University substation`,`Customers`),t(e.residential,`Residential substation`,`Customers`),t(e.office,`Office park substation`,`Customers`)]}var je=3600/(125580*.97),Me=8,Ne=e=>Number(e.dataset.win)*37%101;function Pe(e){let{svg:t,P:n,feed:r}=e,i=(e,t)=>r.num(e,t),o=ye(t,`[data-valve]`).map(e=>{let n=S(e),r=e=>ye(t,`[data-asset="${n}"] ${e}`),i=r(`[data-spin="sub"]`)[0];return{id:n,el:e,at:be(e.dataset.valve),rotor:i,rotorAt:h(i?.dataset.at),rotorR:Number(i?.dataset.radius)||2,foul:r(`[data-foul]`)[0],act:r(`[data-act]`)[0],wins:r(`[data-win]`).sort((e,t)=>Ne(e)-Ne(t)),valve:0,rate:0,spin:0,lit:-1,heat:oe(a(t,n),3,2),ret:h(e.dataset.ret)}}),s=new Map(o.map(e=>[e.id,e]));return{draw(t,a,s){let c=e.reducedMotion();for(let e of o){e.valve=ee(e.valve,g(i(e.id,`control_valve_position`)/100),t,.6,c);let[o=0,l=0,u=0,d=4]=e.at;if(me(e.el,`d`,fe([o,l],[o,l],u,n)+fe([o-1.6,l],[o+1.6,l],u+e.valve*d,n)),e.rate=ee(e.rate,i(e.id,`circulation_pump_speed`)/100*Me,t,.8,c),c||(e.spin+=e.rate*t),e.rotor){let[t,r,i]=e.rotorAt,a=``;for(let o=0;o<3;o++){let s=e.spin+o*_/3;a+=fe([t,r],[t+Math.cos(s)*e.rotorR,r+Math.sin(s)*e.rotorR],i,n)}me(e.rotor,`d`,a)}e.foul&&(e.foul.style.opacity=s&&ae(r,e.id,`hx_fouling`)?`0.85`:`0`);let f=s&&ae(r,e.id,`valve_stuck`);me(e.act,`data-s`,f&&Math.sin(a*6)>0?`a`:null),e.heat.draw(s&&!c&&ae(r,e.id,`low_delta_t`),a,n,e.ret);let p=Math.round(g(i(e.id,`occupancy_pu`))*e.wins.length);if(p!==e.lit){e.lit=p;for(let[t,n]of e.wins.entries())me(n,`data-on`,t<p?``:null)}}},bar(e){return s.has(e)?g(i(e,`heat_delivered_kw`)/r.param(e,`design_load_kw`,500)):void 0},flowPu(e){let t=r.param(e,`design_load_kw`,0)*je;return t>0?g(i(e,`primary_flow`)/t):0}}}var C=e=>e>.002?6+26*g(e*2):0,Fe=e=>{let{svg:t,feed:n,ids:r}=e,i=te(t),a=re(e,i),o=de(e,i),s=we(e),c=Pe(e),l=[a,o,s,c],u=v(e,e=>x(n,e,`availability`)),d=ne(e,{needle:e=>o.needle(e)??0,bar:e=>l.reduce((t,n)=>t??n.bar(e),void 0)??0,alertsHigh:()=>!0,ready:()=>!0}),f=()=>a.flowPu(r.primaryA)+a.flowPu(r.primaryB),p=()=>a.flowPu(r.networkA)+a.flowPu(r.networkB),ee=[r.boilerA,r.boilerB,r.boilerC],h=e=>{let t=ee.filter(e=>o.circulating(e)).length;return o.circulating(e)?f()/t:0},g=new Map([[`hospital`,r.hospital],[`university`,r.university],[`residential`,r.residential],[`office`,r.office]]),_=m(e,({id:e})=>{switch(e){case`sup-1`:return C(h(r.boilerA));case`sup-2`:case`ret-2`:return C(h(r.boilerB));case`sup-3`:case`ret-3`:return C(h(r.boilerC));case`sup-23`:return C(h(r.boilerB)+h(r.boilerC));case`to-acc`:return C(f());case`ret-a`:case`suction-pa`:return C(a.flowPu(r.primaryA));case`ret-collect`:return C(f());case`ret-12`:return C(h(r.boilerA)+h(r.boilerB));case`ret-1`:return C(h(r.boilerA));case`ret-b`:case`suction-b`:return C(a.flowPu(r.primaryB));case`suction-a`:case`sup-a`:return C(a.flowPu(r.networkA));case`sup-b`:case`suction-nb`:return C(a.flowPu(r.networkB));case`acc-out`:case`trunk-sup`:case`trunk-ret`:return C(p());default:{let t=g.get(e.slice(0,e.lastIndexOf(`-`)));return t?C(c.flowPu(t)):0}}});return{data(e){u.draw(e)},draw({sdt:e,t,introDone:n}){_.draw(e),d.draw(e,t);for(let r of l)r.draw(e,t,n)},resync(){},status:e=>ie(n,e,`availability`)}},Ie=e(Te(),1),Le=11;function Re(e,t){let{k:n,P:r,S:i,L:a,slab:o,cyl:s}=e,{plan:c,floors:l,kind:u}=t,d=l*14+4,f=[],p=e=>a(e,{tone:`faint`}),ee=Array.from({length:l-1},(e,t)=>n.sideSeam(c,4+(t+1)*14,r,2)).join(``);f.push(i(n.slabOf(c,0,d,r,2,.6),{tone:u===`office`?`lo`:`mid`,inner:p(ee)})),f.push(a(n.planOutline(n.insetPlan(c,2),d,r,2),{tone:`lo`})),f.push(o({x:c.x+c.w*.2,y:c.y+c.d*.2,w:18,d:12,r:1},d,7,{tone:`mid`},2,.3)),f.push(s(c.x+c.w*.7,c.y+c.d*.35,4,d,9,{tone:`mid`},20));let m=[],te=0,h=(e,t,n)=>`<path class="bd-win" data-win="${te++}" d="M${e.toFixed(1)} ${(-(t+8)).toFixed(1)}H${(e+n).toFixed(1)}V${(-t).toFixed(1)}H${e.toFixed(1)}Z"/>`,g=u===`office`;for(let[t,i,a]of[[c.w,e.front(c.y+c.d),c.x],[c.d,n.sideMatrix([c.x+c.w,c.y+c.d],0,r,`right`),0]]){let e=Math.max(1,Math.floor((t-6)/Le)),n=a+(t-e*Le)/2,r=[];for(let t=0;t<l;t++){let i=7+t*14;if(g)r.push(h(n+1,i,e*Le-2));else for(let t=0;t<e;t++)r.push(h(n+t*Le+2,i,7))}m.push(`<g transform="${i}">${r.join(``)}</g>`)}f.push(...m);let _=c.x+c.w/2,v=c.y+c.d,y=(e,t,n,r,i,a=0)=>{let l=c.x+c.w/2+a;f.push(o({x:l-4.5,y:v,w:9,d:.6,r:.2},0,n-1,{tone:`lo`},2,0),...[-1,1].flatMap(r=>[s(l+r*(e-3)/2,v+t-1.2,1.7,0,.8,{tone:`lo`},14),s(l+r*(e-3)/2,v+t-1.2,i,.8,n-.8,{tone:`mid`},12)]),o({x:l-e/2,y:v,w:e,d:t,r:.5},n,1.4,{tone:r},2,.2))};if(u===`hospital`)f.push(o({x:_-6,y:v-1,w:12,d:1.2,r:.4},d-14,12,{tone:`lo`},2,0)),f.push(`<g transform="${e.front(v+.25)}"><path class="bd-cross" d="M${_-1.4} ${-(d-3.6)}H${_+1.4}V${-(d-6.6)}H${_+4.4}V${-(d-9.4)}H${_+1.4}V${-(d-12.4)}H${_-1.4}V${-(d-9.4)}H${_-4.4}V${-(d-6.6)}H${_-1.4}Z"/></g>`),y(24,8,12,`mid`,.9);else if(u===`university`)y(30,9,18,`mid`,1.8,-16);else if(u===`residential`)for(let e=1;e<l;e++)f.push(o({x:c.x+4,y:v,w:c.w-8,d:4,r:.4},4+e*14,1,{tone:`mid`},2,0));else y(20,7,14,`mid`,.9);return f.join(``)}var w=1.8,ze=4,Be=-14,T=[-5,5],E=[10,26],D=[26,E[0]],O=13,Ve=17.5,He=2.2,Ue=-26,k=[[T[0],28,E[1]],[T[0],28,E[0]]],We={x:-16,y:-24,w:34,d:54,r:2};function Ge(e,t){let{k:n,G:r,P:a,at:o,S:s,L:c,D:l,slab:u,cyl:d,hmi:f,screws:p,faceRule:ee}=e,m=[];m.push(u({x:-14,y:-22,w:30,d:50,r:2},0,3,{tone:`lo`},3,.4)),m.push(p(n.corners({x:-14,y:-22,w:30,d:50},2.4),3)),m.push(u({x:-1.2,y:-20,w:2.4,d:3,r:.4},3,36,{tone:`mid`},2,.2),u({x:-1.4,y:-20,w:2.8,d:27,r:.4},36,2.6,{tone:`mid`},2,.2)),m.push(u({x:-10,y:-17,w:20,d:3,r:.6},3,33,{tone:`mid`},2,.3));let te=[];for(let e=-13.2;e<3.6;e+=.9)te.push(n.segment([9,e,6],[9,e,33],a));m.push(s(n.slabOf({x:-9,y:Be,w:18,d:18,r:.4},5,29,a,2,.2),{tone:`lo`,inner:c(te.join(``),{tone:`faint`})}));let h=[[9.1,-13.6,6],[9.1,3.6,6],[9.1,3.6,33],[9.1,-13.6,33]].map(e=>o(e));m.push(`<path class="sf-grime" data-foul="" style="opacity:0" d="${n.pathOf(h,!0)}"/>`),m.push(u({x:-11,y:ze,w:22,d:3.4,r:.6},3,35,{tone:`mid`},2,.3));let g=7.4;m.push(l([-10.4,10.4].flatMap(e=>[7,31].map(t=>o([e,g,t]))),{size:.5}));for(let e of T)for(let t of E){let n=r.frameAlong([e,g,t],[0,1,0]);m.push(s(r.disc(0,2.2,2,n,a),{tone:`mid`}),s(r.disc(2.2,3,3.2,n,a),{tone:`mid`}))}let _=(e,t)=>[T[e],10.4,E[t]],[v,y]=k;m.push(i(e,[v,_(0,1)],w,`mid`,3,`heat`),i(e,[_(0,0),y],w,`mid`,3,`heatret`));for(let e of[v,y]){let t=r.frameAlong([e[0],e[1]-1.6,e[2]],[0,1,0]);m.push(s(r.disc(0,1.6,3,t,a),{tone:`mid`}))}let[b,,x]=v,ne=r.frameAlong([b,14,x],[0,1,0]);m.push(s(r.disc(0,1,3.2,ne,a),{tone:`mid`}),s(r.solidOf([[1,2.6],[2.6,3.6,1],[5.4,3.6,1],[7,2.6]],ne,a),{tone:`mid`}),s(r.disc(7,8,3.2,ne,a),{tone:`mid`}),d(b,18,1.2,x+3,4,{tone:`mid`,crease:`none`},12),d(b,18,4.4,x+7,2,{tone:`mid`},24),d(b,18,4.8,x+9,5,{tone:`mid`,crease:`lo`},28));let re=o([b+4.8,18,x+11.5]);m.push(`<path class="iso-line" data-tone="lit" data-valve="${b},21,${x+14},4" data-ret="${y[0]},${y[1]-4},${y[2]+2}" d=""/>`,`<circle class="sb-act" data-act="" cx="${re[0].toFixed(2)}" cy="${re[1].toFixed(2)}" r="0.6"/>`);let S=[T[1],21.4,E[1]],ie=(e,t)=>{let n=r.frameAlong([e,-30,t],[0,1,0]);return s(r.disc(0,1.2,4.4,n,a),{tone:`mid`})+s(r.disc(1.2,He,3.2,n,a),{tone:`mid`})},ae=(e,t)=>d(e,Ue,2.4,0,1,{tone:`lo`},18)+d(e,Ue,.9,1,t-w-2.6,{tone:`mid`,crease:`none`},12)+d(e,Ue,1.8,t-w-1.6,1,{tone:`mid`},16),oe=-27.8;return m.push(ie(O,D[0]),ie(O,D[1]),ae(O,D[1]),ae(Ve,D[0]),u({x:12,y:-26.9,w:6.4,d:1.8,r:.3},D[0]-w-1.6,1,{tone:`mid`},2,0),i(e,[_(1,1),S,[O,S[1],D[0]],[O,oe,D[0]]],w,`mid`,4,`heat`,[!0,!1]),i(e,[_(1,0),[T[1],23.4,E[0]],[O,23.4,E[0]],[O,oe,D[1]]],w,`mid`,4,`heatret`,[!0,!1])),m.push(d(S[0],S[1],3.6,E[1]-3,6,{tone:`mid`},24)),m.push(d(S[0],S[1],3,E[1]+3,7,{tone:`mid`,crease:`lo`},24)),m.push(`<path class="iso-line" data-tone="lo" data-spin="sub" data-at="${S[0]},${S[1]},${E[1]+10}" data-radius="2.4" d=""/>`),m.push(u({x:-14,y:10,w:6,d:8,r:.6},3,22,{tone:`mid`},2,.3)),m.push(f(t,18,-13.6,-8.4,8,21)),m.push(ee(18,-13.6,4,5,2)),m.join(``)}var Ke=1e3,qe={x:-380,y:-360,w:305,d:315,r:8},Je={x:-60,y:-300,w:240,d:150,r:8},Ye={x:-380,y:-15,w:620,d:200,r:8},Xe={x:-400,y:-380,w:660,d:585,r:16},Ze=pe([...ve(Xe,-21,-14),...ve(qe,-14,120),...ve(Je,-14,90),...ve(Ye,-14,110)],Ke,620,{pad:22,azimuth:60}),Qe=[[-262,-335],[-262,-245],[-262,-155]],$e=[-120,-255],et={r:34,h:118,windowX:6,panelX:40,nozzles:[{angle:180,z:80,r:3.4,role:`inlet`},{angle:0,z:80,r:3.4,role:`outlet`}]},tt=[94,-130,0],A={primaryA:{c:[-255,-78],scale:1},primaryB:{c:[-130,-78],scale:1},networkA:{c:[0,-190],scale:1.15},networkB:{c:[135,-190],scale:1.15}},nt=[d[0]-tt[0],d[1]-tt[1],d[2]],rt=[r[0]-tt[0],r[1]-tt[1],r[2]],it=18,at=(e,t,n,r,i)=>({key:e,skid:[t+n/2-it,104],building:{kind:e,plan:{x:t-n/2,y:74-r,w:n,d:r,r:2},floors:i}}),ot=[at(`hospital`,150,112,62,4),at(`university`,-5,120,64,3),at(`residential`,-158,68,56,5),at(`office`,-300,92,58,4)],st=[...Qe.map((e,t)=>({key:`boiler${t}`,at:e,h:60})),{key:`accumulator`,at:$e,h:et.h+12},...Object.entries(A).map(([e,t])=>({key:e,at:t.c,h:45})),...ot.flatMap(e=>[{key:`${e.key}-building`,at:[e.building.plan.x+e.building.plan.w/2,e.building.plan.y+e.building.plan.d/2],h:e.building.floors*14+4},{key:e.key,at:e.skid,h:40}])],ct=Ee(st,Ze),lt=ct.order,ut=ct.slotDepths,dt=ct.depth,ft=(e,t)=>[e.c[0]+t[0]*e.scale,e.c[1]+t[1]*e.scale,t[2]*e.scale],j=(e,t,n,r)=>[t??e[0],n??e[1],r??e[2]],pt=e=>{let t=et.nozzles[e],[n,r,i]=t?Ce(et,t):[0,0,0];return[$e[0]+n,$e[1]+r,i]},M=(Qe[0]?.[0]??0)+se[0],N=(Qe[0]?.[0]??0)+ue[0],P=se[2],F=80,I=84,[mt=0,L=0,R=0]=Qe.map(e=>e[1]),ht=pt(0),z=pt(1),{primaryA:B,primaryB:V,networkA:H,networkB:U}=A,W=e=>ft(e,[rt[0],rt[1],rt[2]-3]),G=e=>ft(e,nt),gt=10,K=e=>j(G(e),G(e)[0]+gt*e.scale,null,null),_t=72,q=-106,vt=G(B)[2],J=220,Y=232,yt=3.2*A.networkA.scale,bt=100,xt=82,St=-40,X=k[0][2],Z=k[1][2],Q=104+k[0][1]+30,Ct=Math.min(...ot.map(e=>e.skid[0]))+k[0][0]-14,wt={z:10,flanged:!0,routes:[{id:`sup-1`,medium:`heat`,r:3.2,pts:[[M,mt,P],[M,mt,F],[M,ht[1],F]]},{id:`sup-23`,medium:`heat`,r:3.2,reverse:!0,pts:[[M,ht[1],F],[M,L,F]]},{id:`sup-3`,medium:`heat`,r:3.2,reverse:!0,pts:[[M,L,F],[M,R,F],[M,R,P]]},{id:`sup-2`,medium:`heat`,r:3.2,pts:[[M,L,P],[M,L,F]]},{id:`to-acc`,medium:`heat`,r:3.4,pts:[[M,ht[1],F],ht]},{id:`ret-b`,medium:`heatret`,r:3.2,fromStub:!0,pts:[W(V),j(W(V),null,null,_t),j(W(B),null,null,_t)]},{id:`ret-a`,medium:`heatret`,r:3.2,fromStub:!0,pts:[W(B),j(W(B),null,null,_t)]},{id:`ret-collect`,medium:`heatret`,r:3.2,bend:6,pts:[j(W(B),null,null,_t),j(W(B),N,null,_t),j(W(B),N,null,I),[N,R,I]]},{id:`ret-12`,medium:`heatret`,r:3.2,pts:[[N,R,I],[N,L,I]]},{id:`ret-1`,medium:`heatret`,r:3.2,pts:[[N,L,I],[N,mt,I],[N,mt,P]]},{id:`ret-2`,medium:`heatret`,r:3.2,pts:[[N,L,I],[N,L,P]]},{id:`ret-3`,medium:`heatret`,r:3.2,pts:[[N,R,I],[N,R,P]]},{id:`acc-out`,medium:`heat`,r:3.4,pts:[z,j(K(H),null,z[1],z[2])]},{id:`suction-nb`,medium:`heat`,r:3.4,pts:[j(K(H),null,z[1],z[2]),j(z,K(U)[0],null,null),j(K(U),null,z[1],null),K(U),G(U)]},{id:`suction-a`,medium:`heat`,r:3.4,pts:[j(K(H),null,z[1],z[2]),j(K(H),null,z[1],null),K(H),G(H)]},...ot.flatMap(e=>{let[t,n]=e.skid,r=[t+k[0][0],n+k[0][1],X],i=[t+k[1][0],n+k[1][1],Z];return[{id:`${e.key}-sup`,medium:`heat`,r:1.8,pts:[j(r,null,Q,null),r]},{id:`${e.key}-ret`,medium:`heatret`,r:1.8,pts:[i,j(i,null,Q,null)]}]}),{id:`trunk-ret`,medium:`heatret`,r:3.6,blind:[!0,!1],pts:[[Ct,Q,Z],[Y,Q,Z],[Y,q,Z],[Y,q,vt],j(K(V),null,q,null)]},{id:`suction-pa`,medium:`heatret`,r:3.6,pts:[j(K(V),null,q,null),j(K(B),null,q,null),K(B),G(B)]},{id:`sup-a`,medium:`heat`,r:yt,fromStub:!0,pts:[W(H),j(W(H),null,null,bt),j(W(U),null,null,bt)]},{id:`trunk-sup`,medium:`heat`,r:3.6,blind:[!1,!0],pts:[j(W(U),null,null,bt),[J,W(H)[1],bt],[J,W(H)[1],xt],[J,St,xt],[J,St,X],[J,Q,X],[Ct,Q,X]]},{id:`sup-b`,medium:`heat`,r:yt,fromStub:!0,pts:[W(U),j(W(U),null,null,bt)]},{id:`suction-b`,medium:`heatret`,r:3.2,pts:[G(V),K(V),j(K(V),null,q,null)]}],posts:[[J,-130,3.6,xt],[J,-70,3.6,xt],[J,0,3.6,X,0],[J,80,3.6,X,0],[Y,-60,3.6,Z],[Y,40,3.6,Z,0],[Y,120,3.6,Z,0],...[150,50,-40].map(e=>[e,q,3.6,vt]),[-120,q,3.6,vt,0],...[-230,-80,75,140].map(e=>[e,Q,3.6,Z,0])]},$=De(),Tt=(e,t)=>le(e,t,10),Et=(e,t)=>c(e,t,`heatret`,!0),Dt=(e,t)=>c(e,t,`heat`,!0),Ot=(e,t)=>xe(e,t,et),kt=Se(et);function At({id:e,spec:t,intro:n}){let r=ge(),i=(0,Ie.useMemo)(()=>Re(r,t),[r,t]);return(0,$.jsx)(he,{html:i,asset:e,intro:n})}function jt({ids:e}){let t=ge(),n=s(wt,dt),r=(0,Ie.useMemo)(()=>u(t,Xe)+t.plinth(qe)+t.plinth(Je)+t.plinth(Ye),[t]),i=e=>(0,$.jsx)(he,{html:`${n.layers[e]??``}<g data-flows="${e}" data-depth="${e===0?-1e9:ut[e-1]??0}"></g>`,data:{pipes:``}},`pipes-${e}`),a=(e,t,n,r)=>(0,$.jsx)(o,{from:tt,to:b(t.c),scale:t.scale,children:(0,$.jsx)(_e,{id:e,plan:y,intro:r,draw:n})}),c=[e.boilerA,e.boilerB,e.boilerC],l={hospital:e.hospital,university:e.university,residential:e.residential,office:e.office},d={accumulator:(0,$.jsx)(o,{to:b($e),children:(0,$.jsx)(_e,{id:e.accumulator,plan:kt,intro:5,draw:Ot})}),primaryA:a(e.primaryA,A.primaryA,Et,6),primaryB:a(e.primaryB,A.primaryB,Et,7),networkA:a(e.networkA,A.networkA,Dt,8),networkB:a(e.networkB,A.networkB,Dt,9)};for(let[e,t]of Qe.entries())d[`boiler${e}`]=(0,$.jsx)(o,{to:b(t),children:(0,$.jsx)(_e,{id:c[e]??``,plan:ce,intro:2+e,draw:Tt})});for(let[e,t]of ot.entries()){let n=l[t.key];d[`${t.key}-building`]=(0,$.jsx)(At,{id:n,spec:t.building,intro:10+e}),d[t.key]=(0,$.jsx)(o,{to:b(t.skid),children:(0,$.jsx)(_e,{id:n,plan:We,intro:11+e,draw:Ge})})}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(he,{html:r,data:{plinth:``}}),i(0),lt.flatMap((e,t)=>[(0,$.jsx)(`g`,{children:d[e.key]},e.key),i(t+1)])]})}var Mt=f(Ze),Nt=l(Mt,wt,dt),Pt={width:Ke,height:620,label:`Isometric model of the District Heating network: the heat plant with three gas boilers, the thermal accumulator and two primary pumps; the network pump house with two trunk pumps; and four customers (a hospital, a university, a residential block and an office park), each with its substation, joined by the supply and return trunk main. Every moving part follows live values from the running engine.`,kit:Mt,flows:Nt.flows,joints:Nt.joints,Scene:jt,compose:Fe},Ft=p({layout:Pt,resolve:ke,things:Ae,caption:`heat plant · network · customers`,mismatch:`This floor expects the District Heating network: three boilers, the accumulator and two primary pumps, two network pumps, and the hospital, university, residential and office substations, by area and line.`,statusBasis:`availability`,Overview:t,tab:`Network`});export{Ft as heatingFloor};
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{n as t,t as n}from"./by-path-C9hM5E2c.js";import{A as r,B as i,C as a,D as o,E as s,F as c,H as l,L as u,P as d,V as f,X as p,_ as ee,a as m,b as te,c as h,g,h as _,i as v,j as y,k as b,n as x,o as ne,r as re,s as S,t as ie,w as ae,x as oe}from"./status-DQYLUbXs.js";import{a as se,n as ce,o as le,r as ue,t as de}from"./boiler-s_q0j7rz.js";import{T as fe,b as pe,c as me,d as he,f as ge,l as _e,m as ve,n as ye,s as be}from"./dom-BxZbg3NX.js";import{i as xe,n as Se,r as Ce,t as we}from"./tank-Btg5piqB.js";import{c as Te}from"./vendor-charts-Bquh2dWE.js";import{t as Ee}from"./stages-EYRT12Yp.js";import{ot as De}from"./vendor-ui-BGeFlRLR.js";var Oe=[[`boilerA`,`hot-water-boiler`,`heat-plant`,`boilers`,0],[`boilerB`,`hot-water-boiler`,`heat-plant`,`boilers`,1],[`boilerC`,`hot-water-boiler`,`heat-plant`,`boilers`,2],[`primaryA`,`centrifugal-pump`,`heat-plant`,`primary-loop`,0],[`primaryB`,`centrifugal-pump`,`heat-plant`,`primary-loop`,1],[`accumulator`,`storage-tank`,`heat-plant`,`primary-loop`,0],[`networkA`,`centrifugal-pump`,`network`,`trunk-main`,0],[`networkB`,`centrifugal-pump`,`network`,`trunk-main`,1],[`hospital`,`heat-substation`,`customers`,`hospital`,0],[`university`,`heat-substation`,`customers`,`university`,0],[`residential`,`heat-substation`,`customers`,`residential`,0],[`office`,`heat-substation`,`customers`,`office-park`,0]],ke=e=>n(Oe,e);function Ae(e){let t=(e,t,n)=>({key:e,assetId:e,name:t,kind:`utility`,area:n});return[t(e.boilerA,`Boiler 1 (lead)`,`Heat plant`),t(e.boilerB,`Boiler 2`,`Heat plant`),t(e.boilerC,`Boiler 3`,`Heat plant`),t(e.accumulator,`Thermal accumulator`,`Heat plant`),t(e.primaryA,`Primary pump A`,`Heat plant`),t(e.primaryB,`Primary pump B`,`Heat plant`),t(e.networkA,`Network pump A`,`Network`),t(e.networkB,`Network pump B`,`Network`),t(e.hospital,`Hospital substation`,`Customers`),t(e.university,`University substation`,`Customers`),t(e.residential,`Residential substation`,`Customers`),t(e.office,`Office park substation`,`Customers`)]}var je=3600/(125580*.97),Me=8,Ne=e=>Number(e.dataset.win)*37%101;function Pe(e){let{svg:t,P:n,feed:r}=e,i=(e,t)=>r.num(e,t),o=ye(t,`[data-valve]`).map(e=>{let n=S(e),r=e=>ye(t,`[data-asset="${n}"] ${e}`),i=r(`[data-spin="sub"]`)[0];return{id:n,el:e,at:be(e.dataset.valve),rotor:i,rotorAt:h(i?.dataset.at),rotorR:Number(i?.dataset.radius)||2,foul:r(`[data-foul]`)[0],act:r(`[data-act]`)[0],wins:r(`[data-win]`).sort((e,t)=>Ne(e)-Ne(t)),valve:0,rate:0,spin:0,lit:-1,heat:oe(a(t,n),3,2),ret:h(e.dataset.ret)}}),s=new Map(o.map(e=>[e.id,e]));return{draw(t,a,s){let c=e.reducedMotion();for(let e of o){e.valve=ee(e.valve,g(i(e.id,`control_valve_position`)/100),t,.6,c);let[o=0,l=0,u=0,d=4]=e.at;if(me(e.el,`d`,fe([o,l],[o,l],u,n)+fe([o-1.6,l],[o+1.6,l],u+e.valve*d,n)),e.rate=ee(e.rate,i(e.id,`circulation_pump_speed`)/100*Me,t,.8,c),c||(e.spin+=e.rate*t),e.rotor){let[t,r,i]=e.rotorAt,a=``;for(let o=0;o<3;o++){let s=e.spin+o*_/3;a+=fe([t,r],[t+Math.cos(s)*e.rotorR,r+Math.sin(s)*e.rotorR],i,n)}me(e.rotor,`d`,a)}e.foul&&(e.foul.style.opacity=s&&ae(r,e.id,`hx_fouling`)?`0.85`:`0`);let f=s&&ae(r,e.id,`valve_stuck`);me(e.act,`data-s`,f&&Math.sin(a*6)>0?`a`:null),e.heat.draw(s&&!c&&ae(r,e.id,`low_delta_t`),a,n,e.ret);let p=Math.round(g(i(e.id,`occupancy_pu`))*e.wins.length);if(p!==e.lit){e.lit=p;for(let[t,n]of e.wins.entries())me(n,`data-on`,t<p?``:null)}}},bar(e){return s.has(e)?g(i(e,`heat_delivered_kw`)/r.param(e,`design_load_kw`,500)):void 0},flowPu(e){let t=r.param(e,`design_load_kw`,0)*je;return t>0?g(i(e,`primary_flow`)/t):0}}}var C=e=>e>.002?6+26*g(e*2):0,Fe=e=>{let{svg:t,feed:n,ids:r}=e,i=te(t),a=re(e,i),o=de(e,i),s=we(e),c=Pe(e),l=[a,o,s,c],u=v(e,e=>x(n,e,`availability`)),d=ne(e,{needle:e=>o.needle(e)??0,bar:e=>l.reduce((t,n)=>t??n.bar(e),void 0)??0,alertsHigh:()=>!0,ready:()=>!0}),f=()=>a.flowPu(r.primaryA)+a.flowPu(r.primaryB),p=()=>a.flowPu(r.networkA)+a.flowPu(r.networkB),ee=[r.boilerA,r.boilerB,r.boilerC],h=e=>{let t=ee.filter(e=>o.circulating(e)).length;return o.circulating(e)?f()/t:0},g=new Map([[`hospital`,r.hospital],[`university`,r.university],[`residential`,r.residential],[`office`,r.office]]),_=m(e,({id:e})=>{switch(e){case`sup-1`:return C(h(r.boilerA));case`sup-2`:case`ret-2`:return C(h(r.boilerB));case`sup-3`:case`ret-3`:return C(h(r.boilerC));case`sup-23`:return C(h(r.boilerB)+h(r.boilerC));case`to-acc`:return C(f());case`ret-a`:case`suction-pa`:return C(a.flowPu(r.primaryA));case`ret-collect`:return C(f());case`ret-12`:return C(h(r.boilerA)+h(r.boilerB));case`ret-1`:return C(h(r.boilerA));case`ret-b`:case`suction-b`:return C(a.flowPu(r.primaryB));case`suction-a`:case`sup-a`:return C(a.flowPu(r.networkA));case`sup-b`:case`suction-nb`:return C(a.flowPu(r.networkB));case`acc-out`:case`trunk-sup`:case`trunk-ret`:return C(p());default:{let t=g.get(e.slice(0,e.lastIndexOf(`-`)));return t?C(c.flowPu(t)):0}}});return{data(e){u.draw(e)},draw({sdt:e,t,introDone:n}){_.draw(e),d.draw(e,t);for(let r of l)r.draw(e,t,n)},resync(){},status:e=>ie(n,e,`availability`)}},Ie=e(Te(),1),Le=11;function Re(e,t){let{k:n,P:r,S:i,L:a,slab:o,cyl:s}=e,{plan:c,floors:l,kind:u}=t,d=l*14+4,f=[],p=e=>a(e,{tone:`faint`}),ee=Array.from({length:l-1},(e,t)=>n.sideSeam(c,4+(t+1)*14,r,2)).join(``);f.push(i(n.slabOf(c,0,d,r,2,.6),{tone:u===`office`?`lo`:`mid`,inner:p(ee)})),f.push(a(n.planOutline(n.insetPlan(c,2),d,r,2),{tone:`lo`})),f.push(o({x:c.x+c.w*.2,y:c.y+c.d*.2,w:18,d:12,r:1},d,7,{tone:`mid`},2,.3)),f.push(s(c.x+c.w*.7,c.y+c.d*.35,4,d,9,{tone:`mid`},20));let m=[],te=0,h=(e,t,n)=>`<path class="bd-win" data-win="${te++}" d="M${e.toFixed(1)} ${(-(t+8)).toFixed(1)}H${(e+n).toFixed(1)}V${(-t).toFixed(1)}H${e.toFixed(1)}Z"/>`,g=u===`office`;for(let[t,i,a]of[[c.w,e.front(c.y+c.d),c.x],[c.d,n.sideMatrix([c.x+c.w,c.y+c.d],0,r,`right`),0]]){let e=Math.max(1,Math.floor((t-6)/Le)),n=a+(t-e*Le)/2,r=[];for(let t=0;t<l;t++){let i=7+t*14;if(g)r.push(h(n+1,i,e*Le-2));else for(let t=0;t<e;t++)r.push(h(n+t*Le+2,i,7))}m.push(`<g transform="${i}">${r.join(``)}</g>`)}f.push(...m);let _=c.x+c.w/2,v=c.y+c.d,y=(e,t,n,r,i,a=0)=>{let l=c.x+c.w/2+a;f.push(o({x:l-4.5,y:v,w:9,d:.6,r:.2},0,n-1,{tone:`lo`},2,0),...[-1,1].flatMap(r=>[s(l+r*(e-3)/2,v+t-1.2,1.7,0,.8,{tone:`lo`},14),s(l+r*(e-3)/2,v+t-1.2,i,.8,n-.8,{tone:`mid`},12)]),o({x:l-e/2,y:v,w:e,d:t,r:.5},n,1.4,{tone:r},2,.2))};if(u===`hospital`)f.push(o({x:_-6,y:v-1,w:12,d:1.2,r:.4},d-14,12,{tone:`lo`},2,0)),f.push(`<g transform="${e.front(v+.25)}"><path class="bd-cross" d="M${_-1.4} ${-(d-3.6)}H${_+1.4}V${-(d-6.6)}H${_+4.4}V${-(d-9.4)}H${_+1.4}V${-(d-12.4)}H${_-1.4}V${-(d-9.4)}H${_-4.4}V${-(d-6.6)}H${_-1.4}Z"/></g>`),y(24,8,12,`mid`,.9);else if(u===`university`)y(30,9,18,`mid`,1.8,-16);else if(u===`residential`)for(let e=1;e<l;e++)f.push(o({x:c.x+4,y:v,w:c.w-8,d:4,r:.4},4+e*14,1,{tone:`mid`},2,0));else y(20,7,14,`mid`,.9);return f.join(``)}var w=1.8,ze=4,Be=-14,T=[-5,5],E=[10,26],D=[26,E[0]],O=13,Ve=17.5,He=2.2,Ue=-26,k=[[T[0],28,E[1]],[T[0],28,E[0]]],We={x:-16,y:-24,w:34,d:54,r:2};function Ge(e,t){let{k:n,G:r,P:a,at:o,S:s,L:c,D:l,slab:u,cyl:d,hmi:f,screws:p,faceRule:ee}=e,m=[];m.push(u({x:-14,y:-22,w:30,d:50,r:2},0,3,{tone:`lo`},3,.4)),m.push(p(n.corners({x:-14,y:-22,w:30,d:50},2.4),3)),m.push(u({x:-1.2,y:-20,w:2.4,d:3,r:.4},3,36,{tone:`mid`},2,.2),u({x:-1.4,y:-20,w:2.8,d:27,r:.4},36,2.6,{tone:`mid`},2,.2)),m.push(u({x:-10,y:-17,w:20,d:3,r:.6},3,33,{tone:`mid`},2,.3));let te=[];for(let e=-13.2;e<3.6;e+=.9)te.push(n.segment([9,e,6],[9,e,33],a));m.push(s(n.slabOf({x:-9,y:Be,w:18,d:18,r:.4},5,29,a,2,.2),{tone:`lo`,inner:c(te.join(``),{tone:`faint`})}));let h=[[9.1,-13.6,6],[9.1,3.6,6],[9.1,3.6,33],[9.1,-13.6,33]].map(e=>o(e));m.push(`<path class="sf-grime" data-foul="" style="opacity:0" d="${n.pathOf(h,!0)}"/>`),m.push(u({x:-11,y:ze,w:22,d:3.4,r:.6},3,35,{tone:`mid`},2,.3));let g=7.4;m.push(l([-10.4,10.4].flatMap(e=>[7,31].map(t=>o([e,g,t]))),{size:.5}));for(let e of T)for(let t of E){let n=r.frameAlong([e,g,t],[0,1,0]);m.push(s(r.disc(0,2.2,2,n,a),{tone:`mid`}),s(r.disc(2.2,3,3.2,n,a),{tone:`mid`}))}let _=(e,t)=>[T[e],10.4,E[t]],[v,y]=k;m.push(i(e,[v,_(0,1)],w,`mid`,3,`heat`),i(e,[_(0,0),y],w,`mid`,3,`heatret`));for(let e of[v,y]){let t=r.frameAlong([e[0],e[1]-1.6,e[2]],[0,1,0]);m.push(s(r.disc(0,1.6,3,t,a),{tone:`mid`}))}let[b,,x]=v,ne=r.frameAlong([b,14,x],[0,1,0]);m.push(s(r.disc(0,1,3.2,ne,a),{tone:`mid`}),s(r.solidOf([[1,2.6],[2.6,3.6,1],[5.4,3.6,1],[7,2.6]],ne,a),{tone:`mid`}),s(r.disc(7,8,3.2,ne,a),{tone:`mid`}),d(b,18,1.2,x+3,4,{tone:`mid`,crease:`none`},12),d(b,18,4.4,x+7,2,{tone:`mid`},24),d(b,18,4.8,x+9,5,{tone:`mid`,crease:`lo`},28));let re=o([b+4.8,18,x+11.5]);m.push(`<path class="iso-line" data-tone="lit" data-valve="${b},21,${x+14},4" data-ret="${y[0]},${y[1]-4},${y[2]+2}" d=""/>`,`<circle class="sb-act" data-act="" cx="${re[0].toFixed(2)}" cy="${re[1].toFixed(2)}" r="0.6"/>`);let S=[T[1],21.4,E[1]],ie=(e,t)=>{let n=r.frameAlong([e,-30,t],[0,1,0]);return s(r.disc(0,1.2,4.4,n,a),{tone:`mid`})+s(r.disc(1.2,He,3.2,n,a),{tone:`mid`})},ae=(e,t)=>d(e,Ue,2.4,0,1,{tone:`lo`},18)+d(e,Ue,.9,1,t-w-2.6,{tone:`mid`,crease:`none`},12)+d(e,Ue,1.8,t-w-1.6,1,{tone:`mid`},16),oe=-27.8;return m.push(ie(O,D[0]),ie(O,D[1]),ae(O,D[1]),ae(Ve,D[0]),u({x:12,y:-26.9,w:6.4,d:1.8,r:.3},D[0]-w-1.6,1,{tone:`mid`},2,0),i(e,[_(1,1),S,[O,S[1],D[0]],[O,oe,D[0]]],w,`mid`,4,`heat`,[!0,!1]),i(e,[_(1,0),[T[1],23.4,E[0]],[O,23.4,E[0]],[O,oe,D[1]]],w,`mid`,4,`heatret`,[!0,!1])),m.push(d(S[0],S[1],3.6,E[1]-3,6,{tone:`mid`},24)),m.push(d(S[0],S[1],3,E[1]+3,7,{tone:`mid`,crease:`lo`},24)),m.push(`<path class="iso-line" data-tone="lo" data-spin="sub" data-at="${S[0]},${S[1]},${E[1]+10}" data-radius="2.4" d=""/>`),m.push(u({x:-14,y:10,w:6,d:8,r:.6},3,22,{tone:`mid`},2,.3)),m.push(f(t,18,-13.6,-8.4,8,21)),m.push(ee(18,-13.6,4,5,2)),m.join(``)}var Ke=1e3,qe={x:-380,y:-360,w:305,d:315,r:8},Je={x:-60,y:-300,w:240,d:150,r:8},Ye={x:-380,y:-15,w:620,d:200,r:8},Xe={x:-400,y:-380,w:660,d:585,r:16},Ze=pe([...ve(Xe,-21,-14),...ve(qe,-14,120),...ve(Je,-14,90),...ve(Ye,-14,110)],Ke,620,{pad:22,azimuth:60}),Qe=[[-262,-335],[-262,-245],[-262,-155]],$e=[-120,-255],et={r:34,h:118,windowX:6,panelX:40,nozzles:[{angle:180,z:80,r:3.4,role:`inlet`},{angle:0,z:80,r:3.4,role:`outlet`}]},tt=[94,-130,0],A={primaryA:{c:[-255,-78],scale:1},primaryB:{c:[-130,-78],scale:1},networkA:{c:[0,-190],scale:1.15},networkB:{c:[135,-190],scale:1.15}},nt=[d[0]-tt[0],d[1]-tt[1],d[2]],rt=[r[0]-tt[0],r[1]-tt[1],r[2]],it=18,at=(e,t,n,r,i)=>({key:e,skid:[t+n/2-it,104],building:{kind:e,plan:{x:t-n/2,y:74-r,w:n,d:r,r:2},floors:i}}),ot=[at(`hospital`,150,112,62,4),at(`university`,-5,120,64,3),at(`residential`,-158,68,56,5),at(`office`,-300,92,58,4)],st=[...Qe.map((e,t)=>({key:`boiler${t}`,at:e,h:60})),{key:`accumulator`,at:$e,h:et.h+12},...Object.entries(A).map(([e,t])=>({key:e,at:t.c,h:45})),...ot.flatMap(e=>[{key:`${e.key}-building`,at:[e.building.plan.x+e.building.plan.w/2,e.building.plan.y+e.building.plan.d/2],h:e.building.floors*14+4},{key:e.key,at:e.skid,h:40}])],ct=Ee(st,Ze),lt=ct.order,ut=ct.slotDepths,dt=ct.depth,ft=(e,t)=>[e.c[0]+t[0]*e.scale,e.c[1]+t[1]*e.scale,t[2]*e.scale],j=(e,t,n,r)=>[t??e[0],n??e[1],r??e[2]],pt=e=>{let t=et.nozzles[e],[n,r,i]=t?Ce(et,t):[0,0,0];return[$e[0]+n,$e[1]+r,i]},M=(Qe[0]?.[0]??0)+se[0],N=(Qe[0]?.[0]??0)+ue[0],P=se[2],F=80,I=84,[mt=0,L=0,R=0]=Qe.map(e=>e[1]),ht=pt(0),z=pt(1),{primaryA:B,primaryB:V,networkA:H,networkB:U}=A,W=e=>ft(e,[rt[0],rt[1],rt[2]-3]),G=e=>ft(e,nt),gt=10,K=e=>j(G(e),G(e)[0]+gt*e.scale,null,null),_t=72,q=-106,vt=G(B)[2],J=220,Y=232,yt=3.2*A.networkA.scale,bt=100,xt=82,St=-40,X=k[0][2],Z=k[1][2],Q=104+k[0][1]+30,Ct=Math.min(...ot.map(e=>e.skid[0]))+k[0][0]-14,wt={z:10,flanged:!0,routes:[{id:`sup-1`,medium:`heat`,r:3.2,pts:[[M,mt,P],[M,mt,F],[M,ht[1],F]]},{id:`sup-23`,medium:`heat`,r:3.2,reverse:!0,pts:[[M,ht[1],F],[M,L,F]]},{id:`sup-3`,medium:`heat`,r:3.2,reverse:!0,pts:[[M,L,F],[M,R,F],[M,R,P]]},{id:`sup-2`,medium:`heat`,r:3.2,pts:[[M,L,P],[M,L,F]]},{id:`to-acc`,medium:`heat`,r:3.4,pts:[[M,ht[1],F],ht]},{id:`ret-b`,medium:`heatret`,r:3.2,fromStub:!0,pts:[W(V),j(W(V),null,null,_t),j(W(B),null,null,_t)]},{id:`ret-a`,medium:`heatret`,r:3.2,fromStub:!0,pts:[W(B),j(W(B),null,null,_t)]},{id:`ret-collect`,medium:`heatret`,r:3.2,bend:6,pts:[j(W(B),null,null,_t),j(W(B),N,null,_t),j(W(B),N,null,I),[N,R,I]]},{id:`ret-12`,medium:`heatret`,r:3.2,pts:[[N,R,I],[N,L,I]]},{id:`ret-1`,medium:`heatret`,r:3.2,pts:[[N,L,I],[N,mt,I],[N,mt,P]]},{id:`ret-2`,medium:`heatret`,r:3.2,pts:[[N,L,I],[N,L,P]]},{id:`ret-3`,medium:`heatret`,r:3.2,pts:[[N,R,I],[N,R,P]]},{id:`acc-out`,medium:`heat`,r:3.4,pts:[z,j(K(H),null,z[1],z[2])]},{id:`suction-nb`,medium:`heat`,r:3.4,pts:[j(K(H),null,z[1],z[2]),j(z,K(U)[0],null,null),j(K(U),null,z[1],null),K(U),G(U)]},{id:`suction-a`,medium:`heat`,r:3.4,pts:[j(K(H),null,z[1],z[2]),j(K(H),null,z[1],null),K(H),G(H)]},...ot.flatMap(e=>{let[t,n]=e.skid,r=[t+k[0][0],n+k[0][1],X],i=[t+k[1][0],n+k[1][1],Z];return[{id:`${e.key}-sup`,medium:`heat`,r:1.8,pts:[j(r,null,Q,null),r]},{id:`${e.key}-ret`,medium:`heatret`,r:1.8,pts:[i,j(i,null,Q,null)]}]}),{id:`trunk-ret`,medium:`heatret`,r:3.6,blind:[!0,!1],pts:[[Ct,Q,Z],[Y,Q,Z],[Y,q,Z],[Y,q,vt],j(K(V),null,q,null)]},{id:`suction-pa`,medium:`heatret`,r:3.6,pts:[j(K(V),null,q,null),j(K(B),null,q,null),K(B),G(B)]},{id:`sup-a`,medium:`heat`,r:yt,fromStub:!0,pts:[W(H),j(W(H),null,null,bt),j(W(U),null,null,bt)]},{id:`trunk-sup`,medium:`heat`,r:3.6,blind:[!1,!0],pts:[j(W(U),null,null,bt),[J,W(H)[1],bt],[J,W(H)[1],xt],[J,St,xt],[J,St,X],[J,Q,X],[Ct,Q,X]]},{id:`sup-b`,medium:`heat`,r:yt,fromStub:!0,pts:[W(U),j(W(U),null,null,bt)]},{id:`suction-b`,medium:`heatret`,r:3.2,pts:[G(V),K(V),j(K(V),null,q,null)]}],posts:[[J,-130,3.6,xt],[J,-70,3.6,xt],[J,0,3.6,X,0],[J,80,3.6,X,0],[Y,-60,3.6,Z],[Y,40,3.6,Z,0],[Y,120,3.6,Z,0],...[150,50,-40].map(e=>[e,q,3.6,vt]),[-120,q,3.6,vt,0],...[-230,-80,75,140].map(e=>[e,Q,3.6,Z,0])]},$=De(),Tt=(e,t)=>le(e,t,10),Et=(e,t)=>c(e,t,`heatret`,!0),Dt=(e,t)=>c(e,t,`heat`,!0),Ot=(e,t)=>xe(e,t,et),kt=Se(et);function At({id:e,spec:t,intro:n}){let r=ge(),i=(0,Ie.useMemo)(()=>Re(r,t),[r,t]);return(0,$.jsx)(he,{html:i,asset:e,intro:n})}function jt({ids:e}){let t=ge(),n=s(wt,dt),r=(0,Ie.useMemo)(()=>u(t,Xe)+t.plinth(qe)+t.plinth(Je)+t.plinth(Ye),[t]),i=e=>(0,$.jsx)(he,{html:`${n.layers[e]??``}<g data-flows="${e}" data-depth="${e===0?-1e9:ut[e-1]??0}"></g>`,data:{pipes:``}},`pipes-${e}`),a=(e,t,n,r)=>(0,$.jsx)(o,{from:tt,to:b(t.c),scale:t.scale,children:(0,$.jsx)(_e,{id:e,plan:y,intro:r,draw:n})}),c=[e.boilerA,e.boilerB,e.boilerC],l={hospital:e.hospital,university:e.university,residential:e.residential,office:e.office},d={accumulator:(0,$.jsx)(o,{to:b($e),children:(0,$.jsx)(_e,{id:e.accumulator,plan:kt,intro:5,draw:Ot})}),primaryA:a(e.primaryA,A.primaryA,Et,6),primaryB:a(e.primaryB,A.primaryB,Et,7),networkA:a(e.networkA,A.networkA,Dt,8),networkB:a(e.networkB,A.networkB,Dt,9)};for(let[e,t]of Qe.entries())d[`boiler${e}`]=(0,$.jsx)(o,{to:b(t),children:(0,$.jsx)(_e,{id:c[e]??``,plan:ce,intro:2+e,draw:Tt})});for(let[e,t]of ot.entries()){let n=l[t.key];d[`${t.key}-building`]=(0,$.jsx)(At,{id:n,spec:t.building,intro:10+e}),d[t.key]=(0,$.jsx)(o,{to:b(t.skid),children:(0,$.jsx)(_e,{id:n,plan:We,intro:11+e,draw:Ge})})}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(he,{html:r,data:{plinth:``}}),i(0),lt.flatMap((e,t)=>[(0,$.jsx)(`g`,{children:d[e.key]},e.key),i(t+1)])]})}var Mt=f(Ze),Nt=l(Mt,wt,dt),Pt={width:Ke,height:620,label:`Isometric model of the District Heating network: the heat plant with three gas boilers, the thermal accumulator and two primary pumps; the network pump house with two trunk pumps; and four customers (a hospital, a university, a residential block and an office park), each with its substation, joined by the supply and return trunk main. Every moving part follows live values from the running engine.`,kit:Mt,flows:Nt.flows,joints:Nt.joints,Scene:jt,compose:Fe},Ft=p({layout:Pt,resolve:ke,things:Ae,caption:`heat plant · network · customers`,mismatch:`This floor expects the District Heating network: three boilers, the accumulator and two primary pumps, two network pumps, and the hospital, university, residential and office substations, by area and line.`,statusBasis:`availability`,Overview:t,tab:`Network`});export{Ft as heatingFloor};