@miravo/cli-linux-x64 0.13.0 → 0.14.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 (56) hide show
  1. package/console-dist/assets/api-Bp-mG9Rs.js +1 -0
  2. package/console-dist/assets/api-CtMmjN9m.js +1 -0
  3. package/console-dist/assets/{asset-detail-B2YDSfM1.js → asset-detail-JDx-26wg.js} +1 -1
  4. package/console-dist/assets/{asset-detail-actions-BrttEn24.js → asset-detail-actions-BrLTJCzY.js} +1 -1
  5. package/console-dist/assets/{backup-power-Cm_Ij5yj.js → backup-power-B1THpfxc.js} +1 -1
  6. package/console-dist/assets/{by-path-e6y8DTMV.js → by-path-CGbqDnvK.js} +1 -1
  7. package/console-dist/assets/catalog-B3KfEJkB.js +1 -0
  8. package/console-dist/assets/{catalog-DOGCbTe4.js → catalog-Whukru3I.js} +1 -1
  9. package/console-dist/assets/{catalog-template-icons-7CBAYTtP.js → catalog-template-icons-GGQGFjA8.js} +1 -1
  10. package/console-dist/assets/{commercial-building-D95MTyEI.js → commercial-building-BeGD1bPV.js} +1 -1
  11. package/console-dist/assets/{console-panel-iWo8EgKP.js → console-panel-DXk4doxV.js} +1 -1
  12. package/console-dist/assets/control-BeyuTMD5.js +1 -0
  13. package/console-dist/assets/control-HoYOjLyM.js +1 -0
  14. package/console-dist/assets/{district-heating-B_YycTG-.js → district-heating-MuLRna9G.js} +1 -1
  15. package/console-dist/assets/events-C2Q9HRYG.js +1 -0
  16. package/console-dist/assets/{events-5RYkaW81.js → events-Cb1faGh2.js} +1 -1
  17. package/console-dist/assets/export-tab-CtH28h1G.js +1 -0
  18. package/console-dist/assets/{factory-3x3_UmJZ.js → factory-Boh-9Tjz.js} +1 -1
  19. package/console-dist/assets/factory-CpziAEBj.js +1 -0
  20. package/console-dist/assets/{floor-page-D0qm0GgG.js → floor-page-Bxq5t8Yi.js} +1 -1
  21. package/console-dist/assets/{get-error-message-C9VW9IZB.js → get-error-message-D800c4Uu.js} +1 -1
  22. package/console-dist/assets/{index-M2C34y3X.js → index-CHgd8U-y.js} +5 -5
  23. package/console-dist/assets/{integration-api-ChbzMP5N.js → integration-api-DnCoHAoa.js} +1 -1
  24. package/console-dist/assets/integrations-DYDSuhVG.js +1 -0
  25. package/console-dist/assets/{integrations-Cop24rSE.js → integrations-DlVDmGqI.js} +1 -1
  26. package/console-dist/assets/{login-BZANmwgH.js → login-D6-swZqz.js} +1 -1
  27. package/console-dist/assets/models-C1sVJK7p.js +1 -0
  28. package/console-dist/assets/{models-BgGuH6PQ.js → models-CDGbNOUr.js} +1 -1
  29. package/console-dist/assets/{pharma-cleanroom-BbYfEQjP.js → pharma-cleanroom-DnxAzkeg.js} +1 -1
  30. package/console-dist/assets/{protocol-card-B8XGneNM.js → protocol-card-Bf06qKjE.js} +1 -1
  31. package/console-dist/assets/{registry-BXGfJ4np.js → registry-BKilgP4M.js} +2 -2
  32. package/console-dist/assets/{status-kit-pFRjEjVU.js → status-kit-eQF95zN0.js} +1 -1
  33. package/console-dist/assets/tags-BPR9ZiaM.js +1 -0
  34. package/console-dist/assets/{tags-Bw7b0x14.js → tags-DtfR_AgF.js} +2 -2
  35. package/console-dist/assets/{transition-nav-link-CSrpkA7_.js → transition-nav-link-ZpTbW2Hm.js} +1 -1
  36. package/console-dist/assets/use-engine-command-mutation-5q_LI_xT.js +1 -0
  37. package/console-dist/assets/{use-transition-navigate-D2Y8kfw6.js → use-transition-navigate-5-QJHk2I.js} +2 -2
  38. package/console-dist/assets/{useQuery-Cl48zZ73.js → useQuery-Dxp3WSXF.js} +1 -1
  39. package/console-dist/assets/validation-BSQDilvJ.js +1 -0
  40. package/console-dist/assets/{water-treatment-jG0T2rhc.js → water-treatment-CAxvQSI-.js} +1 -1
  41. package/console-dist/index.html +23 -23
  42. package/miravo +2 -2
  43. package/package.json +1 -1
  44. package/console-dist/assets/api-BG2sUkwk.js +0 -1
  45. package/console-dist/assets/api-CKfC8_zv.js +0 -1
  46. package/console-dist/assets/catalog-Bz24KMiz.js +0 -1
  47. package/console-dist/assets/control-BMhNX7vM.js +0 -1
  48. package/console-dist/assets/control-CML5aS8w.js +0 -1
  49. package/console-dist/assets/events-z582V8se.js +0 -1
  50. package/console-dist/assets/export-tab-BsV7px7m.js +0 -1
  51. package/console-dist/assets/factory-LkZOsGje.js +0 -1
  52. package/console-dist/assets/integrations-BpOu11IH.js +0 -1
  53. package/console-dist/assets/models-C09Ba-2G.js +0 -1
  54. package/console-dist/assets/tags-BjW65yls.js +0 -1
  55. package/console-dist/assets/use-engine-command-mutation-DrMOfYty.js +0 -1
  56. package/console-dist/assets/validation-Cxhiswz2.js +0 -1
@@ -1,2 +1,2 @@
1
- import{C as e,S as t,T as n,f as r,m as i,p as a,t as o,w as s}from"./api-BG2sUkwk.js";import{n as c}from"./utils-XFKvwlFT.js";var l=c(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);async function u(){return(await a(`/integrations/le/targets`,t.integrationTargets)).targets}function d(e){return a(`/integrations/le/targets`,t.integrationTargetCreate,{body:e})}function f(e,n){return a(`/integrations/le/targets/${e}`,t.integrationTargetById,{body:n})}function p(e){return a(`/integrations/le/targets/${e}`,t.integrationTargetDelete)}function m(e,n){return a(`/integrations/le/targets/test`,t.integrationConnectionTest,{body:e,init:{signal:n?.signal}})}function h(e,n){return a(`/integrations/le/plan`,t.integrationPlan,{body:e,init:{signal:n?.signal}})}function g(e,n){return a(`/integrations/le/cleanup/plan`,t.integrationCleanupPlan,{body:e,init:{signal:n?.signal}})}function _(e={}){let n=new URLSearchParams;e.type&&n.set(`type`,e.type),e.targetId&&n.set(`targetId`,e.targetId),e.templateId&&n.set(`templateId`,e.templateId),e.assetId&&n.set(`assetId`,e.assetId),typeof e.limit==`number`&&n.set(`limit`,String(e.limit)),typeof e.offset==`number`&&n.set(`offset`,String(e.offset));let r=n.toString();return a(r?`/integrations/le/operations?${r}`:`/integrations/le/operations`,t.integrationOperations)}var v=500;async function y(e){let t=[];for(let n=0;;n+=v){let r=await _({targetId:e,limit:v,offset:n});if(t.push(...r.operations),!r.hasMore||r.operations.length===0)return t}}async function b(n){try{return await a(`/integrations/le/operations/${n}/cancel`,t.integrationOperationCancel),!0}catch(t){if(e.is(t)&&t.status===404)return!1;throw t}}function x(e,n,r){return C(`/integrations/le/apply/stream`,t.integrationApplyStream,e,n,r)}function S(e,n,r){return C(`/integrations/le/cleanup/stream`,t.integrationCleanupStream,e,n,r)}function C(t,a,c,l,u){let d=new AbortController;return(async()=>{try{let u=a.body.safeParse(c);if(!u.success)throw Error(`Invalid request for ${a.method} ${a.path}: ${u.error.message}`);let f=await fetch(i(o,t),{method:a.method,headers:{"content-type":`application/json`},credentials:`include`,body:JSON.stringify(u.data),signal:d.signal});if(f.status===401&&a.auth===`required`)throw r(),Error(`Session expired`);if(!f.ok){let t=`HTTP ${f.status}`;try{let t=await f.json(),n=s.safeParse(t);if(n.success)throw new e({code:n.data.code,status:f.status,message:n.data.message,hint:n.data.hint})}catch(t){if(t instanceof e)throw t}throw Error(t)}if(!f.body)throw Error(`No response body`);let p=f.body.getReader(),m=new TextDecoder,h=``,g=``,_=``,v=!1;for(;;){let{done:e,value:t}=await p.read();if(e)break;h+=m.decode(t,{stream:!0});let r=h.split(`
1
+ import{C as e,S as t,T as n,f as r,m as i,p as a,t as o,w as s}from"./api-CtMmjN9m.js";import{n as c}from"./utils-XFKvwlFT.js";var l=c(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);async function u(){return(await a(`/integrations/le/targets`,t.integrationTargets)).targets}function d(e){return a(`/integrations/le/targets`,t.integrationTargetCreate,{body:e})}function f(e,n){return a(`/integrations/le/targets/${e}`,t.integrationTargetById,{body:n})}function p(e){return a(`/integrations/le/targets/${e}`,t.integrationTargetDelete)}function m(e,n){return a(`/integrations/le/targets/test`,t.integrationConnectionTest,{body:e,init:{signal:n?.signal}})}function h(e,n){return a(`/integrations/le/plan`,t.integrationPlan,{body:e,init:{signal:n?.signal}})}function g(e,n){return a(`/integrations/le/cleanup/plan`,t.integrationCleanupPlan,{body:e,init:{signal:n?.signal}})}function _(e={}){let n=new URLSearchParams;e.type&&n.set(`type`,e.type),e.targetId&&n.set(`targetId`,e.targetId),e.templateId&&n.set(`templateId`,e.templateId),e.assetId&&n.set(`assetId`,e.assetId),typeof e.limit==`number`&&n.set(`limit`,String(e.limit)),typeof e.offset==`number`&&n.set(`offset`,String(e.offset));let r=n.toString();return a(r?`/integrations/le/operations?${r}`:`/integrations/le/operations`,t.integrationOperations)}var v=500;async function y(e){let t=[];for(let n=0;;n+=v){let r=await _({targetId:e,limit:v,offset:n});if(t.push(...r.operations),!r.hasMore||r.operations.length===0)return t}}async function b(n){try{return await a(`/integrations/le/operations/${n}/cancel`,t.integrationOperationCancel),!0}catch(t){if(e.is(t)&&t.status===404)return!1;throw t}}function x(e,n,r){return C(`/integrations/le/apply/stream`,t.integrationApplyStream,e,n,r)}function S(e,n,r){return C(`/integrations/le/cleanup/stream`,t.integrationCleanupStream,e,n,r)}function C(t,a,c,l,u){let d=new AbortController;return(async()=>{try{let u=a.body.safeParse(c);if(!u.success)throw Error(`Invalid request for ${a.method} ${a.path}: ${u.error.message}`);let f=await fetch(i(o,t),{method:a.method,headers:{"content-type":`application/json`},credentials:`include`,body:JSON.stringify(u.data),signal:d.signal});if(f.status===401&&a.auth===`required`)throw r(),Error(`Session expired`);if(!f.ok){let t=`HTTP ${f.status}`;try{let t=await f.json(),n=s.safeParse(t);if(n.success)throw new e({code:n.data.code,status:f.status,message:n.data.message,hint:n.data.hint})}catch(t){if(t instanceof e)throw t}throw Error(t)}if(!f.body)throw Error(`No response body`);let p=f.body.getReader(),m=new TextDecoder,h=``,g=``,_=``,v=!1;for(;;){let{done:e,value:t}=await p.read();if(e)break;h+=m.decode(t,{stream:!0});let r=h.split(`
2
2
  `);h=r.pop()??``;for(let e of r)if(e.startsWith(`event: `))g=e.slice(7).trim();else if(e.startsWith(`data: `))_=e.slice(6);else if(e===``&&g&&_){let e=!1;try{let t=JSON.parse(_),r=n.safeParse({event:g,data:t});r.success&&((r.data.event===`complete`||r.data.event===`cancelled`||r.data.event===`error`)&&(v=!0,e=!0),l(r.data))}catch{}if(g=``,_=``,e){await p.cancel();return}}}if(!v&&!d.signal.aborted)throw Error(`Connection to server was lost unexpectedly`)}catch(e){if(d.signal.aborted)return;u(e instanceof Error?e:Error(String(e)))}})(),d}export{_ as a,h as c,m as d,f,y as i,x as l,d as n,u as o,l as p,p as r,g as s,b as t,S as u};
@@ -0,0 +1 @@
1
+ import{t as e}from"./integrations-DlVDmGqI.js";export{e as IntegrationsPage};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{ct as r,lt as i,ut as a,v as o,y as s}from"./api-BG2sUkwk.js";import{n as c,p as l,t as u}from"./useQuery-Cl48zZ73.js";import{t as d}from"./proxy-CWZabK8f.js";import{t as f}from"./AnimatePresence-BSSlw02V.js";import{i as p,r as m}from"./dist-xY0pK9Wy.js";import{n as h}from"./chunk-OE4NN4TA-DBWZidbW.js";import{a as g,c as _,i as v,n as y,o as b,r as x,t as S}from"./dialog-B5PqrKVw.js";import{C,S as w,T,m as E,o as D,u as O}from"./format-Bx7DF-TB.js";import{n as k,t as A}from"./utils-XFKvwlFT.js";import{t as j}from"./activity-Cy_niK56.js";import{n as ee,r as te,t as M}from"./server-BVem_egD.js";import{t as ne}from"./chevron-down-x70Pto6j.js";import{n as N,t as P}from"./circle-x-6JtFdy1_.js";import{a as re,d as ie,f as ae,n as oe,o as se,p as ce,r as le}from"./integration-api-ChbzMP5N.js";import{t as ue}from"./copy-button-CSUP1VjU.js";import{n as de,r as fe,t as pe}from"./source-host-miravo-B8eM2IHw.js";import{t as me}from"./loader-circle-DjgHgHHl.js";import{t as F}from"./plus-Cl4Ay5Ry.js";import{r as he,t as ge}from"./query-fetch-error-CWLZA2L5.js";import{t as _e}from"./trash-2-BH9HDsZv.js";import{t as I}from"./triangle-alert-DoAwrRgk.js";import{i as ve,n as ye,t as be}from"./tooltip-B3vOB1Vu.js";import{t as xe}from"./badge-Bk1DaL6C.js";import{t as Se}from"./label-2sIXTEUK.js";import{n as L}from"./get-error-message-C9VW9IZB.js";import{i as Ce,n as we,r as Te,t as Ee}from"./tabs-Ch_VG8_S.js";import{a as De,c as R,i as z,n as B,o as Oe,r as ke,s as V,t as H}from"./select-BWlrSYlA.js";import{i as U,n as Ae,r as W,t as je}from"./integration-targets-Byvdd3Or.js";var Me=class extends l{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:a()})}getOptimisticResult(e){return e.behavior=a(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,a=super.createResult(e,t),{isFetching:o,isRefetching:s,isError:c,isRefetchError:l}=a,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:r(t,n.data),hasPreviousPage:i(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function Ne(e,t){return c(e,Me,t)}var G=k(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Pe=k(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Fe=k(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),K=e(t(),1),q=n(),Ie=`rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/55 bg-muted/10`;function Le(){return(0,q.jsx)(`p`,{className:`mt-2 text-pretty text-sm leading-relaxed text-muted-foreground`,children:`Add a target to get started.`})}function Re({onClick:e}){return(0,q.jsxs)(C,{type:`button`,size:`sm`,className:`h-7 shrink-0 gap-1.5 text-xs`,onClick:e,children:[(0,q.jsx)(F,{className:`size-3.5`,"aria-hidden":!0}),`Add Target`]})}function ze({titleId:e,frameIcon:t,description:n,children:r}){return(0,q.jsx)(`section`,{"aria-labelledby":e,className:Ie,children:(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-4 py-10 text-center`,children:[(0,q.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/50`,children:t}),(0,q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,q.jsx)(`h2`,{id:e,className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`No targets yet`}),n]}),r]})})}function Be(){return(0,q.jsx)(`section`,{"aria-labelledby":`integrations-operation-log-empty-title`,className:Ie,children:(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-4 py-8 text-center sm:py-10`,children:[(0,q.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/50`,children:(0,q.jsx)(j,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0})}),(0,q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,q.jsx)(`h2`,{id:`integrations-operation-log-empty-title`,className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`No operations yet`}),(0,q.jsx)(`p`,{className:`mt-2 text-pretty text-sm leading-relaxed text-muted-foreground`,children:`Apply from the Factory page, or clean up from a target. Finished runs show up here with full detail.`})]})]})})}function Ve(e){let t=new Date(e),n=new Date,r=new Date(n);return r.setDate(n.getDate()-1),t.toDateString()===n.toDateString()?`Today`:t.toDateString()===r.toDateString()?`Yesterday`:t.toLocaleDateString(`en-US`,{weekday:`short`,month:`short`,day:`numeric`})}function He(e){let t=new Map;for(let n of e){let e=new Date(n.completedAt).toDateString(),r=t.get(e);r?r.push(n):t.set(e,[n])}return Array.from(t.entries()).map(([,e])=>({label:Ve(e[0]?.completedAt??Date.now()),ops:e}))}function J(e,t){return e===`device`?t.operationType===`apply`?`Tag/register writes per device step—not a device count.`:`One count per device removed from DeviceHub.`:e===`model`?`One count per model in this run.`:e===`asset`?`One count per asset in this run.`:`Sets the device parameter to the bound DeviceHub device.`}var Ue={devices:`Devices`,models:`DT models`,assets:`Digital Twin instances`},Y={create:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-success/35 bg-success/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-success`,update:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-primary/35 bg-primary/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-primary`,replace:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-chart-2/35 bg-chart-2/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-chart-2`,delete:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-destructive/35 bg-destructive/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-destructive`,noop:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-border/55 bg-muted/55 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-foreground/78`,failed:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-destructive/40 bg-destructive/18 px-1.5 py-0.5 font-mono text-[10px] font-semibold tabular-nums text-destructive`};function We(e){return[{key:`device`,title:`DeviceHub — protocol tags`,subtitle:J(`device`,e),counts:e.resourceCounts.device},{key:`model`,title:`Digital Twin models`,subtitle:J(`model`,e),counts:e.resourceCounts.model},{key:`asset`,title:`Assets`,subtitle:J(`asset`,e),counts:e.resourceCounts.asset},{key:`param-sync`,title:`Parameter sync`,subtitle:J(`param-sync`,e),counts:e.resourceCounts[`param-sync`]}].filter(e=>e.counts.total>0||e.counts.failed>0)}function Ge(e){return e.length===0?`Default (devices, models, assets)`:e.map(e=>Ue[e]??e).join(` · `)}function X(e){return e.templateId??e.assetId??``}function Z(e,t,n){if(e===`device`)switch(t){case`create`:return`+${n} tags (new device)`;case`update`:return`${n} tags rewritten`;case`replace`:return`↻${n} tags (device replaced)`;case`delete`:return`−${n} removed`;case`noop`:return`=${n} unchanged`}switch(t){case`create`:return`+${n} created`;case`update`:return`${n} updated`;case`replace`:return`↻${n} replaced`;case`delete`:return`−${n} removed`;case`noop`:return`=${n} unchanged`}}function Ke({row:e}){let{key:t,counts:n}=e;return(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-1.5`,children:[n.create>0&&(0,q.jsx)(`span`,{className:Y.create,children:Z(t,`create`,n.create)}),n.update>0&&(0,q.jsx)(`span`,{className:Y.update,children:Z(t,`update`,n.update)}),n.replace>0&&(0,q.jsx)(`span`,{className:Y.replace,children:Z(t,`replace`,n.replace)}),n.delete>0&&(0,q.jsx)(`span`,{className:Y.delete,children:Z(t,`delete`,n.delete)}),n.noop>0&&(0,q.jsx)(`span`,{className:Y.noop,children:Z(t,`noop`,n.noop)}),n.failed>0&&(0,q.jsx)(`span`,{className:Y.failed,children:`${n.failed} failed`})]})}function Q(e){return e.resourceCounts.device.noop+e.resourceCounts.model.noop+e.resourceCounts.asset.noop+e.resourceCounts[`param-sync`].noop}function qe({op:e}){let t=Q(e);return(0,q.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50 bg-muted/25 px-3 py-2.5`,children:[(0,q.jsx)(`p`,{className:`font-mono text-[10px] uppercase tracking-[0.16em] text-foreground/72`,children:`Run context`}),(0,q.jsxs)(`dl`,{className:`mt-2 grid grid-cols-[minmax(0,7.5rem)_1fr] gap-x-3 gap-y-1.5 text-xs sm:grid-cols-[9rem_1fr]`,children:[(0,q.jsx)(`dt`,{className:`text-foreground/70`,children:`Operation`}),(0,q.jsx)(`dd`,{className:`font-medium capitalize text-foreground`,children:e.operationType}),(0,q.jsx)(`dt`,{className:`text-foreground/70`,children:`Factory`}),(0,q.jsx)(`dd`,{className:`font-mono text-[11px] text-foreground`,children:e.factoryName}),(0,q.jsx)(`dt`,{className:`text-foreground/70`,children:e.assetId===void 0?`Template`:`Asset`}),(0,q.jsx)(`dd`,{className:`font-mono text-[11px] text-foreground`,children:X(e)}),(0,q.jsx)(`dt`,{className:`text-foreground/70`,children:`Target host`}),(0,q.jsx)(`dd`,{className:`break-all font-mono text-[11px] text-foreground`,children:e.hostname}),(0,q.jsx)(`dt`,{className:`text-foreground/70`,children:`Scope`}),(0,q.jsx)(`dd`,{className:`text-foreground`,children:Ge(e.scope)}),(0,q.jsx)(`dt`,{className:`text-foreground/70`,children:`Duration`}),(0,q.jsxs)(`dd`,{className:`tabular-nums text-foreground`,children:[(e.durationMs/1e3).toFixed(1),`s`]}),(0,q.jsx)(`dt`,{className:`text-foreground/70`,children:`Outcome`}),(0,q.jsxs)(`dd`,{className:`text-foreground`,children:[(0,q.jsx)(`span`,{className:`tabular-nums`,children:e.successCount}),` steps succeeded`,t>0&&(0,q.jsxs)(`span`,{className:`text-foreground/72`,children:[` `,`· `,(0,q.jsx)(`span`,{className:`tabular-nums`,children:t}),` unchanged`]}),e.failedCount>0&&(0,q.jsxs)(`span`,{className:`text-destructive`,children:[` `,`· `,(0,q.jsx)(`span`,{className:`tabular-nums`,children:e.failedCount}),` failed`]}),e.blockedCount>0&&(0,q.jsxs)(`span`,{className:`text-warning`,children:[` `,`· `,(0,q.jsx)(`span`,{className:`tabular-nums`,children:e.blockedCount}),` blocked in plan`]})]})]})]})}function Je({status:e}){switch(e){case`success`:return(0,q.jsx)(N,{className:`mt-px size-4 shrink-0 text-success`});case`failed`:return(0,q.jsx)(P,{className:`mt-px size-4 shrink-0 text-destructive`});case`partial`:case`blocked`:return(0,q.jsx)(I,{className:`mt-px size-4 shrink-0 text-warning`});case`noop`:return(0,q.jsx)(G,{className:`mt-px size-4 shrink-0 text-foreground/55`})}}function Ye(e){let t=e.operationType===`apply`?`Applied`:`Cleaned up`,n=`${(e.durationMs/1e3).toFixed(1)}s`,r=[];e.successCount>0&&r.push(`${e.successCount} resources`);let i=Q(e);return i>0&&r.push(`${i} unchanged`),e.failedCount>0&&r.push(`${e.failedCount} failed`),e.blockedCount>0&&r.push(`${e.blockedCount} blocked`),r.length===0?`${t} · no changes · ${n}`:`${t} · ${r.join(`, `)} · ${n}`}function Xe(e){return e.operationType===`cleanup`&&e.successCount===0&&e.failedCount===0&&e.blockedCount===0?`No Miravo-managed resources were found to clean up.`:e.failedCount>0&&e.blockedCount>0?`No per-phase counts — failures and blocked plan entries.`:e.failedCount>0?`No per-phase counts — run failed.`:e.blockedCount>0?`No per-phase counts — blocked plan entries.`:Q(e)>0?`No resources were mutated. Existing managed resources already matched the desired state.`:`No per-phase counts recorded.`}function Ze({op:e}){let t=We(e);return t.length===0?(0,q.jsx)(`p`,{className:`py-1 text-sm text-foreground/75`,children:Xe(e)}):(0,q.jsxs)(`div`,{className:`space-y-3 pt-1`,children:[(0,q.jsx)(`div`,{className:`flex flex-col divide-y divide-border/45 rounded-[var(--miravo-radius-tight)] border border-border/50`,children:t.map(e=>(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 px-3 py-2.5 sm:flex-row sm:items-start sm:gap-4`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 shrink-0 sm:w-[11.5rem]`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium leading-snug text-foreground`,children:e.title}),(0,q.jsxs)(be,{children:[(0,q.jsx)(ve,{type:`button`,className:`inline-flex shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] p-0.5 text-foreground/60 hover:bg-muted/50 hover:text-foreground`,"aria-label":`About ${e.title}`,children:(0,q.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0})}),(0,q.jsx)(ye,{side:`top`,className:`max-w-xs text-left`,children:e.subtitle})]})]}),(0,q.jsx)(`p`,{className:`mt-0.5 text-[11px] leading-snug text-foreground/72 sm:hidden`,children:e.subtitle})]}),(0,q.jsx)(Ke,{row:e})]},e.key))}),e.blockedCount>0&&(0,q.jsxs)(`p`,{className:`rounded-[var(--miravo-radius-tight)] border border-warning/20 bg-warning/5 px-2.5 py-1.5 text-[11px] text-warning`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:e.blockedCount}),` plan entries were blocked (skipped). Open a `,(0,q.jsx)(`span`,{className:`font-medium`,children:`deploy preview`}),` before running to see block reasons.`]})]})}function Qe({operation:e}){let[t,n]=(0,K.useState)(!1);return(0,q.jsxs)(`div`,{className:A(`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-border/55`,`transition-colors duration-150`),children:[(0,q.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:A(`flex w-full items-start gap-3 p-3.5 text-left`,`transition-colors duration-100`,`hover:bg-muted/25`,t&&`bg-muted/18`),children:[(0,q.jsx)(Je,{status:e.status}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,q.jsxs)(`p`,{className:`min-w-0 truncate text-sm`,children:[(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:O(X(e))}),(0,q.jsx)(`span`,{className:`mx-1.5 text-foreground/50`,children:`→`}),(0,q.jsx)(`span`,{className:`text-foreground/82`,children:e.targetLabel})]}),(0,q.jsx)(`time`,{dateTime:new Date(e.completedAt).toISOString(),title:D(e.completedAt),className:`shrink-0 text-xs text-foreground/75`,children:E(e.completedAt)})]}),(0,q.jsx)(`p`,{className:`text-xs text-foreground/78`,children:Ye(e)}),(e.failedCount>0||e.status===`failed`)&&(0,q.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/72`,children:e.error??`The operation ended with an error.`})]}),(0,q.jsx)(ne,{className:A(`mt-0.5 size-3.5 shrink-0 text-foreground/55 transition-transform duration-150`,t&&`rotate-180`)})]}),(0,q.jsx)(f,{initial:!1,children:t&&(0,q.jsx)(d.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden`,children:(0,q.jsxs)(`div`,{className:`space-y-3 border-t border-border/45 px-4 pb-3 pt-3`,children:[(0,q.jsx)(qe,{op:e}),e.error&&(0,q.jsxs)(`div`,{className:`relative rounded-[var(--miravo-radius-tight)] border border-destructive/40 bg-destructive/15 px-3 py-2 pr-10 text-xs font-medium`,children:[(0,q.jsx)(`div`,{className:`absolute top-1.5 right-1.5 z-10`,children:(0,q.jsx)(ue,{value:e.error,label:`Copy error`,className:`text-destructive hover:bg-destructive/25 hover:text-foreground`})}),(0,q.jsx)(`p`,{className:`whitespace-normal break-words text-destructive [overflow-wrap:anywhere]`,children:e.error})]}),(0,q.jsx)(Ze,{op:e})]})})})]})}function $e({label:e}){return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border/65`}),(0,q.jsx)(`span`,{className:`text-xs font-medium text-foreground/78`,children:e}),(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border/65`})]})}var et={type:``,status:``,target:``,search:``},tt={_all:`All types`,apply:`Apply`,cleanup:`Cleanup`},nt={_all:`All statuses`,success:`Success`,partial:`Partial`,failed:`Failed`,blocked:`Blocked`,noop:`No-op`},rt=`h-7 min-h-7 gap-1.5 border-border/50 bg-transparent px-2 text-xs hover:bg-muted/30 focus:ring-0`;function it({filters:e,targetOptions:t,hasFilters:n,searchRef:r,onTypeChange:i,onStatusChange:a,onTargetChange:o,onSearchChange:s,onClear:c}){return(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-b border-border/50 px-3 py-2`,children:[(0,q.jsxs)(H,{value:e.type||`_all`,onValueChange:e=>e&&i(e===`_all`?``:e),children:[(0,q.jsx)(V,{size:`sm`,className:rt,"aria-label":`Operation type`,children:(0,q.jsx)(R,{children:e=>tt[e??`_all`]??tt._all})}),(0,q.jsxs)(B,{children:[(0,q.jsx)(z,{value:`_all`,children:`All types`}),(0,q.jsx)(z,{value:`apply`,children:`Apply`}),(0,q.jsx)(z,{value:`cleanup`,children:`Cleanup`})]})]}),(0,q.jsxs)(H,{value:e.status||`_all`,onValueChange:e=>e&&a(e===`_all`?``:e),children:[(0,q.jsx)(V,{size:`sm`,className:rt,"aria-label":`Operation status`,children:(0,q.jsx)(R,{children:e=>nt[e??`_all`]??nt._all})}),(0,q.jsxs)(B,{children:[(0,q.jsx)(z,{value:`_all`,children:`All statuses`}),(0,q.jsx)(z,{value:`success`,children:`Success`}),(0,q.jsx)(z,{value:`partial`,children:`Partial`}),(0,q.jsx)(z,{value:`failed`,children:`Failed`}),(0,q.jsx)(z,{value:`blocked`,children:`Blocked`}),(0,q.jsx)(z,{value:`noop`,children:`No-op`})]})]}),t.length>1&&(0,q.jsxs)(H,{value:e.target||`_all`,onValueChange:e=>e&&o(e===`_all`?``:e),children:[(0,q.jsx)(V,{size:`sm`,className:rt,"aria-label":`Target filter`,children:(0,q.jsx)(R,{children:e=>!e||e===`_all`?`All targets`:e})}),(0,q.jsxs)(B,{children:[(0,q.jsx)(z,{value:`_all`,children:`All targets`}),t.map(e=>(0,q.jsx)(z,{value:e,children:e},e))]})]}),(0,q.jsxs)(`div`,{className:`relative flex min-w-[140px] flex-1 items-center`,children:[(0,q.jsx)(`input`,{ref:r,type:`search`,value:e.search,onChange:e=>s(e.target.value),placeholder:`Search template or target…`,"aria-describedby":`ops-search-shortcut`,className:A(`h-7 w-full rounded-[var(--miravo-radius-tight)] border border-border/50 bg-transparent pl-2 pr-7 text-xs`,`placeholder:text-foreground/60 focus:outline-none focus:ring-1 focus:ring-ring/40`,e.search&&`pr-2`)}),(0,q.jsx)(`span`,{id:`ops-search-shortcut`,className:`sr-only`,children:`Press slash to focus search`}),!e.search&&(0,q.jsx)(`kbd`,{"aria-hidden":!0,className:`pointer-events-none absolute right-2 flex h-4 items-center rounded-[var(--miravo-radius-tight)] border border-border/60 bg-muted/50 px-1 font-mono text-[10px] text-foreground/65`,children:`/`})]}),n&&(0,q.jsxs)(`button`,{type:`button`,onClick:c,className:`flex h-7 items-center gap-1 rounded-[var(--miravo-radius-tight)] px-2 text-xs text-foreground/72 transition-colors hover:bg-muted/40 hover:text-foreground`,children:[(0,q.jsx)(T,{className:`size-3`}),`Clear`]})]})}function at({operations:e,totalKnown:t,isLoading:n,error:r,onRefresh:i,hasNextPage:a=!1,isFetchingNextPage:o=!1,loadMoreError:s=null,onRetryLoadMore:c,onLoadMore:l}){let[u,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(et),g=(0,K.useRef)(null);(0,K.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.tagName;t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||(e.preventDefault(),g.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let v=()=>{p(!0),i(),_.success(`Operations refreshed`),setTimeout(()=>p(!1),600)},y=(0,K.useMemo)(()=>{let t=new Set;for(let n of e){let e=n.targetLabel;t.add(e)}return[...t].sort()},[e]),b=(0,K.useMemo)(()=>{let t=e;if(m.type&&(t=t.filter(e=>e.operationType===m.type)),m.status&&(t=t.filter(e=>e.status===m.status)),m.target&&(t=t.filter(e=>e.targetLabel===m.target)),m.search){let e=m.search.toLowerCase();t=t.filter(t=>{let n=t.targetLabel;return X(t).toLowerCase().includes(e)||O(X(t)).toLowerCase().includes(e)||t.factoryName.toLowerCase().includes(e)||n.toLowerCase().includes(e)})}return t},[e,m]),x=m.type!==``||m.status!==``||m.target!==``||m.search!==``,S=(0,K.useMemo)(()=>He(b),[b]);return(0,q.jsxs)(`div`,{className:`flex h-full flex-col rounded-[var(--miravo-radius-stadium-sm)] border border-border/55`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-3.5 py-2.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`Operation log`}),e.length>0&&(0,q.jsx)(`span`,{className:`font-mono text-xs tabular-nums text-foreground/75`,children:typeof t==`number`&&t>0&&e.length<t?`${e.length} / ${t}`:String(e.length)})]}),(0,q.jsx)(`button`,{type:`button`,onClick:v,disabled:u,"aria-label":`Refresh operation list`,className:`relative rounded-[var(--miravo-radius-tight)] p-1 text-foreground/70 transition-colors before:absolute before:inset-[-10px] before:content-[''] hover:bg-muted/50 hover:text-foreground disabled:pointer-events-none`,children:(0,q.jsx)(he,{className:A(`size-3.5`,u&&`animate-spin`),"aria-hidden":!0})})]}),(0,q.jsx)(it,{filters:m,targetOptions:y,hasFilters:x,searchRef:g,onTypeChange:e=>h(t=>({...t,type:e})),onStatusChange:e=>h(t=>({...t,status:e})),onTargetChange:e=>h(t=>({...t,target:e})),onSearchChange:e=>h(t=>({...t,search:e})),onClear:()=>h(et)}),(0,q.jsxs)(`div`,{className:`flex flex-1 min-h-0 flex-col gap-2 overflow-y-auto overscroll-y-contain p-3`,children:[r&&(0,q.jsxs)(`p`,{className:`py-2 text-xs text-destructive`,children:[`✕ `,r.message]}),n&&e.length===0&&!r&&(0,q.jsx)(`p`,{className:`py-4 text-sm text-foreground/75`,children:`Loading…`}),!n&&e.length===0&&!r&&(0,q.jsx)(Be,{}),!n&&e.length>0&&b.length===0&&(0,q.jsxs)(`p`,{className:`py-6 text-center text-sm text-foreground/75`,children:[`No operations match your filters.`,` `,(0,q.jsx)(`button`,{type:`button`,onClick:()=>h(et),className:`text-primary hover:underline`,children:`Clear filters`})]}),x&&b.length>0&&b.length!==e.length&&(0,q.jsxs)(`p`,{className:`text-xs text-foreground/75`,children:[`Showing`,` `,(0,q.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:b.length}),` of`,` `,(0,q.jsx)(`span`,{className:`tabular-nums`,children:e.length}),` loaded`]}),!x&&typeof t==`number`&&t>0&&e.length<t&&(0,q.jsxs)(`p`,{className:`text-xs text-foreground/75`,children:[`Showing`,` `,(0,q.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:e.length}),` `,`of `,(0,q.jsx)(`span`,{className:`tabular-nums`,children:t}),`. Load more for older entries.`]}),(0,q.jsx)(f,{initial:!1,children:S.map(e=>(0,q.jsxs)(d.div,{className:`flex flex-col gap-2`,children:[(0,q.jsx)($e,{label:e.label}),(0,q.jsx)(f,{initial:!1,children:e.ops.map(e=>(0,q.jsx)(d.div,{initial:b.length>40?!1:{opacity:0,x:-6},animate:{opacity:1,x:0},transition:{type:`spring`,stiffness:400,damping:35},children:(0,q.jsx)(Qe,{operation:e})},`${e.operationId}-${e.completedAt}`))})]},e.label))}),s?(0,q.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 flex-col items-center gap-2 border-t border-border/50 pt-3 pb-1 text-center`,children:[(0,q.jsxs)(`p`,{className:`text-xs text-destructive`,children:[`Could not load older entries: `,s.message]}),c?(0,q.jsx)(C,{type:`button`,variant:`outline`,size:`sm`,onClick:c,children:`Retry`}):null]}):a&&l?(0,q.jsx)(`div`,{className:`flex shrink-0 justify-center border-t border-border/50 pt-3 pb-1`,children:(0,q.jsx)(C,{type:`button`,variant:`outline`,size:`sm`,className:`min-w-[7rem]`,disabled:o,"aria-busy":o,"aria-label":o?`Loading older operations`:`Load older operations`,onClick:l,children:o?`Loading…`:`Load more`})}):null]})]})}var ot={...Object.fromEntries(U.map(e=>[e.id,e.exportLabel])),"source-yaml":`Source YAML`};function st(e){return e==null||e===``?`Select integration`:typeof e==`string`?ot[e]??e:`Select integration`}function ct(e){return U.find(t=>t.id===e)?.label??e}function $({id:e,label:t,hint:n,className:r,labelAdornment:i,children:a}){return(0,q.jsxs)(`div`,{className:A(`flex flex-col gap-2`,r),children:[(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,q.jsx)(Se,{htmlFor:e,className:`text-[11px] font-medium text-foreground`,children:t}),i]}),n?(0,q.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:n}):null]}),a]})}function lt({open:e,editing:t,integrationId:n,form:r,showToken:i,saving:a,testing:o,canTestConnection:s,onOpenChange:c,onIntegrationChange:l,onFormChange:u,onShowTokenChange:d,onSave:f,onTestConnection:p,onCancelInFlight:m}){let h=n===W.id,_=t?`Edit Target`:`Add Target`,T=t?`Update the deployment connection.`:`Add the target used for integration deploys.`,E=t?`Leave empty to keep the current token.`:`Required for the first save and connection test.`;return(0,q.jsx)(S,{open:e,onOpenChange:e=>{e||m(),c(e)},children:(0,q.jsxs)(y,{showCloseButton:!0,className:`flex max-h-[min(84vh,38rem)] min-h-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-[38rem]`,children:[(0,q.jsxs)(g,{className:`shrink-0 border-b border-border/60 px-4 pb-3.5 pt-4 pr-12 sm:px-5 sm:pr-14`,children:[(0,q.jsx)(b,{className:`text-base tracking-tight`,children:_}),(0,q.jsx)(x,{className:`max-w-xl text-sm leading-relaxed`,children:T})]}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 sm:px-5`,style:{scrollbarGutter:`stable`},children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t?(0,q.jsx)($,{label:`Integration`,children:(0,q.jsx)(`div`,{className:`flex h-9 items-center rounded-[var(--miravo-radius-stadium-sm)] border border-input bg-input/30 px-3 text-sm text-foreground`,children:ct(n)})}):(0,q.jsx)($,{label:`Integration`,children:(0,q.jsxs)(H,{value:n,onValueChange:e=>l(e),children:[(0,q.jsx)(V,{className:`h-9 w-full text-sm data-placeholder:text-muted-foreground/55`,"aria-label":`Integration type`,children:(0,q.jsx)(R,{placeholder:`Select integration`,children:e=>st(e)})}),(0,q.jsxs)(B,{children:[(0,q.jsxs)(ke,{children:[(0,q.jsx)(De,{children:`Available`}),je.map(e=>(0,q.jsx)(z,{value:e.id,children:e.label},e.id))]}),(0,q.jsx)(Oe,{}),(0,q.jsxs)(ke,{children:[(0,q.jsx)(De,{children:`Coming soon`}),Ae.map(e=>(0,q.jsx)(z,{value:e.id,children:e.label},e.id))]})]})]})}),h?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)($,{id:`env-label`,label:`Label`,children:(0,q.jsx)(w,{id:`env-label`,placeholder:`Production`,value:r.label,onChange:e=>u({...r,label:e.currentTarget.value}),autoComplete:`off`,className:`h-9 placeholder:text-muted-foreground/55`})}),(0,q.jsx)($,{id:`env-hostname`,label:`Hostname`,children:(0,q.jsx)(w,{id:`env-hostname`,placeholder:`192.168.1.100`,value:r.hostname,onChange:e=>u({...r,hostname:e.currentTarget.value}),autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,className:`h-9 font-mono text-[13px] placeholder:text-muted-foreground/55`})}),(0,q.jsx)($,{id:`env-source`,label:de,labelAdornment:(0,q.jsxs)(be,{children:[(0,q.jsx)(ve,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About ${de}`,children:(0,q.jsx)(ce,{className:`size-3`,"aria-hidden":!0})}),(0,q.jsx)(ye,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:pe})]}),children:(0,q.jsx)(w,{id:`env-source`,placeholder:`host.docker.internal`,value:r.sourceHostname,onChange:e=>u({...r,sourceHostname:e.currentTarget.value}),autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,className:`h-9 font-mono text-[13px] placeholder:text-muted-foreground/55`})}),(0,q.jsx)($,{id:`env-token`,label:`API token`,labelAdornment:(0,q.jsxs)(be,{children:[(0,q.jsx)(ve,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About API token`,children:(0,q.jsx)(ce,{className:`size-3`,"aria-hidden":!0})}),(0,q.jsx)(ye,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:E})]}),children:(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(w,{id:`env-token`,type:i?`text`:`password`,placeholder:t?`••••••••`:`Enter API token`,value:r.apiToken,onChange:e=>u({...r,apiToken:e.currentTarget.value}),autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,className:`h-9 pr-11 font-mono text-[13px] placeholder:text-muted-foreground/55`}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>d(!i),"aria-label":i?`Hide token`:`Show token`,"aria-pressed":i,className:`absolute inset-y-0 right-0 flex w-11 items-center justify-center rounded-r-[var(--miravo-radius-stadium-sm)] text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:i?(0,q.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}):(0,q.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0})})]})})]}):(0,q.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border/70 px-4 py-3 text-sm text-muted-foreground`,children:[ct(n),` setup is not available yet. Switch back to Litmus Edge to finish target setup now.`]})]})}),(0,q.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:o&&h?`Checking connection to Litmus Edge…`:``}),(0,q.jsxs)(v,{className:`mx-0 mb-0 shrink-0 flex-col gap-2 border-t border-border/60 bg-background px-4 py-3 sm:flex-row sm:justify-end sm:px-5`,children:[(0,q.jsx)(C,{type:`button`,variant:`outline`,size:`lg`,className:`w-full justify-center sm:mr-auto sm:w-auto`,disabled:a||o||!s,"aria-busy":o,onClick:p,children:o?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(me,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),`Testing connection`]}):`Test connection`}),(0,q.jsxs)(`div`,{className:`flex w-full flex-col gap-2 sm:w-auto sm:flex-row`,children:[(0,q.jsx)(C,{variant:`outline`,size:`lg`,className:`w-full sm:w-auto`,onClick:()=>{m(),c(!1)},disabled:a,children:`Cancel`}),(0,q.jsx)(C,{size:`lg`,className:`w-full sm:w-auto`,onClick:f,disabled:a||!h,children:a?`Saving...`:t?`Save Target`:`Add Target`})]})]})]})})}function ut(e){let t=e.trim();if(t.length===0)return{message:`Connection test failed with no details from the server.`};let n=t.toLowerCase();if(t.includes(`timed out`))return{message:`Litmus Edge did not respond in time.`,description:`Check the hostname, VPN or firewall, and that the device is online.`};if(/\b401\b/.test(t)||/\b403\b/.test(t)||n.includes(`unauthorized`))return{message:`The API token was rejected.`,description:`Create or copy a valid token in Litmus Edge and paste it into the API token field.`};if(/\b404\b/.test(t)&&(n.includes(`sysinfo`)||n.includes(`/sysinfo/`)))return{message:`This Litmus Edge host or version does not expose the system info API.`,description:`Confirm the hostname and that Litmus Edge is running a build with GET /sysinfo/devinfo.`};if(n.includes(`econnrefused`)||n.includes(`connection refused`)||n.includes(`enotfound`)||n.includes(`getaddrinfo`)||n.includes(`failed`)&&n.includes(`fetch`))return{message:`Could not reach the Litmus Edge host.`,description:`Check the hostname or IP, TLS, and that this computer can reach the edge network.`};if(t.includes(`Session expired`))return{message:`Your session expired. Sign in again, then retry the connection test.`};if(n.includes(`factory not found`))return{message:`That target was removed. Close the dialog and refresh the list.`};if(n.includes(`unsupported integration`)&&n.includes(`connection`))return{message:`This integration type does not support connection tests yet.`,description:`Use Litmus Edge for remote apply and connection testing.`};if(n.includes(`invalid request body`)||n.includes(`api token is required`))return{message:`Some required fields are missing or invalid.`,description:`Fill in hostname, source host (Miravo), and API token (for new targets).`};let r=t.replace(/^LE\s+\S+\s+/i,``).trim();return{message:`Could not verify the connection to Litmus Edge.`,description:r.length>0&&r.length<=220?r:dt(t,200)}}function dt(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function ft(e){if(e.connected){let t=e.litmusEdgeVersion?` Litmus Edge v${e.litmusEdgeVersion}.`:``;if(e.warning){_.warning(`Connected to ${e.hostname}.${t}`,{description:e.warning});return}_.success(`Connected to ${e.hostname}.${t}`);return}let{message:t,description:n}=ut(e.error);_.error(t,n?{description:n}:void 0)}function pt(e){let{message:t,description:n}=ut(e instanceof Error?e.message:String(e));_.error(t,n?{description:n}:void 0)}function mt(e){return!!(typeof DOMException<`u`&&e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&(e.name===`AbortError`||/aborted/i.test(e.message)))}function ht(){let[e,t]=(0,K.useState)(!1),n=(0,K.useRef)(null),r=(0,K.useCallback)(()=>{n.current?.abort()},[]);return{testing:e,runTest:(0,K.useCallback)(async e=>{let r=new AbortController;n.current=r,t(!0);try{ft(await ie(e,{signal:r.signal}))}catch(e){if(mt(e))return;pt(e)}finally{n.current===r&&(n.current=null),t(!1)}},[]),cancelInFlight:r}}function gt(e){return U.find(t=>t.id===e)?.label??e}function _t(e){if(!e)return`var(--tooltip-border)`;switch(e.status){case`success`:return`var(--success)`;case`partial`:case`blocked`:return`var(--warning)`;case`noop`:return`var(--muted-foreground)`;case`failed`:return`var(--destructive)`}}function vt({status:e}){switch(e){case`success`:return(0,q.jsx)(N,{className:`size-3 text-success`});case`partial`:case`blocked`:return(0,q.jsx)(I,{className:`size-3 text-warning`});case`noop`:return(0,q.jsx)(G,{className:`size-3 text-muted-foreground`});case`failed`:return(0,q.jsx)(P,{className:`size-3 text-destructive`})}}function yt({target:e,lastOp:t,onEdit:n,onDelete:r}){return(0,q.jsxs)(`div`,{className:`env-orbital relative overflow-hidden border`,style:{"--_status":_t(t)},children:[(0,q.jsx)(`div`,{className:`relative z-10 px-4 pt-3.5 pb-3`,children:(0,q.jsx)(`p`,{className:`font-heading text-[13px] font-semibold leading-tight tracking-tight text-foreground`,children:e.label})}),(0,q.jsx)(`div`,{className:`relative z-10 px-4 py-0.5`,children:(0,q.jsx)(`p`,{className:`font-mono text-xs tracking-tight text-muted-foreground`,children:e.hostname})}),(0,q.jsxs)(`div`,{className:`relative z-10 mx-4 mb-3 flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-muted-foreground`,children:e.sourceHostname}),(0,q.jsx)(`div`,{className:`env-orbital-path min-w-6 flex-1`}),(0,q.jsx)(te,{className:`size-3 shrink-0 text-muted-foreground`})]}),(0,q.jsxs)(`div`,{className:`relative z-10 flex items-center gap-2 border-t border-border/30 px-3 py-1.5`,children:[(0,q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 rounded-full border border-border/40 px-2 py-0.5`,children:[(0,q.jsx)(`span`,{className:`protocol-card-live-dot size-[5px]`}),(0,q.jsx)(`span`,{className:`text-[11px] font-medium tracking-wide text-muted-foreground`,children:gt(e.integrationId)})]}),t&&(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 truncate text-[11px] text-muted-foreground`,children:[(0,q.jsx)(vt,{status:t.status}),t.operationType===`apply`?`Applied`:`Cleaned`,` `,(0,q.jsx)(`time`,{dateTime:new Date(t.completedAt).toISOString(),title:D(t.completedAt),children:E(t.completedAt)})]}),(0,q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5`,children:[(0,q.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit target`,onClick:n,children:(0,q.jsx)(Fe,{className:`size-3`})}),(0,q.jsx)(C,{variant:`ghost`,size:`icon-sm`,className:`text-destructive hover:text-destructive`,"aria-label":`Delete target`,onClick:r,children:(0,q.jsx)(_e,{className:`size-3`})})]})]})]})}function bt({onClick:e}){return(0,q.jsxs)(`button`,{type:`button`,onClick:e,className:`env-orbital group h-full w-full flex flex-col items-center justify-center gap-2 border border-dashed py-10 text-muted-foreground transition-colors hover:border-primary/30 hover:text-primary`,style:{"--_status":`var(--tooltip-border)`},children:[(0,q.jsx)(F,{className:`size-5 transition-transform group-hover:scale-110`}),(0,q.jsx)(`span`,{className:`text-xs`,children:`Add Target`})]})}function xt({targets:e,onMutate:t,lastOpByTarget:n}){let[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),[s,c]=(0,K.useState)(W.id),[l,u]=(0,K.useState)({label:``,hostname:``,apiToken:``,sourceHostname:``}),[p,m]=(0,K.useState)(!1),[h,w]=(0,K.useState)(!1),{testing:T,runTest:E,cancelInFlight:D}=ht(),[O,k]=(0,K.useState)(null),A=s===W.id&&l.hostname.trim().length>0&&l.sourceHostname.trim().length>0&&(a!==null||l.apiToken.trim().length>0),j=()=>{o(null),c(W.id),u({label:``,hostname:``,apiToken:``,sourceHostname:``}),w(!1),i(!0)},ee=e=>{o(e.id),c(U.some(t=>t.id===e.integrationId)?e.integrationId:W.id),u({label:e.label,hostname:e.hostname,apiToken:``,sourceHostname:e.sourceHostname}),w(!1),i(!0)},te=async()=>{if(s!==W.id){_.error(`${gt(s)} target setup is coming soon.`);return}if(!l.label||!l.hostname||!l.sourceHostname){_.error(`Label, hostname, and source host are required.`);return}if(!a&&!l.apiToken){_.error(`API token is required for new targets.`);return}m(!0);try{a?(await ae(a,{integrationId:s,label:l.label,hostname:l.hostname,sourceHostname:l.sourceHostname,...l.apiToken?{apiToken:l.apiToken}:{}}),_.success(`Target updated.`)):(await oe({...l,integrationId:s}),_.success(`Target added.`)),i(!1),t()}catch(e){_.error(L(e,`Failed to save target.`))}finally{m(!1)}};return(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`h2`,{className:`flex h-5 items-center text-xs font-medium leading-none uppercase tracking-wider text-muted-foreground`,children:`Integration Targets`}),e.length>0?(0,q.jsx)(xe,{variant:`secondary`,className:`relative -top-px h-5 shrink-0 px-1.5 py-0 font-mono text-[10px] leading-none tabular-nums`,children:e.length}):null]}),(0,q.jsxs)(C,{size:`sm`,className:`h-7 shrink-0 gap-1.5 text-xs`,onClick:j,children:[(0,q.jsx)(F,{className:`size-3.5`}),` Add Target`]})]}),e.length===0?(0,q.jsx)(ze,{titleId:`integrations-targets-empty-title`,frameIcon:(0,q.jsx)(M,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0}),description:(0,q.jsx)(Le,{}),children:(0,q.jsx)(Re,{onClick:j})}):(0,q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 @2xl/main:grid-cols-2 @5xl/main:grid-cols-3`,children:(0,q.jsxs)(f,{children:[e.map((e,t)=>(0,q.jsx)(d.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,scale:.96,transition:{duration:.15}},transition:{type:`spring`,stiffness:380,damping:30,delay:t*.04},children:(0,q.jsx)(yt,{target:e,lastOp:n.get(e.id),onEdit:()=>ee(e),onDelete:()=>k(e)})},e.id)),(0,q.jsx)(d.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{type:`spring`,stiffness:380,damping:30,delay:e.length*.04},children:(0,q.jsx)(bt,{onClick:j})},`add-card`)]})}),(0,q.jsx)(lt,{open:r,editing:a!==null,integrationId:s,form:l,showToken:h,saving:p,testing:T,canTestConnection:A,onOpenChange:i,onIntegrationChange:c,onFormChange:u,onShowTokenChange:w,onSave:()=>void te(),onTestConnection:()=>{A&&E({...a?{targetId:a}:{},hostname:l.hostname.trim(),sourceHostname:l.sourceHostname.trim(),...l.apiToken.trim()?{apiToken:l.apiToken.trim()}:{}})},onCancelInFlight:D}),(0,q.jsx)(S,{open:O!==null,onOpenChange:e=>!e&&k(null),children:(0,q.jsxs)(y,{children:[(0,q.jsxs)(g,{children:[(0,q.jsx)(b,{children:`Remove Target`}),(0,q.jsxs)(x,{children:[`Remove “`,O?.label,`”? This only deletes the saved credentials — it does not affect resources on the target integration.`]})]}),(0,q.jsxs)(v,{children:[(0,q.jsx)(C,{variant:`outline`,onClick:()=>k(null),children:`Cancel`}),(0,q.jsx)(C,{variant:`destructive`,onClick:async()=>{if(!O)return;let e=O.id;k(null);try{await le(e),_.success(`Target removed.`),t()}catch(e){_.error(L(e,`Failed to remove target.`))}},children:`Remove`})]})]})})]})}var St=25;function Ct({status:e}){switch(e){case`success`:return(0,q.jsx)(N,{className:`size-3 text-success`});case`partial`:case`blocked`:return(0,q.jsx)(I,{className:`size-3 text-warning`});case`noop`:return(0,q.jsx)(G,{className:`size-3 text-muted-foreground`});case`failed`:return(0,q.jsx)(P,{className:`size-3 text-destructive`})}}function wt({targetCount:e,opCount:t,lastOp:n}){return(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(M,{className:`size-3`}),(0,q.jsx)(`span`,{className:`font-mono`,children:e}),` target`,e===1?``:`s`]}),(0,q.jsx)(`span`,{className:`hidden h-3 w-px bg-border/40 sm:inline-block`}),(0,q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(f,{mode:`popLayout`,initial:!1,children:(0,q.jsx)(d.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`font-mono tabular-nums`,children:t},t)}),` `,`operation`,t===1?``:`s`]}),n&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`hidden h-3 w-px bg-border/40 sm:inline-block`}),(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(Ct,{status:n.status}),(0,q.jsxs)(`span`,{children:[n.operationType===`apply`?`Applied`:`Cleaned`,` `,(0,q.jsx)(`time`,{dateTime:new Date(n.completedAt).toISOString(),title:D(n.completedAt),children:E(n.completedAt)})]})]})]})]})}function Tt(){let e=u({queryKey:o.integrations.targets(),queryFn:()=>se()}),t=e.data??[],n=Ne({queryKey:o.integrations.operationsList(),queryFn:({pageParam:e})=>re({limit:St,offset:e}),initialPageParam:0,getNextPageParam:(e,t,n)=>e.hasMore&&e.operations.length>0?n+St:void 0}),r=(0,K.useMemo)(()=>n.data?.pages.flatMap(e=>e.operations)??[],[n.data]),i=n.data?.pages[0]?.total??0,a=(0,K.useMemo)(()=>{let e=new Map;for(let t of r)e.has(t.targetId)||e.set(t.targetId,t);return e},[r]),[c,l]=p(`tab`,m([`targets`,`activity`]).withDefault(`targets`));return(0,q.jsxs)(`div`,{className:`mx-auto flex h-full w-full min-w-0 max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2`,children:[(0,q.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Integrations`}),(0,q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Connect Litmus Edge targets here and review activity. Apply and clean up from the`,` `,(0,q.jsx)(h,{to:`/?tab=integrations`,className:`text-foreground underline underline-offset-2`,children:`Factory page`}),`.`]}),(0,q.jsx)(wt,{targetCount:t.length,opCount:i,lastOp:r[0]})]}),(0,q.jsxs)(Ee,{value:c,onValueChange:e=>{l(e)},className:`flex-1 min-h-0`,children:[(0,q.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,q.jsxs)(Te,{variant:`line`,className:`h-10! gap-0.5 min-w-max`,children:[(0,q.jsxs)(Ce,{value:`targets`,className:`gap-1.5 px-3 text-sm`,children:[(0,q.jsx)(M,{className:`size-3.5 shrink-0`}),`Targets`]}),(0,q.jsxs)(Ce,{value:`activity`,className:`gap-1.5 px-3 text-sm`,children:[(0,q.jsx)(j,{className:`size-3.5 shrink-0`}),`Activity`]})]})}),(0,q.jsx)(we,{value:`targets`,className:`flex-1 py-2`,children:(0,q.jsx)(d.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:e.isError&&e.data===void 0?(0,q.jsx)(ge,{message:L(e.error,`Failed to load targets.`),onRetry:()=>void e.refetch(),isRetrying:e.isFetching&&!e.isPending}):(0,q.jsx)(xt,{targets:t,onMutate:()=>void e.refetch(),lastOpByTarget:a})},`targets`)}),(0,q.jsx)(we,{value:`activity`,className:`flex flex-col flex-1 min-h-0 py-2`,children:(0,q.jsx)(d.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`flex flex-col flex-1 min-h-0`,children:(0,q.jsx)(at,{operations:r,totalKnown:i,isLoading:n.isPending&&!n.data,error:n.error,onRefresh:()=>void s.invalidateQueries({queryKey:o.integrations.operationsList()}),hasNextPage:n.hasNextPage,isFetchingNextPage:n.isFetchingNextPage,loadMoreError:n.isFetchNextPageError&&n.error instanceof Error?n.error:null,onRetryLoadMore:()=>void n.fetchNextPage(),onLoadMore:()=>void n.fetchNextPage()})},`activity`)})]})]})}export{Tt as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{St as r,bt as i,v as a,xt as o,y as s}from"./api-CtMmjN9m.js";import{n as c,p as l,t as u}from"./useQuery-Dxp3WSXF.js";import{t as d}from"./proxy-CWZabK8f.js";import{t as f}from"./AnimatePresence-BSSlw02V.js";import{i as p,r as m}from"./dist-xY0pK9Wy.js";import{n as h}from"./chunk-OE4NN4TA-DBWZidbW.js";import{a as g,c as _,i as v,n as y,o as b,r as x,t as S}from"./dialog-B5PqrKVw.js";import{C,S as w,T,m as E,o as D,u as O}from"./format-Bx7DF-TB.js";import{n as k,t as A}from"./utils-XFKvwlFT.js";import{t as j}from"./activity-Cy_niK56.js";import{n as ee,r as te,t as M}from"./server-BVem_egD.js";import{t as ne}from"./chevron-down-x70Pto6j.js";import{n as N,t as P}from"./circle-x-6JtFdy1_.js";import{a as re,d as ie,f as ae,n as oe,o as se,p as ce,r as le}from"./integration-api-DnCoHAoa.js";import{t as ue}from"./copy-button-CSUP1VjU.js";import{n as de,r as fe,t as pe}from"./source-host-miravo-B8eM2IHw.js";import{t as me}from"./loader-circle-DjgHgHHl.js";import{t as F}from"./plus-Cl4Ay5Ry.js";import{r as he,t as ge}from"./query-fetch-error-CWLZA2L5.js";import{t as _e}from"./trash-2-BH9HDsZv.js";import{t as I}from"./triangle-alert-DoAwrRgk.js";import{i as ve,n as ye,t as be}from"./tooltip-B3vOB1Vu.js";import{t as xe}from"./badge-Bk1DaL6C.js";import{t as Se}from"./label-2sIXTEUK.js";import{n as L}from"./get-error-message-D800c4Uu.js";import{i as Ce,n as we,r as Te,t as Ee}from"./tabs-Ch_VG8_S.js";import{a as De,c as R,i as z,n as B,o as Oe,r as ke,s as V,t as H}from"./select-BWlrSYlA.js";import{i as U,n as Ae,r as W,t as je}from"./integration-targets-Byvdd3Or.js";var Me=class extends l{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:r()})}getOptimisticResult(e){return e.behavior=r(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:a,isRefetching:s,isError:c,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=a&&u===`forward`,p=c&&u===`backward`,m=a&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:i(t,n.data),hasPreviousPage:o(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function Ne(e,t){return c(e,Me,t)}var G=k(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Pe=k(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Fe=k(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),K=e(t(),1),q=n(),Ie=`rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/55 bg-muted/10`;function Le(){return(0,q.jsx)(`p`,{className:`mt-2 text-pretty text-sm leading-relaxed text-muted-foreground`,children:`Add a target to get started.`})}function Re({onClick:e}){return(0,q.jsxs)(C,{type:`button`,size:`sm`,className:`h-7 shrink-0 gap-1.5 text-xs`,onClick:e,children:[(0,q.jsx)(F,{className:`size-3.5`,"aria-hidden":!0}),`Add Target`]})}function ze({titleId:e,frameIcon:t,description:n,children:r}){return(0,q.jsx)(`section`,{"aria-labelledby":e,className:Ie,children:(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-4 py-10 text-center`,children:[(0,q.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/50`,children:t}),(0,q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,q.jsx)(`h2`,{id:e,className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`No targets yet`}),n]}),r]})})}function Be(){return(0,q.jsx)(`section`,{"aria-labelledby":`integrations-operation-log-empty-title`,className:Ie,children:(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-4 py-8 text-center sm:py-10`,children:[(0,q.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/50`,children:(0,q.jsx)(j,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0})}),(0,q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,q.jsx)(`h2`,{id:`integrations-operation-log-empty-title`,className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`No operations yet`}),(0,q.jsx)(`p`,{className:`mt-2 text-pretty text-sm leading-relaxed text-muted-foreground`,children:`Apply from the Factory page, or clean up from a target. Finished runs show up here with full detail.`})]})]})})}function Ve(e){let t=new Date(e),n=new Date,r=new Date(n);return r.setDate(n.getDate()-1),t.toDateString()===n.toDateString()?`Today`:t.toDateString()===r.toDateString()?`Yesterday`:t.toLocaleDateString(`en-US`,{weekday:`short`,month:`short`,day:`numeric`})}function He(e){let t=new Map;for(let n of e){let e=new Date(n.completedAt).toDateString(),r=t.get(e);r?r.push(n):t.set(e,[n])}return Array.from(t.entries()).map(([,e])=>({label:Ve(e[0]?.completedAt??Date.now()),ops:e}))}function J(e,t){return e===`device`?t.operationType===`apply`?`Tag/register writes per device step—not a device count.`:`One count per device removed from DeviceHub.`:e===`model`?`One count per model in this run.`:e===`asset`?`One count per asset in this run.`:`Sets the device parameter to the bound DeviceHub device.`}var Ue={devices:`Devices`,models:`DT models`,assets:`Digital Twin instances`},Y={create:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-success/35 bg-success/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-success`,update:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-primary/35 bg-primary/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-primary`,replace:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-chart-2/35 bg-chart-2/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-chart-2`,delete:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-destructive/35 bg-destructive/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-destructive`,noop:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-border/55 bg-muted/55 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-foreground/78`,failed:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-destructive/40 bg-destructive/18 px-1.5 py-0.5 font-mono text-[10px] font-semibold tabular-nums text-destructive`};function We(e){return[{key:`device`,title:`DeviceHub — protocol tags`,subtitle:J(`device`,e),counts:e.resourceCounts.device},{key:`model`,title:`Digital Twin models`,subtitle:J(`model`,e),counts:e.resourceCounts.model},{key:`asset`,title:`Assets`,subtitle:J(`asset`,e),counts:e.resourceCounts.asset},{key:`param-sync`,title:`Parameter sync`,subtitle:J(`param-sync`,e),counts:e.resourceCounts[`param-sync`]}].filter(e=>e.counts.total>0||e.counts.failed>0)}function Ge(e){return e.length===0?`Default (devices, models, assets)`:e.map(e=>Ue[e]??e).join(` · `)}function X(e){return e.templateId??e.assetId??``}function Z(e,t,n){if(e===`device`)switch(t){case`create`:return`+${n} tags (new device)`;case`update`:return`${n} tags rewritten`;case`replace`:return`↻${n} tags (device replaced)`;case`delete`:return`−${n} removed`;case`noop`:return`=${n} unchanged`}switch(t){case`create`:return`+${n} created`;case`update`:return`${n} updated`;case`replace`:return`↻${n} replaced`;case`delete`:return`−${n} removed`;case`noop`:return`=${n} unchanged`}}function Ke({row:e}){let{key:t,counts:n}=e;return(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-1.5`,children:[n.create>0&&(0,q.jsx)(`span`,{className:Y.create,children:Z(t,`create`,n.create)}),n.update>0&&(0,q.jsx)(`span`,{className:Y.update,children:Z(t,`update`,n.update)}),n.replace>0&&(0,q.jsx)(`span`,{className:Y.replace,children:Z(t,`replace`,n.replace)}),n.delete>0&&(0,q.jsx)(`span`,{className:Y.delete,children:Z(t,`delete`,n.delete)}),n.noop>0&&(0,q.jsx)(`span`,{className:Y.noop,children:Z(t,`noop`,n.noop)}),n.failed>0&&(0,q.jsx)(`span`,{className:Y.failed,children:`${n.failed} failed`})]})}function Q(e){return e.resourceCounts.device.noop+e.resourceCounts.model.noop+e.resourceCounts.asset.noop+e.resourceCounts[`param-sync`].noop}function qe({op:e}){let t=Q(e);return(0,q.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50 bg-muted/25 px-3 py-2.5`,children:[(0,q.jsx)(`p`,{className:`font-mono text-[10px] uppercase tracking-[0.16em] text-foreground/72`,children:`Run context`}),(0,q.jsxs)(`dl`,{className:`mt-2 grid grid-cols-[minmax(0,7.5rem)_1fr] gap-x-3 gap-y-1.5 text-xs sm:grid-cols-[9rem_1fr]`,children:[(0,q.jsx)(`dt`,{className:`text-foreground/70`,children:`Operation`}),(0,q.jsx)(`dd`,{className:`font-medium capitalize text-foreground`,children:e.operationType}),(0,q.jsx)(`dt`,{className:`text-foreground/70`,children:`Factory`}),(0,q.jsx)(`dd`,{className:`font-mono text-[11px] text-foreground`,children:e.factoryName}),(0,q.jsx)(`dt`,{className:`text-foreground/70`,children:e.assetId===void 0?`Template`:`Asset`}),(0,q.jsx)(`dd`,{className:`font-mono text-[11px] text-foreground`,children:X(e)}),(0,q.jsx)(`dt`,{className:`text-foreground/70`,children:`Target host`}),(0,q.jsx)(`dd`,{className:`break-all font-mono text-[11px] text-foreground`,children:e.hostname}),(0,q.jsx)(`dt`,{className:`text-foreground/70`,children:`Scope`}),(0,q.jsx)(`dd`,{className:`text-foreground`,children:Ge(e.scope)}),(0,q.jsx)(`dt`,{className:`text-foreground/70`,children:`Duration`}),(0,q.jsxs)(`dd`,{className:`tabular-nums text-foreground`,children:[(e.durationMs/1e3).toFixed(1),`s`]}),(0,q.jsx)(`dt`,{className:`text-foreground/70`,children:`Outcome`}),(0,q.jsxs)(`dd`,{className:`text-foreground`,children:[(0,q.jsx)(`span`,{className:`tabular-nums`,children:e.successCount}),` steps succeeded`,t>0&&(0,q.jsxs)(`span`,{className:`text-foreground/72`,children:[` `,`· `,(0,q.jsx)(`span`,{className:`tabular-nums`,children:t}),` unchanged`]}),e.failedCount>0&&(0,q.jsxs)(`span`,{className:`text-destructive`,children:[` `,`· `,(0,q.jsx)(`span`,{className:`tabular-nums`,children:e.failedCount}),` failed`]}),e.blockedCount>0&&(0,q.jsxs)(`span`,{className:`text-warning`,children:[` `,`· `,(0,q.jsx)(`span`,{className:`tabular-nums`,children:e.blockedCount}),` blocked in plan`]})]})]})]})}function Je({status:e}){switch(e){case`success`:return(0,q.jsx)(N,{className:`mt-px size-4 shrink-0 text-success`});case`failed`:return(0,q.jsx)(P,{className:`mt-px size-4 shrink-0 text-destructive`});case`partial`:case`blocked`:return(0,q.jsx)(I,{className:`mt-px size-4 shrink-0 text-warning`});case`noop`:return(0,q.jsx)(G,{className:`mt-px size-4 shrink-0 text-foreground/55`})}}function Ye(e){let t=e.operationType===`apply`?`Applied`:`Cleaned up`,n=`${(e.durationMs/1e3).toFixed(1)}s`,r=[];e.successCount>0&&r.push(`${e.successCount} resources`);let i=Q(e);return i>0&&r.push(`${i} unchanged`),e.failedCount>0&&r.push(`${e.failedCount} failed`),e.blockedCount>0&&r.push(`${e.blockedCount} blocked`),r.length===0?`${t} · no changes · ${n}`:`${t} · ${r.join(`, `)} · ${n}`}function Xe(e){return e.operationType===`cleanup`&&e.successCount===0&&e.failedCount===0&&e.blockedCount===0?`No Miravo-managed resources were found to clean up.`:e.failedCount>0&&e.blockedCount>0?`No per-phase counts — failures and blocked plan entries.`:e.failedCount>0?`No per-phase counts — run failed.`:e.blockedCount>0?`No per-phase counts — blocked plan entries.`:Q(e)>0?`No resources were mutated. Existing managed resources already matched the desired state.`:`No per-phase counts recorded.`}function Ze({op:e}){let t=We(e);return t.length===0?(0,q.jsx)(`p`,{className:`py-1 text-sm text-foreground/75`,children:Xe(e)}):(0,q.jsxs)(`div`,{className:`space-y-3 pt-1`,children:[(0,q.jsx)(`div`,{className:`flex flex-col divide-y divide-border/45 rounded-[var(--miravo-radius-tight)] border border-border/50`,children:t.map(e=>(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 px-3 py-2.5 sm:flex-row sm:items-start sm:gap-4`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 shrink-0 sm:w-[11.5rem]`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium leading-snug text-foreground`,children:e.title}),(0,q.jsxs)(be,{children:[(0,q.jsx)(ve,{type:`button`,className:`inline-flex shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] p-0.5 text-foreground/60 hover:bg-muted/50 hover:text-foreground`,"aria-label":`About ${e.title}`,children:(0,q.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0})}),(0,q.jsx)(ye,{side:`top`,className:`max-w-xs text-left`,children:e.subtitle})]})]}),(0,q.jsx)(`p`,{className:`mt-0.5 text-[11px] leading-snug text-foreground/72 sm:hidden`,children:e.subtitle})]}),(0,q.jsx)(Ke,{row:e})]},e.key))}),e.blockedCount>0&&(0,q.jsxs)(`p`,{className:`rounded-[var(--miravo-radius-tight)] border border-warning/20 bg-warning/5 px-2.5 py-1.5 text-[11px] text-warning`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:e.blockedCount}),` plan entries were blocked (skipped). Open a `,(0,q.jsx)(`span`,{className:`font-medium`,children:`deploy preview`}),` before running to see block reasons.`]})]})}function Qe({operation:e}){let[t,n]=(0,K.useState)(!1);return(0,q.jsxs)(`div`,{className:A(`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-border/55`,`transition-colors duration-150`),children:[(0,q.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:A(`flex w-full items-start gap-3 p-3.5 text-left`,`transition-colors duration-100`,`hover:bg-muted/25`,t&&`bg-muted/18`),children:[(0,q.jsx)(Je,{status:e.status}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,q.jsxs)(`p`,{className:`min-w-0 truncate text-sm`,children:[(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:O(X(e))}),(0,q.jsx)(`span`,{className:`mx-1.5 text-foreground/50`,children:`→`}),(0,q.jsx)(`span`,{className:`text-foreground/82`,children:e.targetLabel})]}),(0,q.jsx)(`time`,{dateTime:new Date(e.completedAt).toISOString(),title:D(e.completedAt),className:`shrink-0 text-xs text-foreground/75`,children:E(e.completedAt)})]}),(0,q.jsx)(`p`,{className:`text-xs text-foreground/78`,children:Ye(e)}),(e.failedCount>0||e.status===`failed`)&&(0,q.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/72`,children:e.error??`The operation ended with an error.`})]}),(0,q.jsx)(ne,{className:A(`mt-0.5 size-3.5 shrink-0 text-foreground/55 transition-transform duration-150`,t&&`rotate-180`)})]}),(0,q.jsx)(f,{initial:!1,children:t&&(0,q.jsx)(d.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden`,children:(0,q.jsxs)(`div`,{className:`space-y-3 border-t border-border/45 px-4 pb-3 pt-3`,children:[(0,q.jsx)(qe,{op:e}),e.error&&(0,q.jsxs)(`div`,{className:`relative rounded-[var(--miravo-radius-tight)] border border-destructive/40 bg-destructive/15 px-3 py-2 pr-10 text-xs font-medium`,children:[(0,q.jsx)(`div`,{className:`absolute top-1.5 right-1.5 z-10`,children:(0,q.jsx)(ue,{value:e.error,label:`Copy error`,className:`text-destructive hover:bg-destructive/25 hover:text-foreground`})}),(0,q.jsx)(`p`,{className:`whitespace-normal break-words text-destructive [overflow-wrap:anywhere]`,children:e.error})]}),(0,q.jsx)(Ze,{op:e})]})})})]})}function $e({label:e}){return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border/65`}),(0,q.jsx)(`span`,{className:`text-xs font-medium text-foreground/78`,children:e}),(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border/65`})]})}var et={type:``,status:``,target:``,search:``},tt={_all:`All types`,apply:`Apply`,cleanup:`Cleanup`},nt={_all:`All statuses`,success:`Success`,partial:`Partial`,failed:`Failed`,blocked:`Blocked`,noop:`No-op`},rt=`h-7 min-h-7 gap-1.5 border-border/50 bg-transparent px-2 text-xs hover:bg-muted/30 focus:ring-0`;function it({filters:e,targetOptions:t,hasFilters:n,searchRef:r,onTypeChange:i,onStatusChange:a,onTargetChange:o,onSearchChange:s,onClear:c}){return(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-b border-border/50 px-3 py-2`,children:[(0,q.jsxs)(H,{value:e.type||`_all`,onValueChange:e=>e&&i(e===`_all`?``:e),children:[(0,q.jsx)(V,{size:`sm`,className:rt,"aria-label":`Operation type`,children:(0,q.jsx)(R,{children:e=>tt[e??`_all`]??tt._all})}),(0,q.jsxs)(B,{children:[(0,q.jsx)(z,{value:`_all`,children:`All types`}),(0,q.jsx)(z,{value:`apply`,children:`Apply`}),(0,q.jsx)(z,{value:`cleanup`,children:`Cleanup`})]})]}),(0,q.jsxs)(H,{value:e.status||`_all`,onValueChange:e=>e&&a(e===`_all`?``:e),children:[(0,q.jsx)(V,{size:`sm`,className:rt,"aria-label":`Operation status`,children:(0,q.jsx)(R,{children:e=>nt[e??`_all`]??nt._all})}),(0,q.jsxs)(B,{children:[(0,q.jsx)(z,{value:`_all`,children:`All statuses`}),(0,q.jsx)(z,{value:`success`,children:`Success`}),(0,q.jsx)(z,{value:`partial`,children:`Partial`}),(0,q.jsx)(z,{value:`failed`,children:`Failed`}),(0,q.jsx)(z,{value:`blocked`,children:`Blocked`}),(0,q.jsx)(z,{value:`noop`,children:`No-op`})]})]}),t.length>1&&(0,q.jsxs)(H,{value:e.target||`_all`,onValueChange:e=>e&&o(e===`_all`?``:e),children:[(0,q.jsx)(V,{size:`sm`,className:rt,"aria-label":`Target filter`,children:(0,q.jsx)(R,{children:e=>!e||e===`_all`?`All targets`:e})}),(0,q.jsxs)(B,{children:[(0,q.jsx)(z,{value:`_all`,children:`All targets`}),t.map(e=>(0,q.jsx)(z,{value:e,children:e},e))]})]}),(0,q.jsxs)(`div`,{className:`relative flex min-w-[140px] flex-1 items-center`,children:[(0,q.jsx)(`input`,{ref:r,type:`search`,value:e.search,onChange:e=>s(e.target.value),placeholder:`Search template or target…`,"aria-describedby":`ops-search-shortcut`,className:A(`h-7 w-full rounded-[var(--miravo-radius-tight)] border border-border/50 bg-transparent pl-2 pr-7 text-xs`,`placeholder:text-foreground/60 focus:outline-none focus:ring-1 focus:ring-ring/40`,e.search&&`pr-2`)}),(0,q.jsx)(`span`,{id:`ops-search-shortcut`,className:`sr-only`,children:`Press slash to focus search`}),!e.search&&(0,q.jsx)(`kbd`,{"aria-hidden":!0,className:`pointer-events-none absolute right-2 flex h-4 items-center rounded-[var(--miravo-radius-tight)] border border-border/60 bg-muted/50 px-1 font-mono text-[10px] text-foreground/65`,children:`/`})]}),n&&(0,q.jsxs)(`button`,{type:`button`,onClick:c,className:`flex h-7 items-center gap-1 rounded-[var(--miravo-radius-tight)] px-2 text-xs text-foreground/72 transition-colors hover:bg-muted/40 hover:text-foreground`,children:[(0,q.jsx)(T,{className:`size-3`}),`Clear`]})]})}function at({operations:e,totalKnown:t,isLoading:n,error:r,onRefresh:i,hasNextPage:a=!1,isFetchingNextPage:o=!1,loadMoreError:s=null,onRetryLoadMore:c,onLoadMore:l}){let[u,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(et),g=(0,K.useRef)(null);(0,K.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.tagName;t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||(e.preventDefault(),g.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let v=()=>{p(!0),i(),_.success(`Operations refreshed`),setTimeout(()=>p(!1),600)},y=(0,K.useMemo)(()=>{let t=new Set;for(let n of e){let e=n.targetLabel;t.add(e)}return[...t].sort()},[e]),b=(0,K.useMemo)(()=>{let t=e;if(m.type&&(t=t.filter(e=>e.operationType===m.type)),m.status&&(t=t.filter(e=>e.status===m.status)),m.target&&(t=t.filter(e=>e.targetLabel===m.target)),m.search){let e=m.search.toLowerCase();t=t.filter(t=>{let n=t.targetLabel;return X(t).toLowerCase().includes(e)||O(X(t)).toLowerCase().includes(e)||t.factoryName.toLowerCase().includes(e)||n.toLowerCase().includes(e)})}return t},[e,m]),x=m.type!==``||m.status!==``||m.target!==``||m.search!==``,S=(0,K.useMemo)(()=>He(b),[b]);return(0,q.jsxs)(`div`,{className:`flex h-full flex-col rounded-[var(--miravo-radius-stadium-sm)] border border-border/55`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-3.5 py-2.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`Operation log`}),e.length>0&&(0,q.jsx)(`span`,{className:`font-mono text-xs tabular-nums text-foreground/75`,children:typeof t==`number`&&t>0&&e.length<t?`${e.length} / ${t}`:String(e.length)})]}),(0,q.jsx)(`button`,{type:`button`,onClick:v,disabled:u,"aria-label":`Refresh operation list`,className:`relative rounded-[var(--miravo-radius-tight)] p-1 text-foreground/70 transition-colors before:absolute before:inset-[-10px] before:content-[''] hover:bg-muted/50 hover:text-foreground disabled:pointer-events-none`,children:(0,q.jsx)(he,{className:A(`size-3.5`,u&&`animate-spin`),"aria-hidden":!0})})]}),(0,q.jsx)(it,{filters:m,targetOptions:y,hasFilters:x,searchRef:g,onTypeChange:e=>h(t=>({...t,type:e})),onStatusChange:e=>h(t=>({...t,status:e})),onTargetChange:e=>h(t=>({...t,target:e})),onSearchChange:e=>h(t=>({...t,search:e})),onClear:()=>h(et)}),(0,q.jsxs)(`div`,{className:`flex flex-1 min-h-0 flex-col gap-2 overflow-y-auto overscroll-y-contain p-3`,children:[r&&(0,q.jsxs)(`p`,{className:`py-2 text-xs text-destructive`,children:[`✕ `,r.message]}),n&&e.length===0&&!r&&(0,q.jsx)(`p`,{className:`py-4 text-sm text-foreground/75`,children:`Loading…`}),!n&&e.length===0&&!r&&(0,q.jsx)(Be,{}),!n&&e.length>0&&b.length===0&&(0,q.jsxs)(`p`,{className:`py-6 text-center text-sm text-foreground/75`,children:[`No operations match your filters.`,` `,(0,q.jsx)(`button`,{type:`button`,onClick:()=>h(et),className:`text-primary hover:underline`,children:`Clear filters`})]}),x&&b.length>0&&b.length!==e.length&&(0,q.jsxs)(`p`,{className:`text-xs text-foreground/75`,children:[`Showing`,` `,(0,q.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:b.length}),` of`,` `,(0,q.jsx)(`span`,{className:`tabular-nums`,children:e.length}),` loaded`]}),!x&&typeof t==`number`&&t>0&&e.length<t&&(0,q.jsxs)(`p`,{className:`text-xs text-foreground/75`,children:[`Showing`,` `,(0,q.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:e.length}),` `,`of `,(0,q.jsx)(`span`,{className:`tabular-nums`,children:t}),`. Load more for older entries.`]}),(0,q.jsx)(f,{initial:!1,children:S.map(e=>(0,q.jsxs)(d.div,{className:`flex flex-col gap-2`,children:[(0,q.jsx)($e,{label:e.label}),(0,q.jsx)(f,{initial:!1,children:e.ops.map(e=>(0,q.jsx)(d.div,{initial:b.length>40?!1:{opacity:0,x:-6},animate:{opacity:1,x:0},transition:{type:`spring`,stiffness:400,damping:35},children:(0,q.jsx)(Qe,{operation:e})},`${e.operationId}-${e.completedAt}`))})]},e.label))}),s?(0,q.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 flex-col items-center gap-2 border-t border-border/50 pt-3 pb-1 text-center`,children:[(0,q.jsxs)(`p`,{className:`text-xs text-destructive`,children:[`Could not load older entries: `,s.message]}),c?(0,q.jsx)(C,{type:`button`,variant:`outline`,size:`sm`,onClick:c,children:`Retry`}):null]}):a&&l?(0,q.jsx)(`div`,{className:`flex shrink-0 justify-center border-t border-border/50 pt-3 pb-1`,children:(0,q.jsx)(C,{type:`button`,variant:`outline`,size:`sm`,className:`min-w-[7rem]`,disabled:o,"aria-busy":o,"aria-label":o?`Loading older operations`:`Load older operations`,onClick:l,children:o?`Loading…`:`Load more`})}):null]})]})}var ot={...Object.fromEntries(U.map(e=>[e.id,e.exportLabel])),"source-yaml":`Source YAML`};function st(e){return e==null||e===``?`Select integration`:typeof e==`string`?ot[e]??e:`Select integration`}function ct(e){return U.find(t=>t.id===e)?.label??e}function $({id:e,label:t,hint:n,className:r,labelAdornment:i,children:a}){return(0,q.jsxs)(`div`,{className:A(`flex flex-col gap-2`,r),children:[(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,q.jsx)(Se,{htmlFor:e,className:`text-[11px] font-medium text-foreground`,children:t}),i]}),n?(0,q.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:n}):null]}),a]})}function lt({open:e,editing:t,integrationId:n,form:r,showToken:i,saving:a,testing:o,canTestConnection:s,onOpenChange:c,onIntegrationChange:l,onFormChange:u,onShowTokenChange:d,onSave:f,onTestConnection:p,onCancelInFlight:m}){let h=n===W.id,_=t?`Edit Target`:`Add Target`,T=t?`Update the deployment connection.`:`Add the target used for integration deploys.`,E=t?`Leave empty to keep the current token.`:`Required for the first save and connection test.`;return(0,q.jsx)(S,{open:e,onOpenChange:e=>{e||m(),c(e)},children:(0,q.jsxs)(y,{showCloseButton:!0,className:`flex max-h-[min(84vh,38rem)] min-h-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-[38rem]`,children:[(0,q.jsxs)(g,{className:`shrink-0 border-b border-border/60 px-4 pb-3.5 pt-4 pr-12 sm:px-5 sm:pr-14`,children:[(0,q.jsx)(b,{className:`text-base tracking-tight`,children:_}),(0,q.jsx)(x,{className:`max-w-xl text-sm leading-relaxed`,children:T})]}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 sm:px-5`,style:{scrollbarGutter:`stable`},children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t?(0,q.jsx)($,{label:`Integration`,children:(0,q.jsx)(`div`,{className:`flex h-9 items-center rounded-[var(--miravo-radius-stadium-sm)] border border-input bg-input/30 px-3 text-sm text-foreground`,children:ct(n)})}):(0,q.jsx)($,{label:`Integration`,children:(0,q.jsxs)(H,{value:n,onValueChange:e=>l(e),children:[(0,q.jsx)(V,{className:`h-9 w-full text-sm data-placeholder:text-muted-foreground/55`,"aria-label":`Integration type`,children:(0,q.jsx)(R,{placeholder:`Select integration`,children:e=>st(e)})}),(0,q.jsxs)(B,{children:[(0,q.jsxs)(ke,{children:[(0,q.jsx)(De,{children:`Available`}),je.map(e=>(0,q.jsx)(z,{value:e.id,children:e.label},e.id))]}),(0,q.jsx)(Oe,{}),(0,q.jsxs)(ke,{children:[(0,q.jsx)(De,{children:`Coming soon`}),Ae.map(e=>(0,q.jsx)(z,{value:e.id,children:e.label},e.id))]})]})]})}),h?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)($,{id:`env-label`,label:`Label`,children:(0,q.jsx)(w,{id:`env-label`,placeholder:`Production`,value:r.label,onChange:e=>u({...r,label:e.currentTarget.value}),autoComplete:`off`,className:`h-9 placeholder:text-muted-foreground/55`})}),(0,q.jsx)($,{id:`env-hostname`,label:`Hostname`,children:(0,q.jsx)(w,{id:`env-hostname`,placeholder:`192.168.1.100`,value:r.hostname,onChange:e=>u({...r,hostname:e.currentTarget.value}),autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,className:`h-9 font-mono text-[13px] placeholder:text-muted-foreground/55`})}),(0,q.jsx)($,{id:`env-source`,label:de,labelAdornment:(0,q.jsxs)(be,{children:[(0,q.jsx)(ve,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About ${de}`,children:(0,q.jsx)(ce,{className:`size-3`,"aria-hidden":!0})}),(0,q.jsx)(ye,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:pe})]}),children:(0,q.jsx)(w,{id:`env-source`,placeholder:`host.docker.internal`,value:r.sourceHostname,onChange:e=>u({...r,sourceHostname:e.currentTarget.value}),autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,className:`h-9 font-mono text-[13px] placeholder:text-muted-foreground/55`})}),(0,q.jsx)($,{id:`env-token`,label:`API token`,labelAdornment:(0,q.jsxs)(be,{children:[(0,q.jsx)(ve,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About API token`,children:(0,q.jsx)(ce,{className:`size-3`,"aria-hidden":!0})}),(0,q.jsx)(ye,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:E})]}),children:(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(w,{id:`env-token`,type:i?`text`:`password`,placeholder:t?`••••••••`:`Enter API token`,value:r.apiToken,onChange:e=>u({...r,apiToken:e.currentTarget.value}),autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,className:`h-9 pr-11 font-mono text-[13px] placeholder:text-muted-foreground/55`}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>d(!i),"aria-label":i?`Hide token`:`Show token`,"aria-pressed":i,className:`absolute inset-y-0 right-0 flex w-11 items-center justify-center rounded-r-[var(--miravo-radius-stadium-sm)] text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:i?(0,q.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}):(0,q.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0})})]})})]}):(0,q.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border/70 px-4 py-3 text-sm text-muted-foreground`,children:[ct(n),` setup is not available yet. Switch back to Litmus Edge to finish target setup now.`]})]})}),(0,q.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:o&&h?`Checking connection to Litmus Edge…`:``}),(0,q.jsxs)(v,{className:`mx-0 mb-0 shrink-0 flex-col gap-2 border-t border-border/60 bg-background px-4 py-3 sm:flex-row sm:justify-end sm:px-5`,children:[(0,q.jsx)(C,{type:`button`,variant:`outline`,size:`lg`,className:`w-full justify-center sm:mr-auto sm:w-auto`,disabled:a||o||!s,"aria-busy":o,onClick:p,children:o?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(me,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),`Testing connection`]}):`Test connection`}),(0,q.jsxs)(`div`,{className:`flex w-full flex-col gap-2 sm:w-auto sm:flex-row`,children:[(0,q.jsx)(C,{variant:`outline`,size:`lg`,className:`w-full sm:w-auto`,onClick:()=>{m(),c(!1)},disabled:a,children:`Cancel`}),(0,q.jsx)(C,{size:`lg`,className:`w-full sm:w-auto`,onClick:f,disabled:a||!h,children:a?`Saving...`:t?`Save Target`:`Add Target`})]})]})]})})}function ut(e){let t=e.trim();if(t.length===0)return{message:`Connection test failed with no details from the server.`};let n=t.toLowerCase();if(t.includes(`timed out`))return{message:`Litmus Edge did not respond in time.`,description:`Check the hostname, VPN or firewall, and that the device is online.`};if(/\b401\b/.test(t)||/\b403\b/.test(t)||n.includes(`unauthorized`))return{message:`The API token was rejected.`,description:`Create or copy a valid token in Litmus Edge and paste it into the API token field.`};if(/\b404\b/.test(t)&&(n.includes(`sysinfo`)||n.includes(`/sysinfo/`)))return{message:`This Litmus Edge host or version does not expose the system info API.`,description:`Confirm the hostname and that Litmus Edge is running a build with GET /sysinfo/devinfo.`};if(n.includes(`econnrefused`)||n.includes(`connection refused`)||n.includes(`enotfound`)||n.includes(`getaddrinfo`)||n.includes(`failed`)&&n.includes(`fetch`))return{message:`Could not reach the Litmus Edge host.`,description:`Check the hostname or IP, TLS, and that this computer can reach the edge network.`};if(t.includes(`Session expired`))return{message:`Your session expired. Sign in again, then retry the connection test.`};if(n.includes(`factory not found`))return{message:`That target was removed. Close the dialog and refresh the list.`};if(n.includes(`unsupported integration`)&&n.includes(`connection`))return{message:`This integration type does not support connection tests yet.`,description:`Use Litmus Edge for remote apply and connection testing.`};if(n.includes(`invalid request body`)||n.includes(`api token is required`))return{message:`Some required fields are missing or invalid.`,description:`Fill in hostname, source host (Miravo), and API token (for new targets).`};let r=t.replace(/^LE\s+\S+\s+/i,``).trim();return{message:`Could not verify the connection to Litmus Edge.`,description:r.length>0&&r.length<=220?r:dt(t,200)}}function dt(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function ft(e){if(e.connected){let t=e.litmusEdgeVersion?` Litmus Edge v${e.litmusEdgeVersion}.`:``;if(e.warning){_.warning(`Connected to ${e.hostname}.${t}`,{description:e.warning});return}_.success(`Connected to ${e.hostname}.${t}`);return}let{message:t,description:n}=ut(e.error);_.error(t,n?{description:n}:void 0)}function pt(e){let{message:t,description:n}=ut(e instanceof Error?e.message:String(e));_.error(t,n?{description:n}:void 0)}function mt(e){return!!(typeof DOMException<`u`&&e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&(e.name===`AbortError`||/aborted/i.test(e.message)))}function ht(){let[e,t]=(0,K.useState)(!1),n=(0,K.useRef)(null),r=(0,K.useCallback)(()=>{n.current?.abort()},[]);return{testing:e,runTest:(0,K.useCallback)(async e=>{let r=new AbortController;n.current=r,t(!0);try{ft(await ie(e,{signal:r.signal}))}catch(e){if(mt(e))return;pt(e)}finally{n.current===r&&(n.current=null),t(!1)}},[]),cancelInFlight:r}}function gt(e){return U.find(t=>t.id===e)?.label??e}function _t(e){if(!e)return`var(--tooltip-border)`;switch(e.status){case`success`:return`var(--success)`;case`partial`:case`blocked`:return`var(--warning)`;case`noop`:return`var(--muted-foreground)`;case`failed`:return`var(--destructive)`}}function vt({status:e}){switch(e){case`success`:return(0,q.jsx)(N,{className:`size-3 text-success`});case`partial`:case`blocked`:return(0,q.jsx)(I,{className:`size-3 text-warning`});case`noop`:return(0,q.jsx)(G,{className:`size-3 text-muted-foreground`});case`failed`:return(0,q.jsx)(P,{className:`size-3 text-destructive`})}}function yt({target:e,lastOp:t,onEdit:n,onDelete:r}){return(0,q.jsxs)(`div`,{className:`env-orbital relative overflow-hidden border`,style:{"--_status":_t(t)},children:[(0,q.jsx)(`div`,{className:`relative z-10 px-4 pt-3.5 pb-3`,children:(0,q.jsx)(`p`,{className:`font-heading text-[13px] font-semibold leading-tight tracking-tight text-foreground`,children:e.label})}),(0,q.jsx)(`div`,{className:`relative z-10 px-4 py-0.5`,children:(0,q.jsx)(`p`,{className:`font-mono text-xs tracking-tight text-muted-foreground`,children:e.hostname})}),(0,q.jsxs)(`div`,{className:`relative z-10 mx-4 mb-3 flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-muted-foreground`,children:e.sourceHostname}),(0,q.jsx)(`div`,{className:`env-orbital-path min-w-6 flex-1`}),(0,q.jsx)(te,{className:`size-3 shrink-0 text-muted-foreground`})]}),(0,q.jsxs)(`div`,{className:`relative z-10 flex items-center gap-2 border-t border-border/30 px-3 py-1.5`,children:[(0,q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 rounded-full border border-border/40 px-2 py-0.5`,children:[(0,q.jsx)(`span`,{className:`protocol-card-live-dot size-[5px]`}),(0,q.jsx)(`span`,{className:`text-[11px] font-medium tracking-wide text-muted-foreground`,children:gt(e.integrationId)})]}),t&&(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 truncate text-[11px] text-muted-foreground`,children:[(0,q.jsx)(vt,{status:t.status}),t.operationType===`apply`?`Applied`:`Cleaned`,` `,(0,q.jsx)(`time`,{dateTime:new Date(t.completedAt).toISOString(),title:D(t.completedAt),children:E(t.completedAt)})]}),(0,q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5`,children:[(0,q.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit target`,onClick:n,children:(0,q.jsx)(Fe,{className:`size-3`})}),(0,q.jsx)(C,{variant:`ghost`,size:`icon-sm`,className:`text-destructive hover:text-destructive`,"aria-label":`Delete target`,onClick:r,children:(0,q.jsx)(_e,{className:`size-3`})})]})]})]})}function bt({onClick:e}){return(0,q.jsxs)(`button`,{type:`button`,onClick:e,className:`env-orbital group h-full w-full flex flex-col items-center justify-center gap-2 border border-dashed py-10 text-muted-foreground transition-colors hover:border-primary/30 hover:text-primary`,style:{"--_status":`var(--tooltip-border)`},children:[(0,q.jsx)(F,{className:`size-5 transition-transform group-hover:scale-110`}),(0,q.jsx)(`span`,{className:`text-xs`,children:`Add Target`})]})}function xt({targets:e,onMutate:t,lastOpByTarget:n}){let[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),[s,c]=(0,K.useState)(W.id),[l,u]=(0,K.useState)({label:``,hostname:``,apiToken:``,sourceHostname:``}),[p,m]=(0,K.useState)(!1),[h,w]=(0,K.useState)(!1),{testing:T,runTest:E,cancelInFlight:D}=ht(),[O,k]=(0,K.useState)(null),A=s===W.id&&l.hostname.trim().length>0&&l.sourceHostname.trim().length>0&&(a!==null||l.apiToken.trim().length>0),j=()=>{o(null),c(W.id),u({label:``,hostname:``,apiToken:``,sourceHostname:``}),w(!1),i(!0)},ee=e=>{o(e.id),c(U.some(t=>t.id===e.integrationId)?e.integrationId:W.id),u({label:e.label,hostname:e.hostname,apiToken:``,sourceHostname:e.sourceHostname}),w(!1),i(!0)},te=async()=>{if(s!==W.id){_.error(`${gt(s)} target setup is coming soon.`);return}if(!l.label||!l.hostname||!l.sourceHostname){_.error(`Label, hostname, and source host are required.`);return}if(!a&&!l.apiToken){_.error(`API token is required for new targets.`);return}m(!0);try{a?(await ae(a,{integrationId:s,label:l.label,hostname:l.hostname,sourceHostname:l.sourceHostname,...l.apiToken?{apiToken:l.apiToken}:{}}),_.success(`Target updated.`)):(await oe({...l,integrationId:s}),_.success(`Target added.`)),i(!1),t()}catch(e){_.error(L(e,`Failed to save target.`))}finally{m(!1)}};return(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`h2`,{className:`flex h-5 items-center text-xs font-medium leading-none uppercase tracking-wider text-muted-foreground`,children:`Integration Targets`}),e.length>0?(0,q.jsx)(xe,{variant:`secondary`,className:`relative -top-px h-5 shrink-0 px-1.5 py-0 font-mono text-[10px] leading-none tabular-nums`,children:e.length}):null]}),(0,q.jsxs)(C,{size:`sm`,className:`h-7 shrink-0 gap-1.5 text-xs`,onClick:j,children:[(0,q.jsx)(F,{className:`size-3.5`}),` Add Target`]})]}),e.length===0?(0,q.jsx)(ze,{titleId:`integrations-targets-empty-title`,frameIcon:(0,q.jsx)(M,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0}),description:(0,q.jsx)(Le,{}),children:(0,q.jsx)(Re,{onClick:j})}):(0,q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 @2xl/main:grid-cols-2 @5xl/main:grid-cols-3`,children:(0,q.jsxs)(f,{children:[e.map((e,t)=>(0,q.jsx)(d.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,scale:.96,transition:{duration:.15}},transition:{type:`spring`,stiffness:380,damping:30,delay:t*.04},children:(0,q.jsx)(yt,{target:e,lastOp:n.get(e.id),onEdit:()=>ee(e),onDelete:()=>k(e)})},e.id)),(0,q.jsx)(d.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{type:`spring`,stiffness:380,damping:30,delay:e.length*.04},children:(0,q.jsx)(bt,{onClick:j})},`add-card`)]})}),(0,q.jsx)(lt,{open:r,editing:a!==null,integrationId:s,form:l,showToken:h,saving:p,testing:T,canTestConnection:A,onOpenChange:i,onIntegrationChange:c,onFormChange:u,onShowTokenChange:w,onSave:()=>void te(),onTestConnection:()=>{A&&E({...a?{targetId:a}:{},hostname:l.hostname.trim(),sourceHostname:l.sourceHostname.trim(),...l.apiToken.trim()?{apiToken:l.apiToken.trim()}:{}})},onCancelInFlight:D}),(0,q.jsx)(S,{open:O!==null,onOpenChange:e=>!e&&k(null),children:(0,q.jsxs)(y,{children:[(0,q.jsxs)(g,{children:[(0,q.jsx)(b,{children:`Remove Target`}),(0,q.jsxs)(x,{children:[`Remove “`,O?.label,`”? This only deletes the saved credentials — it does not affect resources on the target integration.`]})]}),(0,q.jsxs)(v,{children:[(0,q.jsx)(C,{variant:`outline`,onClick:()=>k(null),children:`Cancel`}),(0,q.jsx)(C,{variant:`destructive`,onClick:async()=>{if(!O)return;let e=O.id;k(null);try{await le(e),_.success(`Target removed.`),t()}catch(e){_.error(L(e,`Failed to remove target.`))}},children:`Remove`})]})]})})]})}var St=25;function Ct({status:e}){switch(e){case`success`:return(0,q.jsx)(N,{className:`size-3 text-success`});case`partial`:case`blocked`:return(0,q.jsx)(I,{className:`size-3 text-warning`});case`noop`:return(0,q.jsx)(G,{className:`size-3 text-muted-foreground`});case`failed`:return(0,q.jsx)(P,{className:`size-3 text-destructive`})}}function wt({targetCount:e,opCount:t,lastOp:n}){return(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(M,{className:`size-3`}),(0,q.jsx)(`span`,{className:`font-mono`,children:e}),` target`,e===1?``:`s`]}),(0,q.jsx)(`span`,{className:`hidden h-3 w-px bg-border/40 sm:inline-block`}),(0,q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(f,{mode:`popLayout`,initial:!1,children:(0,q.jsx)(d.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`font-mono tabular-nums`,children:t},t)}),` `,`operation`,t===1?``:`s`]}),n&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`hidden h-3 w-px bg-border/40 sm:inline-block`}),(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(Ct,{status:n.status}),(0,q.jsxs)(`span`,{children:[n.operationType===`apply`?`Applied`:`Cleaned`,` `,(0,q.jsx)(`time`,{dateTime:new Date(n.completedAt).toISOString(),title:D(n.completedAt),children:E(n.completedAt)})]})]})]})]})}function Tt(){let e=u({queryKey:a.integrations.targets(),queryFn:()=>se()}),t=e.data??[],n=Ne({queryKey:a.integrations.operationsList(),queryFn:({pageParam:e})=>re({limit:St,offset:e}),initialPageParam:0,getNextPageParam:(e,t,n)=>e.hasMore&&e.operations.length>0?n+St:void 0}),r=(0,K.useMemo)(()=>n.data?.pages.flatMap(e=>e.operations)??[],[n.data]),i=n.data?.pages[0]?.total??0,o=(0,K.useMemo)(()=>{let e=new Map;for(let t of r)e.has(t.targetId)||e.set(t.targetId,t);return e},[r]),[c,l]=p(`tab`,m([`targets`,`activity`]).withDefault(`targets`));return(0,q.jsxs)(`div`,{className:`mx-auto flex h-full w-full min-w-0 max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2`,children:[(0,q.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Integrations`}),(0,q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Connect Litmus Edge targets here and review activity. Apply and clean up from the`,` `,(0,q.jsx)(h,{to:`/?tab=integrations`,className:`text-foreground underline underline-offset-2`,children:`Factory page`}),`.`]}),(0,q.jsx)(wt,{targetCount:t.length,opCount:i,lastOp:r[0]})]}),(0,q.jsxs)(Ee,{value:c,onValueChange:e=>{l(e)},className:`flex-1 min-h-0`,children:[(0,q.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,q.jsxs)(Te,{variant:`line`,className:`h-10! gap-0.5 min-w-max`,children:[(0,q.jsxs)(Ce,{value:`targets`,className:`gap-1.5 px-3 text-sm`,children:[(0,q.jsx)(M,{className:`size-3.5 shrink-0`}),`Targets`]}),(0,q.jsxs)(Ce,{value:`activity`,className:`gap-1.5 px-3 text-sm`,children:[(0,q.jsx)(j,{className:`size-3.5 shrink-0`}),`Activity`]})]})}),(0,q.jsx)(we,{value:`targets`,className:`flex-1 py-2`,children:(0,q.jsx)(d.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:e.isError&&e.data===void 0?(0,q.jsx)(ge,{message:L(e.error,`Failed to load targets.`),onRetry:()=>void e.refetch(),isRetrying:e.isFetching&&!e.isPending}):(0,q.jsx)(xt,{targets:t,onMutate:()=>void e.refetch(),lastOpByTarget:o})},`targets`)}),(0,q.jsx)(we,{value:`activity`,className:`flex flex-col flex-1 min-h-0 py-2`,children:(0,q.jsx)(d.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`flex flex-col flex-1 min-h-0`,children:(0,q.jsx)(at,{operations:r,totalKnown:i,isLoading:n.isPending&&!n.data,error:n.error,onRefresh:()=>void s.invalidateQueries({queryKey:a.integrations.operationsList()}),hasNextPage:n.hasNextPage,isFetchingNextPage:n.isFetchingNextPage,loadMoreError:n.isFetchNextPageError&&n.error instanceof Error?n.error:null,onRetryLoadMore:()=>void n.fetchNextPage(),onLoadMore:()=>void n.fetchNextPage()})},`activity`)})]})]})}export{Tt as t};
@@ -1,4 +1,4 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{l as r,r as i,y as a}from"./api-BG2sUkwk.js";import{t as o}from"./use-transition-navigate-D2Y8kfw6.js";import{t as s}from"./transition-nav-link-CSrpkA7_.js";import{n as c}from"./get-error-message-C9VW9IZB.js";var l=e(t(),1),u=n(),d=`
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{l as r,r as i,y as a}from"./api-CtMmjN9m.js";import{t as o}from"./use-transition-navigate-5-QJHk2I.js";import{t as s}from"./transition-nav-link-ZpTbW2Hm.js";import{n as c}from"./get-error-message-D800c4Uu.js";var l=e(t(),1),u=n(),d=`
2
2
  @keyframes readout-appear {
3
3
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
4
4
  to { opacity: 1; transform: translateY(0) scale(1); }
@@ -0,0 +1 @@
1
+ import{t as e}from"./models-CDGbNOUr.js";export{e as ModelsPage};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{A as r,M as i,S as a,d as o,n as s,o as c,ot as l,v as u}from"./api-BG2sUkwk.js";import{f as d,t as f}from"./useQuery-Cl48zZ73.js";import{t as p}from"./proxy-CWZabK8f.js";import{t as m}from"./AnimatePresence-BSSlw02V.js";import{a as h,i as g,n as _,o as v,r as y,t as b}from"./dialog-B5PqrKVw.js";import{C as x,S,c as C,g as w,l as T,u as E,x as D}from"./format-Bx7DF-TB.js";import{n as O,t as k}from"./utils-XFKvwlFT.js";import{t as A}from"./activity-Cy_niK56.js";import{t as j}from"./chevron-down-x70Pto6j.js";import{r as M}from"./source-host-miravo-B8eM2IHw.js";import{t as N}from"./minus-CaT9UaQx.js";import{a as P,i as F,l as I,s as ee,t as te}from"./use-engine-command-mutation-DrMOfYty.js";import{t as ne}from"./plus-Cl4Ay5Ry.js";import{t as L}from"./query-fetch-error-CWLZA2L5.js";import{t as re}from"./rocket-KZ5oHK1G.js";import{i as ie,n as R,r as z,t as ae}from"./catalog-source-B4L5N-a1.js";import{c as oe,d as se,f as ce,l as le,s as ue,t as de,u as fe}from"./export-tab-BsV7px7m.js";import{t as pe}from"./triangle-alert-DoAwrRgk.js";import{t as B}from"./badge-Bk1DaL6C.js";import{t as V}from"./label-2sIXTEUK.js";import{n as H}from"./get-error-message-C9VW9IZB.js";import{i as U,n as W,r as me,t as he}from"./tabs-Ch_VG8_S.js";import{t as ge}from"./checkbox-DEAkDfFr.js";var G=O(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),_e=O(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),ve=O(`heart-pulse`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}],[`path`,{d:`M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`auskq0`}]]),ye=O(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),be=O(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),K=e(t(),1),q=n(),xe=new Set([`fault_active`,`fault_count`,`active_fault_code`,`lifecycle_stage`,`health_state`,`availability_state`]);function Se(e){let t=[],n=[],r=[],i=[];for(let[a,o]of Object.entries(e)){let e={name:a,kind:o.kind,dataType:o.dataType,access:o.access,unit:o.unit,euRange:o.euRange};xe.has(a)?i.push(e):o.kind===`property`?t.push(e):o.access===`readwrite`?n.push(e):r.push(e)}let a=[];return t.length>0&&a.push({key:`nameplate`,label:`Nameplate`,icon:(0,q.jsx)(ce,{className:`size-3`}),members:t,accentClass:`text-muted-foreground`}),n.length>0&&a.push({key:`commands`,label:`Commands`,icon:(0,q.jsx)(ye,{className:`size-3`}),members:n,accentClass:`text-info`}),r.length>0&&a.push({key:`process`,label:`Process Tags`,icon:(0,q.jsx)(A,{className:`size-3`}),members:r,accentClass:`text-primary`}),i.length>0&&a.push({key:`health`,label:`Health & Status`,icon:(0,q.jsx)(ve,{className:`size-3`}),members:i,accentClass:`text-success`}),a}function Ce({modelName:e,onClose:t}){let[n,r]=(0,K.useState)(new Set([`nameplate`,`process`])),i=f({queryKey:u.catalog.modelSchema(e??``),queryFn:()=>c(`/catalog/models/${e}`,a.catalogModelDetail),enabled:e!==null}),o=i.data,s=i.isPending&&!o,l=i.isError,d=H(i.error,`Failed to load model.`);(0,K.useEffect)(()=>{e&&r(new Set([`nameplate`,`process`]))},[e]);let m=(0,K.useMemo)(()=>o?Se(o.members):[],[o]),h=(0,K.useCallback)(e=>{r(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),g=o?Object.keys(o.members).length:0,_=o?Object.keys(o.methods).length:0;return(0,q.jsx)(ue,{open:e!==null,onOpenChange:e=>{e||t()},children:(0,q.jsx)(oe,{side:`right`,className:`flex w-full flex-col gap-4 touch-manipulation`,children:s?null:l&&!o?(0,q.jsx)(`div`,{className:`flex flex-1 flex-col justify-center px-2`,children:(0,q.jsx)(L,{message:d,onRetry:()=>void i.refetch(),isRetrying:i.isFetching})}):o?(0,q.jsxs)(p.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.18},className:`flex min-h-0 flex-1 flex-col gap-4`,children:[(0,q.jsxs)(fe,{className:`gap-1 pb-0 pe-12`,children:[(0,q.jsx)(se,{className:`font-heading text-base uppercase tracking-wide`,children:E(o.name)}),o.description&&(0,q.jsx)(le,{className:`text-xs leading-relaxed text-foreground/88`,children:o.description}),(0,q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,q.jsxs)(B,{variant:`outline`,className:`font-mono text-xs`,children:[g,` members`]}),(0,q.jsxs)(B,{variant:`outline`,className:`font-mono text-xs`,children:[_,` methods`]}),(0,q.jsxs)(B,{variant:`outline`,className:`font-mono text-xs`,children:[o.faults.length,` faults`]}),o.lifecycle&&(0,q.jsxs)(B,{variant:`outline`,className:`font-mono text-xs text-primary`,children:[o.lifecycle.stages.length,`-stage lifecycle`]})]})]}),(0,q.jsxs)(he,{defaultValue:`overview`,className:`flex min-h-0 flex-1 flex-col gap-1 pt-0`,children:[(0,q.jsxs)(me,{variant:`line`,className:`h-8! shrink-0 gap-0.5 border-b-border/60 px-2 py-0.5`,children:[(0,q.jsx)(U,{value:`overview`,className:`min-h-10 px-2 py-1 text-xs text-foreground/82 after:bottom-[-3px] data-active:text-foreground sm:min-h-0 sm:px-2.5 sm:py-1`,children:`Overview`}),(0,q.jsx)(U,{value:`export`,className:`min-h-10 px-2 py-1 text-xs text-foreground/82 after:bottom-[-3px] data-active:text-foreground sm:min-h-0 sm:px-2.5 sm:py-1`,children:`Export`})]}),(0,q.jsx)(W,{value:`overview`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-2`,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5 pb-1 pt-0.5`,children:[m.map(e=>(0,q.jsx)(J,{sectionKey:e.key,label:e.label,count:e.members.length,icon:e.icon,accentClass:e.accentClass,expanded:n.has(e.key),onToggle:h,children:(0,q.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.members.map(e=>(0,q.jsx)(we,{member:e},e.name))})},e.key)),o.faults.length>0&&(0,q.jsx)(J,{sectionKey:`faults`,label:`Faults`,count:o.faults.length,icon:(0,q.jsx)(pe,{className:`size-3`}),accentClass:`text-warning`,expanded:n.has(`faults`),onToggle:h,children:(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:o.faults.map(e=>(0,q.jsx)(B,{variant:`secondary`,className:`text-[10px] text-warning`,children:w(e)},e))})}),o.lifecycle&&(0,q.jsx)(J,{sectionKey:`lifecycle`,label:`Lifecycle`,count:o.lifecycle.stages.length,icon:(0,q.jsx)(_e,{className:`size-3`}),accentClass:`text-primary`,expanded:n.has(`lifecycle`),onToggle:h,children:(0,q.jsx)(Te,{lifecycle:o.lifecycle})}),_>0&&(0,q.jsx)(J,{sectionKey:`methods`,label:`Methods`,count:_,icon:(0,q.jsx)(be,{className:`size-3`}),accentClass:`text-info`,expanded:n.has(`methods`),onToggle:h,children:(0,q.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:Object.entries(o.methods).map(([e,t])=>(0,q.jsx)(Ee,{name:e,method:t},e))})})]})})})}),(0,q.jsx)(W,{value:`export`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,q.jsx)(de,{kind:`model`,id:o.name,yamlPath:`/catalog/models/${o.name}/yaml`,yamlFilename:`${o.name}.asset.yaml`})})})]})]},o.name):(0,q.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Model not found`})})})}function J({sectionKey:e,label:t,count:n,icon:r,accentClass:i,expanded:a,onToggle:o,children:s}){return(0,q.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50`,children:[(0,q.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 px-2.5 py-1.5 text-left text-xs font-medium transition-colors hover:bg-muted/30`,onClick:()=>o(e),children:[(0,q.jsx)(`span`,{className:i,children:r}),(0,q.jsx)(`span`,{className:`uppercase tracking-wider`,children:t}),(0,q.jsx)(B,{variant:`secondary`,className:`ml-auto text-[10px]`,children:n}),(0,q.jsx)(j,{className:`size-3 text-muted-foreground transition-transform ${a?`rotate-180`:``}`})]}),(0,q.jsx)(m,{initial:!1,children:a&&(0,q.jsx)(p.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden`,children:(0,q.jsx)(`div`,{className:`border-t px-2.5 py-1.5`,children:s})},`content`)})]})}function we({member:e}){return(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 py-0.5 text-xs`,children:[(0,q.jsx)(`span`,{title:e.name,className:`min-w-0 truncate font-mono text-foreground`,children:C(e.name)}),(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:e.dataType}),e.unit&&(0,q.jsx)(B,{variant:`outline`,className:`px-1 py-0 text-[10px]`,children:e.unit}),e.euRange&&(0,q.jsxs)(`span`,{className:`ml-auto font-mono text-xs text-muted-foreground`,children:[`[`,e.euRange[0],`–`,e.euRange[1],`]`]})]})}var Y={healthy:`bg-success`,normal:`bg-success`,degraded:`bg-warning`,critical:`bg-destructive`,failed:`bg-destructive`};function Te({lifecycle:e}){let t=e.stages.length;return(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsx)(`div`,{className:`flex h-2.5 w-full overflow-hidden rounded-full bg-muted`,children:e.stages.map((e,n)=>(0,q.jsx)(`div`,{className:`transition-[background-color] ${Y[e]??`bg-chart-1`} ${n===0?`rounded-l-full`:``} ${n===t-1?`rounded-r-full`:``}`,style:{width:`${100/t}%`}},`${e}-${n}`))}),(0,q.jsx)(`div`,{className:`flex items-center gap-3`,children:e.stages.map((e,t)=>(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,q.jsx)(`span`,{className:`size-2 rounded-full ${Y[e]??`bg-chart-1`}`}),(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:w(e)})]},`${e}-${t}`))}),(0,q.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[`~`,T(e.totalHours),` total hours`]})]})}function Ee({name:e,method:t}){return(0,q.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:e}),t.inputArguments.length>0&&(0,q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t.inputArguments.map(e=>`${e.name}: ${e.dataType}`).join(`, `),`)`]})]}),t.description&&(0,q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.description})]})}var X=[{value:`mqtt`,label:`MQTT`},{value:`opcua`,label:`OPC UA`},{value:`modbus`,label:`Modbus`}];function De({value:e,onChange:t,className:n}){let r=(0,K.useId)(),i=new Set(e),a=l(e=>e.availableAdapters),o=X.filter(e=>i.has(e.value)&&a.some(t=>t.name===e.value&&!t.enabled));return(0,q.jsxs)(`fieldset`,{className:k(`min-w-0`,n),children:[(0,q.jsx)(`legend`,{className:`mb-2 text-xs font-medium text-foreground`,children:`Protocol exposure`}),(0,q.jsx)(`div`,{className:`grid min-w-0 gap-2 sm:grid-cols-3`,children:X.map(n=>(0,q.jsxs)(V,{htmlFor:`${r}-${n.value}`,className:`min-w-0 rounded-[var(--miravo-radius-tight)] border border-border/80 px-2.5 py-2 text-xs`,children:[(0,q.jsx)(ge,{id:`${r}-${n.value}`,checked:i.has(n.value),onCheckedChange:r=>{let i=e.filter(e=>e!==n.value);r===!0&&i.push(n.value),t(i)}}),(0,q.jsx)(`span`,{children:n.label})]},n.value))}),(0,q.jsx)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:e.length>0?`${e.length} selected`:`Default: enabled adapters`}),o.length>0&&(0,q.jsxs)(`p`,{role:`status`,className:`mt-1 text-[11px] text-warning`,children:[`Spawning will also enable the `,o.map(e=>e.label).join(`, `),` `,o.length===1?`adapter`:`adapters`,` and open`,` `,o.length===1?`its port`:`their ports`,`.`]})]})}function Oe(e,t){let[n,r]=(0,K.useState)(e);return(0,K.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Z(e){let t=e.trim();return t===``?{}:r(t)===null?{assetPrefix:t}:{assetName:t}}function ke(e){return e.settled&&e.isSuccess&&!e.isFetching?e.data??null:null}var Ae=300;function je(e){return e instanceof s?e.result.error?`${e.result.message} ${e.result.error}`:e.message:e instanceof Error?e.message:`Could not preview the spawn.`}function Me({modelName:e,count:t,onClose:n}){let[r,a]=(0,K.useState)(``),[s,c]=(0,K.useState)([]),[p,m]=(0,K.useState)(!1),C=te(),w=l(e=>e.assets.map(e=>e.id).join(`,`)),T=d();(0,K.useEffect)(()=>{T.invalidateQueries({queryKey:u.spawnPreviewAll})},[w,T]),(0,K.useEffect)(()=>{e!==null&&(a(``),c([]))},[e]);let O=i(r),A=Oe(r,Ae),j=Z(A),M=A===r,N=f({queryKey:u.spawnPreview(e??``,t,A.trim(),s.join(`,`)),queryFn:async()=>{let n=await o({type:`spawn`,model:e??``,count:t,dryRun:!0,...j,...s.length>0?{protocolScope:s}:{}});return Array.isArray(n.data)?n.data:[]},enabled:e!==null&&i(A)===null,retry:!1,gcTime:0,staleTime:0}),P=O??(M&&N.isError?je(N.error):null),F=ke({settled:M,...N}),I=async()=>{if(e===null)return;let i=Z(r);m(!0);try{await C.mutateAsync({type:`spawn`,model:e,count:t,...i,...s.length>0?{protocolScope:s}:{}}),n()}catch{}finally{m(!1)}};return(0,q.jsx)(b,{open:e!==null,onOpenChange:e=>{e||n()},children:(0,q.jsxs)(_,{className:`min-w-0 sm:max-w-md`,children:[(0,q.jsxs)(h,{children:[(0,q.jsx)(v,{children:`Spawn assets?`}),(0,q.jsx)(y,{children:e!==null&&(0,q.jsxs)(q.Fragment,{children:[`This spawns `,t,` asset`,t===1?``:`s`,` of`,` `,(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:E(e)}),` `,`into the running factory.`]})})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,q.jsx)(V,{htmlFor:`spawn-asset-target`,className:`text-xs font-medium text-foreground`,children:`ID or prefix`}),(0,q.jsx)(S,{id:`spawn-asset-target`,value:r,maxLength:120,onChange:e=>a(e.target.value),placeholder:`Default`,className:k(`min-w-0 font-mono text-xs`,P&&`border-destructive`),"aria-invalid":P!=null,"aria-describedby":`spawn-asset-target-hint spawn-asset-target-preview`}),(0,q.jsx)(`p`,{id:`spawn-asset-target-hint`,className:`min-w-0 wrap-break-word text-[11px] text-muted-foreground`,children:`A name ending in a number (pump-007) is an exact ID and needs a count of 1. Anything else is a prefix (pump gives pump-001, pump-002).`}),(0,q.jsx)(`p`,{id:`spawn-asset-target-preview`,role:`status`,className:k(`min-w-0 wrap-break-word text-[11px]`,P?`text-destructive`:`text-muted-foreground`),children:P??(F===null?`Checking IDs...`:(0,q.jsxs)(q.Fragment,{children:[`Will likely create`,` `,(0,q.jsx)(`span`,{className:`break-all font-mono text-foreground`,children:D(F)})]}))})]}),(0,q.jsx)(De,{value:s,onChange:c})]}),(0,q.jsxs)(g,{children:[(0,q.jsx)(x,{variant:`outline`,disabled:p,onClick:n,children:`Cancel`}),(0,q.jsx)(x,{disabled:p||e===null||O!=null||F===null,onClick:()=>void I(),children:p?`Spawning...`:`Spawn`})]})]})})}var Q=[`builtin`,`personal`];function Ne(){let[e,t]=(0,K.useState)(``),[n,r]=(0,K.useState)(`all`),[i,o]=(0,K.useState)({}),[s,l]=(0,K.useState)(null),[d,h]=(0,K.useState)(null),g=(0,K.useRef)(null);(0,K.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.tagName;t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||(e.preventDefault(),g.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let _=f({queryKey:u.catalog.models(),queryFn:()=>c(`/catalog/models`,a.catalogModels)}),v=_.data??[],y=_.isPending&&!_.data,b=_.isError&&!_.data,x=_.isError&&!!_.data,C=H(_.error,`Failed to load models.`),w=e=>i[e]??1,T=(0,K.useCallback)((e,t)=>{o(n=>({...n,[e]:Math.max(1,Math.min(10,t))}))},[]),E=(0,K.useCallback)(e=>{h(e)},[]),D=(0,K.useCallback)(e=>{l(e)},[]),O=(0,K.useMemo)(()=>{let e={all:v.length};for(let t of Q)e[t]=0;for(let t of v){let n=z(t.source);e[n]=(e[n]??0)+1}return e},[v]),A=e.toLowerCase(),j=v.filter(e=>n===`all`||z(e.source)===n).filter(e=>A?e.name.toLowerCase().includes(A)||(e.description?.toLowerCase().includes(A)??!1):!0);return(0,q.jsxs)(`div`,{className:`@container/models mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Asset Model Library`}),(0,q.jsx)(B,{variant:`outline`,className:`text-xs`,children:b?(0,q.jsx)(`span`,{className:`text-destructive`,children:`Unavailable`}):y&&v.length===0?(0,q.jsx)(q.Fragment,{children:`Loading...`}):(0,q.jsxs)(q.Fragment,{children:[v.length,` models`]})})]}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Canonical asset models with realistic physics, lifecycle degradation, and fault modes. Inspect to explore schema, copy YAML, or export.`})]}),b&&(0,q.jsx)(L,{message:C,onRetry:()=>void _.refetch(),isRetrying:_.isFetching}),x&&(0,q.jsx)(L,{message:`${C} Showing cached models.`,onRetry:()=>void _.refetch(),isRetrying:_.isFetching}),!b&&(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,q.jsxs)(`div`,{className:`relative max-w-xs flex-1 min-w-[14rem]`,children:[(0,q.jsx)(ie,{className:`absolute left-2.5 top-2.5 size-4 text-muted-foreground`}),(0,q.jsx)(S,{ref:g,placeholder:`Filter models...`,value:e,onChange:e=>t(e.target.value),className:`pl-9 pr-7`}),!e&&(0,q.jsx)(`kbd`,{className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded-[var(--miravo-radius-tight)] border border-border bg-muted px-1 font-mono text-[10px] text-muted-foreground`,children:`/`})]}),(0,q.jsx)(Fe,{value:n,counts:O,onChange:r})]}),(0,q.jsx)(`div`,{className:`grid grid-cols-1 gap-4 @[720px]/models:grid-cols-2 @[1120px]/models:grid-cols-3`,"aria-busy":y&&!b,children:b?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(m,{children:j.map((e,t)=>(0,q.jsx)(p.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,scale:.96,transition:{duration:.15}},transition:{type:`spring`,stiffness:380,damping:30,delay:t*.04},className:`grid`,children:(0,q.jsx)(Pe,{model:e,count:w(e.name),onCountChange:T,onInspect:E,onSpawn:D})},e.name))}),j.length===0&&v.length>0&&(0,q.jsx)(`p`,{className:`col-span-full py-8 text-center text-sm text-muted-foreground`,children:`No models match the current filters.`})]})}),v.length>0&&(0,q.jsx)(`div`,{className:k(P,`p-0`),children:(0,q.jsx)(`div`,{className:`community-teaser relative overflow-hidden rounded-[inherit]`,children:(0,q.jsx)(`div`,{className:`relative z-10 mx-auto max-w-3xl px-5 py-10 sm:px-10 sm:py-12`,children:(0,q.jsxs)(`div`,{className:`grid items-center gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,17rem)]`,children:[(0,q.jsxs)(`div`,{className:`order-2 flex min-w-0 flex-col gap-4 lg:order-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,q.jsx)(`p`,{className:`blueprint-title text-primary`,children:`Future channel`}),(0,q.jsx)(`span`,{className:`blueprint-stat text-[10px] text-muted-foreground`,children:`MIRAVO_REGISTRY · NOT_CONNECTED`})]}),(0,q.jsx)(`h2`,{className:`font-heading text-xl font-semibold tracking-tight sm:text-2xl`,children:`Community Models`}),(0,q.jsx)(`p`,{className:`max-w-xl text-sm leading-relaxed text-muted-foreground`,children:`Publish your custom asset models to the Miravo registry. Discover equipment models from other engineers, fork them, and adapt parameters for your use case.`}),(0,q.jsx)(`div`,{children:(0,q.jsx)(B,{variant:`outline`,className:`community-teaser-soon border-primary/35 bg-primary/5 text-[10px] text-primary`,children:`Coming Soon`})})]}),(0,q.jsx)(`div`,{className:`order-1 flex justify-center lg:order-2 lg:justify-end`,children:(0,q.jsxs)(`div`,{className:`community-teaser-module relative flex w-full max-w-[14rem] flex-col items-center justify-center gap-3 border border-primary/15 bg-muted/15 py-8 sm:max-w-[15.5rem] sm:py-10`,"aria-hidden":!0,children:[(0,q.jsx)(`div`,{className:`community-teaser-icon-ring relative z-[1] flex size-[4.25rem] items-center justify-center rounded-[var(--miravo-radius-tight)] border border-primary/35 bg-gradient-to-br from-primary/18 to-primary/5`,children:(0,q.jsx)(re,{className:`size-9 text-primary`,"aria-hidden":!0})}),(0,q.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] tracking-[0.18em] text-muted-foreground`,children:`AWAITING SIGNAL`}),(0,q.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] text-muted-foreground`,children:`Uplink idle`})]})})]})})})}),(0,q.jsx)(Me,{modelName:s,count:s===null?1:w(s),onClose:()=>l(null)}),(0,q.jsx)(Ce,{modelName:d,onClose:()=>h(null)})]})}var Pe=(0,K.memo)(function({model:e,count:t,onCountChange:n,onInspect:r,onSpawn:i}){return(0,q.jsxs)(`div`,{className:k(ee,`flex flex-col gap-4 p-5`),children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] bg-primary/10 text-primary`,children:(0,q.jsx)(G,{className:`size-4`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-0.5`,children:[(0,q.jsx)(`span`,{className:`font-heading text-sm font-semibold uppercase tracking-wide`,children:E(e.name)}),e.description&&(0,q.jsx)(`span`,{className:`line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-muted-foreground`,children:[(0,q.jsx)($,{label:`mbr`,value:e.memberCount}),(0,q.jsx)($,{label:`mth`,value:e.methodCount}),(0,q.jsx)($,{label:`flt`,value:e.faultCount}),e.hasLifecycle&&(0,q.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,children:[(0,q.jsx)(`span`,{className:`text-[10px]`,children:`◈`}),(0,q.jsxs)(`span`,{children:[e.lifecycleStageCount,`-stage`]})]}),(0,q.jsx)(B,{variant:`outline`,className:k(`ml-auto shrink-0 font-sans text-[10px] font-medium uppercase tracking-wide`,ae(e.source)),children:R(e.source)})]}),(0,q.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 border-t border-border/30 pt-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center rounded-[var(--miravo-radius-tight)] border bg-muted/30`,children:[(0,q.jsx)(x,{variant:`ghost`,size:`icon`,className:`size-7 rounded-none rounded-l-md`,disabled:t<=1,"aria-label":`Decrease count`,onClick:r=>{r.stopPropagation(),n(e.name,t-1)},children:(0,q.jsx)(N,{className:`size-3`})}),(0,q.jsx)(`span`,{className:`flex size-7 items-center justify-center border-x font-mono text-xs`,children:t}),(0,q.jsx)(x,{variant:`ghost`,size:`icon`,className:`size-7 rounded-none rounded-r-md`,disabled:t>=10,"aria-label":`Increase count`,onClick:r=>{r.stopPropagation(),n(e.name,t+1)},children:(0,q.jsx)(ne,{className:`size-3`})})]}),(0,q.jsxs)(x,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(e.name),className:F,children:[(0,q.jsx)(M,{className:`size-3.5`,"aria-hidden":!0}),`Inspect`]}),(0,q.jsxs)(x,{size:`sm`,className:`ml-auto`,onClick:()=>i(e.name),children:[(0,q.jsx)(I,{className:`mr-1 size-3`}),`Spawn`]})]})]})});function $({label:e,value:t}){return(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`span`,{className:`text-foreground`,children:t}),` `,(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:e})]})}function Fe({value:e,counts:t,onChange:n}){return(0,q.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`radiogroup`,"aria-label":`Filter by source`,children:[{id:`all`,label:`All`},...Q.map(e=>({id:e,label:R(e)}))].map(r=>{let i=e===r.id,a=t[r.id]??0,o=r.id!==`all`&&a===0;return(0,q.jsxs)(`label`,{className:k(`inline-flex h-7 items-center gap-1.5 rounded-[var(--miravo-radius-pill)] border px-3 text-xs font-medium transition-colors`,i?`border-primary/60 bg-primary/15 text-primary`:`border-border/60 bg-card/30 text-muted-foreground hover:border-border hover:bg-muted/40 hover:text-foreground`,o?`cursor-not-allowed opacity-40 hover:border-border/60 hover:bg-card/30 hover:text-muted-foreground`:`cursor-pointer`),children:[(0,q.jsx)(`input`,{type:`radio`,name:`models-source-filter`,value:r.id,checked:i,disabled:o,onChange:()=>n(r.id),className:`sr-only`}),(0,q.jsx)(`span`,{children:r.label}),(0,q.jsx)(`span`,{className:`font-mono text-[10px] text-foreground`,children:a})]},r.id)})})}export{G as n,Ne as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{K as r,S as i,W as a,d as o,n as s,o as c,v as l,vt as u}from"./api-CtMmjN9m.js";import{f as d,t as f}from"./useQuery-Dxp3WSXF.js";import{t as p}from"./proxy-CWZabK8f.js";import{t as m}from"./AnimatePresence-BSSlw02V.js";import{a as h,i as g,n as _,o as v,r as y,t as b}from"./dialog-B5PqrKVw.js";import{C as x,S,c as C,g as w,l as T,u as E,x as D}from"./format-Bx7DF-TB.js";import{n as O,t as k}from"./utils-XFKvwlFT.js";import{t as A}from"./activity-Cy_niK56.js";import{t as j}from"./chevron-down-x70Pto6j.js";import{r as M}from"./source-host-miravo-B8eM2IHw.js";import{t as N}from"./minus-CaT9UaQx.js";import{a as P,i as F,l as I,s as ee,t as te}from"./use-engine-command-mutation-5q_LI_xT.js";import{t as ne}from"./plus-Cl4Ay5Ry.js";import{t as L}from"./query-fetch-error-CWLZA2L5.js";import{t as re}from"./rocket-KZ5oHK1G.js";import{i as ie,n as R,r as z,t as ae}from"./catalog-source-B4L5N-a1.js";import{c as oe,d as se,f as ce,l as le,s as ue,t as de,u as fe}from"./export-tab-CtH28h1G.js";import{t as pe}from"./triangle-alert-DoAwrRgk.js";import{t as B}from"./badge-Bk1DaL6C.js";import{t as V}from"./label-2sIXTEUK.js";import{n as H}from"./get-error-message-D800c4Uu.js";import{i as U,n as W,r as me,t as he}from"./tabs-Ch_VG8_S.js";import{t as ge}from"./checkbox-DEAkDfFr.js";var G=O(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),_e=O(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),ve=O(`heart-pulse`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}],[`path`,{d:`M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`auskq0`}]]),ye=O(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),be=O(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),K=e(t(),1),q=n(),xe=new Set([`fault_active`,`fault_count`,`active_fault_code`,`lifecycle_stage`,`health_state`,`availability_state`]);function Se(e){let t=[],n=[],r=[],i=[];for(let[a,o]of Object.entries(e)){let e={name:a,kind:o.kind,dataType:o.dataType,access:o.access,unit:o.unit,euRange:o.euRange};xe.has(a)?i.push(e):o.kind===`property`?t.push(e):o.access===`readwrite`?n.push(e):r.push(e)}let a=[];return t.length>0&&a.push({key:`nameplate`,label:`Nameplate`,icon:(0,q.jsx)(ce,{className:`size-3`}),members:t,accentClass:`text-muted-foreground`}),n.length>0&&a.push({key:`commands`,label:`Commands`,icon:(0,q.jsx)(ye,{className:`size-3`}),members:n,accentClass:`text-info`}),r.length>0&&a.push({key:`process`,label:`Process Tags`,icon:(0,q.jsx)(A,{className:`size-3`}),members:r,accentClass:`text-primary`}),i.length>0&&a.push({key:`health`,label:`Health & Status`,icon:(0,q.jsx)(ve,{className:`size-3`}),members:i,accentClass:`text-success`}),a}function Ce({modelName:e,onClose:t}){let[n,r]=(0,K.useState)(new Set([`nameplate`,`process`])),a=f({queryKey:l.catalog.modelSchema(e??``),queryFn:()=>c(`/catalog/models/${e}`,i.catalogModelDetail),enabled:e!==null}),o=a.data,s=a.isPending&&!o,u=a.isError,d=H(a.error,`Failed to load model.`);(0,K.useEffect)(()=>{e&&r(new Set([`nameplate`,`process`]))},[e]);let m=(0,K.useMemo)(()=>o?Se(o.members):[],[o]),h=(0,K.useCallback)(e=>{r(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),g=o?Object.keys(o.members).length:0,_=o?Object.keys(o.methods).length:0;return(0,q.jsx)(ue,{open:e!==null,onOpenChange:e=>{e||t()},children:(0,q.jsx)(oe,{side:`right`,className:`flex w-full flex-col gap-4 touch-manipulation`,children:s?null:u&&!o?(0,q.jsx)(`div`,{className:`flex flex-1 flex-col justify-center px-2`,children:(0,q.jsx)(L,{message:d,onRetry:()=>void a.refetch(),isRetrying:a.isFetching})}):o?(0,q.jsxs)(p.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.18},className:`flex min-h-0 flex-1 flex-col gap-4`,children:[(0,q.jsxs)(fe,{className:`gap-1 pb-0 pe-12`,children:[(0,q.jsx)(se,{className:`font-heading text-base uppercase tracking-wide`,children:E(o.name)}),o.description&&(0,q.jsx)(le,{className:`text-xs leading-relaxed text-foreground/88`,children:o.description}),(0,q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,q.jsxs)(B,{variant:`outline`,className:`font-mono text-xs`,children:[g,` members`]}),(0,q.jsxs)(B,{variant:`outline`,className:`font-mono text-xs`,children:[_,` methods`]}),(0,q.jsxs)(B,{variant:`outline`,className:`font-mono text-xs`,children:[o.faults.length,` faults`]}),o.lifecycle&&(0,q.jsxs)(B,{variant:`outline`,className:`font-mono text-xs text-primary`,children:[o.lifecycle.stages.length,`-stage lifecycle`]})]})]}),(0,q.jsxs)(he,{defaultValue:`overview`,className:`flex min-h-0 flex-1 flex-col gap-1 pt-0`,children:[(0,q.jsxs)(me,{variant:`line`,className:`h-8! shrink-0 gap-0.5 border-b-border/60 px-2 py-0.5`,children:[(0,q.jsx)(U,{value:`overview`,className:`min-h-10 px-2 py-1 text-xs text-foreground/82 after:bottom-[-3px] data-active:text-foreground sm:min-h-0 sm:px-2.5 sm:py-1`,children:`Overview`}),(0,q.jsx)(U,{value:`export`,className:`min-h-10 px-2 py-1 text-xs text-foreground/82 after:bottom-[-3px] data-active:text-foreground sm:min-h-0 sm:px-2.5 sm:py-1`,children:`Export`})]}),(0,q.jsx)(W,{value:`overview`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-2`,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5 pb-1 pt-0.5`,children:[m.map(e=>(0,q.jsx)(J,{sectionKey:e.key,label:e.label,count:e.members.length,icon:e.icon,accentClass:e.accentClass,expanded:n.has(e.key),onToggle:h,children:(0,q.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.members.map(e=>(0,q.jsx)(we,{member:e},e.name))})},e.key)),o.faults.length>0&&(0,q.jsx)(J,{sectionKey:`faults`,label:`Faults`,count:o.faults.length,icon:(0,q.jsx)(pe,{className:`size-3`}),accentClass:`text-warning`,expanded:n.has(`faults`),onToggle:h,children:(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:o.faults.map(e=>(0,q.jsx)(B,{variant:`secondary`,className:`text-[10px] text-warning`,children:w(e)},e))})}),o.lifecycle&&(0,q.jsx)(J,{sectionKey:`lifecycle`,label:`Lifecycle`,count:o.lifecycle.stages.length,icon:(0,q.jsx)(_e,{className:`size-3`}),accentClass:`text-primary`,expanded:n.has(`lifecycle`),onToggle:h,children:(0,q.jsx)(Te,{lifecycle:o.lifecycle})}),_>0&&(0,q.jsx)(J,{sectionKey:`methods`,label:`Methods`,count:_,icon:(0,q.jsx)(be,{className:`size-3`}),accentClass:`text-info`,expanded:n.has(`methods`),onToggle:h,children:(0,q.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:Object.entries(o.methods).map(([e,t])=>(0,q.jsx)(Ee,{name:e,method:t},e))})})]})})})}),(0,q.jsx)(W,{value:`export`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,q.jsx)(de,{kind:`model`,id:o.name,yamlPath:`/catalog/models/${o.name}/yaml`,yamlFilename:`${o.name}.asset.yaml`})})})]})]},o.name):(0,q.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Model not found`})})})}function J({sectionKey:e,label:t,count:n,icon:r,accentClass:i,expanded:a,onToggle:o,children:s}){return(0,q.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50`,children:[(0,q.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 px-2.5 py-1.5 text-left text-xs font-medium transition-colors hover:bg-muted/30`,onClick:()=>o(e),children:[(0,q.jsx)(`span`,{className:i,children:r}),(0,q.jsx)(`span`,{className:`uppercase tracking-wider`,children:t}),(0,q.jsx)(B,{variant:`secondary`,className:`ml-auto text-[10px]`,children:n}),(0,q.jsx)(j,{className:`size-3 text-muted-foreground transition-transform ${a?`rotate-180`:``}`})]}),(0,q.jsx)(m,{initial:!1,children:a&&(0,q.jsx)(p.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden`,children:(0,q.jsx)(`div`,{className:`border-t px-2.5 py-1.5`,children:s})},`content`)})]})}function we({member:e}){return(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 py-0.5 text-xs`,children:[(0,q.jsx)(`span`,{title:e.name,className:`min-w-0 truncate font-mono text-foreground`,children:C(e.name)}),(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:e.dataType}),e.unit&&(0,q.jsx)(B,{variant:`outline`,className:`px-1 py-0 text-[10px]`,children:e.unit}),e.euRange&&(0,q.jsxs)(`span`,{className:`ml-auto font-mono text-xs text-muted-foreground`,children:[`[`,e.euRange[0],`–`,e.euRange[1],`]`]})]})}var Y={healthy:`bg-success`,normal:`bg-success`,degraded:`bg-warning`,critical:`bg-destructive`,failed:`bg-destructive`};function Te({lifecycle:e}){let t=e.stages.length;return(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsx)(`div`,{className:`flex h-2.5 w-full overflow-hidden rounded-full bg-muted`,children:e.stages.map((e,n)=>(0,q.jsx)(`div`,{className:`transition-[background-color] ${Y[e]??`bg-chart-1`} ${n===0?`rounded-l-full`:``} ${n===t-1?`rounded-r-full`:``}`,style:{width:`${100/t}%`}},`${e}-${n}`))}),(0,q.jsx)(`div`,{className:`flex items-center gap-3`,children:e.stages.map((e,t)=>(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,q.jsx)(`span`,{className:`size-2 rounded-full ${Y[e]??`bg-chart-1`}`}),(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:w(e)})]},`${e}-${t}`))}),(0,q.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[`~`,T(e.totalHours),` total hours`]})]})}function Ee({name:e,method:t}){return(0,q.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:e}),t.inputArguments.length>0&&(0,q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t.inputArguments.map(e=>`${e.name}: ${e.dataType}`).join(`, `),`)`]})]}),t.description&&(0,q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.description})]})}var X=[{value:`mqtt`,label:`MQTT`},{value:`opcua`,label:`OPC UA`},{value:`modbus`,label:`Modbus`}];function De({value:e,onChange:t,className:n}){let r=(0,K.useId)(),i=new Set(e),a=u(e=>e.availableAdapters),o=X.filter(e=>i.has(e.value)&&a.some(t=>t.name===e.value&&!t.enabled));return(0,q.jsxs)(`fieldset`,{className:k(`min-w-0`,n),children:[(0,q.jsx)(`legend`,{className:`mb-2 text-xs font-medium text-foreground`,children:`Protocol exposure`}),(0,q.jsx)(`div`,{className:`grid min-w-0 gap-2 sm:grid-cols-3`,children:X.map(n=>(0,q.jsxs)(V,{htmlFor:`${r}-${n.value}`,className:`min-w-0 rounded-[var(--miravo-radius-tight)] border border-border/80 px-2.5 py-2 text-xs`,children:[(0,q.jsx)(ge,{id:`${r}-${n.value}`,checked:i.has(n.value),onCheckedChange:r=>{let i=e.filter(e=>e!==n.value);r===!0&&i.push(n.value),t(i)}}),(0,q.jsx)(`span`,{children:n.label})]},n.value))}),(0,q.jsx)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:e.length>0?`${e.length} selected`:`Default: enabled adapters`}),o.length>0&&(0,q.jsxs)(`p`,{role:`status`,className:`mt-1 text-[11px] text-warning`,children:[`Spawning will also enable the `,o.map(e=>e.label).join(`, `),` `,o.length===1?`adapter`:`adapters`,` and open`,` `,o.length===1?`its port`:`their ports`,`.`]})]})}function Oe(e,t){let[n,r]=(0,K.useState)(e);return(0,K.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Z(e){let t=e.trim();return t===``?{}:a(t)===null?{assetPrefix:t}:{assetName:t}}function ke(e){return e.settled&&e.isSuccess&&!e.isFetching?e.data??null:null}var Ae=300;function je(e){return e instanceof s?e.result.error?`${e.result.message} ${e.result.error}`:e.message:e instanceof Error?e.message:`Could not preview the spawn.`}function Me({modelName:e,count:t,onClose:n}){let[i,a]=(0,K.useState)(``),[s,c]=(0,K.useState)([]),[p,m]=(0,K.useState)(!1),C=te(),w=u(e=>e.assets.map(e=>e.id).join(`,`)),T=d();(0,K.useEffect)(()=>{T.invalidateQueries({queryKey:l.spawnPreviewAll})},[w,T]),(0,K.useEffect)(()=>{e!==null&&(a(``),c([]))},[e]);let O=r(i),A=Oe(i,Ae),j=Z(A),M=A===i,N=f({queryKey:l.spawnPreview(e??``,t,A.trim(),s.join(`,`)),queryFn:async()=>{let n=await o({type:`spawn`,model:e??``,count:t,dryRun:!0,...j,...s.length>0?{protocolScope:s}:{}});return Array.isArray(n.data)?n.data:[]},enabled:e!==null&&r(A)===null,retry:!1,gcTime:0,staleTime:0}),P=O??(M&&N.isError?je(N.error):null),F=ke({settled:M,...N}),I=async()=>{if(e===null)return;let r=Z(i);m(!0);try{await C.mutateAsync({type:`spawn`,model:e,count:t,...r,...s.length>0?{protocolScope:s}:{}}),n()}catch{}finally{m(!1)}};return(0,q.jsx)(b,{open:e!==null,onOpenChange:e=>{e||n()},children:(0,q.jsxs)(_,{className:`min-w-0 sm:max-w-md`,children:[(0,q.jsxs)(h,{children:[(0,q.jsx)(v,{children:`Spawn assets?`}),(0,q.jsx)(y,{children:e!==null&&(0,q.jsxs)(q.Fragment,{children:[`This spawns `,t,` asset`,t===1?``:`s`,` of`,` `,(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:E(e)}),` `,`into the running factory.`]})})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,q.jsx)(V,{htmlFor:`spawn-asset-target`,className:`text-xs font-medium text-foreground`,children:`ID or prefix`}),(0,q.jsx)(S,{id:`spawn-asset-target`,value:i,maxLength:120,onChange:e=>a(e.target.value),placeholder:`Default`,className:k(`min-w-0 font-mono text-xs`,P&&`border-destructive`),"aria-invalid":P!=null,"aria-describedby":`spawn-asset-target-hint spawn-asset-target-preview`}),(0,q.jsx)(`p`,{id:`spawn-asset-target-hint`,className:`min-w-0 wrap-break-word text-[11px] text-muted-foreground`,children:`A name ending in a number (pump-007) is an exact ID and needs a count of 1. Anything else is a prefix (pump gives pump-001, pump-002).`}),(0,q.jsx)(`p`,{id:`spawn-asset-target-preview`,role:`status`,className:k(`min-w-0 wrap-break-word text-[11px]`,P?`text-destructive`:`text-muted-foreground`),children:P??(F===null?`Checking IDs...`:(0,q.jsxs)(q.Fragment,{children:[`Will likely create`,` `,(0,q.jsx)(`span`,{className:`break-all font-mono text-foreground`,children:D(F)})]}))})]}),(0,q.jsx)(De,{value:s,onChange:c})]}),(0,q.jsxs)(g,{children:[(0,q.jsx)(x,{variant:`outline`,disabled:p,onClick:n,children:`Cancel`}),(0,q.jsx)(x,{disabled:p||e===null||O!=null||F===null,onClick:()=>void I(),children:p?`Spawning...`:`Spawn`})]})]})})}var Q=[`builtin`,`personal`];function Ne(){let[e,t]=(0,K.useState)(``),[n,r]=(0,K.useState)(`all`),[a,o]=(0,K.useState)({}),[s,u]=(0,K.useState)(null),[d,h]=(0,K.useState)(null),g=(0,K.useRef)(null);(0,K.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.tagName;t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||(e.preventDefault(),g.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let _=f({queryKey:l.catalog.models(),queryFn:()=>c(`/catalog/models`,i.catalogModels)}),v=_.data??[],y=_.isPending&&!_.data,b=_.isError&&!_.data,x=_.isError&&!!_.data,C=H(_.error,`Failed to load models.`),w=e=>a[e]??1,T=(0,K.useCallback)((e,t)=>{o(n=>({...n,[e]:Math.max(1,Math.min(10,t))}))},[]),E=(0,K.useCallback)(e=>{h(e)},[]),D=(0,K.useCallback)(e=>{u(e)},[]),O=(0,K.useMemo)(()=>{let e={all:v.length};for(let t of Q)e[t]=0;for(let t of v){let n=z(t.source);e[n]=(e[n]??0)+1}return e},[v]),A=e.toLowerCase(),j=v.filter(e=>n===`all`||z(e.source)===n).filter(e=>A?e.name.toLowerCase().includes(A)||(e.description?.toLowerCase().includes(A)??!1):!0);return(0,q.jsxs)(`div`,{className:`@container/models mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Asset Model Library`}),(0,q.jsx)(B,{variant:`outline`,className:`text-xs`,children:b?(0,q.jsx)(`span`,{className:`text-destructive`,children:`Unavailable`}):y&&v.length===0?(0,q.jsx)(q.Fragment,{children:`Loading...`}):(0,q.jsxs)(q.Fragment,{children:[v.length,` models`]})})]}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Canonical asset models with realistic physics, lifecycle degradation, and fault modes. Inspect to explore schema, copy YAML, or export.`})]}),b&&(0,q.jsx)(L,{message:C,onRetry:()=>void _.refetch(),isRetrying:_.isFetching}),x&&(0,q.jsx)(L,{message:`${C} Showing cached models.`,onRetry:()=>void _.refetch(),isRetrying:_.isFetching}),!b&&(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,q.jsxs)(`div`,{className:`relative max-w-xs flex-1 min-w-[14rem]`,children:[(0,q.jsx)(ie,{className:`absolute left-2.5 top-2.5 size-4 text-muted-foreground`}),(0,q.jsx)(S,{ref:g,placeholder:`Filter models...`,value:e,onChange:e=>t(e.target.value),className:`pl-9 pr-7`}),!e&&(0,q.jsx)(`kbd`,{className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded-[var(--miravo-radius-tight)] border border-border bg-muted px-1 font-mono text-[10px] text-muted-foreground`,children:`/`})]}),(0,q.jsx)(Fe,{value:n,counts:O,onChange:r})]}),(0,q.jsx)(`div`,{className:`grid grid-cols-1 gap-4 @[720px]/models:grid-cols-2 @[1120px]/models:grid-cols-3`,"aria-busy":y&&!b,children:b?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(m,{children:j.map((e,t)=>(0,q.jsx)(p.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,scale:.96,transition:{duration:.15}},transition:{type:`spring`,stiffness:380,damping:30,delay:t*.04},className:`grid`,children:(0,q.jsx)(Pe,{model:e,count:w(e.name),onCountChange:T,onInspect:E,onSpawn:D})},e.name))}),j.length===0&&v.length>0&&(0,q.jsx)(`p`,{className:`col-span-full py-8 text-center text-sm text-muted-foreground`,children:`No models match the current filters.`})]})}),v.length>0&&(0,q.jsx)(`div`,{className:k(P,`p-0`),children:(0,q.jsx)(`div`,{className:`community-teaser relative overflow-hidden rounded-[inherit]`,children:(0,q.jsx)(`div`,{className:`relative z-10 mx-auto max-w-3xl px-5 py-10 sm:px-10 sm:py-12`,children:(0,q.jsxs)(`div`,{className:`grid items-center gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,17rem)]`,children:[(0,q.jsxs)(`div`,{className:`order-2 flex min-w-0 flex-col gap-4 lg:order-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,q.jsx)(`p`,{className:`blueprint-title text-primary`,children:`Future channel`}),(0,q.jsx)(`span`,{className:`blueprint-stat text-[10px] text-muted-foreground`,children:`MIRAVO_REGISTRY · NOT_CONNECTED`})]}),(0,q.jsx)(`h2`,{className:`font-heading text-xl font-semibold tracking-tight sm:text-2xl`,children:`Community Models`}),(0,q.jsx)(`p`,{className:`max-w-xl text-sm leading-relaxed text-muted-foreground`,children:`Publish your custom asset models to the Miravo registry. Discover equipment models from other engineers, fork them, and adapt parameters for your use case.`}),(0,q.jsx)(`div`,{children:(0,q.jsx)(B,{variant:`outline`,className:`community-teaser-soon border-primary/35 bg-primary/5 text-[10px] text-primary`,children:`Coming Soon`})})]}),(0,q.jsx)(`div`,{className:`order-1 flex justify-center lg:order-2 lg:justify-end`,children:(0,q.jsxs)(`div`,{className:`community-teaser-module relative flex w-full max-w-[14rem] flex-col items-center justify-center gap-3 border border-primary/15 bg-muted/15 py-8 sm:max-w-[15.5rem] sm:py-10`,"aria-hidden":!0,children:[(0,q.jsx)(`div`,{className:`community-teaser-icon-ring relative z-[1] flex size-[4.25rem] items-center justify-center rounded-[var(--miravo-radius-tight)] border border-primary/35 bg-gradient-to-br from-primary/18 to-primary/5`,children:(0,q.jsx)(re,{className:`size-9 text-primary`,"aria-hidden":!0})}),(0,q.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] tracking-[0.18em] text-muted-foreground`,children:`AWAITING SIGNAL`}),(0,q.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] text-muted-foreground`,children:`Uplink idle`})]})})]})})})}),(0,q.jsx)(Me,{modelName:s,count:s===null?1:w(s),onClose:()=>u(null)}),(0,q.jsx)(Ce,{modelName:d,onClose:()=>h(null)})]})}var Pe=(0,K.memo)(function({model:e,count:t,onCountChange:n,onInspect:r,onSpawn:i}){return(0,q.jsxs)(`div`,{className:k(ee,`flex flex-col gap-4 p-5`),children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] bg-primary/10 text-primary`,children:(0,q.jsx)(G,{className:`size-4`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-0.5`,children:[(0,q.jsx)(`span`,{className:`font-heading text-sm font-semibold uppercase tracking-wide`,children:E(e.name)}),e.description&&(0,q.jsx)(`span`,{className:`line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-muted-foreground`,children:[(0,q.jsx)($,{label:`mbr`,value:e.memberCount}),(0,q.jsx)($,{label:`mth`,value:e.methodCount}),(0,q.jsx)($,{label:`flt`,value:e.faultCount}),e.hasLifecycle&&(0,q.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,children:[(0,q.jsx)(`span`,{className:`text-[10px]`,children:`◈`}),(0,q.jsxs)(`span`,{children:[e.lifecycleStageCount,`-stage`]})]}),(0,q.jsx)(B,{variant:`outline`,className:k(`ml-auto shrink-0 font-sans text-[10px] font-medium uppercase tracking-wide`,ae(e.source)),children:R(e.source)})]}),(0,q.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 border-t border-border/30 pt-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center rounded-[var(--miravo-radius-tight)] border bg-muted/30`,children:[(0,q.jsx)(x,{variant:`ghost`,size:`icon`,className:`size-7 rounded-none rounded-l-md`,disabled:t<=1,"aria-label":`Decrease count`,onClick:r=>{r.stopPropagation(),n(e.name,t-1)},children:(0,q.jsx)(N,{className:`size-3`})}),(0,q.jsx)(`span`,{className:`flex size-7 items-center justify-center border-x font-mono text-xs`,children:t}),(0,q.jsx)(x,{variant:`ghost`,size:`icon`,className:`size-7 rounded-none rounded-r-md`,disabled:t>=10,"aria-label":`Increase count`,onClick:r=>{r.stopPropagation(),n(e.name,t+1)},children:(0,q.jsx)(ne,{className:`size-3`})})]}),(0,q.jsxs)(x,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(e.name),className:F,children:[(0,q.jsx)(M,{className:`size-3.5`,"aria-hidden":!0}),`Inspect`]}),(0,q.jsxs)(x,{size:`sm`,className:`ml-auto`,onClick:()=>i(e.name),children:[(0,q.jsx)(I,{className:`mr-1 size-3`}),`Spawn`]})]})]})});function $({label:e,value:t}){return(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`span`,{className:`text-foreground`,children:t}),` `,(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:e})]})}function Fe({value:e,counts:t,onChange:n}){return(0,q.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`radiogroup`,"aria-label":`Filter by source`,children:[{id:`all`,label:`All`},...Q.map(e=>({id:e,label:R(e)}))].map(r=>{let i=e===r.id,a=t[r.id]??0,o=r.id!==`all`&&a===0;return(0,q.jsxs)(`label`,{className:k(`inline-flex h-7 items-center gap-1.5 rounded-[var(--miravo-radius-pill)] border px-3 text-xs font-medium transition-colors`,i?`border-primary/60 bg-primary/15 text-primary`:`border-border/60 bg-card/30 text-muted-foreground hover:border-border hover:bg-muted/40 hover:text-foreground`,o?`cursor-not-allowed opacity-40 hover:border-border/60 hover:bg-card/30 hover:text-muted-foreground`:`cursor-pointer`),children:[(0,q.jsx)(`input`,{type:`radio`,name:`models-source-filter`,value:r.id,checked:i,disabled:o,onChange:()=>n(r.id),className:`sr-only`}),(0,q.jsx)(`span`,{children:r.label}),(0,q.jsx)(`span`,{className:`font-mono text-[10px] text-foreground`,children:a})]},r.id)})})}export{G as n,Ne as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{C as r,a as i,b as a,c as o,d as s,f as c,l,m as u,n as d,s as f}from"./dom-CQuChC3G.js";import{n as p,t as m}from"./by-path-e6y8DTMV.js";import{A as ee,C as h,D as g,E as _,F as v,H as te,I as ne,L as re,O as ie,P as ae,T as oe,V as se,X as ce,_ as le,a as ue,b as de,d as fe,g as pe,h as me,i as he,j as ge,k as y,n as _e,o as ve,r as ye,s as be,t as xe,w as Se,x as Ce,y as we}from"./status-DNfdEhTs.js";import{r as Te,t as Ee}from"./chiller-Jug0vRg-.js";import{i as De,n as Oe,r as ke,t as Ae}from"./tank-xgQfMS2d.js";import{t as je}from"./stages-C0cErwSQ.js";import{a as Me,i as Ne,n as Pe,o as Fe,r as Ie,s as Le,t as Re}from"./rtu-BR4DhLbE.js";import{a as ze,n as Be,o as Ve,r as He,t as Ue}from"./boiler-BQwqgoVY.js";var We=[[`gowning`,`cleanroom-zone`,`cleanrooms`,`gowning`,0],[`zoneD`,`cleanroom-zone`,`cleanrooms`,`grade-d`,0],[`zoneC`,`cleanroom-zone`,`cleanrooms`,`grade-c`,0],[`zoneB`,`cleanroom-zone`,`cleanrooms`,`grade-b`,0],[`rtuA`,`hvac-rtu`,`make-up-air`,`rooftop-units`,0],[`rtuB`,`hvac-rtu`,`make-up-air`,`rooftop-units`,1],[`chillerA`,`industrial-chiller`,`utilities`,`chilled-water`,0],[`chillerB`,`industrial-chiller`,`utilities`,`chilled-water`,1],[`pumpA`,`centrifugal-pump`,`utilities`,`chilled-water`,0],[`pumpB`,`centrifugal-pump`,`utilities`,`chilled-water`,1],[`buffer`,`storage-tank`,`utilities`,`chilled-water`,0],[`steam`,`hot-water-boiler`,`utilities`,`clean-steam`,0]],Ge=e=>m(We,e);function Ke(e){let t=(e,t,n)=>({key:e,assetId:e,name:t,kind:`utility`,area:n});return[t(e.gowning,`Gowning room`,`Cleanrooms`),t(e.zoneD,`Grade D room`,`Cleanrooms`),t(e.zoneC,`Grade C room`,`Cleanrooms`),t(e.zoneB,`Grade B room`,`Cleanrooms`),t(e.rtuA,`Make-up air unit 1`,`Make-up air`),t(e.rtuB,`Make-up air unit 2`,`Make-up air`),t(e.chillerA,`Chiller 1 (duty)`,`Utilities`),t(e.chillerB,`Chiller 2 (standby)`,`Utilities`),t(e.pumpA,`Chilled-water pump 1`,`Utilities`),t(e.pumpB,`Chilled-water pump 2`,`Utilities`),t(e.buffer,`Chilled-water buffer`,`Utilities`),t(e.steam,`Clean steam generator`,`Utilities`)]}var qe=60,Je=600,Ye=1.4,Xe=16,Ze=1.3;function Qe(e){let{svg:t,P:n,feed:a}=e,s=(e,t)=>a.num(e,t),c=d(t,`[data-air]`).map(e=>{let n=be(e),r=e=>d(t,`[data-asset="${n}"] ${e}`),[i=``,a=`0`,o=`0`]=(e.dataset.air??``).split(`|`),s=i.split(` `).filter(Boolean).map(Number),c=r(`[data-fan]`)[0],l=r(`[data-door]`)[0],u=h(t,n);return{id:n,terminals:s,ty:Number(a),tz:Number(o),streams:s.map(()=>oe(e,10,`path`,`cr-stream`)),fan:c,fanAt:f(c?.dataset.fan),door:l,doorAt:f(l?.dataset.door),doorLamp:r(`[data-door-lamp]`)[0],hum:r(`[data-hum]`)[0],pm:r(`[data-pm]`)[0],staff:r(`[data-staff]`)[0],foul:r(`[data-foul]`),spin:0,rate:0,fall:0,swing:0,fanHeat:Ce(u,3,2),roomHeat:Ce(u,4,3),inleak:we(u)}}),l=new Map(c.map(e=>[e.id,e])),u=e=>s(e,`fan_speed`)>1?pe(s(e,`airflow_fraction`)):0;return{draw(t,l,d){let f=e.reducedMotion();for(let e of c){let c=t=>d&&Se(a,e.id,t);e.rate=le(e.rate,s(e.id,`fan_speed`)/100*Ye,t,.8,f),f||(e.spin+=e.rate*me*t),e.fan&&o(e.fan,`d`,fe(n,e.fanAt,e.spin));let[p=0,m=0,ee=0]=e.fanAt;e.fanHeat.draw(c(`supply_fan_degraded`)&&!f,l,n,[p,m,ee]);let h=u(e.id);f||(e.fall+=h*Xe*t);for(let[t,a]of e.terminals.entries())for(let s of e.streams[t]??[]){if(!d||f||h<.02||s.seed>.2+h){i(s.el,`0`);continue}let t=e.tz-2,c=(e.fall+s.seed*t*3.7)%t,l=a+(s.seed*997%1-.5)*18,u=e.ty+(s.seed*577%1-.5)*14,p=r([l,u,e.tz-c],n),m=r([l,u,e.tz-c-4],n);o(s.el,`d`,`M${p[0].toFixed(1)} ${p[1].toFixed(1)}L${m[0].toFixed(1)} ${m[1].toFixed(1)}`),i(s.el,(Math.sin(Math.PI*c/t)*.5).toFixed(2))}if(e.swing=le(e.swing,s(e.id,`door_open`)>0?Ze:0,t,.45,f),e.door){let[t=0,i=0,a=0,s=0,c=0,l=0,u=0,d=0]=e.doorAt,f=(a*Math.cos(e.swing)+c*Math.sin(e.swing))*u,p=(s*Math.cos(e.swing)+l*Math.sin(e.swing))*u,m=[[t,i,0],[t+f,i+p,0],[t+f,i+p,d],[t,i,d]];o(e.door,`d`,`M${m.map(e=>r(e,n).map(e=>e.toFixed(1)).join(` `)).join(`L`)}Z`)}o(e.doorLamp,`data-s`,c(`door_left_open`)&&Math.sin(l*6)>0?`a`:null);let[g=0,_=0,v=0,te=0,ne=0,re=0,ie=0,ae=0]=e.doorAt;e.inleak.draw(c(`pressure_cascade_loss`)&&!f,l,n,[g+v*ie*.5,_+te*ie*.5,ae*.4],[ne,re]);let oe=s(e.id,`running`)>0?a.num(e.id,`particle_action`)>0?`r`:a.num(e.id,`particle_alert`)>0?`a`:`g`:null;o(e.pm,`data-s`,oe);let se=c(`humidifier_failure`)||c(`humidifier_trip`);o(e.hum,`data-s`,se?Math.sin(l*6)>0?`a`:null:s(e.id,`humidifier_output`)>1?`g`:null),e.staff&&(e.staff.style.opacity=s(e.id,`staffed`)>0?`1`:`0`);let ce=c(`hepa_filter_loading`)?`0.85`:`0`;for(let t of e.foul)t.style.opacity=ce;e.roomHeat.draw(c(`cooling_loss`)&&!f,l,n,[e.terminals[0]??0,e.ty+40,14])}},bar(e){return l.has(e)?pe(s(e,`fan_speed`)/100):void 0},needle(e){let[t=``,n]=e.split(`:`);if(l.has(t))return n===`dp`?s(t,`differential_pressure`)/qe:s(t,`hepa_filter_dp`)/Je},airPu:u,humPu:e=>pe(s(e,`humidifier_output`)/100)}}var b=44,x=[84,108],$e=[12,36],S=36,C=3;function et(e,t){return`<path class="cr-glass" d="${e.k.pathOf(t.map(t=>e.at(t)),!0)}"/>`}function tt(e,t,n,r,i){let{slab:a}=e,o=[a({x:t-1,y:n,w:2,d:r-n,r:.3},0,C,{tone:`mid`},2,0)],s=i?[[n,i[0]],[i[1],r]]:[[n,r]];for(let[n=0,r=0]of s)o.push(et(e,[[t,n,C],[t,r,C],[t,r,b-C],[t,n,b-C]]));let c=new Set([n,r,...i??[],...s.flatMap(([e=0,t=0])=>t-e>60?[(e+t)/2]:[])]);for(let e of c)o.push(a({x:t-1.3,y:e-1.3,w:2.6,d:2.6,r:.3},0,b,{tone:`mid`},2,0));return o.push(a({x:t-1.1,y:n,w:2.2,d:r-n,r:.3},b-C,C,{tone:`mid`},2,0)),i&&o.push(a({x:t-1.1,y:i[0],w:2.2,d:i[1]-i[0],r:.3},S,b-C-S,{tone:`mid`},2,0)),o.join(``)}function nt(e,t,n,r,i){let{slab:a}=e,o=[a({x:n,y:t-1,w:r-n,d:2,r:.3},0,C,{tone:`mid`},2,0)],s=[n,...i.flat(),r];for(let n=0;n<s.length;n+=2){let r=s[n]??0,i=s[n+1]??0;o.push(et(e,[[r,t,C],[i,t,C],[i,t,b-C],[r,t,b-C]]));let c=Math.max(1,Math.round((i-r)/40));for(let e=0;e<=c;e++){let n=r+(i-r)*e/c;o.push(a({x:n-1.3,y:t-1.3,w:2.6,d:2.6,r:.3},0,b,{tone:`mid`},2,0))}}o.push(a({x:n,y:t-1.1,w:r-n,d:2.2,r:.3},b-C,C,{tone:`mid`},2,0));for(let[e,n]of i)o.push(a({x:e,y:t-1.1,w:n-e,d:2.2,r:.3},S,b-C-S,{tone:`mid`},2,0));return o.join(``)}function rt(e,t,n){let{cyl:r,slab:i}=e;return`<g class="cr-staff cr-white" data-staff="" style="opacity:0">`+r(t-1.6,n,1.3,0,10,{tone:`hi`,crease:`none`},12)+r(t+1.6,n,1.3,0,10,{tone:`hi`,crease:`none`},12)+r(t,n,3.4,9,10,{tone:`hi`},20)+r(t,n,2.3,19,4.6,{tone:`hi`},16)+i({x:t-1.6,y:n+1.6,w:3.2,d:.8,r:.3},21,1.4,{tone:`lo`},1,0)+`</g>`}function it(e,t){let{slab:n,cyl:r,D:i,P:a}=e,{x0:o,x1:s}=t,c=(e,t,n,i,a)=>[e+1.5,e+n-1.5].flatMap(e=>[t+1.5,t+i-1.5].map(t=>r(e,t,.8,0,a,{tone:`mid`,crease:`none`},8))).join(``),l=e=>`<g class="cr-white">${e}</g>`,u=(e,t,r,i)=>c(e,t,r,i,16)+l(n({x:e,y:t,w:r,d:i,r:.6},16,1.6,{tone:`hi`},2,.2));switch(t.kind){case`gowning`:return n({x:o+2,y:8,w:9,d:56,r:.4},0,34,{tone:`mid`},2,.2)+u(o+16,58,s-o-20,5)+l(n({x:o+19,y:0,w:30,d:2.4,r:.3},33,1.2,{tone:`hi`},1,0)+[o+22,o+32,o+42].map(e=>n({x:e,y:1,w:6,d:1.6,r:.4},14,18,{tone:`hi`},1,0)).join(``));case`grade-d`:{let t=o+16,[i,a,c,d]=[o+60,50,22,12],f=(e,t,n,i,a=1)=>r(e,t,a,n,i,{tone:`hi`,crease:`none`},10),p=[i+1.5,i+c-1.5].flatMap(e=>[a+1.5,a+d-1.5].map(t=>[e,t])),m=p.map(([e,t])=>r(e,t,1.5,0,2,{tone:`lo`,crease:`none`},10)).join(``)+l(p.map(([e,t])=>f(e,t,2,21)).join(``)+[7,14.5,22].map(e=>n({x:i,y:a,w:c,d,r:.4},e,.8,{tone:`hi`},1,0)).join(``)+[i+1.5,i+c-1.5].map(e=>f(e,a+d-1.5,22.8,9,.7)).join(``)+n({x:i,y:a+d-2.2,w:c,d:1.4,r:.3},31.2,1.2,{tone:`hi`},1,0)+n({x:i+4,y:a+3,w:12,d:6,r:.8},22.8,4,{tone:`mid`},1,.2));return n({x:t,y:2,w:34,d:26,r:1},0,38,{tone:`mid`},2,.4)+`<g transform="${e.front(28)}"><path class="cr-window" d="M${t+5} -30H${t+29}V-12H${t+5}Z"/></g>`+m+u(s-46,18,40,12)}case`grade-c`:{let e=o+34;return[0,1,2].map(t=>r(e+Math.cos(t*2.1)*9,52+Math.sin(t*2.1)*9,.9,0,10,{tone:`mid`,crease:`none`},8)).join(``)+l(r(e,52,12,8,4,{tone:`hi`},36)+r(e,52,13,12,14,{tone:`hi`},40)+r(e,52,11,26,3,{tone:`hi`},36))+r(e,52,3,29,3,{tone:`mid`},16)+u(s-50,20,42,12)}case`grade-b`:{let t=o+12,r=s-o-24,c=[.25,.5,.75].flatMap(e=>[[t+r*e-4,64,27],[t+r*e+4,64,27]]);return n({x:t,y:40,w:r,d:24,r:1},0,18,{tone:`mid`},2,.4)+l(n({x:t+4,y:46,w:r-8,d:8,r:.4},18,2,{tone:`hi`},1,0))+i(Array.from({length:Math.floor((r-12)/4)},(n,r)=>e.at([t+6+r*4,50,21])),{size:.7})+et(e,[[t,64,18],[t+r,64,18],[t+r,64,38],[t,64,38]])+et(e,[[t+r,40,18],[t+r,64,18],[t+r,64,38],[t+r,40,38]])+n({x:t,y:40,w:r,d:24,r:1},38,1.6,{tone:`mid`},2,.2)+c.map(t=>`<circle class="cr-port" cx="${e.at(t)[0].toFixed(2)}" cy="${e.at(t)[1].toFixed(2)}" r="${(1.6*a.scale).toFixed(2)}"/>`).join(``)}default:return t.kind}}var at={gowning:[.6,80],"grade-d":[.3,76],"grade-c":[.6,70],"grade-b":[.5,74]};function ot(e,t,n,r,i){let{k:a,P:o,S:s,L:c,slab:l,at:u}=e,{x0:d,x1:f}=n,p=f-d,m=[],ee=[];for(let e=d+20;e<f;e+=20)ee.push(a.segment([e,0,.6],[e,120,.6],o));m.push(s(a.slabOf({x:d,y:0,w:p,d:120,r:0},0,.6,o,1,0),{tone:`lo`,inner:c(ee.join(``),{tone:`faint`})})),r&&m.push(l({x:d-4,y:-4,w:4,d:124,r:.3},0,b,{tone:`mid`},2,0)),m.push(l({x:d,y:-4,w:p,d:4,r:.3},0,b,{tone:`mid`},2,0));let h=e.front(0),g=n.terminals.map(e=>{let t=[4.5,6,7.5].map(t=>`M${e-7} ${-t}H${e+7}`).join(``);return`<path class="cr-grille" d="M${e-8} -9H${e+8}V-3H${e-8}Z"/><path class="iso-line" data-tone="faint" d="${t}"/>`}).join(``);m.push(`<g transform="${h}">${g}</g>`),m.push(ne(h,`${t}:dp`,d+10,30,3.6)),m.push(l({x:d+17,y:0,w:7,d:2.4,r:.4},26,8,{tone:`mid`},1,.2));let _=u([d+20.5,2.4,31]);m.push(`<circle class="cr-pm" data-pm="" cx="${_[0].toFixed(2)}" cy="${_[1].toFixed(2)}" r="${(.9*o.scale).toFixed(2)}"/>`),m.push(it(e,n));let[v,te]=at[n.kind];m.push(rt(e,d+p*v,te));for(let e of n.terminals)m.push(`<g class="cr-white">${l({x:e-11,y:21,w:22,d:18,r:1},36,3,{tone:`hi`},2,.3)}</g>`);m.push(`<g class="cr-air" data-air="${n.terminals.join(` `)}|30|36"></g>`);let[re,ie,ae,oe,se,ce,le]=n.entry===`west`?[d,x[1],0,-1,1,0,x[1]-x[0]]:[d+$e[0],120,1,0,0,-1,$e[1]-$e[0]];m.push(`<path class="cr-door" data-door="${re},${ie},${ae},${oe},${se},${ce},${le},${S}" d=""/>`);let ue=u(n.entry===`west`?[d+1.4,x[0]-3,S+3]:[re+le+3,118.6,S+3]);return m.push(`<circle class="cr-lamp" data-door-lamp="" cx="${ue[0].toFixed(2)}" cy="${ue[1].toFixed(2)}" r="${(.8*o.scale).toFixed(2)}"/>`),i&&m.push(tt(e,f,0,120,x)),m.join(``)}function st(e,t){let n=t[0],r=t[t.length-1];if(!n||!r)return``;let i=t.filter(e=>e.entry===`south`).map(e=>[e.x0+$e[0],e.x0+$e[1]]);return tt(e,r.x1,-4,120)+nt(e,120,n.x0-4,r.x1,i)}function ct(e,t,n){let{slab:r}=e,i=[],a=Math.max(2,Math.round(t.w/90));for(let e=0;e<=a;e++){let o=t.x+3+(t.w-6)*e/a;for(let e of[t.y+3,t.y+t.d-3])i.push(r({x:o-1.6,y:e-1.6,w:3.2,d:3.2,r:.3},0,n-3,{tone:`mid`},2,0))}return i.push(r(t,n-3,3,{tone:`mid`},2,.3)),i.push(r({x:t.x,y:t.y+t.d-1,w:t.w,d:1,r:.2},n,2,{tone:`lo`},1,0)),i.join(``)}var lt=1e3,w=[{kind:`gowning`,x0:-330,x1:-260,terminals:[-295],entry:`south`},{kind:`grade-d`,x0:-260,x1:-120,terminals:[-196,-158],entry:`west`},{kind:`grade-c`,x0:-120,x1:0,terminals:[-90,-35],entry:`west`},{kind:`grade-b`,x0:0,x1:110,terminals:[30,80],entry:`west`}],ut={x:-342,y:-10,w:464,d:160,r:8},dt={x:-336,y:-64,w:452,d:60,r:2},ft={x:-342,y:-400,w:530,d:250,r:8},pt={x:-362,y:-425,w:570,d:595,r:16},mt=a([...u(pt,-21,-14),...u(ut,-14,60),...u(dt,-14,120),...u(ft,-14,110)],lt,620,{pad:22,azimuth:60}),ht=-36,gt=e=>Math.min(e.x1-e.x0-14,120),_t=e=>[(e.x0+e.x1)/2,ht,49],vt=e=>{let[t,n,r]=_t(e),i=Fe(gt(e)),a=e=>[t+e[0],n+e[1],r+e[2]];return{intake:a(i.intake),chwSupply:a(i.chwSupply),chwReturn:a(i.chwReturn),steam:a(i.steam),discharge:a(i.discharge)}},yt=[-202,-135,0],bt=[[-192,-366],[-296,-366]],xt=[-34,36.6,40],St=[-20,36.6,40],Ct=[94,-130,0],T=.8,wt=[[-80,-280],[30,-280]],Tt=e=>[(e[0]-Ct[0])*T,(e[1]-Ct[1])*T,e[2]*T],Et=Tt(ae),Dt=Tt(ee),Ot=[120,-360],E={r:20,h:58,windowX:5,nozzles:[{angle:0,z:0,r:2.6,role:`inlet`,roof:[-10,-5]},{angle:180,z:Et[2],r:2.6,role:`outlet`}]},D=[-38,-360],kt=.72,At=[[128,-250],[-195,-246]],jt=je([...w.map(e=>({key:`ahu-${e.kind}`,at:[_t(e)[0],ht],h:83})),...w.map(e=>({key:e.kind,at:[(e.x0+e.x1)/2,0],h:36})),...bt.map((e,t)=>({key:`chiller${t}`,at:e,h:56})),...wt.map((e,t)=>({key:`pump${t}`,at:e,h:45*T})),...At.map((e,t)=>({key:`rtu${t}`,at:[e[0]+Ie[0],e[1]+Ie[1]],h:40})),{key:`buffer`,at:Ot,h:E.h+10},{key:`steam`,at:D,h:60}],mt),Mt=jt.order,Nt=jt.slotDepths,Pt=jt.depth,O=(e,t,n=1)=>[e[0]+t[0]*n,e[1]+t[1]*n,t[2]*n],k=(e,t,n,r)=>[t??e[0],n??e[1],r??e[2]],Ft=e=>{let t=E.nozzles.find(t=>t.role===e);return t?O(Ot,ke(E,t)):[0,0,0]},[A=[0,0],It=[0,0]]=bt,[j=[0,0],M=[0,0]]=wt,[Lt=[0,0],Rt=[0,0]]=At,N=e=>{let t=w.find(t=>t.kind===e);if(!t)throw Error(`No room of kind '${e}'. Add it to ROOMS in scene.ts.`);return vt(t)},P=-305,F=72,I=-318,L=84,R=[-130,34],z=[O(D,ze,kt)[0]-16,54],B=[40,108],zt=-300,V=-82,Bt=108,H=-74,Vt=108,U=-66,Ht=108,W=92,Ut=-90,G=6,Wt=30,K=e=>O(e,[Dt[0],Dt[1],Dt[2]-3*T]),q=e=>O(e,Et),J=Ft(`outlet`),Y=q(M)[0]+13,Gt=-302,Kt=q(j)[0]+8,X=e=>O(e,xt),Z=e=>O(e,St),qt=O(D,ze,kt),Jt=O(D,He,kt),Yt=e=>O(e,Ie),Xt=-410,Zt=e=>w.map(t=>e(N(t.kind))[0]),Qt=(e,...t)=>{let n=[...Zt(e),...t];return[Math.min(...n)-G,Math.max(...n)+G]},$t=new Map([[`chws:w`,Zt(e=>e.chwSupply).filter(e=>e<R[0]).length],[`chws:e`,Zt(e=>e.chwSupply).filter(e=>e>R[0]).length],[`chwr:w`,Zt(e=>e.chwReturn).filter(e=>e<B[0]).length],[`chwr:e`,Zt(e=>e.chwReturn).filter(e=>e>B[0]).length]]),en=(e,t,n,[r,i],a,o,s,c)=>[{id:`${e}:w`,medium:t,r:n,...c?{blind:[!0,!1],pts:[[r,o,s],[a,o,s]]}:{blind:[!1,!0],pts:[[a,o,s],[r,o,s]]}},{id:`${e}:e`,medium:t,r:n,...c?{blind:[!1,!0],reverse:!0,pts:[[a,o,s],[i,o,s]]}:{blind:[!1,!0],pts:[[a,o,s],[i,o,s]]}}],tn=w.flatMap(e=>{let t=N(e.kind);return[{id:`chws:${e.kind}`,medium:`coolant`,r:1.8,pts:[k(t.chwSupply,null,H,Vt),k(t.chwSupply,null,H,W),k(t.chwSupply,null,null,W),t.chwSupply]},{id:`chwr:${e.kind}`,medium:`coolantret`,r:1.8,pts:[t.chwReturn,k(t.chwReturn,null,null,W),k(t.chwReturn,null,U,W),k(t.chwReturn,null,U,Ht)]},{id:`steam:${e.kind}`,medium:`steam`,r:1.6,pts:[k(t.steam,null,V,Bt),k(t.steam,null,V,W),k(t.steam,null,null,W),t.steam]}]}),nn=w.flatMap(e=>{let t=N(e.kind).discharge,[n=0,...r]=e.terminals,i=e=>[[e,Wt,t[2]],[e,Wt,39]];return[{id:`supply:${e.kind}`,medium:`duct`,r:3,bare:[!1,!0],pts:[t,k(t,null,Wt,null),...i(n)]},...r.map((t,n)=>({id:`supply:${e.kind}:${n+2}`,medium:`duct`,r:3,bare:[!1,!0],pts:i(t)}))]}),rn=(e,t,[n,...r])=>{let i=Yt(t),a=N(n??`gowning`).intake,o=a[2];return[{id:`oa:${e}`,medium:`duct`,r:4,pts:[i,k(i,null,null,o),[i[0],Ut,o],k(a,null,Ut,null),a]},...r.map((t,n)=>({id:`oa:${e}:${n+2}`,medium:`duct`,r:4,pts:[k(N(t).intake,null,Ut,null),N(t).intake]}))]},an=[...tn,{id:`suction`,medium:`coolantret`,r:2.6,pts:[J,k(J,Y,null,null),[Y,Gt,J[2]]]},{id:`suction:standby`,medium:`coolantret`,r:2.6,pts:[[Y,Gt,J[2]],k(q(M),Y,null,null),q(M)]},{id:`suction:duty`,medium:`coolantret`,r:2.6,pts:[[Y,Gt,J[2]],[Kt,Gt,J[2]],k(q(j),Kt,null,null),q(j)]},...[[`a`,A],[`b`,It]].map(([e,t])=>({id:`out:${e}`,medium:`coolant`,r:2.2,pts:[Z(t),k(Z(t),null,I,null),k(Z(t),null,I,L)]})),{id:`chws:b`,medium:`coolant`,r:2.6,blind:[!0,!1],pts:[[Z(It)[0]-G,I,L],[Z(A)[0],I,L]]},{id:`chws`,medium:`coolant`,r:2.6,pts:[[Z(A)[0],I,L],[R[0],I,L],[R[0],I,R[1]],[R[0],H,R[1]],[R[0],H,Vt]]},...[[`duty`,j],[`standby`,M]].map(([e,t])=>({id:`discharge:${e}`,medium:`coolantret`,r:3.2*T,fromStub:!0,pts:[K(t),k(K(t),null,null,F),k(K(t),null,P,F)]})),{id:`header:standby`,medium:`coolantret`,r:2.6,blind:[!0,!1],pts:[[K(M)[0]+G,P,F],[K(j)[0],P,F]]},{id:`header`,medium:`coolantret`,r:2.6,pts:[[K(j)[0],P,F],[X(A)[0],P,F]]},{id:`header:b`,medium:`coolantret`,r:2.6,blind:[!1,!0],pts:[[X(A)[0],P,F],[X(It)[0]-G,P,F]]},...[[`a`,A],[`b`,It]].map(([e,t])=>({id:`in:${e}`,medium:`coolantret`,r:2.2,pts:[k(X(t),null,P,F),k(X(t),null,P,null),X(t)]})),...en(`chws`,`coolant`,2.6,Qt(e=>e.chwSupply),R[0],H,Vt,!1),...en(`chwr`,`coolantret`,2.6,Qt(e=>e.chwReturn),B[0],U,Ht,!0),{id:`chwr`,medium:`coolantret`,r:2.6,pts:[[B[0],U,Ht],[B[0],zt,B[1]],[Ft(`inlet`)[0],zt,B[1]],k(Ft(`inlet`),null,null,B[1]),Ft(`inlet`)]},{id:`steam`,medium:`steam`,r:1.8,pts:[qt,k(qt,null,null,z[1]),k(qt,z[0],null,z[1]),[z[0],V,z[1]],[z[0],V,Bt]]},...en(`steam`,`steam`,1.8,Qt(e=>e.steam),z[0],V,Bt,!1),{id:`feed`,medium:`pw`,r:1.6,reverse:!0,bare:[!1,!0],pts:[Jt,k(Jt,null,null,50),k(Jt,null,Xt,50),k(Jt,null,Xt,-14)]},...rn(`a`,Lt,[`grade-c`,`grade-b`]),...rn(`b`,Rt,[`gowning`,`grade-d`]),...nn],on=[[R[0],2.6,R[1]],[B[0],2.6,B[1]],[z[0],1.8,z[1]],[Yt(Lt)[0],4,N(`grade-b`).intake[2]],[Yt(Rt)[0],4,N(`grade-b`).intake[2]]],sn={z:10,flanged:!0,routes:an,posts:[...on.map(([e,t,n])=>[e,-110,t,n]),...on.map(([e,t,n])=>[e,-190,t,n,0]),[-300,P,2.6,F,0],[-300,I,2.6,L,0],...[-250,-110,40].map(e=>[e,H,2.6,Vt]),...[-230,-90,45].map(e=>[e,U,2.6,Ht]),...[-240,-110,40].map(e=>[e,V,1.8,Bt])]},Q=e=>e>.002?6+26*pe(e*2):0,cn=e=>{let{svg:t,feed:n,ids:r}=e,i=de(t),a=Qe(e),o=Re(e,i),s=Ee(e,i),c=ye(e,i),l=Ae(e),u=Ue(e,i),d=[a,o,s,c,l,u],f=he(e,e=>_e(n,e,`availability`)),p=ve(e,{needle:e=>a.needle(e)??s.needle(e)??u.needle(e)??0,bar:e=>d.reduce((t,n)=>t??n.bar(e),void 0)??0,alertsHigh:()=>!0,ready:()=>!0}),m=new Map([[`gowning`,r.gowning],[`grade-d`,r.zoneD],[`grade-c`,r.zoneC],[`grade-b`,r.zoneB]]),ee=new Map([[`a`,r.chillerA],[`b`,r.chillerB]]),h=()=>c.flowPu(r.pumpA)+c.flowPu(r.pumpB),g=e=>{let t=[r.chillerA,r.chillerB].filter(e=>n.num(e,`coolant_flow_rate`)>0);return t.includes(e)?h()/t.length:0},_=e=>$t.get(e)??0,v=(...e)=>e.reduce((e,t)=>e+a.humPu(m.get(t)??``),0),te=ue(e,({id:e})=>{let[t=``,n=``]=e.split(`:`),i=m.get(n);switch(t){case`suction`:case`discharge`:return Q(n===`duty`?c.flowPu(r.pumpA):n===`standby`?c.flowPu(r.pumpB):h());case`header`:return Q(n===`b`?g(r.chillerB):n===`standby`?c.flowPu(r.pumpB):h());case`in`:case`out`:return Q(g(ee.get(n)??``));case`chws`:case`chwr`:return Q(i?h()/m.size:n===`b`?g(r.chillerB):n===`w`||n===`e`?h()*_(e)/m.size:h());case`steam`:return Q(i?a.humPu(i):n===`w`?v(`gowning`,`grade-d`,`grade-c`):n===`e`?v(`grade-b`):v(...m.keys()));case`feed`:return Q(v(...m.keys()));case`oa`:return Q(o.airPu(n===`a`?r.rtuA:r.rtuB));case`supply`:return Q(a.airPu(i??``));default:return 0}});return{data(e){f.draw(e)},draw({sdt:e,t,introDone:n}){te.draw(e),p.draw(e,t);for(let r of d)r.draw(e,t,n)},resync(){},status:e=>xe(n,e,`availability`)}},ln=e(t(),1),$=n(),un={x:-248,y:-164,w:92,d:58,r:3},dn=Oe(E),fn=(e,t)=>v(e,t,`coolantret`,!0),pn=(e,t)=>De(e,t,E),mn=(e,t)=>Ve(e,t,6),hn=e=>st(e,w);function gn({ids:e}){let t=c(),n=_(sn,Pt),r=(0,ln.useMemo)(()=>re(t,pt)+t.plinth(ut)+t.plinth(ft)+ct(t,dt,49),[t]),i=e=>(0,$.jsx)(s,{html:`${n.layers[e]??``}<g data-flows="${e}" data-depth="${e===0?-1e9:Nt[e-1]??0}"></g>`,data:{pipes:``}},`pipes-${e}`),a={gowning:e.gowning,"grade-d":e.zoneD,"grade-c":e.zoneC,"grade-b":e.zoneB},o={buffer:(0,$.jsx)(g,{to:y(Ot),children:(0,$.jsx)(l,{id:e.buffer,plan:dn,intro:14,draw:pn})}),steam:(0,$.jsx)(g,{to:y(D),scale:kt,children:(0,$.jsx)(l,{id:e.steam,plan:Be,intro:15,draw:mn})})};for(let[e,t]of w.entries()){let n=a[t.kind],r=(n,r)=>ot(n,r,t,e===0,e<w.length-1),i={x:t.x0,y:0,w:t.x1-t.x0,d:120,r:2},s=gt(t);o[t.kind]=(0,$.jsx)(l,{id:n,plan:i,intro:2+e,draw:r}),o[`ahu-${t.kind}`]=(0,$.jsx)(g,{to:_t(t),children:(0,$.jsx)(l,{id:n,plan:Me(s),intro:6+e,draw:(e,t)=>Le(e,t,s)})})}for(let[t,n]of bt.entries())o[`chiller${t}`]=(0,$.jsx)(g,{from:yt,to:y(n),children:(0,$.jsx)(l,{id:t?e.chillerB:e.chillerA,plan:un,intro:10+t,draw:Te})});for(let[t,n]of wt.entries())o[`pump${t}`]=(0,$.jsx)(g,{from:Ct,to:y(n),scale:T,children:(0,$.jsx)(l,{id:t?e.pumpB:e.pumpA,plan:ge,intro:12+t,draw:fn})});for(let[t,n]of At.entries())o[`rtu${t}`]=(0,$.jsx)(g,{to:y(n),children:(0,$.jsx)(l,{id:t?e.rtuB:e.rtuA,plan:Pe,intro:16+t,draw:Ne})});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(s,{html:r,data:{plinth:``}}),i(0),Mt.flatMap((e,t)=>[(0,$.jsx)(`g`,{children:o[e.key]},e.key),i(t+1)]),(0,$.jsx)(ie,{build:hn,intro:18})]})}var _n=se(mt),vn=te(_n,sn,Pt),yn=ce({layout:{width:lt,height:620,label:`Isometric model of the Pharma Cleanroom suite: the gowning room and the Grade D, C and B rooms along a viewing corridor, each with its air handler on the mezzanine above; and the utilities yard with two make-up air units, two chillers and their chilled-water pumps, the buffer tank and the clean-steam generator. Every moving part follows live values from the running engine.`,kit:_n,flows:vn.flows,joints:vn.joints,Scene:gn,compose:cn},resolve:Ge,things:Ke,caption:`cleanrooms · air handling · utilities`,mismatch:`This floor expects the Pharma Cleanroom suite: the gowning, Grade D, C and B rooms, two make-up air units, two chillers and two chilled-water pumps, the buffer tank and the clean-steam generator, by area and line.`,statusBasis:`availability`,Overview:p,tab:`Suite`});export{yn as pharmaFloor};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{C as r,a as i,b as a,c as o,d as s,f as c,l,m as u,n as d,s as f}from"./dom-CQuChC3G.js";import{n as p,t as m}from"./by-path-CGbqDnvK.js";import{A as ee,C as h,D as g,E as _,F as v,H as te,I as ne,L as re,O as ie,P as ae,T as oe,V as se,X as ce,_ as le,a as ue,b as de,d as fe,g as pe,h as me,i as he,j as ge,k as y,n as _e,o as ve,r as ye,s as be,t as xe,w as Se,x as Ce,y as we}from"./status-DNfdEhTs.js";import{r as Te,t as Ee}from"./chiller-Jug0vRg-.js";import{i as De,n as Oe,r as ke,t as Ae}from"./tank-xgQfMS2d.js";import{t as je}from"./stages-C0cErwSQ.js";import{a as Me,i as Ne,n as Pe,o as Fe,r as Ie,s as Le,t as Re}from"./rtu-BR4DhLbE.js";import{a as ze,n as Be,o as Ve,r as He,t as Ue}from"./boiler-BQwqgoVY.js";var We=[[`gowning`,`cleanroom-zone`,`cleanrooms`,`gowning`,0],[`zoneD`,`cleanroom-zone`,`cleanrooms`,`grade-d`,0],[`zoneC`,`cleanroom-zone`,`cleanrooms`,`grade-c`,0],[`zoneB`,`cleanroom-zone`,`cleanrooms`,`grade-b`,0],[`rtuA`,`hvac-rtu`,`make-up-air`,`rooftop-units`,0],[`rtuB`,`hvac-rtu`,`make-up-air`,`rooftop-units`,1],[`chillerA`,`industrial-chiller`,`utilities`,`chilled-water`,0],[`chillerB`,`industrial-chiller`,`utilities`,`chilled-water`,1],[`pumpA`,`centrifugal-pump`,`utilities`,`chilled-water`,0],[`pumpB`,`centrifugal-pump`,`utilities`,`chilled-water`,1],[`buffer`,`storage-tank`,`utilities`,`chilled-water`,0],[`steam`,`hot-water-boiler`,`utilities`,`clean-steam`,0]],Ge=e=>m(We,e);function Ke(e){let t=(e,t,n)=>({key:e,assetId:e,name:t,kind:`utility`,area:n});return[t(e.gowning,`Gowning room`,`Cleanrooms`),t(e.zoneD,`Grade D room`,`Cleanrooms`),t(e.zoneC,`Grade C room`,`Cleanrooms`),t(e.zoneB,`Grade B room`,`Cleanrooms`),t(e.rtuA,`Make-up air unit 1`,`Make-up air`),t(e.rtuB,`Make-up air unit 2`,`Make-up air`),t(e.chillerA,`Chiller 1 (duty)`,`Utilities`),t(e.chillerB,`Chiller 2 (standby)`,`Utilities`),t(e.pumpA,`Chilled-water pump 1`,`Utilities`),t(e.pumpB,`Chilled-water pump 2`,`Utilities`),t(e.buffer,`Chilled-water buffer`,`Utilities`),t(e.steam,`Clean steam generator`,`Utilities`)]}var qe=60,Je=600,Ye=1.4,Xe=16,Ze=1.3;function Qe(e){let{svg:t,P:n,feed:a}=e,s=(e,t)=>a.num(e,t),c=d(t,`[data-air]`).map(e=>{let n=be(e),r=e=>d(t,`[data-asset="${n}"] ${e}`),[i=``,a=`0`,o=`0`]=(e.dataset.air??``).split(`|`),s=i.split(` `).filter(Boolean).map(Number),c=r(`[data-fan]`)[0],l=r(`[data-door]`)[0],u=h(t,n);return{id:n,terminals:s,ty:Number(a),tz:Number(o),streams:s.map(()=>oe(e,10,`path`,`cr-stream`)),fan:c,fanAt:f(c?.dataset.fan),door:l,doorAt:f(l?.dataset.door),doorLamp:r(`[data-door-lamp]`)[0],hum:r(`[data-hum]`)[0],pm:r(`[data-pm]`)[0],staff:r(`[data-staff]`)[0],foul:r(`[data-foul]`),spin:0,rate:0,fall:0,swing:0,fanHeat:Ce(u,3,2),roomHeat:Ce(u,4,3),inleak:we(u)}}),l=new Map(c.map(e=>[e.id,e])),u=e=>s(e,`fan_speed`)>1?pe(s(e,`airflow_fraction`)):0;return{draw(t,l,d){let f=e.reducedMotion();for(let e of c){let c=t=>d&&Se(a,e.id,t);e.rate=le(e.rate,s(e.id,`fan_speed`)/100*Ye,t,.8,f),f||(e.spin+=e.rate*me*t),e.fan&&o(e.fan,`d`,fe(n,e.fanAt,e.spin));let[p=0,m=0,ee=0]=e.fanAt;e.fanHeat.draw(c(`supply_fan_degraded`)&&!f,l,n,[p,m,ee]);let h=u(e.id);f||(e.fall+=h*Xe*t);for(let[t,a]of e.terminals.entries())for(let s of e.streams[t]??[]){if(!d||f||h<.02||s.seed>.2+h){i(s.el,`0`);continue}let t=e.tz-2,c=(e.fall+s.seed*t*3.7)%t,l=a+(s.seed*997%1-.5)*18,u=e.ty+(s.seed*577%1-.5)*14,p=r([l,u,e.tz-c],n),m=r([l,u,e.tz-c-4],n);o(s.el,`d`,`M${p[0].toFixed(1)} ${p[1].toFixed(1)}L${m[0].toFixed(1)} ${m[1].toFixed(1)}`),i(s.el,(Math.sin(Math.PI*c/t)*.5).toFixed(2))}if(e.swing=le(e.swing,s(e.id,`door_open`)>0?Ze:0,t,.45,f),e.door){let[t=0,i=0,a=0,s=0,c=0,l=0,u=0,d=0]=e.doorAt,f=(a*Math.cos(e.swing)+c*Math.sin(e.swing))*u,p=(s*Math.cos(e.swing)+l*Math.sin(e.swing))*u,m=[[t,i,0],[t+f,i+p,0],[t+f,i+p,d],[t,i,d]];o(e.door,`d`,`M${m.map(e=>r(e,n).map(e=>e.toFixed(1)).join(` `)).join(`L`)}Z`)}o(e.doorLamp,`data-s`,c(`door_left_open`)&&Math.sin(l*6)>0?`a`:null);let[g=0,_=0,v=0,te=0,ne=0,re=0,ie=0,ae=0]=e.doorAt;e.inleak.draw(c(`pressure_cascade_loss`)&&!f,l,n,[g+v*ie*.5,_+te*ie*.5,ae*.4],[ne,re]);let oe=s(e.id,`running`)>0?a.num(e.id,`particle_action`)>0?`r`:a.num(e.id,`particle_alert`)>0?`a`:`g`:null;o(e.pm,`data-s`,oe);let se=c(`humidifier_failure`)||c(`humidifier_trip`);o(e.hum,`data-s`,se?Math.sin(l*6)>0?`a`:null:s(e.id,`humidifier_output`)>1?`g`:null),e.staff&&(e.staff.style.opacity=s(e.id,`staffed`)>0?`1`:`0`);let ce=c(`hepa_filter_loading`)?`0.85`:`0`;for(let t of e.foul)t.style.opacity=ce;e.roomHeat.draw(c(`cooling_loss`)&&!f,l,n,[e.terminals[0]??0,e.ty+40,14])}},bar(e){return l.has(e)?pe(s(e,`fan_speed`)/100):void 0},needle(e){let[t=``,n]=e.split(`:`);if(l.has(t))return n===`dp`?s(t,`differential_pressure`)/qe:s(t,`hepa_filter_dp`)/Je},airPu:u,humPu:e=>pe(s(e,`humidifier_output`)/100)}}var b=44,x=[84,108],$e=[12,36],S=36,C=3;function et(e,t){return`<path class="cr-glass" d="${e.k.pathOf(t.map(t=>e.at(t)),!0)}"/>`}function tt(e,t,n,r,i){let{slab:a}=e,o=[a({x:t-1,y:n,w:2,d:r-n,r:.3},0,C,{tone:`mid`},2,0)],s=i?[[n,i[0]],[i[1],r]]:[[n,r]];for(let[n=0,r=0]of s)o.push(et(e,[[t,n,C],[t,r,C],[t,r,b-C],[t,n,b-C]]));let c=new Set([n,r,...i??[],...s.flatMap(([e=0,t=0])=>t-e>60?[(e+t)/2]:[])]);for(let e of c)o.push(a({x:t-1.3,y:e-1.3,w:2.6,d:2.6,r:.3},0,b,{tone:`mid`},2,0));return o.push(a({x:t-1.1,y:n,w:2.2,d:r-n,r:.3},b-C,C,{tone:`mid`},2,0)),i&&o.push(a({x:t-1.1,y:i[0],w:2.2,d:i[1]-i[0],r:.3},S,b-C-S,{tone:`mid`},2,0)),o.join(``)}function nt(e,t,n,r,i){let{slab:a}=e,o=[a({x:n,y:t-1,w:r-n,d:2,r:.3},0,C,{tone:`mid`},2,0)],s=[n,...i.flat(),r];for(let n=0;n<s.length;n+=2){let r=s[n]??0,i=s[n+1]??0;o.push(et(e,[[r,t,C],[i,t,C],[i,t,b-C],[r,t,b-C]]));let c=Math.max(1,Math.round((i-r)/40));for(let e=0;e<=c;e++){let n=r+(i-r)*e/c;o.push(a({x:n-1.3,y:t-1.3,w:2.6,d:2.6,r:.3},0,b,{tone:`mid`},2,0))}}o.push(a({x:n,y:t-1.1,w:r-n,d:2.2,r:.3},b-C,C,{tone:`mid`},2,0));for(let[e,n]of i)o.push(a({x:e,y:t-1.1,w:n-e,d:2.2,r:.3},S,b-C-S,{tone:`mid`},2,0));return o.join(``)}function rt(e,t,n){let{cyl:r,slab:i}=e;return`<g class="cr-staff cr-white" data-staff="" style="opacity:0">`+r(t-1.6,n,1.3,0,10,{tone:`hi`,crease:`none`},12)+r(t+1.6,n,1.3,0,10,{tone:`hi`,crease:`none`},12)+r(t,n,3.4,9,10,{tone:`hi`},20)+r(t,n,2.3,19,4.6,{tone:`hi`},16)+i({x:t-1.6,y:n+1.6,w:3.2,d:.8,r:.3},21,1.4,{tone:`lo`},1,0)+`</g>`}function it(e,t){let{slab:n,cyl:r,D:i,P:a}=e,{x0:o,x1:s}=t,c=(e,t,n,i,a)=>[e+1.5,e+n-1.5].flatMap(e=>[t+1.5,t+i-1.5].map(t=>r(e,t,.8,0,a,{tone:`mid`,crease:`none`},8))).join(``),l=e=>`<g class="cr-white">${e}</g>`,u=(e,t,r,i)=>c(e,t,r,i,16)+l(n({x:e,y:t,w:r,d:i,r:.6},16,1.6,{tone:`hi`},2,.2));switch(t.kind){case`gowning`:return n({x:o+2,y:8,w:9,d:56,r:.4},0,34,{tone:`mid`},2,.2)+u(o+16,58,s-o-20,5)+l(n({x:o+19,y:0,w:30,d:2.4,r:.3},33,1.2,{tone:`hi`},1,0)+[o+22,o+32,o+42].map(e=>n({x:e,y:1,w:6,d:1.6,r:.4},14,18,{tone:`hi`},1,0)).join(``));case`grade-d`:{let t=o+16,[i,a,c,d]=[o+60,50,22,12],f=(e,t,n,i,a=1)=>r(e,t,a,n,i,{tone:`hi`,crease:`none`},10),p=[i+1.5,i+c-1.5].flatMap(e=>[a+1.5,a+d-1.5].map(t=>[e,t])),m=p.map(([e,t])=>r(e,t,1.5,0,2,{tone:`lo`,crease:`none`},10)).join(``)+l(p.map(([e,t])=>f(e,t,2,21)).join(``)+[7,14.5,22].map(e=>n({x:i,y:a,w:c,d,r:.4},e,.8,{tone:`hi`},1,0)).join(``)+[i+1.5,i+c-1.5].map(e=>f(e,a+d-1.5,22.8,9,.7)).join(``)+n({x:i,y:a+d-2.2,w:c,d:1.4,r:.3},31.2,1.2,{tone:`hi`},1,0)+n({x:i+4,y:a+3,w:12,d:6,r:.8},22.8,4,{tone:`mid`},1,.2));return n({x:t,y:2,w:34,d:26,r:1},0,38,{tone:`mid`},2,.4)+`<g transform="${e.front(28)}"><path class="cr-window" d="M${t+5} -30H${t+29}V-12H${t+5}Z"/></g>`+m+u(s-46,18,40,12)}case`grade-c`:{let e=o+34;return[0,1,2].map(t=>r(e+Math.cos(t*2.1)*9,52+Math.sin(t*2.1)*9,.9,0,10,{tone:`mid`,crease:`none`},8)).join(``)+l(r(e,52,12,8,4,{tone:`hi`},36)+r(e,52,13,12,14,{tone:`hi`},40)+r(e,52,11,26,3,{tone:`hi`},36))+r(e,52,3,29,3,{tone:`mid`},16)+u(s-50,20,42,12)}case`grade-b`:{let t=o+12,r=s-o-24,c=[.25,.5,.75].flatMap(e=>[[t+r*e-4,64,27],[t+r*e+4,64,27]]);return n({x:t,y:40,w:r,d:24,r:1},0,18,{tone:`mid`},2,.4)+l(n({x:t+4,y:46,w:r-8,d:8,r:.4},18,2,{tone:`hi`},1,0))+i(Array.from({length:Math.floor((r-12)/4)},(n,r)=>e.at([t+6+r*4,50,21])),{size:.7})+et(e,[[t,64,18],[t+r,64,18],[t+r,64,38],[t,64,38]])+et(e,[[t+r,40,18],[t+r,64,18],[t+r,64,38],[t+r,40,38]])+n({x:t,y:40,w:r,d:24,r:1},38,1.6,{tone:`mid`},2,.2)+c.map(t=>`<circle class="cr-port" cx="${e.at(t)[0].toFixed(2)}" cy="${e.at(t)[1].toFixed(2)}" r="${(1.6*a.scale).toFixed(2)}"/>`).join(``)}default:return t.kind}}var at={gowning:[.6,80],"grade-d":[.3,76],"grade-c":[.6,70],"grade-b":[.5,74]};function ot(e,t,n,r,i){let{k:a,P:o,S:s,L:c,slab:l,at:u}=e,{x0:d,x1:f}=n,p=f-d,m=[],ee=[];for(let e=d+20;e<f;e+=20)ee.push(a.segment([e,0,.6],[e,120,.6],o));m.push(s(a.slabOf({x:d,y:0,w:p,d:120,r:0},0,.6,o,1,0),{tone:`lo`,inner:c(ee.join(``),{tone:`faint`})})),r&&m.push(l({x:d-4,y:-4,w:4,d:124,r:.3},0,b,{tone:`mid`},2,0)),m.push(l({x:d,y:-4,w:p,d:4,r:.3},0,b,{tone:`mid`},2,0));let h=e.front(0),g=n.terminals.map(e=>{let t=[4.5,6,7.5].map(t=>`M${e-7} ${-t}H${e+7}`).join(``);return`<path class="cr-grille" d="M${e-8} -9H${e+8}V-3H${e-8}Z"/><path class="iso-line" data-tone="faint" d="${t}"/>`}).join(``);m.push(`<g transform="${h}">${g}</g>`),m.push(ne(h,`${t}:dp`,d+10,30,3.6)),m.push(l({x:d+17,y:0,w:7,d:2.4,r:.4},26,8,{tone:`mid`},1,.2));let _=u([d+20.5,2.4,31]);m.push(`<circle class="cr-pm" data-pm="" cx="${_[0].toFixed(2)}" cy="${_[1].toFixed(2)}" r="${(.9*o.scale).toFixed(2)}"/>`),m.push(it(e,n));let[v,te]=at[n.kind];m.push(rt(e,d+p*v,te));for(let e of n.terminals)m.push(`<g class="cr-white">${l({x:e-11,y:21,w:22,d:18,r:1},36,3,{tone:`hi`},2,.3)}</g>`);m.push(`<g class="cr-air" data-air="${n.terminals.join(` `)}|30|36"></g>`);let[re,ie,ae,oe,se,ce,le]=n.entry===`west`?[d,x[1],0,-1,1,0,x[1]-x[0]]:[d+$e[0],120,1,0,0,-1,$e[1]-$e[0]];m.push(`<path class="cr-door" data-door="${re},${ie},${ae},${oe},${se},${ce},${le},${S}" d=""/>`);let ue=u(n.entry===`west`?[d+1.4,x[0]-3,S+3]:[re+le+3,118.6,S+3]);return m.push(`<circle class="cr-lamp" data-door-lamp="" cx="${ue[0].toFixed(2)}" cy="${ue[1].toFixed(2)}" r="${(.8*o.scale).toFixed(2)}"/>`),i&&m.push(tt(e,f,0,120,x)),m.join(``)}function st(e,t){let n=t[0],r=t[t.length-1];if(!n||!r)return``;let i=t.filter(e=>e.entry===`south`).map(e=>[e.x0+$e[0],e.x0+$e[1]]);return tt(e,r.x1,-4,120)+nt(e,120,n.x0-4,r.x1,i)}function ct(e,t,n){let{slab:r}=e,i=[],a=Math.max(2,Math.round(t.w/90));for(let e=0;e<=a;e++){let o=t.x+3+(t.w-6)*e/a;for(let e of[t.y+3,t.y+t.d-3])i.push(r({x:o-1.6,y:e-1.6,w:3.2,d:3.2,r:.3},0,n-3,{tone:`mid`},2,0))}return i.push(r(t,n-3,3,{tone:`mid`},2,.3)),i.push(r({x:t.x,y:t.y+t.d-1,w:t.w,d:1,r:.2},n,2,{tone:`lo`},1,0)),i.join(``)}var lt=1e3,w=[{kind:`gowning`,x0:-330,x1:-260,terminals:[-295],entry:`south`},{kind:`grade-d`,x0:-260,x1:-120,terminals:[-196,-158],entry:`west`},{kind:`grade-c`,x0:-120,x1:0,terminals:[-90,-35],entry:`west`},{kind:`grade-b`,x0:0,x1:110,terminals:[30,80],entry:`west`}],ut={x:-342,y:-10,w:464,d:160,r:8},dt={x:-336,y:-64,w:452,d:60,r:2},ft={x:-342,y:-400,w:530,d:250,r:8},pt={x:-362,y:-425,w:570,d:595,r:16},mt=a([...u(pt,-21,-14),...u(ut,-14,60),...u(dt,-14,120),...u(ft,-14,110)],lt,620,{pad:22,azimuth:60}),ht=-36,gt=e=>Math.min(e.x1-e.x0-14,120),_t=e=>[(e.x0+e.x1)/2,ht,49],vt=e=>{let[t,n,r]=_t(e),i=Fe(gt(e)),a=e=>[t+e[0],n+e[1],r+e[2]];return{intake:a(i.intake),chwSupply:a(i.chwSupply),chwReturn:a(i.chwReturn),steam:a(i.steam),discharge:a(i.discharge)}},yt=[-202,-135,0],bt=[[-192,-366],[-296,-366]],xt=[-34,36.6,40],St=[-20,36.6,40],Ct=[94,-130,0],T=.8,wt=[[-80,-280],[30,-280]],Tt=e=>[(e[0]-Ct[0])*T,(e[1]-Ct[1])*T,e[2]*T],Et=Tt(ae),Dt=Tt(ee),Ot=[120,-360],E={r:20,h:58,windowX:5,nozzles:[{angle:0,z:0,r:2.6,role:`inlet`,roof:[-10,-5]},{angle:180,z:Et[2],r:2.6,role:`outlet`}]},D=[-38,-360],kt=.72,At=[[128,-250],[-195,-246]],jt=je([...w.map(e=>({key:`ahu-${e.kind}`,at:[_t(e)[0],ht],h:83})),...w.map(e=>({key:e.kind,at:[(e.x0+e.x1)/2,0],h:36})),...bt.map((e,t)=>({key:`chiller${t}`,at:e,h:56})),...wt.map((e,t)=>({key:`pump${t}`,at:e,h:45*T})),...At.map((e,t)=>({key:`rtu${t}`,at:[e[0]+Ie[0],e[1]+Ie[1]],h:40})),{key:`buffer`,at:Ot,h:E.h+10},{key:`steam`,at:D,h:60}],mt),Mt=jt.order,Nt=jt.slotDepths,Pt=jt.depth,O=(e,t,n=1)=>[e[0]+t[0]*n,e[1]+t[1]*n,t[2]*n],k=(e,t,n,r)=>[t??e[0],n??e[1],r??e[2]],Ft=e=>{let t=E.nozzles.find(t=>t.role===e);return t?O(Ot,ke(E,t)):[0,0,0]},[A=[0,0],It=[0,0]]=bt,[j=[0,0],M=[0,0]]=wt,[Lt=[0,0],Rt=[0,0]]=At,N=e=>{let t=w.find(t=>t.kind===e);if(!t)throw Error(`No room of kind '${e}'. Add it to ROOMS in scene.ts.`);return vt(t)},P=-305,F=72,I=-318,L=84,R=[-130,34],z=[O(D,ze,kt)[0]-16,54],B=[40,108],zt=-300,V=-82,Bt=108,H=-74,Vt=108,U=-66,Ht=108,W=92,Ut=-90,G=6,Wt=30,K=e=>O(e,[Dt[0],Dt[1],Dt[2]-3*T]),q=e=>O(e,Et),J=Ft(`outlet`),Y=q(M)[0]+13,Gt=-302,Kt=q(j)[0]+8,X=e=>O(e,xt),Z=e=>O(e,St),qt=O(D,ze,kt),Jt=O(D,He,kt),Yt=e=>O(e,Ie),Xt=-410,Zt=e=>w.map(t=>e(N(t.kind))[0]),Qt=(e,...t)=>{let n=[...Zt(e),...t];return[Math.min(...n)-G,Math.max(...n)+G]},$t=new Map([[`chws:w`,Zt(e=>e.chwSupply).filter(e=>e<R[0]).length],[`chws:e`,Zt(e=>e.chwSupply).filter(e=>e>R[0]).length],[`chwr:w`,Zt(e=>e.chwReturn).filter(e=>e<B[0]).length],[`chwr:e`,Zt(e=>e.chwReturn).filter(e=>e>B[0]).length]]),en=(e,t,n,[r,i],a,o,s,c)=>[{id:`${e}:w`,medium:t,r:n,...c?{blind:[!0,!1],pts:[[r,o,s],[a,o,s]]}:{blind:[!1,!0],pts:[[a,o,s],[r,o,s]]}},{id:`${e}:e`,medium:t,r:n,...c?{blind:[!1,!0],reverse:!0,pts:[[a,o,s],[i,o,s]]}:{blind:[!1,!0],pts:[[a,o,s],[i,o,s]]}}],tn=w.flatMap(e=>{let t=N(e.kind);return[{id:`chws:${e.kind}`,medium:`coolant`,r:1.8,pts:[k(t.chwSupply,null,H,Vt),k(t.chwSupply,null,H,W),k(t.chwSupply,null,null,W),t.chwSupply]},{id:`chwr:${e.kind}`,medium:`coolantret`,r:1.8,pts:[t.chwReturn,k(t.chwReturn,null,null,W),k(t.chwReturn,null,U,W),k(t.chwReturn,null,U,Ht)]},{id:`steam:${e.kind}`,medium:`steam`,r:1.6,pts:[k(t.steam,null,V,Bt),k(t.steam,null,V,W),k(t.steam,null,null,W),t.steam]}]}),nn=w.flatMap(e=>{let t=N(e.kind).discharge,[n=0,...r]=e.terminals,i=e=>[[e,Wt,t[2]],[e,Wt,39]];return[{id:`supply:${e.kind}`,medium:`duct`,r:3,bare:[!1,!0],pts:[t,k(t,null,Wt,null),...i(n)]},...r.map((t,n)=>({id:`supply:${e.kind}:${n+2}`,medium:`duct`,r:3,bare:[!1,!0],pts:i(t)}))]}),rn=(e,t,[n,...r])=>{let i=Yt(t),a=N(n??`gowning`).intake,o=a[2];return[{id:`oa:${e}`,medium:`duct`,r:4,pts:[i,k(i,null,null,o),[i[0],Ut,o],k(a,null,Ut,null),a]},...r.map((t,n)=>({id:`oa:${e}:${n+2}`,medium:`duct`,r:4,pts:[k(N(t).intake,null,Ut,null),N(t).intake]}))]},an=[...tn,{id:`suction`,medium:`coolantret`,r:2.6,pts:[J,k(J,Y,null,null),[Y,Gt,J[2]]]},{id:`suction:standby`,medium:`coolantret`,r:2.6,pts:[[Y,Gt,J[2]],k(q(M),Y,null,null),q(M)]},{id:`suction:duty`,medium:`coolantret`,r:2.6,pts:[[Y,Gt,J[2]],[Kt,Gt,J[2]],k(q(j),Kt,null,null),q(j)]},...[[`a`,A],[`b`,It]].map(([e,t])=>({id:`out:${e}`,medium:`coolant`,r:2.2,pts:[Z(t),k(Z(t),null,I,null),k(Z(t),null,I,L)]})),{id:`chws:b`,medium:`coolant`,r:2.6,blind:[!0,!1],pts:[[Z(It)[0]-G,I,L],[Z(A)[0],I,L]]},{id:`chws`,medium:`coolant`,r:2.6,pts:[[Z(A)[0],I,L],[R[0],I,L],[R[0],I,R[1]],[R[0],H,R[1]],[R[0],H,Vt]]},...[[`duty`,j],[`standby`,M]].map(([e,t])=>({id:`discharge:${e}`,medium:`coolantret`,r:3.2*T,fromStub:!0,pts:[K(t),k(K(t),null,null,F),k(K(t),null,P,F)]})),{id:`header:standby`,medium:`coolantret`,r:2.6,blind:[!0,!1],pts:[[K(M)[0]+G,P,F],[K(j)[0],P,F]]},{id:`header`,medium:`coolantret`,r:2.6,pts:[[K(j)[0],P,F],[X(A)[0],P,F]]},{id:`header:b`,medium:`coolantret`,r:2.6,blind:[!1,!0],pts:[[X(A)[0],P,F],[X(It)[0]-G,P,F]]},...[[`a`,A],[`b`,It]].map(([e,t])=>({id:`in:${e}`,medium:`coolantret`,r:2.2,pts:[k(X(t),null,P,F),k(X(t),null,P,null),X(t)]})),...en(`chws`,`coolant`,2.6,Qt(e=>e.chwSupply),R[0],H,Vt,!1),...en(`chwr`,`coolantret`,2.6,Qt(e=>e.chwReturn),B[0],U,Ht,!0),{id:`chwr`,medium:`coolantret`,r:2.6,pts:[[B[0],U,Ht],[B[0],zt,B[1]],[Ft(`inlet`)[0],zt,B[1]],k(Ft(`inlet`),null,null,B[1]),Ft(`inlet`)]},{id:`steam`,medium:`steam`,r:1.8,pts:[qt,k(qt,null,null,z[1]),k(qt,z[0],null,z[1]),[z[0],V,z[1]],[z[0],V,Bt]]},...en(`steam`,`steam`,1.8,Qt(e=>e.steam),z[0],V,Bt,!1),{id:`feed`,medium:`pw`,r:1.6,reverse:!0,bare:[!1,!0],pts:[Jt,k(Jt,null,null,50),k(Jt,null,Xt,50),k(Jt,null,Xt,-14)]},...rn(`a`,Lt,[`grade-c`,`grade-b`]),...rn(`b`,Rt,[`gowning`,`grade-d`]),...nn],on=[[R[0],2.6,R[1]],[B[0],2.6,B[1]],[z[0],1.8,z[1]],[Yt(Lt)[0],4,N(`grade-b`).intake[2]],[Yt(Rt)[0],4,N(`grade-b`).intake[2]]],sn={z:10,flanged:!0,routes:an,posts:[...on.map(([e,t,n])=>[e,-110,t,n]),...on.map(([e,t,n])=>[e,-190,t,n,0]),[-300,P,2.6,F,0],[-300,I,2.6,L,0],...[-250,-110,40].map(e=>[e,H,2.6,Vt]),...[-230,-90,45].map(e=>[e,U,2.6,Ht]),...[-240,-110,40].map(e=>[e,V,1.8,Bt])]},Q=e=>e>.002?6+26*pe(e*2):0,cn=e=>{let{svg:t,feed:n,ids:r}=e,i=de(t),a=Qe(e),o=Re(e,i),s=Ee(e,i),c=ye(e,i),l=Ae(e),u=Ue(e,i),d=[a,o,s,c,l,u],f=he(e,e=>_e(n,e,`availability`)),p=ve(e,{needle:e=>a.needle(e)??s.needle(e)??u.needle(e)??0,bar:e=>d.reduce((t,n)=>t??n.bar(e),void 0)??0,alertsHigh:()=>!0,ready:()=>!0}),m=new Map([[`gowning`,r.gowning],[`grade-d`,r.zoneD],[`grade-c`,r.zoneC],[`grade-b`,r.zoneB]]),ee=new Map([[`a`,r.chillerA],[`b`,r.chillerB]]),h=()=>c.flowPu(r.pumpA)+c.flowPu(r.pumpB),g=e=>{let t=[r.chillerA,r.chillerB].filter(e=>n.num(e,`coolant_flow_rate`)>0);return t.includes(e)?h()/t.length:0},_=e=>$t.get(e)??0,v=(...e)=>e.reduce((e,t)=>e+a.humPu(m.get(t)??``),0),te=ue(e,({id:e})=>{let[t=``,n=``]=e.split(`:`),i=m.get(n);switch(t){case`suction`:case`discharge`:return Q(n===`duty`?c.flowPu(r.pumpA):n===`standby`?c.flowPu(r.pumpB):h());case`header`:return Q(n===`b`?g(r.chillerB):n===`standby`?c.flowPu(r.pumpB):h());case`in`:case`out`:return Q(g(ee.get(n)??``));case`chws`:case`chwr`:return Q(i?h()/m.size:n===`b`?g(r.chillerB):n===`w`||n===`e`?h()*_(e)/m.size:h());case`steam`:return Q(i?a.humPu(i):n===`w`?v(`gowning`,`grade-d`,`grade-c`):n===`e`?v(`grade-b`):v(...m.keys()));case`feed`:return Q(v(...m.keys()));case`oa`:return Q(o.airPu(n===`a`?r.rtuA:r.rtuB));case`supply`:return Q(a.airPu(i??``));default:return 0}});return{data(e){f.draw(e)},draw({sdt:e,t,introDone:n}){te.draw(e),p.draw(e,t);for(let r of d)r.draw(e,t,n)},resync(){},status:e=>xe(n,e,`availability`)}},ln=e(t(),1),$=n(),un={x:-248,y:-164,w:92,d:58,r:3},dn=Oe(E),fn=(e,t)=>v(e,t,`coolantret`,!0),pn=(e,t)=>De(e,t,E),mn=(e,t)=>Ve(e,t,6),hn=e=>st(e,w);function gn({ids:e}){let t=c(),n=_(sn,Pt),r=(0,ln.useMemo)(()=>re(t,pt)+t.plinth(ut)+t.plinth(ft)+ct(t,dt,49),[t]),i=e=>(0,$.jsx)(s,{html:`${n.layers[e]??``}<g data-flows="${e}" data-depth="${e===0?-1e9:Nt[e-1]??0}"></g>`,data:{pipes:``}},`pipes-${e}`),a={gowning:e.gowning,"grade-d":e.zoneD,"grade-c":e.zoneC,"grade-b":e.zoneB},o={buffer:(0,$.jsx)(g,{to:y(Ot),children:(0,$.jsx)(l,{id:e.buffer,plan:dn,intro:14,draw:pn})}),steam:(0,$.jsx)(g,{to:y(D),scale:kt,children:(0,$.jsx)(l,{id:e.steam,plan:Be,intro:15,draw:mn})})};for(let[e,t]of w.entries()){let n=a[t.kind],r=(n,r)=>ot(n,r,t,e===0,e<w.length-1),i={x:t.x0,y:0,w:t.x1-t.x0,d:120,r:2},s=gt(t);o[t.kind]=(0,$.jsx)(l,{id:n,plan:i,intro:2+e,draw:r}),o[`ahu-${t.kind}`]=(0,$.jsx)(g,{to:_t(t),children:(0,$.jsx)(l,{id:n,plan:Me(s),intro:6+e,draw:(e,t)=>Le(e,t,s)})})}for(let[t,n]of bt.entries())o[`chiller${t}`]=(0,$.jsx)(g,{from:yt,to:y(n),children:(0,$.jsx)(l,{id:t?e.chillerB:e.chillerA,plan:un,intro:10+t,draw:Te})});for(let[t,n]of wt.entries())o[`pump${t}`]=(0,$.jsx)(g,{from:Ct,to:y(n),scale:T,children:(0,$.jsx)(l,{id:t?e.pumpB:e.pumpA,plan:ge,intro:12+t,draw:fn})});for(let[t,n]of At.entries())o[`rtu${t}`]=(0,$.jsx)(g,{to:y(n),children:(0,$.jsx)(l,{id:t?e.rtuB:e.rtuA,plan:Pe,intro:16+t,draw:Ne})});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(s,{html:r,data:{plinth:``}}),i(0),Mt.flatMap((e,t)=>[(0,$.jsx)(`g`,{children:o[e.key]},e.key),i(t+1)]),(0,$.jsx)(ie,{build:hn,intro:18})]})}var _n=se(mt),vn=te(_n,sn,Pt),yn=ce({layout:{width:lt,height:620,label:`Isometric model of the Pharma Cleanroom suite: the gowning room and the Grade D, C and B rooms along a viewing corridor, each with its air handler on the mezzanine above; and the utilities yard with two make-up air units, two chillers and their chilled-water pumps, the buffer tank and the clean-steam generator. Every moving part follows live values from the running engine.`,kit:_n,flows:vn.flows,joints:vn.joints,Scene:gn,compose:cn},resolve:Ge,things:Ke,caption:`cleanrooms · air handling · utilities`,mismatch:`This floor expects the Pharma Cleanroom suite: the gowning, Grade D, C and B rooms, two make-up air units, two chillers and two chilled-water pumps, the buffer tank and the clean-steam generator, by area and line.`,statusBasis:`availability`,Overview:p,tab:`Suite`});export{yn as pharmaFloor};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{F as r,I as i,P as a}from"./api-BG2sUkwk.js";import{t as o}from"./proxy-CWZabK8f.js";import{t as s}from"./AnimatePresence-BSSlw02V.js";import{C as c,S as l,l as u}from"./format-Bx7DF-TB.js";import{n as d,t as f}from"./utils-XFKvwlFT.js";import{t as p}from"./activity-Cy_niK56.js";import{r as m,t as h}from"./server-BVem_egD.js";import{t as g}from"./chevron-down-x70Pto6j.js";import{n as _,t as v}from"./circle-x-6JtFdy1_.js";import{t as y}from"./copy-button-CSUP1VjU.js";import{t as b}from"./loader-circle-DjgHgHHl.js";import{t as x}from"./use-engine-command-mutation-DrMOfYty.js";import{t as S}from"./radio-BxpVYiyS.js";import{t as C}from"./triangle-alert-DoAwrRgk.js";import{t as w}from"./transition-nav-link-CSrpkA7_.js";import{t as T}from"./badge-Bk1DaL6C.js";import{t as E}from"./label-2sIXTEUK.js";var D=d(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),O=d(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),k=d(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),A=d(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),j=e(t(),1),M=n(),N={mqtt:S,opcua:h,modbus:O},P={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus TCP`},F={mqtt:r,opcua:i,modbus:a};function I({adapter:e}){let t=e.pending?`pending`:e.enabled?`enabled`:`disabled`;return(0,M.jsx)(s,{mode:`wait`,initial:!1,children:(0,M.jsx)(o.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:`spring`,stiffness:500,damping:30},children:e.pending?(0,M.jsxs)(T,{className:`gap-1 bg-info/20 text-info hover:bg-info/20`,children:[(0,M.jsx)(b,{className:`size-3 animate-spin`}),e.enabled?`Disabling...`:`Enabling...`]}):e.enabled?(0,M.jsxs)(T,{className:`gap-1 bg-success/20 text-success hover:bg-success/20`,children:[(0,M.jsx)(_,{className:`size-3`}),`Enabled`]}):(0,M.jsxs)(T,{variant:`outline`,className:`gap-1 text-muted-foreground`,children:[(0,M.jsx)(D,{className:`size-2`}),`Disabled`]})},t)})}function L({metrics:e}){return e?e.connected?null:(0,M.jsxs)(T,{variant:`destructive`,className:`gap-1`,children:[(0,M.jsx)(v,{className:`size-3`}),`Disconnected`]}):null}function R({health:e}){if(!e)return null;let t={healthy:`bg-success/20 text-success hover:bg-success/20`,busy:`bg-warning/20 text-warning hover:bg-warning/20`,saturated:`bg-destructive/20 text-destructive hover:bg-destructive/20`},n=e.state,r=`size-3 shrink-0`,i=n===`healthy`?(0,M.jsx)(_,{className:r,"aria-hidden":!0}):n===`busy`?(0,M.jsx)(p,{className:r,"aria-hidden":!0}):n===`saturated`?(0,M.jsx)(C,{className:r,"aria-hidden":!0}):null;return(0,M.jsxs)(T,{className:f(`gap-1`,t[n]??``),children:[i,n]})}function z({label:e,value:t,valueClassName:n}){return(0,M.jsxs)(`div`,{className:`flex min-h-[3.35rem] flex-col justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/55 px-3 py-2 transition-colors hover:border-muted-foreground/25`,children:[(0,M.jsx)(`span`,{className:`blueprint-title text-[10px] leading-tight text-muted-foreground`,children:e}),(0,M.jsx)(`span`,{className:f(`mt-1.5 font-mono text-[13px] leading-none tabular-nums tracking-tight text-foreground`,n),children:t})]})}function B({metrics:e}){return(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:[(0,M.jsx)(z,{label:`Messages sent`,value:u(e.messagesPublished)}),(0,M.jsx)(z,{label:`Attempted`,value:u(e.messagesAttempted)}),(0,M.jsx)(z,{label:`Skipped (unchanged)`,value:u(e.messagesFiltered)}),(0,M.jsx)(z,{label:`Errors`,value:u(e.errorsCount),valueClassName:e.errorsCount>0?`text-destructive`:void 0}),(0,M.jsx)(z,{label:`Publish latency`,value:`${e.lastPublishMs.toFixed(1)} ms`}),e.health?(0,M.jsx)(z,{label:`Queued messages`,value:String(e.health.pendingWorkCount)}):null]})}function V({port:e}){return(0,M.jsxs)(`div`,{className:`flex gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-warning/30 bg-warning/10 p-3 text-sm text-warning`,children:[(0,M.jsx)(C,{className:`mt-0.5 size-4 shrink-0`}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`font-medium`,children:`Before enabling`}),(0,M.jsxs)(`p`,{className:`mt-1 text-warning`,children:[`Ensure port `,(0,M.jsx)(`code`,{className:`font-mono font-bold`,children:e}),` is available on the host.`]}),(0,M.jsxs)(`ul`,{className:`mt-1 list-inside list-disc space-y-0.5 text-warning`,children:[(0,M.jsxs)(`li`,{children:[(0,M.jsx)(`strong`,{children:`Docker:`}),` Restart with`,` `,(0,M.jsxs)(`code`,{className:`font-mono`,children:[`-p `,e,`:`,e]}),` `,`to expose the port.`]}),(0,M.jsxs)(`li`,{children:[(0,M.jsx)(`strong`,{children:`Bare metal:`}),` Run `,(0,M.jsxs)(`code`,{className:`font-mono`,children:[`lsof -i :`,e]}),` to check availability.`]})]})]})]})}function H({adapter:e,metrics:t}){let[n,r]=(0,j.useState)(!1),[i,a]=(0,j.useState)(``),[d,f]=(0,j.useState)(!1),p=x(),v=N[e.name]??h,S=P[e.name]??e.name,C=F[e.name]??0,D=d||e.pending===!0,O=(0,j.useMemo)(()=>{let t=e.config?.port;return typeof t==`number`?t:C},[e.config,C]);return(0,M.jsxs)(`div`,{className:`protocol-card-art min-w-0 border`,children:[(0,M.jsxs)(`div`,{className:`relative z-2`,children:[(0,M.jsxs)(`button`,{type:`button`,"aria-expanded":n,className:`group/row flex w-full min-w-0 cursor-pointer gap-3 px-4 py-3 text-left transition-colors duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] hover:bg-muted/35`,onClick:()=>r(!n),children:[(0,M.jsx)(v,{className:`mt-0.5 size-5 shrink-0 text-muted-foreground transition-[transform,color] duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] group-hover/row:-rotate-[8deg] group-hover/row:scale-[1.08] group-hover/row:text-primary motion-reduce:transition-none motion-reduce:group-hover/row:rotate-0 motion-reduce:group-hover/row:scale-100`,"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:(0,M.jsxs)(`div`,{className:`flex w-full min-w-0 flex-wrap items-start justify-between gap-x-3 gap-y-2`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[e.enabled&&!e.pending&&(0,M.jsx)(`span`,{className:`protocol-card-live-dot`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`whitespace-nowrap font-medium tracking-tight`,children:S}),(0,M.jsx)(I,{adapter:e}),e.enabled&&!e.pending&&t&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(L,{metrics:t}),t.health?(0,M.jsx)(R,{health:t.health}):(0,M.jsxs)(T,{className:`gap-1 bg-success/20 text-success hover:bg-success/20`,children:[(0,M.jsx)(_,{className:`size-3 shrink-0`,"aria-hidden":!0}),`healthy`]})]})]}),(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[e.enabled&&t&&!e.pending&&(0,M.jsxs)(`span`,{className:`protocol-card-metric-readout text-muted-foreground`,children:[(0,M.jsx)(`span`,{className:`text-[10px] font-normal uppercase tracking-[0.12em] text-muted-foreground`,children:`out`}),` `,(0,M.jsx)(`span`,{className:`text-foreground`,children:u(t.messagesPublished)}),(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:` msgs`}),t.errorsCount>0&&(0,M.jsxs)(`span`,{className:`ml-1.5 text-destructive`,children:[t.errorsCount,` err`]})]}),(0,M.jsx)(g,{className:`size-4 shrink-0 text-muted-foreground transition-[transform,color] duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] group-hover/row:translate-y-0.5 group-hover/row:text-primary motion-reduce:transition-none motion-reduce:group-hover/row:translate-y-0 ${n?`rotate-180`:``}`})]})]})})]}),e.enabled&&!e.pending&&e.endpoint&&(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 px-4 pb-2 pl-11`,children:[(0,M.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:e.endpoint}),(0,M.jsx)(y,{value:e.endpoint,label:`Copy endpoint URL`})]})]}),(0,M.jsx)(s,{initial:!1,children:n&&(0,M.jsx)(o.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden`,children:(0,M.jsx)(`div`,{className:`protocol-card-art-body border-t`,children:e.enabled&&t?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`section`,{className:`px-4 pb-4 pt-4`,"aria-labelledby":`protocol-telemetry-${e.name}`,children:[(0,M.jsxs)(`div`,{className:`mb-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3`,children:[(0,M.jsx)(`h4`,{id:`protocol-telemetry-${e.name}`,className:`blueprint-title shrink-0 text-muted-foreground`,children:`Telemetry`}),(0,M.jsxs)(w,{to:`/tags?protocol=${e.name}`,className:`group/footer-link inline-flex w-full min-h-8 min-w-0 max-w-full shrink-0 items-center justify-start gap-1.5 rounded-[var(--miravo-radius-pill)] border border-primary/25 bg-primary/5 px-2.5 py-1.5 text-xs font-medium leading-tight text-primary transition-colors hover:border-primary/40 hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background sm:w-fit`,children:[(0,M.jsx)(`span`,{className:`whitespace-nowrap`,children:`Browse Tags`}),(0,M.jsx)(m,{className:`size-3 shrink-0 text-primary transition-transform group-hover/footer-link:translate-x-0.5`})]})]}),(0,M.jsx)(B,{metrics:t})]}),(0,M.jsx)(`footer`,{className:`protocol-card-art-footer flex flex-col gap-4 border-t border-border/80 px-4 pb-4 pt-4`,children:(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,M.jsxs)(c,{variant:`destructive`,size:`sm`,className:`gap-1.5`,disabled:D,onClick:async()=>{f(!0);try{await p.mutateAsync({type:`disableAdapter`,adapter:e.name})}catch{}finally{f(!1)}},children:[D?(0,M.jsx)(b,{className:`size-3.5 animate-spin`}):(0,M.jsx)(k,{className:`size-3.5`}),D?`Disabling...`:`Disable ${S}`]}),!D&&(0,M.jsx)(`span`,{className:`text-xs leading-snug text-muted-foreground`,children:`Active connections will be dropped.`})]})})]}):(0,M.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 py-4`,children:[!D&&(0,M.jsx)(V,{port:i&&Number(i)||O}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,M.jsx)(E,{htmlFor:`port-${e.name}`,className:`text-xs`,children:`Port`}),(0,M.jsx)(l,{id:`port-${e.name}`,type:`number`,placeholder:String(O),value:i,onChange:e=>a(e.target.value),className:`w-28`,disabled:D})]}),(0,M.jsxs)(c,{size:`sm`,className:`gap-1.5`,disabled:D,onClick:async()=>{f(!0);try{let t=i?Number(i):void 0,n={};t&&Number.isFinite(t)&&(n.port=t),await p.mutateAsync({type:`enableAdapter`,adapter:e.name,...Object.keys(n).length>0?{config:n}:{}})}catch{}finally{f(!1)}},children:[D?(0,M.jsx)(b,{className:`size-3.5 animate-spin`}):(0,M.jsx)(A,{className:`size-3.5`}),D?`Enabling...`:`Enable ${S}`]})]})]})})},`panel`)})]})}export{H as n,P as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{J as r,X as i,Y as a}from"./api-CtMmjN9m.js";import{t as o}from"./proxy-CWZabK8f.js";import{t as s}from"./AnimatePresence-BSSlw02V.js";import{C as c,S as l,l as u}from"./format-Bx7DF-TB.js";import{n as d,t as f}from"./utils-XFKvwlFT.js";import{t as p}from"./activity-Cy_niK56.js";import{r as m,t as h}from"./server-BVem_egD.js";import{t as g}from"./chevron-down-x70Pto6j.js";import{n as _,t as v}from"./circle-x-6JtFdy1_.js";import{t as y}from"./copy-button-CSUP1VjU.js";import{t as b}from"./loader-circle-DjgHgHHl.js";import{t as x}from"./use-engine-command-mutation-5q_LI_xT.js";import{t as S}from"./radio-BxpVYiyS.js";import{t as C}from"./triangle-alert-DoAwrRgk.js";import{t as w}from"./transition-nav-link-ZpTbW2Hm.js";import{t as T}from"./badge-Bk1DaL6C.js";import{t as E}from"./label-2sIXTEUK.js";var D=d(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),O=d(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),k=d(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),A=d(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),j=e(t(),1),M=n(),N={mqtt:S,opcua:h,modbus:O},P={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus TCP`},F={mqtt:a,opcua:i,modbus:r};function I({adapter:e}){let t=e.pending?`pending`:e.enabled?`enabled`:`disabled`;return(0,M.jsx)(s,{mode:`wait`,initial:!1,children:(0,M.jsx)(o.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:`spring`,stiffness:500,damping:30},children:e.pending?(0,M.jsxs)(T,{className:`gap-1 bg-info/20 text-info hover:bg-info/20`,children:[(0,M.jsx)(b,{className:`size-3 animate-spin`}),e.enabled?`Disabling...`:`Enabling...`]}):e.enabled?(0,M.jsxs)(T,{className:`gap-1 bg-success/20 text-success hover:bg-success/20`,children:[(0,M.jsx)(_,{className:`size-3`}),`Enabled`]}):(0,M.jsxs)(T,{variant:`outline`,className:`gap-1 text-muted-foreground`,children:[(0,M.jsx)(D,{className:`size-2`}),`Disabled`]})},t)})}function L({metrics:e}){return e?e.connected?null:(0,M.jsxs)(T,{variant:`destructive`,className:`gap-1`,children:[(0,M.jsx)(v,{className:`size-3`}),`Disconnected`]}):null}function R({health:e}){if(!e)return null;let t={healthy:`bg-success/20 text-success hover:bg-success/20`,busy:`bg-warning/20 text-warning hover:bg-warning/20`,saturated:`bg-destructive/20 text-destructive hover:bg-destructive/20`},n=e.state,r=`size-3 shrink-0`,i=n===`healthy`?(0,M.jsx)(_,{className:r,"aria-hidden":!0}):n===`busy`?(0,M.jsx)(p,{className:r,"aria-hidden":!0}):n===`saturated`?(0,M.jsx)(C,{className:r,"aria-hidden":!0}):null;return(0,M.jsxs)(T,{className:f(`gap-1`,t[n]??``),children:[i,n]})}function z({label:e,value:t,valueClassName:n}){return(0,M.jsxs)(`div`,{className:`flex min-h-[3.35rem] flex-col justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/55 px-3 py-2 transition-colors hover:border-muted-foreground/25`,children:[(0,M.jsx)(`span`,{className:`blueprint-title text-[10px] leading-tight text-muted-foreground`,children:e}),(0,M.jsx)(`span`,{className:f(`mt-1.5 font-mono text-[13px] leading-none tabular-nums tracking-tight text-foreground`,n),children:t})]})}function B({metrics:e}){return(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:[(0,M.jsx)(z,{label:`Messages sent`,value:u(e.messagesPublished)}),(0,M.jsx)(z,{label:`Attempted`,value:u(e.messagesAttempted)}),(0,M.jsx)(z,{label:`Skipped (unchanged)`,value:u(e.messagesFiltered)}),(0,M.jsx)(z,{label:`Errors`,value:u(e.errorsCount),valueClassName:e.errorsCount>0?`text-destructive`:void 0}),(0,M.jsx)(z,{label:`Publish latency`,value:`${e.lastPublishMs.toFixed(1)} ms`}),e.health?(0,M.jsx)(z,{label:`Queued messages`,value:String(e.health.pendingWorkCount)}):null]})}function V({port:e}){return(0,M.jsxs)(`div`,{className:`flex gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-warning/30 bg-warning/10 p-3 text-sm text-warning`,children:[(0,M.jsx)(C,{className:`mt-0.5 size-4 shrink-0`}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`font-medium`,children:`Before enabling`}),(0,M.jsxs)(`p`,{className:`mt-1 text-warning`,children:[`Ensure port `,(0,M.jsx)(`code`,{className:`font-mono font-bold`,children:e}),` is available on the host.`]}),(0,M.jsxs)(`ul`,{className:`mt-1 list-inside list-disc space-y-0.5 text-warning`,children:[(0,M.jsxs)(`li`,{children:[(0,M.jsx)(`strong`,{children:`Docker:`}),` Restart with`,` `,(0,M.jsxs)(`code`,{className:`font-mono`,children:[`-p `,e,`:`,e]}),` `,`to expose the port.`]}),(0,M.jsxs)(`li`,{children:[(0,M.jsx)(`strong`,{children:`Bare metal:`}),` Run `,(0,M.jsxs)(`code`,{className:`font-mono`,children:[`lsof -i :`,e]}),` to check availability.`]})]})]})]})}function H({adapter:e,metrics:t}){let[n,r]=(0,j.useState)(!1),[i,a]=(0,j.useState)(``),[d,f]=(0,j.useState)(!1),p=x(),v=N[e.name]??h,S=P[e.name]??e.name,C=F[e.name]??0,D=d||e.pending===!0,O=(0,j.useMemo)(()=>{let t=e.config?.port;return typeof t==`number`?t:C},[e.config,C]);return(0,M.jsxs)(`div`,{className:`protocol-card-art min-w-0 border`,children:[(0,M.jsxs)(`div`,{className:`relative z-2`,children:[(0,M.jsxs)(`button`,{type:`button`,"aria-expanded":n,className:`group/row flex w-full min-w-0 cursor-pointer gap-3 px-4 py-3 text-left transition-colors duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] hover:bg-muted/35`,onClick:()=>r(!n),children:[(0,M.jsx)(v,{className:`mt-0.5 size-5 shrink-0 text-muted-foreground transition-[transform,color] duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] group-hover/row:-rotate-[8deg] group-hover/row:scale-[1.08] group-hover/row:text-primary motion-reduce:transition-none motion-reduce:group-hover/row:rotate-0 motion-reduce:group-hover/row:scale-100`,"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:(0,M.jsxs)(`div`,{className:`flex w-full min-w-0 flex-wrap items-start justify-between gap-x-3 gap-y-2`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[e.enabled&&!e.pending&&(0,M.jsx)(`span`,{className:`protocol-card-live-dot`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`whitespace-nowrap font-medium tracking-tight`,children:S}),(0,M.jsx)(I,{adapter:e}),e.enabled&&!e.pending&&t&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(L,{metrics:t}),t.health?(0,M.jsx)(R,{health:t.health}):(0,M.jsxs)(T,{className:`gap-1 bg-success/20 text-success hover:bg-success/20`,children:[(0,M.jsx)(_,{className:`size-3 shrink-0`,"aria-hidden":!0}),`healthy`]})]})]}),(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[e.enabled&&t&&!e.pending&&(0,M.jsxs)(`span`,{className:`protocol-card-metric-readout text-muted-foreground`,children:[(0,M.jsx)(`span`,{className:`text-[10px] font-normal uppercase tracking-[0.12em] text-muted-foreground`,children:`out`}),` `,(0,M.jsx)(`span`,{className:`text-foreground`,children:u(t.messagesPublished)}),(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:` msgs`}),t.errorsCount>0&&(0,M.jsxs)(`span`,{className:`ml-1.5 text-destructive`,children:[t.errorsCount,` err`]})]}),(0,M.jsx)(g,{className:`size-4 shrink-0 text-muted-foreground transition-[transform,color] duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] group-hover/row:translate-y-0.5 group-hover/row:text-primary motion-reduce:transition-none motion-reduce:group-hover/row:translate-y-0 ${n?`rotate-180`:``}`})]})]})})]}),e.enabled&&!e.pending&&e.endpoint&&(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 px-4 pb-2 pl-11`,children:[(0,M.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:e.endpoint}),(0,M.jsx)(y,{value:e.endpoint,label:`Copy endpoint URL`})]})]}),(0,M.jsx)(s,{initial:!1,children:n&&(0,M.jsx)(o.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden`,children:(0,M.jsx)(`div`,{className:`protocol-card-art-body border-t`,children:e.enabled&&t?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`section`,{className:`px-4 pb-4 pt-4`,"aria-labelledby":`protocol-telemetry-${e.name}`,children:[(0,M.jsxs)(`div`,{className:`mb-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3`,children:[(0,M.jsx)(`h4`,{id:`protocol-telemetry-${e.name}`,className:`blueprint-title shrink-0 text-muted-foreground`,children:`Telemetry`}),(0,M.jsxs)(w,{to:`/tags?protocol=${e.name}`,className:`group/footer-link inline-flex w-full min-h-8 min-w-0 max-w-full shrink-0 items-center justify-start gap-1.5 rounded-[var(--miravo-radius-pill)] border border-primary/25 bg-primary/5 px-2.5 py-1.5 text-xs font-medium leading-tight text-primary transition-colors hover:border-primary/40 hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background sm:w-fit`,children:[(0,M.jsx)(`span`,{className:`whitespace-nowrap`,children:`Browse Tags`}),(0,M.jsx)(m,{className:`size-3 shrink-0 text-primary transition-transform group-hover/footer-link:translate-x-0.5`})]})]}),(0,M.jsx)(B,{metrics:t})]}),(0,M.jsx)(`footer`,{className:`protocol-card-art-footer flex flex-col gap-4 border-t border-border/80 px-4 pb-4 pt-4`,children:(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,M.jsxs)(c,{variant:`destructive`,size:`sm`,className:`gap-1.5`,disabled:D,onClick:async()=>{f(!0);try{await p.mutateAsync({type:`disableAdapter`,adapter:e.name})}catch{}finally{f(!1)}},children:[D?(0,M.jsx)(b,{className:`size-3.5 animate-spin`}):(0,M.jsx)(k,{className:`size-3.5`}),D?`Disabling...`:`Disable ${S}`]}),!D&&(0,M.jsx)(`span`,{className:`text-xs leading-snug text-muted-foreground`,children:`Active connections will be dropped.`})]})})]}):(0,M.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 py-4`,children:[!D&&(0,M.jsx)(V,{port:i&&Number(i)||O}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,M.jsx)(E,{htmlFor:`port-${e.name}`,className:`text-xs`,children:`Port`}),(0,M.jsx)(l,{id:`port-${e.name}`,type:`number`,placeholder:String(O),value:i,onChange:e=>a(e.target.value),className:`w-28`,disabled:D})]}),(0,M.jsxs)(c,{size:`sm`,className:`gap-1.5`,disabled:D,onClick:async()=>{f(!0);try{let t=i?Number(i):void 0,n={};t&&Number.isFinite(t)&&(n.port=t),await p.mutateAsync({type:`enableAdapter`,adapter:e.name,...Object.keys(n).length>0?{config:n}:{}})}catch{}finally{f(!1)}},children:[D?(0,M.jsx)(b,{className:`size-3.5 animate-spin`}):(0,M.jsx)(A,{className:`size-3.5`}),D?`Enabling...`:`Enable ${S}`]})]})]})})},`panel`)})]})}export{H as n,P as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/smart-factory-DozakG3N.js","assets/rolldown-runtime-COnpUsM8.js","assets/vendor-ui-D8j69UH4.js","assets/vendor-charts-95ykyDlI.js","assets/chiller-Jug0vRg-.js","assets/status-DNfdEhTs.js","assets/dom-CQuChC3G.js","assets/compressor-BkWNdwvy.js","assets/water-treatment-jG0T2rhc.js","assets/tank-xgQfMS2d.js","assets/by-path-e6y8DTMV.js","assets/api-BG2sUkwk.js","assets/status-kit-pFRjEjVU.js","assets/chunk-OE4NN4TA-DBWZidbW.js","assets/useQuery-Cl48zZ73.js","assets/format-Bx7DF-TB.js","assets/utils-XFKvwlFT.js","assets/arrow-up-right-CwPw_2U1.js","assets/chevron-right-CrNKVFcI.js","assets/console-panel-iWo8EgKP.js","assets/use-engine-command-mutation-DrMOfYty.js","assets/dialog-B5PqrKVw.js","assets/runtime-link-BRnaEnOm.js","assets/asset-detail-actions-BrttEn24.js","assets/circle-x-6JtFdy1_.js","assets/loader-circle-DjgHgHHl.js","assets/trash-2-BH9HDsZv.js","assets/triangle-alert-DoAwrRgk.js","assets/badge-Bk1DaL6C.js","assets/validation-Cxhiswz2.js","assets/tooltip-B3vOB1Vu.js","assets/district-heating-B_YycTG-.js","assets/boiler-BQwqgoVY.js","assets/stages-C0cErwSQ.js","assets/pharma-cleanroom-BbYfEQjP.js","assets/rtu-BR4DhLbE.js","assets/commercial-building-D95MTyEI.js","assets/genset-DBpkUT9p.js","assets/backup-power-Cm_Ij5yj.js"])))=>i.map(i=>d[i]);
2
- import{d as e}from"./chunk-OE4NN4TA-DBWZidbW.js";import{n as t}from"./utils-XFKvwlFT.js";var n=t(`factory`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M16 16h.01`,key:`1f9h7w`}],[`path`,{d:`M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z`,key:`1iv0i2`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),r=new Map([[`smart-factory`,()=>e(()=>import(`./smart-factory-DozakG3N.js`).then(e=>e.smartFactoryFloor),__vite__mapDeps([0,1,2,3,4,5,6,7]))],[`water-treatment`,()=>e(()=>import(`./water-treatment-jG0T2rhc.js`).then(e=>e.waterFloor),__vite__mapDeps([8,1,2,3,7,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]))],[`district-heating`,()=>e(()=>import(`./district-heating-B_YycTG-.js`).then(e=>e.heatingFloor),__vite__mapDeps([31,1,2,3,32,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,33]))],[`pharma-cleanroom`,()=>e(()=>import(`./pharma-cleanroom-BbYfEQjP.js`).then(e=>e.pharmaFloor),__vite__mapDeps([34,1,2,3,35,5,6,32,4,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,33]))],[`commercial-building`,()=>e(()=>import(`./commercial-building-D95MTyEI.js`).then(e=>e.buildingFloor),__vite__mapDeps([36,1,2,3,35,5,6,32,4,37,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,33]))],[`backup-power`,()=>e(()=>import(`./backup-power-Cm_Ij5yj.js`).then(e=>e.backupFloor),__vite__mapDeps([38,1,2,3,4,5,6,7,37,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,33]))]]);function i(e){return r.has(e)}function a(e){return`/floor/${encodeURIComponent(e)}`}var o=new Map;function s(e){let t=o.get(e);if(!t){let n=r.get(e);if(!n)throw Error(`No floor for template '${e}'. Add it to FLOORS in layouts/registry.ts.`);t=n(),o.set(e,t)}return t}export{n as i,i as n,s as r,a as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/smart-factory-DozakG3N.js","assets/rolldown-runtime-COnpUsM8.js","assets/vendor-ui-D8j69UH4.js","assets/vendor-charts-95ykyDlI.js","assets/chiller-Jug0vRg-.js","assets/status-DNfdEhTs.js","assets/dom-CQuChC3G.js","assets/compressor-BkWNdwvy.js","assets/water-treatment-CAxvQSI-.js","assets/tank-xgQfMS2d.js","assets/by-path-CGbqDnvK.js","assets/api-CtMmjN9m.js","assets/status-kit-eQF95zN0.js","assets/chunk-OE4NN4TA-DBWZidbW.js","assets/useQuery-Dxp3WSXF.js","assets/format-Bx7DF-TB.js","assets/utils-XFKvwlFT.js","assets/arrow-up-right-CwPw_2U1.js","assets/chevron-right-CrNKVFcI.js","assets/console-panel-DXk4doxV.js","assets/use-engine-command-mutation-5q_LI_xT.js","assets/dialog-B5PqrKVw.js","assets/runtime-link-BRnaEnOm.js","assets/asset-detail-actions-BrLTJCzY.js","assets/circle-x-6JtFdy1_.js","assets/loader-circle-DjgHgHHl.js","assets/trash-2-BH9HDsZv.js","assets/triangle-alert-DoAwrRgk.js","assets/badge-Bk1DaL6C.js","assets/validation-BSQDilvJ.js","assets/tooltip-B3vOB1Vu.js","assets/district-heating-MuLRna9G.js","assets/boiler-BQwqgoVY.js","assets/stages-C0cErwSQ.js","assets/pharma-cleanroom-DnxAzkeg.js","assets/rtu-BR4DhLbE.js","assets/commercial-building-BeGD1bPV.js","assets/genset-DBpkUT9p.js","assets/backup-power-B1THpfxc.js"])))=>i.map(i=>d[i]);
2
+ import{d as e}from"./chunk-OE4NN4TA-DBWZidbW.js";import{n as t}from"./utils-XFKvwlFT.js";var n=t(`factory`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M16 16h.01`,key:`1f9h7w`}],[`path`,{d:`M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z`,key:`1iv0i2`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),r=new Map([[`smart-factory`,()=>e(()=>import(`./smart-factory-DozakG3N.js`).then(e=>e.smartFactoryFloor),__vite__mapDeps([0,1,2,3,4,5,6,7]))],[`water-treatment`,()=>e(()=>import(`./water-treatment-CAxvQSI-.js`).then(e=>e.waterFloor),__vite__mapDeps([8,1,2,3,7,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]))],[`district-heating`,()=>e(()=>import(`./district-heating-MuLRna9G.js`).then(e=>e.heatingFloor),__vite__mapDeps([31,1,2,3,32,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,33]))],[`pharma-cleanroom`,()=>e(()=>import(`./pharma-cleanroom-DnxAzkeg.js`).then(e=>e.pharmaFloor),__vite__mapDeps([34,1,2,3,35,5,6,32,4,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,33]))],[`commercial-building`,()=>e(()=>import(`./commercial-building-BeGD1bPV.js`).then(e=>e.buildingFloor),__vite__mapDeps([36,1,2,3,35,5,6,32,4,37,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,33]))],[`backup-power`,()=>e(()=>import(`./backup-power-B1THpfxc.js`).then(e=>e.backupFloor),__vite__mapDeps([38,1,2,3,4,5,6,7,37,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,33]))]]);function i(e){return r.has(e)}function a(e){return`/floor/${encodeURIComponent(e)}`}var o=new Map;function s(e){let t=o.get(e);if(!t){let n=r.get(e);if(!n)throw Error(`No floor for template '${e}'. Add it to FLOORS in layouts/registry.ts.`);t=n(),o.set(e,t)}return t}export{n as i,i as n,s as r,a as t};