@miravo/cli-linux-x64 0.6.1 → 0.6.2

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 (52) hide show
  1. package/console-dist/assets/catalog-BKhsnMBa.js +1 -0
  2. package/console-dist/assets/catalog-Ia1pbi0U.js +1 -0
  3. package/console-dist/assets/control-M9POk7sD.js +1 -0
  4. package/console-dist/assets/control-xSKU0dgF.js +1 -0
  5. package/console-dist/assets/copy-button-BK3jqKBZ.js +1 -0
  6. package/console-dist/assets/deploy-tab-zi4NXsfj.js +1 -0
  7. package/console-dist/assets/events-BRekhc6s.js +1 -0
  8. package/console-dist/assets/{events-40FcPI5G.js → events-CfrhnDG_.js} +1 -1
  9. package/console-dist/assets/fleet-Bk6J6tiE.js +1 -0
  10. package/console-dist/assets/{fleet-CcWeGysy.js → fleet-CcdFCWOI.js} +1 -1
  11. package/console-dist/assets/{index-0Q8wjuZr.js → index-DVW3M0iW.js} +5 -5
  12. package/console-dist/assets/instance-detail-bpv-KYmO.js +1 -0
  13. package/console-dist/assets/{login-B9bEXW-9.js → login-DV1Fd0nK.js} +1 -1
  14. package/console-dist/assets/models-BOPuZsyi.js +1 -0
  15. package/console-dist/assets/models-BbWAxRFR.js +1 -0
  16. package/console-dist/assets/platforms-Dq6BGck6.js +1 -0
  17. package/console-dist/assets/platforms-H2Z4z-EX.js +1 -0
  18. package/console-dist/assets/route-preload-CMl-AryU.js +2 -0
  19. package/console-dist/assets/tabs-BgPF8MSY.js +1 -0
  20. package/console-dist/assets/tags-DZpOeuyx.js +4 -0
  21. package/console-dist/assets/tags-nAOAgZzI.js +1 -0
  22. package/console-dist/assets/{transition-nav-link-CuWixOOd.js → transition-nav-link-B89fDRXR.js} +1 -1
  23. package/console-dist/assets/use-engine-command-mutation-DTvKLMBg.js +1 -0
  24. package/console-dist/assets/use-platform-stream-BZTQlkbS.js +2 -0
  25. package/console-dist/assets/{use-transition-navigate-C3Y3EWRr.js → use-transition-navigate-CG8tHeYN.js} +1 -1
  26. package/console-dist/assets/validation-CyzCfw_2.js +1 -0
  27. package/console-dist/icon.png +0 -0
  28. package/console-dist/index.html +19 -19
  29. package/miravo +0 -0
  30. package/package.json +1 -1
  31. package/console-dist/assets/catalog-CurT8GX7.js +0 -1
  32. package/console-dist/assets/catalog-Dq3afUeM.js +0 -1
  33. package/console-dist/assets/control-DbOdtp7Q.js +0 -1
  34. package/console-dist/assets/control-O0UYo7WO.js +0 -1
  35. package/console-dist/assets/deploy-tab-BjWxHSsV.js +0 -1
  36. package/console-dist/assets/dialog-DD0yn-KA.js +0 -1
  37. package/console-dist/assets/events-Dq2kZb5H.js +0 -1
  38. package/console-dist/assets/fleet-C4qL3Z_E.js +0 -1
  39. package/console-dist/assets/instance-detail-4xiHIeF2.js +0 -1
  40. package/console-dist/assets/models-6X-8K2W2.js +0 -1
  41. package/console-dist/assets/models-wWuV5zGw.js +0 -1
  42. package/console-dist/assets/platforms-C5DxJAky.js +0 -1
  43. package/console-dist/assets/platforms-DrizMC87.js +0 -1
  44. package/console-dist/assets/route-preload-Dz8gP8hl.js +0 -2
  45. package/console-dist/assets/tabs-Bwhx891Q.js +0 -1
  46. package/console-dist/assets/tags-CbYqG-S1.js +0 -1
  47. package/console-dist/assets/tags-Z8A51KqE.js +0 -4
  48. package/console-dist/assets/use-engine-command-mutation-CQc8tXfc.js +0 -1
  49. package/console-dist/assets/use-platform-stream-7982hIDJ.js +0 -2
  50. package/console-dist/assets/validation-4FJlp2qx.js +0 -1
  51. package/console-dist/favicon.svg +0 -1
  52. package/console-dist/miravo-logo.png +0 -0
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{a as t,i as n,n as r,r as i,s as a,t as o}from"./vendor-charts-CAZdaPlq.js";import{at as s}from"./vendor-ui-mizMYESS.js";import{_ as c,a as l}from"./api-Bef9FEIU.js";import{a as u,n as d,r as f,t as p}from"./get-error-message-DhCjoSSJ.js";import{t as m}from"./proxy-CgM57W61.js";import{i as ee,r as te}from"./dist-jROhexoH.js";import{c as ne,l as re}from"./chunk-OE4NN4TA-m2UhO8Q2.js";import{a as h,i as g,n as _,r as v,s as y,t as b}from"./copy-button-BK3jqKBZ.js";import{n as x,t as S}from"./createLucideIcon-Yddw9eHa.js";import{i as C,n as w,t as T}from"./tooltip-TtanriwA.js";import{C as E,E as D,S as O,c as k,d as ie,g as A,l as j,m as M,n as N,p as P,t as ae,u as F,v as I,y as oe}from"./input-BCiRHEmc.js";import{r as L}from"./engine-store-BUO-9Dsh.js";import{t as se}from"./activity-DP0Us3HU.js";import{a as ce,c as le,i as ue,n as de,o as R,r as fe,s as z,t as pe}from"./tabs-BgPF8MSY.js";import{c as me,l as he,o as ge,s as B}from"./validation-CyzCfw_2.js";import{a as _e,c as V,o as ve,t as ye}from"./use-engine-command-mutation-DTvKLMBg.js";import{t as H}from"./triangle-alert-DPtblpQC.js";import{t as U}from"./badge-tnWgSITj.js";import{t as be}from"./query-keys-Co1J4HmV.js";import{t as xe}from"./transition-types-CMW7IObN.js";import{n as Se}from"./auth-screen-backdrop-OrOL41MR.js";var W=S(`layers-2`,[[`path`,{d:`M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z`,key:`15q6uc`}],[`path`,{d:`m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845`,key:`byia6g`}]]),Ce=S(`signal`,[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}],[`path`,{d:`M12 20v-8`,key:`i3yub9`}],[`path`,{d:`M17 20V8`,key:`1tkaf5`}],[`path`,{d:`M22 4v16`,key:`sih9yq`}]]),we=S(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),G=e(a(),1),K=s(),q=`bg-transparent bg-transparent`,J=`blueprint-title text-foreground`;function Te(e,t){return t.includes(`rpm`)||t.includes(`speed`)?`e.g. 2500`:t.includes(`temp`)?`e.g. 70.0`:t.includes(`pressure`)?`e.g. 4.5`:e===`Boolean`?`true / false`:e===`String`?`value`:`e.g. 100`}function Ee({detail:e,methodArgs:t,setMethodArgs:n,onInvoke:r,isPending:i=!1,pendingMethod:a=null}){let o=Object.entries(e.methods);if(o.length===0)return null;let s=o.filter(([,e])=>e.inputArguments.length===0),c=o.filter(([,e])=>e.inputArguments.length>0);return(0,K.jsxs)(`div`,{id:`commands`,className:`flex min-w-0 flex-col gap-3 p-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsx)(`h2`,{className:J,children:`Commands`}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:`Executable methods on this asset`})]}),s.length>0&&(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:s.map(([e,t])=>{let n=a===e&&i,o=n?R:V;return t.description?(0,K.jsxs)(T,{children:[(0,K.jsx)(C,{render:(0,K.jsxs)(N,{size:`sm`,variant:`outline`,disabled:i,title:e,className:x(`h-8 gap-1.5 font-mono text-xs`,q),onClick:()=>r(e),children:[(0,K.jsx)(o,{className:x(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),P(e)]})}),(0,K.jsx)(w,{side:`bottom`,className:`max-w-xs`,children:t.description})]},e):(0,K.jsxs)(N,{size:`sm`,variant:`outline`,disabled:i,title:e,className:x(`h-8 gap-1.5 font-mono text-xs`,q),onClick:()=>r(e),children:[(0,K.jsx)(o,{className:x(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),P(e)]},e)})}),c.length>0&&s.length>0&&(0,K.jsx)(B,{className:`bg-border/60`}),c.map(([e,o])=>{let s=a===e&&i;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{title:e,className:`font-mono text-sm font-medium`,children:P(e)}),o.description&&(0,K.jsx)(`p`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:o.description})]}),(0,K.jsxs)(N,{size:`sm`,variant:`default`,disabled:i,className:`shrink-0`,onClick:()=>r(e),children:[s?(0,K.jsx)(R,{className:`mr-1 size-3 animate-spin`,"aria-hidden":!0}):(0,K.jsx)(V,{className:`mr-1 size-3`,"aria-hidden":!0}),`Execute`]})]}),(0,K.jsx)(`div`,{className:`mt-3 flex flex-col gap-1.5 border-t border-border/50 pt-3`,children:o.inputArguments.map(r=>(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(`span`,{title:r.name,className:`w-28 shrink-0 truncate pt-1.5 font-mono text-[10px] leading-tight text-muted-foreground`,children:P(r.name)}),(0,K.jsx)(ae,{className:`h-7 flex-1 font-mono text-xs`,placeholder:Te(r.dataType,r.name),value:t[e]?.[r.name]??``,onChange:t=>n(n=>({...n,[e]:{...n[e],[r.name]:t.target.value}}))})]},r.name))})]},e)})]})}function De({activeFaults:e,availableFaults:t,onTriggerFault:n,onClearFault:r}){let i=e.length>0,[a,o]=(0,G.useState)(null);return(0,K.jsxs)(`div`,{id:`faults`,className:`flex min-w-0 flex-col gap-3 p-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsx)(`h2`,{className:J,children:`Alarms`}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:`Active faults and injectable failure modes (environment)`})]}),i?(0,K.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(e=>(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[var(--miravo-radius-tight)] border border-destructive/30 bg-transparent py-2.5 pl-3 pr-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(H,{className:`size-4 shrink-0 text-destructive`}),(0,K.jsx)(`span`,{title:e,className:`font-mono text-sm font-medium text-destructive`,children:P(e)})]}),(0,K.jsxs)(N,{size:`sm`,variant:`outline`,className:x(`h-8 shrink-0 gap-1 border-destructive/30 px-2.5 font-mono text-[0.75rem] text-destructive shadow-none`,`hover:border-destructive/45 hover:bg-destructive/5 hover:text-destructive`,`focus-visible:border-destructive/40 focus-visible:ring-destructive/20`,q),onClick:()=>r(e),children:[(0,K.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),`Clear`]})]},e))}):(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,K.jsx)(le,{className:`size-4 text-success`}),`All clear — no active faults`]}),t.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{className:`bg-border/60`}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`p`,{className:x(J,`mb-2`),children:[`Inject fault`,(0,K.jsxs)(U,{variant:`secondary`,className:`ml-2 text-[10px]`,children:[t.filter(t=>!e.includes(t)).length,` available`]})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.filter(t=>!e.includes(t)).map(e=>(0,K.jsx)(N,{size:`sm`,variant:`outline`,title:e,className:x(`h-7 font-mono text-[10px]`,q),onClick:()=>o(e),children:P(e)},e))})]})]}),(0,K.jsx)(_,{open:a!==null,onOpenChange:e=>{e||o(null)},children:(0,K.jsxs)(v,{children:[(0,K.jsx)(y,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Inject fault?`}),(0,K.jsxs)(g,{className:`text-sm text-muted-foreground`,children:[`This asserts`,` `,(0,K.jsx)(`span`,{title:a??void 0,className:`font-mono text-foreground`,children:a?P(a):``}),` `,`on the running environment. Downstream consumers will see the fault immediately. Clear it from the active list when you're done.`]}),(0,K.jsxs)(h,{children:[(0,K.jsx)(N,{variant:`outline`,onClick:()=>o(null),children:`Cancel`}),(0,K.jsxs)(N,{variant:`destructive`,onClick:()=>{a&&n(a),o(null)},children:[(0,K.jsx)(H,{className:`mr-1 size-3.5`,"aria-hidden":!0}),`Inject fault`]})]})]})})]})}function Oe({detail:e,tick:t,activeFaults:n,memberValues:r,onBack:i}){let a=n.length,o=e.isQuarantined,s=`OK`,c=`ok`;a>0?(s=`FAULT`,c=`bad`):o&&(s=`QRTN`,c=`warn`);let l=0;if(r)for(let e of r.values())e.quality!==`good`&&l++;let u=Object.keys(e.members).length,d=r?.get(`availability_state`)?.value,f=e.members.availability_state?.value,p=typeof d==`string`?d:typeof f==`string`?f:`unknown`,m=p===`running`?{dot:`bg-success`,pulse:`bg-success/60`,animate:!0}:p===`faulted`?{dot:`bg-destructive`,pulse:`bg-destructive/60`,animate:!0}:p===`stopped`?{dot:`bg-warning`,pulse:`bg-warning/60`,animate:!0}:{dot:`bg-muted-foreground/60`,pulse:`bg-muted-foreground/50`,animate:!1},ee=p===`running`?`Availability state is running — the asset is available and in service.`:p===`faulted`?`Availability state is faulted — the asset is unavailable because a fault is active.`:p===`stopped`?`Availability state is stopped — the asset is available but not running.`:`Availability state is not available for this asset yet.`;return(0,K.jsxs)(`header`,{className:x(ve,`flex w-full min-w-0 flex-col`),children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 px-5 py-4 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:i,className:`transition-colors hover:text-foreground`,children:`Fleet`}),(0,K.jsx)(`span`,{"aria-hidden":!0,children:`/`}),(0,K.jsx)(`span`,{className:`truncate`,children:A(e.assetType)})]}),(0,K.jsx)(G.ViewTransition,{name:`instance-${e.id}`,default:`none`,children:(0,K.jsx)(`h1`,{className:`font-heading mt-1 text-2xl font-semibold uppercase leading-tight tracking-wide`,children:M(e.id)})}),(0,K.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-1.5`,children:[(0,K.jsx)(`p`,{className:`m-0 min-w-0 flex-1 font-mono text-[10px] leading-tight tracking-tight text-muted-foreground`,children:(0,K.jsx)(`span`,{className:`break-all`,children:e.browsePath.join(` / `)})}),(0,K.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,K.jsx)(b,{value:ie(e.browsePath),label:`Copy Topic / UNS path`})})]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 self-end font-mono text-xs sm:self-start`,children:[(0,K.jsx)(ce,{className:`size-3.5 animate-pulse text-primary`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`font-medium text-primary`,children:`LIVE`}),(0,K.jsxs)(`span`,{className:`tabular-nums text-muted-foreground`,children:[`t=`,t]}),(0,K.jsxs)(T,{children:[(0,K.jsx)(C,{render:(0,K.jsx)(`span`,{className:`inline-flex size-3.5 items-center justify-center outline-none focus-visible:ring-2 focus-visible:ring-ring`}),children:(0,K.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 shrink-0 items-center justify-center`,children:[(0,K.jsx)(`span`,{className:x(`relative inline-flex size-1.5 rounded-full`,m.dot)}),m.animate&&(0,K.jsx)(`span`,{className:x(`absolute inline-flex size-2.5 animate-ping rounded-full opacity-75`,m.pulse)})]})}),(0,K.jsx)(w,{side:`top`,align:`end`,children:(0,K.jsxs)(`span`,{className:`block max-w-[16rem] text-[11px] leading-snug`,children:[(0,K.jsx)(`span`,{className:`font-medium uppercase tracking-[0.08em]`,children:`Availability`}),` `,(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[`— `,ee]})]})})]})]})]}),(0,K.jsxs)(`fieldset`,{"aria-label":`Instance status`,className:`m-0 flex flex-col border-0 border-t border-border/50 p-0`,children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-px bg-transparent`,children:[(0,K.jsx)(Y,{variant:`primary`,icon:se,label:`Health`,value:s,tone:c,tooltip:`Rolls up active faults and quarantine into a single status — OK when nothing is asserted, FAULT when any fault is active, QRTN when the asset is excluded from the running fleet.`}),(0,K.jsx)(Y,{variant:`primary`,icon:H,label:`Active faults`,labelCompact:`Faults`,value:String(a),tone:a>0?`bad`:`neutral`,tooltip:`Fault codes currently asserted on this asset. Clear or inject faults from the Alarms section below.`})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-px border-t border-border/50 bg-transparent sm:grid-cols-4`,children:[(0,K.jsx)(Y,{variant:`compact`,icon:W,label:`Lifecycle`,labelCompact:`Life`,value:P(e.lifecycleStage),tone:D(e.lifecycleStage),tooltip:`Where this asset sits in its operational lifecycle (e.g. commissioning, operating, maintenance, retired).`}),(0,K.jsx)(Y,{variant:`compact`,icon:he,label:`Tags`,value:String(u),tone:`neutral`,tooltip:`Total members exposed by this asset — process variables, state flags, counters, commands, and reference fields combined.`}),(0,K.jsx)(Y,{variant:`compact`,icon:Ce,label:`Bad quality`,value:String(l),tone:l>0?`warn`:`neutral`,tooltip:`Members whose quality stamp is anything other than good (uncertain or bad). A healthy asset reads 0.`}),(0,K.jsx)(Y,{variant:`compact`,icon:we,label:`Operating age`,value:oe(e.operatingHours),tone:`neutral`,tooltip:`Total operating age on this asset, including any environment-seeded starting hours plus simulated runtime elapsed in this session.`})]})]})]})}function Y({icon:e,label:t,labelCompact:n,value:r,suffix:i,tone:a,variant:o=`compact`,tooltip:s}){let c=o===`primary`;return(0,K.jsxs)(`div`,{className:x(`relative flex min-w-0 flex-col justify-center`,c?`min-h-20 gap-1.5 px-4 py-4 sm:min-h-24 sm:px-6 sm:py-5 lg:min-h-28 lg:px-8`:`min-h-12 gap-1 px-3 py-2.5 sm:min-h-13 sm:px-4 lg:min-h-14 lg:px-5`),children:[(0,K.jsx)(`div`,{className:`flex min-h-0 min-w-0 items-center gap-2`,children:(0,K.jsxs)(T,{children:[(0,K.jsxs)(C,{className:`flex min-h-0 min-w-0 flex-1 cursor-default items-center gap-2 text-left`,render:(0,K.jsx)(`div`,{}),children:[(0,K.jsx)(e,{className:x(`shrink-0 text-muted-foreground`,c?`size-4`:`size-3.5`),"aria-hidden":!0}),(0,K.jsxs)(`span`,{className:x(`min-w-0 flex-1 font-medium tracking-wide text-muted-foreground uppercase 2xl:tracking-wider`,c?`text-[11px] leading-snug sm:text-[12px]`:`text-[9px] leading-snug sm:text-[10px]`),children:[(0,K.jsx)(`span`,{className:`block wrap-break-word 2xl:hidden`,children:n??t}),(0,K.jsx)(`span`,{className:`hidden wrap-break-word 2xl:block`,children:t})]})]}),(0,K.jsx)(w,{side:`top`,align:`start`,sideOffset:6,className:`max-w-xs`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:s??t})]})})]})}),(0,K.jsxs)(`p`,{className:x(`min-w-0 wrap-break-word font-mono font-semibold leading-tight tracking-tight tabular-nums`,c?`text-2xl sm:text-3xl lg:text-4xl`:`text-base lg:text-lg`,a===`ok`&&`text-success`,a===`warn`&&`text-warning`,a===`bad`&&`text-destructive`,a===`neutral`&&`text-foreground`),children:[r,i?(0,K.jsx)(`span`,{className:x(`ml-0.5 font-medium text-muted-foreground`,c?`text-base lg:text-lg`:`text-xs lg:text-sm`),children:i}):null]})]})}function X({title:e,subtitle:t,children:n,className:r,id:i}){return(0,K.jsxs)(`section`,{id:i,className:x(_e,r),children:[(0,K.jsxs)(`div`,{className:`border-b border-border/60 px-4 py-3`,children:[(0,K.jsx)(`h2`,{className:`blueprint-title text-foreground`,children:e}),t?(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t}):null]}),(0,K.jsx)(`div`,{className:`overflow-hidden p-0`,children:n})]})}function Z({className:e,counters:t,memberValues:n}){return(0,K.jsx)(X,{title:`Counters`,subtitle:`Totals, hours, and accumulators`,className:e,children:(0,K.jsx)(`div`,{className:`flex flex-col gap-2 p-4`,children:t.map(([e,t])=>{let r=n?.get(e),i=r?r.value:t.value;return(0,K.jsxs)(`div`,{className:`flex items-center justify-between rounded-[var(--miravo-radius-tight)] border border-border/60 bg-transparent px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:O(e)}),(0,K.jsxs)(`span`,{className:`blueprint-stat text-sm font-medium`,children:[typeof i==`number`?I(i):String(i),t.meta.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:E(t.meta.unit)})]})]},e)})})})}function Q({className:e,detail:t,referenceMembers:n,memberValues:r}){let i=Object.keys(t.parameters).length>0,a=n.length>0;return!i&&!a?null:(0,K.jsx)(X,{title:`Nameplate & configuration`,subtitle:`Design parameters, identity, and reference values`,className:e,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[i&&(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Object.entries(t.parameters).map(([e,t])=>(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5 py-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:O(e)}),(0,K.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof t.value==`number`?I(t.value):String(t.value),t.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:E(t.unit)})]})]},e))}),a&&(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:n.map(([e,t])=>{let n=r?.get(e),i=n?n.value:t.value;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-[var(--miravo-radius-tight)] border border-border/60 bg-transparent p-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:O(e)}),(0,K.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof i==`number`?I(i):String(i),t.meta.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:E(t.meta.unit)})]})]},e)})})]})})}var ke=new Set([`pu`,`h`]),Ae=[`_reference`,`_baseline`,`_setpoint`,`_command`],$=`var(--color-primary)`,je=`var(--color-background)`;function Me(e){return Object.entries(e.members).filter(([e,t])=>t.meta.kind===`variable`&&t.meta.access===`read`&&t.meta.dataType===`Double`&&t.meta.euRange!==null&&!ke.has(t.meta.unit??``)&&!Ae.some(t=>e.endsWith(t)))}function Ne(e){if(e.length<3)return!1;let t=e[0]?.value??0;return e.some(e=>Math.abs(e.value-t)>.001)}function Pe({data:e,chartHeight:a=34}){let s=(0,G.useId)(),[c,l]=(0,G.useState)(null),u=e.map(e=>e.value),d=Math.min(...u),f=Math.max(...u);return(0,K.jsxs)(`div`,{className:`flex min-h-0 w-full flex-col overflow-hidden`,style:{height:a+14},children:[(0,K.jsx)(`div`,{style:{height:a,width:`100%`},children:(0,K.jsx)(n,{width:`100%`,height:a,children:(0,K.jsxs)(o,{data:e,margin:{top:2,right:2,bottom:2,left:0},onMouseMove:e=>{let t=e?.activePayload?.[0]?.value;typeof t==`number`&&l(t)},onMouseLeave:()=>l(null),children:[(0,K.jsx)(`defs`,{children:(0,K.jsxs)(`linearGradient`,{id:s,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,K.jsx)(`stop`,{offset:`0%`,stopColor:$,stopOpacity:.3}),(0,K.jsx)(`stop`,{offset:`100%`,stopColor:$,stopOpacity:0})]})}),(0,K.jsx)(r,{domain:[`auto`,`auto`],hide:!0}),(0,K.jsx)(t,{content:()=>null,cursor:!1}),(0,K.jsx)(i,{type:`monotone`,dataKey:`value`,stroke:$,strokeWidth:1.5,fill:`url(#${s})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,fill:$,stroke:je,strokeWidth:1}})]})})}),(0,K.jsx)(`span`,{className:`text-[10px] leading-none tabular-nums text-muted-foreground`,children:c===null?(0,K.jsxs)(K.Fragment,{children:[I(d),`–`,I(f)]}):(0,K.jsx)(`span`,{className:`font-medium text-primary`,children:I(c)})})]})}function Fe({detail:e,processVariables:t,memberValues:n,historyRef:r,showQuality:i}){let a=(0,G.useMemo)(()=>[...t].sort(([e],[t])=>{let n=r.current.get(e)??[],i=r.current.get(t)??[],a=n.length>2&&Ne(n);return a===(i.length>2&&Ne(i))?0:a?-1:1}),[t,n,r]);return t.length===0?(0,K.jsx)(X,{title:`Process`,subtitle:`No continuous analog readings defined for this asset`,className:`opacity-90`,children:(0,K.jsx)(`p`,{className:`px-4 py-6 text-center text-sm text-muted-foreground`,children:`This asset exposes no continuous process variables. Discrete states, flags, and commands are available in the Tags section below.`})}):(0,K.jsx)(X,{title:`Process`,subtitle:`Live tag readings — trend is ~2 min at 1 Hz`,children:(0,K.jsx)(`ul`,{className:`divide-y divide-border/40`,children:a.map(([t,a])=>{let o=n?.get(t),s=o?o.value:a.value,c=o?o.quality:a.quality,l=r.current.get(t)??[],u=F(e.browsePath,t),d=l.length>2&&Ne(l),f=E(a.meta.unit),p=O(t);return(0,K.jsxs)(m.li,{layout:!0,transition:{duration:.32,ease:[.22,1,.36,1]},className:`flex flex-col gap-2.5 bg-background px-4 py-3 sm:flex-row sm:items-center sm:gap-5 sm:py-3.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 sm:w-44 sm:shrink-0`,children:[(0,K.jsxs)(T,{children:[(0,K.jsx)(C,{className:`min-w-0 flex-1 cursor-default truncate text-left text-[11px] font-medium uppercase tracking-[var(--miravo-tracking-eyebrow)] text-muted-foreground`,render:(0,K.jsx)(`span`,{}),children:p}),(0,K.jsx)(w,{side:`top`,align:`start`,className:`max-w-xs`,children:p})]}),(0,K.jsx)(b,{value:u,label:`Copy Topic / UNS path`})]}),(0,K.jsxs)(`div`,{className:`relative h-[56px] min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-x-0 top-1/2 h-px -translate-y-1/2 bg-border/30`}),d?(0,K.jsx)(Pe,{data:l,chartHeight:42}):(0,K.jsx)(`p`,{className:`flex h-full items-center text-[10px] uppercase tracking-widest text-muted-foreground`,children:l.length<=2?`Collecting trend…`:`No change (last 2 min)`})]}),(0,K.jsxs)(`div`,{className:`flex items-baseline gap-2 sm:min-w-36 sm:shrink-0 sm:justify-end`,children:[(0,K.jsx)(`span`,{className:`blueprint-stat text-2xl font-semibold leading-none tabular-nums text-foreground`,children:typeof s==`number`?I(s):String(s)}),f&&(0,K.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:f}),i&&c!==`good`&&(0,K.jsx)(U,{variant:c===`uncertain`?`secondary`:`destructive`,className:`shrink-0 text-[10px]`,children:c})]})]},t)})})})}function Ie({name:e,value:t,dataType:n,unit:r,access:i}){let a=O(e),o=i===`readwrite`;if(n===`Boolean`||typeof t==`boolean`||r===`pu`&&(t===0||t===1)){let n=t===!0||t===`true`||t===1,r=e.includes(`fault`);return(0,K.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] border px-2 py-1 ${r&&n?`border-destructive/30 bg-transparent`:``}`,children:[(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left text-[10px] leading-snug text-muted-foreground`,children:[a,o&&(0,K.jsx)(`span`,{className:`ml-1 text-[8px] text-primary`,children:`CMD`})]}),(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-xs font-medium tabular-nums ${r&&n?`text-destructive`:n?`text-success`:`text-muted-foreground`}`,children:n?`ON`:`OFF`})]})}if(n===`String`){let n=String(t),r=n===`none`||n===``,i=k.has(n)||e.includes(`fault_code`)&&!r,o=!i&&j.has(n);return(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col justify-center gap-1 rounded-[var(--miravo-radius-tight)] border px-2 py-2 ${i?`border-destructive/30 bg-transparent`:o?`border-warning/30 bg-warning/5`:``}`,children:[(0,K.jsx)(`span`,{className:`wrap-break-word text-[10px] leading-tight text-muted-foreground`,children:a}),r?(0,K.jsx)(`span`,{className:`wrap-break-word font-mono text-sm font-medium leading-snug text-muted-foreground`,children:`—`}):(0,K.jsx)(`span`,{title:n,className:`wrap-break-word font-mono text-sm font-medium leading-snug ${i?`text-destructive`:o?`text-warning`:`text-foreground`}`,children:P(n)})]})}return(0,K.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] border px-2 py-1`,children:[(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left text-[10px] leading-snug text-muted-foreground`,children:[a,o&&(0,K.jsx)(`span`,{className:`ml-1 text-[8px] text-primary`,children:`CMD`})]}),(0,K.jsxs)(`span`,{className:`shrink-0 text-right font-mono text-xs font-medium tabular-nums`,children:[typeof t==`number`?I(t):String(t),r&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:E(r)})]})]})}function Le(e){return[...e].sort((e,t)=>{let n=e[1].meta.access===`readwrite`;return n===(t[1].meta.access===`readwrite`)?e[0].localeCompare(t[0]):n?-1:1})}function Re({stringEnumMembers:e,nonStringOperationalMembers:t,memberValues:n,className:r}){let i=(0,G.useMemo)(()=>Le(e),[e]),a=(0,G.useMemo)(()=>Le(t),[t]),o=`grid min-w-0 gap-2 [grid-template-columns:repeat(auto-fill,minmax(min(100%,12.5rem),1fr))]`;return(0,K.jsx)(X,{title:`Tags`,subtitle:`Mode, status flags, and control tags`,className:r,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5 p-4`,children:[i.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a.length>0&&(0,K.jsx)(`h3`,{className:`blueprint-title text-muted-foreground`,children:`States`}),(0,K.jsx)(`div`,{className:o,children:i.map(([e,t])=>{let r=n?.get(e);return(0,K.jsx)(Ie,{name:e,value:r?r.value:t.value,dataType:t.meta.dataType,unit:t.meta.unit,access:t.meta.access},e)})})]}),a.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.length>0&&(0,K.jsx)(`h3`,{className:`blueprint-title text-muted-foreground`,children:`Flags & commands`}),(0,K.jsx)(`div`,{className:o,children:a.map(([e,t])=>{let r=n?.get(e);return(0,K.jsx)(Ie,{name:e,value:r?r.value:t.value,dataType:t.meta.dataType,unit:t.meta.unit,access:t.meta.access},e)})})]})]})})}var ze=120,Be=`gap-4 sm:gap-5 lg:gap-x-6 lg:gap-y-5 xl:gap-x-8`,Ve=`instance-detail-page relative isolate mx-auto flex min-h-full w-full max-w-screen-2xl flex-col gap-6 p-4 sm:gap-8 sm:p-6`;function He(e){return e instanceof Error&&`code`in e&&e.code===`NOT_FOUND`?!0:e instanceof Error&&/^404\b/.test(e.message.trim())}function Ue(){let{id:e}=re(),t=ne(),n=(0,G.useCallback)(()=>{(0,G.startTransition)(()=>{(0,G.addTransitionType)(xe),t(`/`)})},[t]),[r,i]=(0,G.useState)({}),[a,o]=(0,G.useState)(null),[s,h]=(0,G.useState)(!1),[g,_]=ee(`tab`,te([`hmi`,`operate`,`data`,`operations`]).withDefault(`hmi`)),v=g===`data`||g===`operations`?`operate`:g,y=ye();(0,G.useEffect)(()=>{y.isPending||o(null)},[y.isPending]),(0,G.useEffect)(()=>{(g===`data`||g===`operations`)&&_(`operate`)},[g,_]);let b=(0,G.useCallback)(e=>{_(`operate`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})})})},[_]);(0,G.useEffect)(()=>{let e=null,t=!1,r=()=>{t=!1,e&&=(clearTimeout(e),null)},i=i=>{if(i.metaKey||i.ctrlKey||i.altKey)return;let a=i.target;if(a){let e=a.tagName;if(e===`INPUT`||e===`TEXTAREA`||e===`SELECT`||a.isContentEditable)return}if(t){i.key===`f`?(b(`faults`),i.preventDefault()):i.key===`c`&&(b(`commands`),i.preventDefault()),r();return}if(i.key===`g`){t=!0,e=setTimeout(r,1200);return}i.key===`b`&&!i.shiftKey?(n(),i.preventDefault()):i.key===`?`&&(h(!0),i.preventDefault())};return window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`keydown`,i),r()}},[n,b]);let S=u({queryKey:be.instances.detail(e??``),queryFn:()=>l(`/instances/${e}`,c.instanceDetail),enabled:e!==void 0}),C=(0,G.useDeferredValue)(S.data??null),w=S.isError,T=L(e=>e.memberValues),E=(0,G.useMemo)(()=>e?T.get(e):void 0,[T,e]),D=L(e=>e.models),O=L(e=>e.instances),k=(0,G.useMemo)(()=>O.find(t=>t.id===e),[O,e]),ie=(0,G.useMemo)(()=>k?.activeFaults??[],[k]),A=(0,G.useRef)(new Map),j=L(e=>e.tick);(0,G.useEffect)(()=>{if(!E||!e)return;let t=A.current;for(let[e,n]of E){if(typeof n.value!=`number`)continue;let r=t.get(e);r||(r=[],t.set(e,r)),(r.length===0||r[r.length-1]?.tick!==j)&&(r.push({value:n.value,tick:j}),r.length>ze&&r.shift())}},[E,j,e]);let M=(0,G.useMemo)(()=>C?Me(C):[],[C]),P=(0,G.useMemo)(()=>{if(!C)return{operational:[],counters:[],reference:[]};let e=new Set(M.map(([e])=>e)),t=Object.entries(C.members).filter(([t])=>!e.has(t)),n=[],r=[],i=[];for(let e of t){let[,t]=e,a=t.meta.dataType,o=t.meta.kind,s=t.meta.unit,c=s===`pu`&&t.meta.euRange?.[0]===0&&t.meta.euRange?.[1]===1;o===`property`?i.push(e):a===`Boolean`||a===`String`||c?n.push(e):s===`count`||a===`UInt16`||a===`UInt32`?r.push(e):t.meta.access===`readwrite`||Ae.some(t=>e[0].endsWith(t))?n.push(e):s===`pu`||s===`h`?r.push(e):i.push(e)}return{operational:n,counters:r,reference:i}},[C,M]),ae=(0,G.useMemo)(()=>C?D.find(e=>e.name===C.assetType)?.faultNames??[]:[],[C,D]),F=ie??C?.activeFaults??[],I=(0,G.useMemo)(()=>{if(!E)return F.length>0;for(let[,e]of E)if(e.quality!==`good`)return!0;return!1},[E,F.length]),oe=(0,G.useMemo)(()=>P.operational.filter(([,e])=>e.meta.dataType===`String`),[P.operational]),se=(0,G.useMemo)(()=>P.operational.filter(([,e])=>e.meta.dataType!==`String`),[P.operational]),ce=t=>{if(!e)return;let n={},i=C?.methods[t];if(i)for(let e of i.inputArguments){let i=r[t]?.[e.name]??``,a=ge(e.name,i,e.dataType);if(!a)return;n[e.name]=a.value}o(t),y.mutateAsync({type:`invokeMethod`,instanceId:e,method:t,arguments:n}).then(async()=>{await S.refetch()}).catch(()=>{})},le=t=>{e&&y.mutate({type:`triggerFault`,instanceId:e,fault:t})},R=t=>{e&&y.mutate({type:`clearFault`,instanceId:e,fault:t})};if(!C)return w?He(S.error)?(0,K.jsx)(Se,{className:`min-h-full`,children:(0,K.jsx)(`div`,{className:`flex min-h-[40vh] items-center justify-center p-6 sm:p-12`,children:(0,K.jsx)(`div`,{className:`w-full max-w-md`,children:(0,K.jsxs)(f,{eyebrow:`Instance lookup`,stamp:`404`,title:`Instance not found`,detail:e??`Unknown instance id`,detailLabel:`Requested instance`,primaryLabel:`Back to Fleet`,onPrimary:n,children:[(0,K.jsx)(`p`,{children:`The requested asset is no longer in the running fleet or the URL is wrong.`}),(0,K.jsx)(`p`,{children:`Return to Fleet and pick a live instance from the current environment.`})]})})})}):(0,K.jsx)(Se,{className:`min-h-full`,children:(0,K.jsxs)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center gap-4 p-6 sm:p-12`,children:[(0,K.jsx)(`div`,{className:`w-full max-w-md`,children:(0,K.jsx)(d,{message:p(S.error,`Could not load instance.`),onRetry:()=>void S.refetch(),isRetrying:S.isFetching})}),(0,K.jsx)(N,{variant:`outline`,size:`sm`,onClick:n,children:`Back to Fleet`})]})}):k?(0,K.jsx)(`div`,{className:Ve,children:(0,K.jsx)(Oe,{detail:{id:k.id,assetType:k.model,browsePath:k.browsePath,lifecycleStage:k.lifecycleStage,operatingHours:k.operatingHours,activeFaults:k.activeFaults,isQuarantined:k.isQuarantined,parameters:{},members:{},methods:{}},tick:j,activeFaults:F,memberValues:E,onBack:n})}):null;let z=P.operational.length>0,B=P.counters.length>0,V=P.reference.length>0||Object.keys(C.parameters).length>0,ve=z||B||V,H=Object.keys(C.methods).length>0,U=z&&!B&&!V,W=z&&B&&V;return(0,K.jsxs)(`div`,{className:Ve,children:[(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 -z-10 hidden select-none overflow-hidden md:block`,children:(0,K.jsx)(`span`,{className:`absolute -top-2 left-0 whitespace-nowrap uppercase leading-none opacity-35 blur-[2px]`,style:{fontFamily:`var(--miravo-font-heading)`,fontSize:`clamp(5rem, 14vw, 12rem)`,fontWeight:`var(--miravo-weight-medium)`,letterSpacing:`var(--miravo-tracking-heading)`,color:`var(--miravo-ghost)`},children:C.assetType.replace(/_/g,` `)})}),(0,K.jsx)(Oe,{detail:C,tick:j,activeFaults:F,memberValues:E,onBack:n}),(0,K.jsx)(G.ViewTransition,{enter:`fade-in`,default:`none`,children:(0,K.jsxs)(pe,{value:v,onValueChange:e=>{_(e)},className:`min-h-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,K.jsxs)(fe,{variant:`line`,className:`h-10! min-w-max gap-0.5`,children:[(0,K.jsxs)(ue,{value:`hmi`,className:`gap-1.5 px-3 text-sm`,children:[(0,K.jsx)(he,{className:`size-3.5 shrink-0`}),`HMI`]}),(0,K.jsxs)(ue,{value:`operate`,className:`gap-1.5 px-3 text-sm`,children:[(0,K.jsx)(me,{className:`size-3.5 shrink-0`}),`Operate`]})]})}),(0,K.jsx)(de,{value:`hmi`,className:`flex-1 py-2`,children:(0,K.jsx)(m.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:(0,K.jsx)(Fe,{detail:C,processVariables:M,memberValues:E,historyRef:A,showQuality:I})},`hmi`)}),(0,K.jsx)(de,{value:`operate`,className:`flex-1 py-2`,children:(0,K.jsxs)(m.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`flex min-w-0 flex-col gap-4`,children:[ve&&(0,K.jsxs)(`section`,{"aria-label":`Data`,className:x(`grid min-w-0 grid-cols-1`,Be,W&&`lg:grid-cols-2 lg:grid-rows-[auto_auto] lg:items-start`,!W&&z&&(B||V)&&`lg:grid-cols-2 lg:items-start`),children:[z&&(0,K.jsx)(Re,{stringEnumMembers:oe,nonStringOperationalMembers:se,memberValues:E,className:x(`min-h-0 min-w-0 self-stretch`,U&&`lg:col-span-2`,W&&`lg:row-span-2`)}),!z&&B&&V&&(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-6 lg:col-span-2`,children:[(0,K.jsx)(Z,{counters:P.counters,memberValues:E}),(0,K.jsx)(Q,{detail:C,referenceMembers:P.reference,memberValues:E})]}),!z&&B&&!V&&(0,K.jsx)(Z,{className:`lg:col-span-2`,counters:P.counters,memberValues:E}),!z&&!B&&V&&(0,K.jsx)(Q,{className:`lg:col-span-2`,detail:C,referenceMembers:P.reference,memberValues:E}),z&&B&&(0,K.jsx)(Z,{className:`min-h-0 min-w-0 self-stretch lg:col-start-2 lg:row-start-1`,counters:P.counters,memberValues:E}),z&&V&&(0,K.jsx)(Q,{className:x(`min-h-0 min-w-0 self-stretch lg:col-start-2`,W?`lg:row-start-2`:`lg:row-start-1`),detail:C,referenceMembers:P.reference,memberValues:E})]}),(0,K.jsxs)(`section`,{"aria-label":`Operations`,className:x(_e,`grid grid-cols-1`,H&&`lg:grid-cols-2`),children:[(0,K.jsx)(De,{activeFaults:F,availableFaults:ae,onTriggerFault:le,onClearFault:R}),H&&(0,K.jsx)(`div`,{className:`border-t border-border/50 lg:border-l lg:border-t-0`,children:(0,K.jsx)(Ee,{detail:C,methodArgs:r,setMethodArgs:i,onInvoke:ce,isPending:y.isPending,pendingMethod:a})})]})]},`operate`)})]})}),(0,K.jsx)(We,{open:s,onOpenChange:h})]})}function We({open:e,onOpenChange:t}){return(0,K.jsx)(_,{open:e,onOpenChange:t,children:(0,K.jsxs)(v,{children:[(0,K.jsx)(y,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Keyboard shortcuts`}),(0,K.jsx)(g,{className:`text-sm text-muted-foreground`,children:`Navigate this instance without leaving the keyboard.`}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-2 pt-1`,children:[{keys:[`g`,`f`],label:`Jump to Alarms`},{keys:[`g`,`c`],label:`Jump to Commands`},{keys:[`b`],label:`Back to Fleet`},{keys:[`?`],label:`Show this sheet`}].map(e=>(0,K.jsxs)(`li`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`span`,{className:`text-sm text-foreground`,children:e.label}),(0,K.jsx)(`span`,{className:`flex items-center gap-1`,children:e.keys.map((t,n)=>(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`kbd`,{className:`rounded-[var(--miravo-radius-tight)] border border-border bg-muted/40 px-1.5 py-0.5 font-mono text-[11px] font-medium text-foreground`,children:t}),n<e.keys.length-1&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`then`})]},`${e.label}-${t}`))})]},e.label))})]})})}export{Ue as InstanceDetailPage};
@@ -1,4 +1,4 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-mizMYESS.js";import{c as r,g as i,r as a}from"./api-Bef9FEIU.js";import{t as o}from"./use-transition-navigate-C3Y3EWRr.js";import{t as s}from"./transition-nav-link-CuWixOOd.js";var c=e(t(),1),l=n(),u=`
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-mizMYESS.js";import{c as r,g as i,r as a}from"./api-Bef9FEIU.js";import{t as o}from"./use-transition-navigate-CG8tHeYN.js";import{t as s}from"./transition-nav-link-B89fDRXR.js";var c=e(t(),1),l=n(),u=`
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-BbWAxRFR.js";export{e as ModelsPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-mizMYESS.js";import{_ as r,a as i}from"./api-Bef9FEIU.js";import{a,n as o,t as s}from"./get-error-message-DhCjoSSJ.js";import{t as c}from"./proxy-CgM57W61.js";import{t as l}from"./AnimatePresence-CVhkybDC.js";import{a as u,i as d,n as f,o as p,r as m,s as h}from"./copy-button-BK3jqKBZ.js";import{n as g,t as _}from"./createLucideIcon-Yddw9eHa.js";import{S as v,g as y,h as b,n as x,p as S,t as C}from"./input-BCiRHEmc.js";import{t as w}from"./activity-DP0Us3HU.js";import{C as T,n as E,t as D,w as O}from"./use-platform-stream-BZTQlkbS.js";import{l as k}from"./select-4wihIkEE.js";import{i as A,n as j,r as M,t as N}from"./tabs-BgPF8MSY.js";import{n as ee}from"./checkbox-Xly18Uyz.js";import{a as P,c as F,i as I,l as L,n as R,o as z,r as B,s as V,t as H}from"./deploy-tab-zi4NXsfj.js";import{c as U,n as te,r as ne,s as re,t as ie}from"./use-engine-command-mutation-DTvKLMBg.js";import{t as W}from"./triangle-alert-DPtblpQC.js";import{t as G}from"./badge-tnWgSITj.js";import{t as K}from"./query-keys-Co1J4HmV.js";var q=_(`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`}]]),J=_(`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`}]]),ae=_(`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`}]]),oe=_(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),se=_(`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`}]]),Y=e(t(),1),X=n(),ce=new Set([`fault_active`,`fault_count`,`active_fault_code`,`lifecycle_stage`,`health_state`,`availability_state`]);function le(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};ce.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,X.jsx)(V,{className:`size-3`}),members:t,accentClass:`text-muted-foreground`}),n.length>0&&a.push({key:`commands`,label:`Commands`,icon:(0,X.jsx)(oe,{className:`size-3`}),members:n,accentClass:`text-info`}),r.length>0&&a.push({key:`process`,label:`Process Tags`,icon:(0,X.jsx)(w,{className:`size-3`}),members:r,accentClass:`text-primary`}),i.length>0&&a.push({key:`health`,label:`Health & Status`,icon:(0,X.jsx)(ae,{className:`size-3`}),members:i,accentClass:`text-success`}),a}function ue({modelName:e,onClose:t}){let[n,l]=(0,Y.useState)(new Set([`nameplate`,`process`])),u=a({queryKey:K.catalog.modelSchema(e??``),queryFn:()=>i(`/catalog/models/${e}`,r.catalogModelDetail),enabled:e!==null}),d=u.data,f=u.isPending&&!d,p=u.isError,m=s(u.error,`Failed to load model.`);(0,Y.useEffect)(()=>{e&&l(new Set([`nameplate`,`process`]))},[e]);let h=(0,Y.useMemo)(()=>d?le(d.members):[],[d]),g=(0,Y.useCallback)(e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),_=D(),b=d?Object.keys(d.members).length:0,x=d?Object.keys(d.methods).length:0;return(0,X.jsx)(R,{open:e!==null,onOpenChange:e=>{e||(_.reset(),t())},children:(0,X.jsx)(B,{side:`right`,className:`flex w-full flex-col gap-4 touch-manipulation`,children:f?null:p&&!d?(0,X.jsx)(`div`,{className:`flex flex-1 flex-col justify-center px-2`,children:(0,X.jsx)(o,{message:m,onRetry:()=>void u.refetch(),isRetrying:u.isFetching})}):d?(0,X.jsxs)(c.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.18},className:`flex min-h-0 flex-1 flex-col gap-4`,children:[(0,X.jsxs)(P,{className:`gap-1 pb-0 pe-12`,children:[(0,X.jsx)(z,{className:`font-heading text-base uppercase tracking-wide`,children:y(d.name)}),d.description&&(0,X.jsx)(I,{className:`text-xs leading-relaxed text-foreground/88`,children:d.description}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[b,` members`]}),(0,X.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[x,` methods`]}),(0,X.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[d.faults.length,` faults`]}),d.lifecycle&&(0,X.jsxs)(G,{variant:`outline`,className:`font-mono text-xs text-primary`,children:[d.lifecycle.stages.length,`-stage lifecycle`]}),(0,X.jsx)(E,{stream:_})]})]}),(0,X.jsxs)(N,{defaultValue:`overview`,className:`flex min-h-0 flex-1 flex-col gap-1 pt-0`,children:[(0,X.jsxs)(M,{variant:`line`,className:`h-8! shrink-0 gap-0.5 border-b-border/60 px-2 py-0.5`,children:[(0,X.jsx)(A,{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,X.jsx)(A,{value:`deploy`,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:`Deploy`})]}),(0,X.jsx)(j,{value:`overview`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-2`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5 pb-1 pt-0.5`,children:[h.map(e=>(0,X.jsx)(Z,{sectionKey:e.key,label:e.label,count:e.members.length,icon:e.icon,accentClass:e.accentClass,expanded:n.has(e.key),onToggle:g,children:(0,X.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.members.map(e=>(0,X.jsx)(de,{member:e},e.name))})},e.key)),d.faults.length>0&&(0,X.jsx)(Z,{sectionKey:`faults`,label:`Faults`,count:d.faults.length,icon:(0,X.jsx)(W,{className:`size-3`}),accentClass:`text-warning`,expanded:n.has(`faults`),onToggle:g,children:(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:d.faults.map(e=>(0,X.jsx)(G,{variant:`secondary`,className:`text-[10px] text-warning`,children:v(e)},e))})}),d.lifecycle&&(0,X.jsx)(Z,{sectionKey:`lifecycle`,label:`Lifecycle`,count:d.lifecycle.stages.length,icon:(0,X.jsx)(J,{className:`size-3`}),accentClass:`text-primary`,expanded:n.has(`lifecycle`),onToggle:g,children:(0,X.jsx)(fe,{lifecycle:d.lifecycle})}),x>0&&(0,X.jsx)(Z,{sectionKey:`methods`,label:`Methods`,count:x,icon:(0,X.jsx)(se,{className:`size-3`}),accentClass:`text-info`,expanded:n.has(`methods`),onToggle:g,children:(0,X.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:Object.entries(d.methods).map(([e,t])=>(0,X.jsx)(pe,{name:e,method:t},e))})})]})})})}),(0,X.jsx)(j,{value:`deploy`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,X.jsx)(H,{kind:`model`,id:d.name,displayName:y(d.name),yamlPath:`/catalog/models/${d.name}/yaml`,yamlFilename:`${d.name}.twin.yaml`,stream:_})})})]})]},d.name):(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Model not found`})})})}function Z({sectionKey:e,label:t,count:n,icon:r,accentClass:i,expanded:a,onToggle:o,children:s}){return(0,X.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50`,children:[(0,X.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,X.jsx)(`span`,{className:i,children:r}),(0,X.jsx)(`span`,{className:`uppercase tracking-wider`,children:t}),(0,X.jsx)(G,{variant:`secondary`,className:`ml-auto text-[10px]`,children:n}),(0,X.jsx)(k,{className:`size-3 text-muted-foreground transition-transform ${a?`rotate-180`:``}`})]}),(0,X.jsx)(l,{initial:!1,children:a&&(0,X.jsx)(c.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,X.jsx)(`div`,{className:`border-t px-2.5 py-1.5`,children:s})},`content`)})]})}function de({member:e}){return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 py-0.5 text-xs`,children:[(0,X.jsx)(`span`,{title:e.name,className:`min-w-0 truncate font-mono text-foreground`,children:S(e.name)}),(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:e.dataType}),e.unit&&(0,X.jsx)(G,{variant:`outline`,className:`px-1 py-0 text-[10px]`,children:e.unit}),e.euRange&&(0,X.jsxs)(`span`,{className:`ml-auto font-mono text-xs text-muted-foreground`,children:[`[`,e.euRange[0],`–`,e.euRange[1],`]`]})]})}var Q={healthy:`bg-success`,normal:`bg-success`,degraded:`bg-warning`,critical:`bg-destructive`,failed:`bg-destructive`};function fe({lifecycle:e}){let t=e.stages.length;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`div`,{className:`flex h-2.5 w-full overflow-hidden rounded-full bg-muted`,children:e.stages.map((e,n)=>(0,X.jsx)(`div`,{className:`transition-[background-color] ${Q[e]??`bg-chart-1`} ${n===0?`rounded-l-full`:``} ${n===t-1?`rounded-r-full`:``}`,style:{width:`${100/t}%`}},`${e}-${n}`))}),(0,X.jsx)(`div`,{className:`flex items-center gap-3`,children:e.stages.map((e,t)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,X.jsx)(`span`,{className:`size-2 rounded-full ${Q[e]??`bg-chart-1`}`}),(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:v(e)})]},`${e}-${t}`))}),(0,X.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[`~`,b(e.totalHours),` total hours`]})]})}function pe({name:e,method:t}){return(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:e}),t.inputArguments.length>0&&(0,X.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t.inputArguments.map(e=>`${e.name}: ${e.dataType}`).join(`, `),`)`]})]}),t.description&&(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.description})]})}function me(){let[e,t]=(0,Y.useState)(``),[n,_]=(0,Y.useState)({}),[v,b]=(0,Y.useState)(null),[S,w]=(0,Y.useState)(null),[T,E]=(0,Y.useState)(null),D=(0,Y.useRef)(null),O=ie();(0,Y.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(),D.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let k=a({queryKey:K.catalog.models(),queryFn:()=>i(`/catalog/models`,r.catalogModels)}),A=k.data??[],j=k.isPending&&!k.data,M=k.isError&&!k.data,N=k.isError&&!!k.data,P=s(k.error,`Failed to load models.`),I=e=>n[e]??1,L=(0,Y.useCallback)((e,t)=>{_(n=>({...n,[e]:Math.max(1,Math.min(10,t))}))},[]),R=(0,Y.useCallback)(e=>{E(e)},[]),z=(0,Y.useCallback)(e=>{w(e)},[]),B=async e=>{b(e);try{return await O.mutateAsync({type:`spawn`,model:e,count:I(e)}),!0}catch{return!1}finally{b(null)}},V=e?A.filter(t=>t.name.toLowerCase().includes(e.toLowerCase())||(t.description?.toLowerCase().includes(e.toLowerCase())??!1)):A;return(0,X.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,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Asset Model Library`}),(0,X.jsx)(G,{variant:`outline`,className:`text-xs`,children:M?(0,X.jsx)(`span`,{className:`text-destructive`,children:`Unavailable`}):j&&A.length===0?(0,X.jsx)(X.Fragment,{children:`Loading...`}):(0,X.jsxs)(X.Fragment,{children:[A.length,` built-in`]})})]}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Canonical twin models with realistic physics, lifecycle degradation, and fault modes. Inspect to explore schema, copy YAML, or export.`})]}),M&&(0,X.jsx)(o,{message:P,onRetry:()=>void k.refetch(),isRetrying:k.isFetching}),N&&(0,X.jsx)(o,{message:`${P} Showing cached models.`,onRetry:()=>void k.refetch(),isRetrying:k.isFetching}),!M&&A.length>6&&(0,X.jsxs)(`div`,{className:`relative max-w-xs`,children:[(0,X.jsx)(F,{className:`absolute left-2.5 top-2.5 size-4 text-muted-foreground`}),(0,X.jsx)(C,{ref:D,placeholder:`Filter models...`,value:e,onChange:e=>t(e.target.value),className:`pl-9 pr-7`}),!e&&(0,X.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,X.jsx)(`div`,{className:`grid grid-cols-1 gap-4 @[720px]/models:grid-cols-2 @[1120px]/models:grid-cols-3`,"aria-busy":j&&!M,children:M?null:(0,X.jsxs)(X.Fragment,{children:[j&&A.length===0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`}),(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`}),(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`}),(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`}),(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`}),(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`})]}),(0,X.jsx)(l,{children:V.map((e,t)=>(0,X.jsx)(c.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,X.jsx)(he,{model:e,count:I(e.name),spawning:v===e.name,onCountChange:L,onInspect:R,onSpawn:z})},e.name))}),V.length===0&&A.length>0&&(0,X.jsxs)(`p`,{className:`col-span-full py-8 text-center text-sm text-muted-foreground`,children:[`No models match “`,e,`”`]})]})}),A.length>0&&(0,X.jsx)(`div`,{className:g(ne,`p-0`),children:(0,X.jsx)(`div`,{className:`community-teaser relative overflow-hidden rounded-[inherit]`,children:(0,X.jsx)(`div`,{className:`relative z-10 mx-auto max-w-3xl px-5 py-10 sm:px-10 sm:py-12`,children:(0,X.jsxs)(`div`,{className:`grid items-center gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,17rem)]`,children:[(0,X.jsxs)(`div`,{className:`order-2 flex min-w-0 flex-col gap-4 lg:order-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,X.jsx)(`p`,{className:`blueprint-title text-primary`,children:`Future channel`}),(0,X.jsx)(`span`,{className:`blueprint-stat text-[10px] text-muted-foreground`,children:`MIRAVO_REGISTRY · NOT_CONNECTED`})]}),(0,X.jsx)(`h2`,{className:`font-heading text-xl font-semibold tracking-tight sm:text-2xl`,children:`Community Models`}),(0,X.jsx)(`p`,{className:`max-w-xl text-sm leading-relaxed text-muted-foreground`,children:`Publish your custom twin models to the Miravo registry. Discover equipment models from other engineers, fork them, and adapt parameters for your use case.`}),(0,X.jsx)(`div`,{children:(0,X.jsx)(G,{variant:`outline`,className:`community-teaser-soon border-primary/35 bg-primary/5 text-[10px] text-primary`,children:`Coming Soon`})})]}),(0,X.jsx)(`div`,{className:`order-1 flex justify-center lg:order-2 lg:justify-end`,children:(0,X.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,X.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,X.jsx)(ee,{className:`size-9 text-primary`,"aria-hidden":!0})}),(0,X.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] tracking-[0.18em] text-muted-foreground`,children:`AWAITING SIGNAL`}),(0,X.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] text-muted-foreground`,children:`Uplink idle`})]})})]})})})}),(0,X.jsx)(f,{open:S!==null,onOpenChange:e=>{e||w(null)},children:(0,X.jsxs)(m,{children:[(0,X.jsxs)(p,{children:[(0,X.jsx)(h,{children:`Spawn instances?`}),(0,X.jsx)(d,{children:S!==null&&(0,X.jsxs)(X.Fragment,{children:[`This spawns `,I(S),` instance`,I(S)===1?``:`s`,` of`,` `,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:y(S)}),` `,`into the running environment.`]})})]}),(0,X.jsxs)(u,{children:[(0,X.jsx)(x,{variant:`outline`,disabled:v!==null,onClick:()=>w(null),children:`Cancel`}),(0,X.jsx)(x,{disabled:v!==null||S===null,onClick:async()=>{S!==null&&await B(S)&&w(null)},children:v===S?`Spawning...`:`Spawn`})]})]})}),(0,X.jsx)(ue,{modelName:T,onClose:()=>E(null)})]})}var he=(0,Y.memo)(function({model:e,count:t,spawning:n,onCountChange:r,onInspect:i,onSpawn:a}){return(0,X.jsxs)(`div`,{className:g(re,`flex flex-col gap-4 p-5`),children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.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,X.jsx)(q,{className:`size-4`})}),(0,X.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{className:`font-heading text-sm font-semibold uppercase tracking-wide`,children:y(e.name)}),e.description&&(0,X.jsx)(`span`,{className:`line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-muted-foreground`,children:[(0,X.jsx)($,{label:`mbr`,value:e.memberCount}),(0,X.jsx)($,{label:`mth`,value:e.methodCount}),(0,X.jsx)($,{label:`flt`,value:e.faultCount}),e.hasLifecycle&&(0,X.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,children:[(0,X.jsx)(`span`,{className:`text-[10px]`,children:`◈`}),(0,X.jsxs)(`span`,{children:[e.lifecycleStageCount,`-stage`]})]}),(0,X.jsx)(G,{variant:`secondary`,className:`ml-auto shrink-0 font-sans text-[10px] font-medium`,children:e.source})]}),(0,X.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 border-t border-border/30 pt-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center rounded-[var(--miravo-radius-tight)] border bg-muted/30`,children:[(0,X.jsx)(x,{variant:`ghost`,size:`icon`,className:`size-7 rounded-none rounded-l-md`,disabled:t<=1,"aria-label":`Decrease count`,onClick:n=>{n.stopPropagation(),r(e.name,t-1)},children:(0,X.jsx)(L,{className:`size-3`})}),(0,X.jsx)(`span`,{className:`flex size-7 items-center justify-center border-x font-mono text-xs`,children:t}),(0,X.jsx)(x,{variant:`ghost`,size:`icon`,className:`size-7 rounded-none rounded-r-md`,disabled:t>=10,"aria-label":`Increase count`,onClick:n=>{n.stopPropagation(),r(e.name,t+1)},children:(0,X.jsx)(T,{className:`size-3`})})]}),(0,X.jsxs)(x,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(e.name),className:te,children:[(0,X.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),`Inspect`]}),(0,X.jsxs)(x,{size:`sm`,className:`ml-auto`,disabled:n,onClick:()=>a(e.name),children:[(0,X.jsx)(U,{className:`mr-1 size-3`}),n?`...`:`Spawn`]})]})]})});function $({label:e,value:t}){return(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`text-foreground`,children:t}),` `,(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:e})]})}export{q as n,me as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-mizMYESS.js";import{F as r,I as i,P as a,_ as o,a as s,g as c}from"./api-Bef9FEIU.js";import{a as l,i as u,l as d,n as f,o as p,t as m}from"./get-error-message-DhCjoSSJ.js";import{t as h}from"./proxy-CgM57W61.js";import{t as g}from"./AnimatePresence-CVhkybDC.js";import{i as _,r as v}from"./dist-jROhexoH.js";import{n as y}from"./chunk-OE4NN4TA-m2UhO8Q2.js";import{a as b,i as x,l as S,n as C,o as ee,r as te,s as w,t as T}from"./copy-button-BK3jqKBZ.js";import{n as E,t as D}from"./createLucideIcon-Yddw9eHa.js";import{i as O,n as k,t as ne}from"./tooltip-TtanriwA.js";import{a as A,b as j,f as M,g as re,n as N,r as P}from"./input-BCiRHEmc.js";import{t as F}from"./activity-DP0Us3HU.js";import{t as ie}from"./arrow-right-DrKCU9WM.js";import{C as ae,S as I,_ as oe,a as se,c as ce,d as le,f as ue,h as de,i as fe,l as pe,m as me,n as he,o as ge,p as _e,r as ve,s as ye,t as be,u as xe,v as Se,x as Ce,y as we}from"./use-platform-stream-BZTQlkbS.js";import{n as Te,t as Ee}from"./catalog-template-icons-b6a6Gty-.js";import{c as L,i as R,l as De,n as z,s as B,t as V}from"./select-4wihIkEE.js";import{a as Oe,i as ke,r as H}from"./platform-targets-BbVxaqAc.js";import{c as U,i as W,n as G,o as Ae,r as je,s as Me,t as Ne}from"./tabs-BgPF8MSY.js";import{n as Pe,r as Fe,t as Ie}from"./checkbox-Xly18Uyz.js";import{n as Le,t as K}from"./server-D7sb2mj5.js";import{t as Re}from"./triangle-alert-DPtblpQC.js";import{t as ze}from"./badge-tnWgSITj.js";import{t as q}from"./skeleton-C6iEH-9E.js";import{t as J}from"./query-keys-Co1J4HmV.js";import{t as Be}from"./label-xIWEC6lW.js";var Ve=class extends d{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:i()})}getOptimisticResult(e){return e.behavior=i(),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,i=super.createResult(e,t),{isFetching:o,isRefetching:s,isError:c,isRefetchError:l}=i,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:a(t,n.data),hasPreviousPage:r(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function He(e,t){return p(e,Ve,t)}var Ue=D(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),We=D(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Ge=D(`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`}]]),Ke=D(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Y=e(t(),1),X=n(),qe=`rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/55 bg-muted/10`;function Je(){return(0,X.jsx)(`p`,{className:`mt-2 text-pretty text-sm leading-relaxed text-muted-foreground`,children:`Add a target to get started.`})}function Ye({onClick:e}){return(0,X.jsxs)(N,{type:`button`,size:`sm`,className:`h-7 shrink-0 gap-1.5 text-xs`,onClick:e,children:[(0,X.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),`Add Target`]})}function Xe({titleId:e,frameIcon:t,description:n,children:r}){return(0,X.jsx)(`section`,{"aria-labelledby":e,className:qe,children:(0,X.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-4 py-10 text-center`,children:[(0,X.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/50`,children:t}),(0,X.jsxs)(`div`,{className:`max-w-sm`,children:[(0,X.jsx)(`h2`,{id:e,className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`No targets yet`}),n]}),r]})})}function Ze({stream:e,onReset:t,catalogTemplates:n}){let[r,i]=(0,Y.useState)(!1),a=e.operation?.operationId;if((0,Y.useEffect)(()=>{i(!1)},[a]),!e.operation&&e.status!==`running`)return null;let{title:o,subtitle:s}=fe(e),c=e.status===`complete`,l=e.status===`error`,u=e.status===`running`,d=c||l;async function f(){i(!0);try{await e.cancel()}catch{i(!1)}}return(0,X.jsx)(me,{title:o,subtitle:s,footerAction:u&&e.operation?.operationId?(0,X.jsx)(`div`,{className:`ml-auto shrink-0`,children:(0,X.jsx)(`button`,{type:`button`,onClick:f,disabled:r,"aria-busy":r,className:E(P({variant:`outline`,size:`sm`}),`group h-8 gap-1.5 px-3 text-xs`,r?`cursor-not-allowed`:`hover:bg-destructive/12 hover:text-destructive hover:border-destructive/35`),children:r?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ae,{className:`size-3.5 shrink-0 animate-spin text-muted-foreground`,"aria-hidden":!0}),(0,X.jsx)(h.span,{animate:{opacity:[1,.72,1]},transition:{duration:1.25,repeat:1/0,ease:`easeInOut`},className:`font-medium text-foreground`,children:`Cancelling…`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{className:`size-3.5 shrink-0 text-foreground/65 group-hover:text-destructive`,"aria-hidden":!0}),(0,X.jsx)(h.span,{animate:{opacity:[1,.88,1]},transition:{duration:2.2,repeat:1/0,ease:`easeInOut`},children:`Cancel`})]})})}):d?(0,X.jsxs)(`div`,{className:`flex w-full flex-col gap-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 w-full flex-1 flex-wrap items-center justify-between gap-x-3 gap-y-1`,children:[(0,X.jsxs)(y,{to:`/platforms?tab=activity`,className:E(P({variant:`ghost`,size:`xs`}),`group inline-flex h-6 shrink-0 items-center gap-1.5 px-2 text-[11px] font-medium text-foreground/80`,`hover:bg-primary/12 hover:text-primary`),children:[(0,X.jsx)(F,{className:`size-3 shrink-0 text-foreground/70 group-hover:text-primary`,"aria-hidden":!0}),`View full activity`,(0,X.jsx)(Oe,{className:`size-2.5 shrink-0 text-foreground/50 group-hover:text-primary`,"aria-hidden":!0})]}),(0,X.jsx)(`div`,{className:`flex shrink-0 items-center`,children:(0,X.jsx)(N,{type:`button`,variant:`secondary`,size:`xs`,className:`h-6 px-2.5 text-[11px] font-medium`,onClick:t,children:`Close`})})]}),e.operation?.status===`cancelled`||l&&e.operation?(0,X.jsx)(Se,{type:e.operation.type,errorMessage:e.operation.error,className:`mt-2.5 w-full min-w-0`}):null]}):void 0,onDismiss:t,children:e.operation?(0,X.jsx)(oe,{operation:e.operation,catalogTemplates:n}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 py-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Ae,{className:`size-3.5 animate-spin text-primary`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`text-xs text-foreground/78`,children:`Connecting to Litmus Edge…`})]}),(0,X.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-muted/55`,children:(0,X.jsx)(h.div,{className:`h-full w-2/5 rounded-full bg-primary`,animate:{x:[`-100%`,`250%`]},transition:{duration:1.2,repeat:1/0,ease:`easeInOut`}})})]})})}function Qe(e){return e.map(e=>e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)).join(`, `)}function $e({onCloseTable:e,planKind:t=`apply`}){return(0,X.jsx)(`div`,{className:`border-b border-border/40 px-3 py-3 sm:px-4`,children:(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[(0,X.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-muted/15`,children:(0,X.jsx)(Ue,{className:`size-4 text-muted-foreground`,"aria-hidden":!0})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-1 pt-0.5 sm:gap-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,X.jsx)(`p`,{className:`font-heading text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground`,children:t===`cleanup`?`Expected removals`:`Expected changes`}),(0,X.jsx)(`span`,{className:`rounded-[var(--miravo-radius-tight)] border border-primary/25 bg-primary/5 px-1.5 py-px font-mono text-[9px] uppercase tracking-wider text-primary/90`,children:`Draft`})]}),(0,X.jsx)(`p`,{className:`mt-1.5 max-w-prose text-[10px] leading-relaxed text-muted-foreground`,children:t===`cleanup`?`Preview only — nothing runs until you confirm cleanup.`:`Preview only — nothing runs until you confirm deploy.`})]}),e&&(0,X.jsx)(N,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 shrink-0 text-muted-foreground hover:text-foreground`,onClick:e,"aria-label":`Close table`,children:(0,X.jsx)(A,{className:`size-4`,"aria-hidden":!0})})]})]})})}var et={create:`border-success/30 bg-success/12 text-success`,update:`border-info/30 bg-info/12 text-info`,replace:`border-chart-2/30 bg-chart-2/12 text-chart-2`,delete:`border-destructive/30 bg-destructive/12 text-destructive`,blocked:`border-warning/30 bg-warning/12 text-warning`};function tt({plan:e,planKind:t}){let n=t===`apply`&&e.sourceHostname!=null&&e.sourceHostname!==``;return(0,X.jsx)(`div`,{className:`border-b border-border/35 bg-muted/10 px-3 py-2 sm:px-4`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-[10px] leading-snug sm:flex-row sm:flex-wrap sm:items-baseline sm:gap-x-4 sm:gap-y-1`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-[9px] uppercase tracking-wider text-muted-foreground/85`,children:`Target LE`}),(0,X.jsx)(`span`,{className:`font-mono text-foreground/90 wrap-anywhere`,children:e.targetHost})]}),n?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5 sm:border-l sm:border-border/50 sm:pl-4`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-[9px] uppercase tracking-wider text-muted-foreground/85`,children:Ce}),(0,X.jsx)(`span`,{className:`font-mono text-foreground/90 wrap-anywhere`,children:e.sourceHostname})]}):null]})})}function nt({entries:e}){let t=e.reduce((e,t)=>(e[t.action]++,e),{create:0,update:0,replace:0,delete:0,blocked:0});return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border/35 px-3 py-2.5 sm:px-4`,children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`Summary of planned actions`}),(0,X.jsx)(`span`,{className:`font-mono text-[9px] uppercase tracking-[0.18em] text-muted-foreground`,children:`Manifest`}),(0,X.jsx)(`span`,{className:`hidden h-3 w-px bg-border/60 sm:block`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2`,children:[t.create>0&&(0,X.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-success/25 bg-success/10 px-2 py-0.5 font-mono text-[10px] tabular-nums text-success`,children:[`+`,t.create,` new`]}),t.update>0&&(0,X.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-info/25 bg-info/10 px-2 py-0.5 font-mono text-[10px] tabular-nums text-info`,children:[`~`,t.update,` update`]}),t.replace>0&&(0,X.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-chart-2/25 bg-chart-2/10 px-2 py-0.5 font-mono text-[10px] tabular-nums text-chart-2`,children:[`↺`,t.replace,` replace`]}),t.delete>0&&(0,X.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-destructive/25 bg-destructive/10 px-2 py-0.5 font-mono text-[10px] tabular-nums text-destructive`,children:[`−`,t.delete,` remove`]}),t.blocked>0&&(0,X.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-warning/25 bg-warning/10 px-2 py-0.5 font-mono text-[10px] tabular-nums text-warning`,children:[t.blocked,` skipped`]})]})]})}function rt({plan:e,onCloseTable:t,planKind:n=`apply`}){return e.entries.length===0?(0,X.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border/55`,children:[(0,X.jsx)($e,{onCloseTable:t,planKind:n}),(0,X.jsx)(tt,{plan:e,planKind:n}),(0,X.jsxs)(`div`,{className:`flex flex-col items-center gap-3 px-4 py-10 text-center`,children:[(0,X.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/50`,children:(0,X.jsx)(Ue,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:n===`cleanup`?`Nothing to remove`:`Nothing to change`}),(0,X.jsx)(`p`,{className:`mx-auto mt-2 max-w-sm text-[11px] leading-relaxed text-muted-foreground`,children:n===`cleanup`?`No Miravo-managed resources matched this cleanup scope on the environment — nothing would be deleted.`:`This environment already matches what is on the target — no create or update steps.`})]})]})]}):(0,X.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-border/45`,children:[(0,X.jsx)($e,{onCloseTable:t,planKind:n}),(0,X.jsx)(tt,{plan:e,planKind:n}),(0,X.jsx)(nt,{entries:e.entries}),(0,X.jsx)(`div`,{className:`overflow-x-auto`,children:(0,X.jsxs)(`table`,{className:`w-full min-w-lg text-xs`,children:[(0,X.jsx)(`caption`,{className:`sr-only`,children:n===`cleanup`?`Detailed list of planned cleanup actions in deletion order`:`Detailed list of create, update, and delete actions in deployment order`}),(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{className:`border-b border-border/45`,children:[(0,X.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left font-heading text-[9px] font-semibold uppercase tracking-[0.14em] text-muted-foreground sm:px-3.5`,children:`Action`}),(0,X.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left font-heading text-[9px] font-semibold uppercase tracking-[0.14em] text-muted-foreground sm:px-3.5`,children:`Type`}),(0,X.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left font-heading text-[9px] font-semibold uppercase tracking-[0.14em] text-muted-foreground sm:px-3.5`,children:`Name`}),(0,X.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 hidden bg-background px-3 py-2 text-left font-heading text-[9px] font-semibold uppercase tracking-[0.14em] text-muted-foreground sm:table-cell sm:px-3.5`,children:`Protocol`}),(0,X.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 hidden bg-background px-3 py-2 text-left font-heading text-[9px] font-semibold uppercase tracking-[0.14em] text-muted-foreground md:table-cell md:px-3.5`,children:`Detail`})]})}),(0,X.jsx)(`tbody`,{children:e.entries.map((e,t)=>(0,X.jsxs)(`tr`,{className:E(`border-b border-border/25 transition-colors`,t%2==1?`bg-muted/35`:`bg-transparent`,`hover:bg-primary/4`),children:[(0,X.jsx)(`td`,{className:`px-3 py-2 align-middle sm:px-3.5`,children:(0,X.jsx)(ze,{variant:`outline`,className:E(`border px-1.5 py-0 font-mono text-[10px] uppercase tracking-wide`,et[e.action]),children:e.action})}),(0,X.jsx)(`td`,{className:`px-3 py-2 align-middle font-mono text-[11px] text-foreground sm:px-3.5`,children:e.resourceType}),(0,X.jsx)(`td`,{className:`max-w-[min(16rem,28vw)] truncate px-3 py-2 align-middle font-mono text-[11px] text-foreground sm:max-w-xs sm:px-3.5`,children:e.name}),(0,X.jsx)(`td`,{className:`hidden px-3 py-2 align-middle font-mono text-[11px] text-muted-foreground sm:table-cell sm:px-3.5`,children:e.protocol??`—`}),(0,X.jsx)(`td`,{className:`hidden max-w-xs truncate px-3 py-2 align-middle text-[11px] text-muted-foreground md:table-cell md:px-3.5`,children:e.blockReason??e.detail??`—`})]},`${e.action}-${e.resourceType}-${e.name}-${e.protocol??``}-${e.detail??e.blockReason??``}`))})]})}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border/40 px-3 py-3 text-[10px] text-muted-foreground sm:flex-row sm:items-center sm:justify-between sm:gap-4 sm:px-4`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`font-mono tabular-nums text-foreground/90`,children:e.entries.length}),` `,(0,X.jsxs)(`span`,{className:`text-muted-foreground/90`,children:[e.entries.length===1?`action`:`actions`,` queued`]})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 font-mono text-[10px] wrap-anywhere`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-[9px] uppercase tracking-wider text-muted-foreground/80`,children:`Scope`}),(0,X.jsx)(`span`,{className:`min-w-0 text-foreground/90`,children:Qe(e.scope)})]})]})]})}var it=[`s1`,`s2`,`s3`,`s4`];function at(){return(0,X.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-border/45`,role:`status`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`Loading plan preview`}),(0,X.jsx)(`div`,{className:`border-b border-border/40 px-3 py-3 sm:px-4`,children:(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[(0,X.jsx)(q,{className:`size-10 shrink-0 rounded-[var(--miravo-radius-stadium-sm)]`}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-1 items-start gap-1 pt-0.5 sm:gap-2`,children:(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,X.jsx)(q,{className:`h-3.5 w-40`}),(0,X.jsx)(q,{className:`h-4 w-11 rounded-[var(--miravo-radius-tight)] border`})]}),(0,X.jsx)(q,{className:`mt-1.5 h-3 max-w-prose`})]})})]})}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border/35 px-3 py-2.5 sm:px-4`,children:[(0,X.jsx)(q,{className:`h-2.5 w-14`}),(0,X.jsx)(q,{className:`hidden h-3 w-px shrink-0 sm:block`}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2`,children:[(0,X.jsx)(q,{className:`h-5 w-18 rounded-[var(--miravo-radius-tight)]`}),(0,X.jsx)(q,{className:`h-5 w-24 rounded-[var(--miravo-radius-tight)]`}),(0,X.jsx)(q,{className:`h-5 w-20 rounded-[var(--miravo-radius-tight)]`})]})]}),(0,X.jsx)(`div`,{className:`overflow-x-auto`,children:(0,X.jsxs)(`table`,{className:`w-full min-w-lg text-xs`,"aria-hidden":!0,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{className:`border-b border-border/45`,children:[(0,X.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left sm:px-3.5`,children:(0,X.jsx)(q,{className:`h-2.5 w-12`})}),(0,X.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left sm:px-3.5`,children:(0,X.jsx)(q,{className:`h-2.5 w-9`})}),(0,X.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left sm:px-3.5`,children:(0,X.jsx)(q,{className:`h-2.5 w-10`})}),(0,X.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 hidden bg-background px-3 py-2 text-left sm:table-cell sm:px-3.5`,children:(0,X.jsx)(q,{className:`h-2.5 w-14`})}),(0,X.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 hidden bg-background px-3 py-2 text-left md:table-cell md:px-3.5`,children:(0,X.jsx)(q,{className:`h-2.5 w-11`})})]})}),(0,X.jsx)(`tbody`,{children:it.map((e,t)=>(0,X.jsxs)(`tr`,{className:E(`border-b border-border/25 transition-colors`,t%2==1?`bg-muted/35`:`bg-transparent`,`hover:bg-primary/4`),children:[(0,X.jsx)(`td`,{className:`px-3 py-2 align-middle sm:px-3.5`,children:(0,X.jsx)(q,{className:`h-5 w-13 rounded-[var(--miravo-radius-tight)]`})}),(0,X.jsx)(`td`,{className:`px-3 py-2 align-middle sm:px-3.5`,children:(0,X.jsx)(q,{className:`h-3.5 w-16 font-mono`})}),(0,X.jsx)(`td`,{className:`max-w-[min(16rem,28vw)] px-3 py-2 align-middle sm:max-w-xs sm:px-3.5`,children:(0,X.jsx)(q,{className:`h-3.5 w-full max-w-48 font-mono`})}),(0,X.jsx)(`td`,{className:`hidden px-3 py-2 align-middle sm:table-cell sm:px-3.5`,children:(0,X.jsx)(q,{className:`h-3.5 w-10 font-mono`})}),(0,X.jsx)(`td`,{className:`hidden max-w-xs px-3 py-2 align-middle md:table-cell md:px-3.5`,children:(0,X.jsx)(q,{className:`h-3.5 w-full max-w-40`})})]},e))})]})}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border/40 px-3 py-3 text-[10px] text-muted-foreground sm:flex-row sm:items-center sm:justify-between sm:gap-4 sm:px-4`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,X.jsx)(q,{className:`inline-block h-3 w-6 rounded-[var(--miravo-radius-tight)]`}),(0,X.jsx)(q,{className:`inline-block h-3 w-28`})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 font-mono text-[10px] wrap-anywhere`,children:[(0,X.jsx)(q,{className:`h-2.5 w-8 shrink-0`}),(0,X.jsx)(q,{className:`h-6 min-w-32 rounded-[var(--miravo-radius-tight)] border border-border/50 px-2 py-0.5`}),(0,X.jsx)(q,{className:`h-1 w-1 shrink-0 rounded-full`}),(0,X.jsx)(q,{className:`h-2.5 w-10 shrink-0`}),(0,X.jsx)(q,{className:`h-3 min-w-16 max-w-56 flex-1`})]})]})]})}function ot(e){return e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&e.name===`AbortError`}function st({targets:e,stream:t}){let[n,r]=(0,Y.useState)(`apply`),[i,a]=(0,Y.useState)(``),[c,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(!1),b=(0,Y.useRef)(0),x=(0,Y.useRef)(null),C=t.status===`running`,ee=l({queryKey:J.catalog.templates(),queryFn:()=>s(`/catalog/templates`,o.catalogTemplates)}),te=n===`apply`?!!i&&!!c:!!i&&(d||!!c),w=e.find(e=>e.id===i),T=(0,Y.useCallback)(()=>{b.current+=1,x.current?.abort(),x.current=null,_(!1),m(null)},[]),D=(0,Y.useCallback)(()=>{T(),S.message(`Preview cancelled`)},[T]),O=e=>{C||(r(e),T(),f(!1))},k=(0,Y.useCallback)(async e=>{if(e===`apply`){if(!i||!c)return}else if(!i||!d&&!c)return;t.operation&&t.status!==`running`&&t.reset(),x.current?.abort(),b.current+=1;let n=b.current,r=new AbortController;x.current=r,_(!0),m(null);try{let t=e===`apply`?await xe({targetId:i,template:c},{signal:r.signal}):await pe({targetId:i,...d?{allManaged:!0}:{template:c}},{signal:r.signal});if(n!==b.current)return;m(t.plan)}catch(t){if(n!==b.current||ot(t))return;S.error(t instanceof Error?t.message:e===`apply`?`Plan failed`:`Cleanup plan failed`)}finally{n===b.current&&_(!1)}},[i,c,d,t]),ne=(0,Y.useCallback)(e=>{y(!1),T();let{scope:r,ifUnmanaged:a}=e;n===`apply`?t.startApply({targetId:i,template:c,scope:r,ifUnmanaged:a}):t.startCleanup({targetId:i,...d?{allManaged:!0}:{template:c},scope:r})},[n,i,c,d,t,T]),j=n===`apply`,M=ee.data??[],re=M.find(e=>e.id===c)?.name??c,P=te&&!C,F=`Provisions devices, tags, and Digital Twin models from the selected environment on the selected target.`;return j||(F=d?`Removes all Miravo-managed resources from the target (ignores environment scope).`:`Removes Miravo-managed resources for this environment from the selected target.`),(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,X.jsxs)(`div`,{role:`toolbar`,"aria-label":`Operation mode`,className:`inline-flex items-center gap-0.5 rounded-[var(--miravo-radius-pill)] border border-border/50 bg-muted/15 p-0.5`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":j,className:E(`relative flex items-center gap-1.5 rounded-[var(--miravo-radius-pill)] px-4 py-1.5 text-xs font-medium transition-colors`,j?`text-primary`:`text-muted-foreground hover:text-foreground`),onClick:()=>O(`apply`),disabled:C,children:[j&&(0,X.jsx)(h.span,{layoutId:`mode-pill`,className:`absolute inset-0 rounded-[var(--miravo-radius-pill)] bg-primary/15 shadow-sm`,transition:{type:`spring`,stiffness:500,damping:40}}),(0,X.jsx)(Ke,{className:`relative z-10 size-3.5`}),(0,X.jsx)(`span`,{className:`relative z-10`,children:`Apply`})]}),(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":!j,className:E(`relative flex items-center gap-1.5 rounded-[var(--miravo-radius-pill)] px-4 py-1.5 text-xs font-medium transition-colors`,j?`text-muted-foreground hover:text-foreground`:`text-destructive`),onClick:()=>O(`cleanup`),disabled:C,children:[!j&&(0,X.jsx)(h.span,{layoutId:`mode-pill`,className:`absolute inset-0 rounded-[var(--miravo-radius-pill)] bg-destructive/15 shadow-sm`,transition:{type:`spring`,stiffness:500,damping:40}}),(0,X.jsx)(I,{className:`relative z-10 size-3.5`}),(0,X.jsx)(`span`,{className:`relative z-10`,children:`Cleanup`})]})]}),(0,X.jsx)(he,{stream:t})]}),(0,X.jsx)(de,{children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-border/25 pb-3`,children:[(0,X.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-primary/25 bg-primary/9 shadow-[inset_0_1px_0_0_var(--miravo-inset-highlight)]`,children:(0,X.jsx)(Le,{className:`size-4 text-primary`,"aria-hidden":!0})}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{className:`font-heading text-[11px] font-semibold uppercase tracking-[0.12em] text-foreground`,children:`Litmus Edge`}),(0,X.jsx)(`p`,{className:`mt-0.5 text-[11px] leading-relaxed text-muted-foreground`,children:F})]})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(Be,{className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Target`}),(0,X.jsx)(ue,{targets:e,value:i,onValueChange:e=>{a(e),T()},disabled:C,size:`sm`,className:`min-w-0 w-full text-xs`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(Be,{className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Environment`}),(0,X.jsxs)(V,{value:c,onValueChange:e=>{e&&(u(e),T(),j&&t.reset())},disabled:n===`cleanup`&&d||C,children:[(0,X.jsx)(B,{size:`sm`,className:`min-w-0 w-full text-xs h-9! min-h-9 py-0`,"aria-label":`Environment`,children:(0,X.jsx)(L,{placeholder:d?`All managed`:`Select environment`,children:e=>n===`cleanup`&&d?`All managed resources`:M.find(t=>t.id===e)?.name??(d?`All managed`:`Select environment`)})}),(0,X.jsx)(z,{className:`max-h-48 w-(--anchor-width) min-w-0 p-1`,children:M.map(e=>(0,X.jsx)(R,{value:e.id,className:`h-9 gap-1.5 rounded-[var(--miravo-radius-tight)] py-0 pr-7 pl-1.5 text-xs leading-tight`,children:(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] border border-border/35 bg-muted/25 text-primary`,children:(0,X.jsx)(Ee,{id:e.id,className:`size-3.5`})}),(0,X.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name})]})},e.id))})]})]})]}),(0,X.jsxs)(`button`,{type:`button`,disabled:!P,onClick:()=>y(!0),className:E(`group flex w-full min-h-14 min-w-0 items-stretch overflow-hidden rounded-[var(--miravo-radius-stadium-lg)] text-left outline-none`,`transition-[border-color,box-shadow,background-color] duration-200 ease-out`,`focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,`disabled:pointer-events-none disabled:opacity-55`,P?[`border-2 border-primary/40 bg-background`,`bg-linear-to-r from-primary/12 via-background to-background`,`shadow-[inset_0_1px_0_0_rgba(255,255,255,0.025)]`,`hover:border-primary/56 hover:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.025),0_0_14px_-8px_color-mix(in_srgb,var(--primary)_18%,transparent),0_0_22px_-12px_color-mix(in_srgb,var(--primary)_8%,transparent)]`]:[`border border-dashed border-border/65 bg-muted/15`,`hover:bg-muted/22`]),children:[(0,X.jsx)(`span`,{className:`relative flex w-18 shrink-0 items-center justify-center bg-transparent`,"aria-hidden":!0,children:j?(0,X.jsx)(Pe,{className:E(`relative size-5`,P?`text-primary`:`text-muted-foreground`)}):(0,X.jsx)(I,{className:E(`relative size-5`,P?`text-primary`:`text-muted-foreground`)})}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col justify-center gap-0.5 overflow-hidden px-3 py-2.5 sm:px-4`,children:[(0,X.jsx)(`span`,{className:E(`font-heading text-[11px] font-semibold uppercase tracking-[0.18em]`,P?`text-primary`:`text-muted-foreground`),children:P?j?`Commit deploy`:`Commit cleanup`:`Awaiting selection`}),(0,X.jsx)(`span`,{className:E(`truncate font-mono text-[13px] leading-tight tracking-tight`,P?`text-foreground`:`text-muted-foreground`),children:w?.label??`Select target and environment`})]}),(0,X.jsx)(`span`,{className:E(`flex shrink-0 items-center pr-2.5 sm:pr-3`,P&&`pl-1`),children:(0,X.jsx)(`span`,{className:E(`flex size-9 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border bg-transparent transition-[border-color,color] duration-200`,P?`border-primary/40 text-primary group-hover:border-primary/55`:`border-border/45 text-muted-foreground`),"aria-hidden":!0,children:(0,X.jsx)(Oe,{className:`size-4`,strokeWidth:2.25})})})]}),!j&&(0,X.jsx)(`div`,{className:`flex w-full min-w-0 flex-wrap items-center justify-end gap-2`,children:(0,X.jsxs)(Be,{id:`all-managed-label`,htmlFor:`all-managed`,"aria-disabled":C,className:E(`inline-flex h-8 w-fit max-w-full cursor-pointer items-center gap-2 text-xs font-medium leading-none`,C&&`pointer-events-none opacity-40`),children:[(0,X.jsx)(Ie,{id:`all-managed`,checked:d,onCheckedChange:e=>f(e===!0),disabled:C}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`Remove all Miravo managed resources`})]})})]})}),(g||p)&&!C&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[g&&(0,X.jsx)(`div`,{className:`flex w-full min-w-0 flex-wrap items-center justify-end gap-2`,children:(0,X.jsxs)(N,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 shrink-0 gap-1.5 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:D,children:[(0,X.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),`Cancel preview`]})}),g&&(0,X.jsx)(at,{}),p&&!g&&(0,X.jsx)(rt,{plan:p,planKind:j?`apply`:`cleanup`,onCloseTable:T})]}),w&&(0,X.jsx)(we,{open:v,onOpenChange:y,type:n,label:!j&&d?`All managed resources`:re,targetLabel:w.label,hostname:w.hostname,sourceHostname:w.sourceHostname,onConfirm:ne,applyPreview:j?{onPreview:()=>void k(`apply`),planLoading:g,disabled:!i||!c||C}:void 0,cleanupPreview:j?void 0:{onPreview:()=>void k(`cleanup`),planLoading:g,disabled:!i||!d&&!c||C}})]})}function ct(){return(0,X.jsx)(`section`,{"aria-labelledby":`platforms-operation-log-empty-title`,className:qe,children:(0,X.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-4 py-8 text-center sm:py-10`,children:[(0,X.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/50`,children:(0,X.jsx)(F,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0})}),(0,X.jsxs)(`div`,{className:`max-w-sm`,children:[(0,X.jsx)(`h2`,{id:`platforms-operation-log-empty-title`,className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`No operations yet`}),(0,X.jsx)(`p`,{className:`mt-2 text-pretty text-sm leading-relaxed text-muted-foreground`,children:`Run apply or cleanup from the Operations tab. Finished runs show up here with full detail.`})]})]})})}function lt(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 ut(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:lt(e[0]?.completedAt??Date.now()),ops:e}))}function Z(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===`instance`?`One count per twin instance in this run.`:`Sets the device parameter to the bound DeviceHub device.`}var dt={devices:`Devices`,models:`DT models`,instances:`DT instances`},Q={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`,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 ft(e){return[{key:`device`,title:`DeviceHub — protocol tags`,subtitle:Z(`device`,e),counts:e.resourceCounts.device},{key:`model`,title:`Digital Twin models`,subtitle:Z(`model`,e),counts:e.resourceCounts.model},{key:`instance`,title:`Twin instances`,subtitle:Z(`instance`,e),counts:e.resourceCounts.instance},{key:`param-sync`,title:`Parameter sync`,subtitle:Z(`param-sync`,e),counts:e.resourceCounts[`param-sync`]}].filter(e=>e.counts.total>0||e.counts.failed>0)}function pt(e){return e.length===0?`Default (devices, models, instances)`:e.map(e=>dt[e]??e).join(` · `)}function mt(e){let t=[];return e.filters.area&&t.push(`Area ${e.filters.area}`),e.filters.line&&t.push(`Line ${e.filters.line}`),e.filters.instance&&t.push(`Instance ${e.filters.instance}`),t.length>0?t.join(` · `):null}function $(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`}switch(t){case`create`:return`+${n} created`;case`update`:return`${n} updated`;case`replace`:return`↻${n} replaced`;case`delete`:return`−${n} removed`}}function ht({row:e}){let{key:t,counts:n}=e;return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-1.5`,children:[n.create>0&&(0,X.jsx)(`span`,{className:Q.create,children:$(t,`create`,n.create)}),n.update>0&&(0,X.jsx)(`span`,{className:Q.update,children:$(t,`update`,n.update)}),n.replace>0&&(0,X.jsx)(`span`,{className:Q.replace,children:$(t,`replace`,n.replace)}),n.delete>0&&(0,X.jsx)(`span`,{className:Q.delete,children:$(t,`delete`,n.delete)}),n.failed>0&&(0,X.jsx)(`span`,{className:Q.failed,children:`${n.failed} failed`})]})}function gt({op:e}){let t=mt(e);return(0,X.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50 bg-muted/25 px-3 py-2.5`,children:[(0,X.jsx)(`p`,{className:`font-mono text-[10px] uppercase tracking-[0.16em] text-foreground/72`,children:`Run context`}),(0,X.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,X.jsx)(`dt`,{className:`text-foreground/70`,children:`Operation`}),(0,X.jsx)(`dd`,{className:`font-medium capitalize text-foreground`,children:e.operationType}),(0,X.jsx)(`dt`,{className:`text-foreground/70`,children:`Target host`}),(0,X.jsx)(`dd`,{className:`break-all font-mono text-[11px] text-foreground`,children:e.hostname}),(0,X.jsx)(`dt`,{className:`text-foreground/70`,children:`Scope`}),(0,X.jsx)(`dd`,{className:`text-foreground`,children:pt(e.scope)}),t&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-foreground/70`,children:`Filters`}),(0,X.jsx)(`dd`,{className:`text-foreground`,children:t})]}),(0,X.jsx)(`dt`,{className:`text-foreground/70`,children:`Duration`}),(0,X.jsxs)(`dd`,{className:`tabular-nums text-foreground`,children:[(e.durationMs/1e3).toFixed(1),`s`]}),(0,X.jsx)(`dt`,{className:`text-foreground/70`,children:`Outcome`}),(0,X.jsxs)(`dd`,{className:`text-foreground`,children:[(0,X.jsx)(`span`,{className:`tabular-nums`,children:e.successCount}),` steps succeeded`,e.failedCount>0&&(0,X.jsxs)(`span`,{className:`text-destructive`,children:[` `,`· `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:e.failedCount}),` failed`]}),e.blockedCount>0&&(0,X.jsxs)(`span`,{className:`text-warning`,children:[` `,`· `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:e.blockedCount}),` blocked in plan`]})]})]})]})}function _t({status:e}){switch(e){case`success`:return(0,X.jsx)(U,{className:`mt-px size-4 shrink-0 text-success`});case`failed`:return(0,X.jsx)(Me,{className:`mt-px size-4 shrink-0 text-destructive`});case`partial`:case`blocked`:return(0,X.jsx)(Re,{className:`mt-px size-4 shrink-0 text-warning`});case`noop`:return(0,X.jsx)(We,{className:`mt-px size-4 shrink-0 text-foreground/55`})}}function vt(e){let t=e.operationType===`apply`?`Applied`:`Cleaned up`,n=`${(e.durationMs/1e3).toFixed(1)}s`,r=[];return e.successCount>0&&r.push(`${e.successCount} resources`),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 yt(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.`:`No per-phase counts recorded.`}function bt({op:e}){let t=ft(e);return t.length===0?(0,X.jsx)(`p`,{className:`py-1 text-sm text-foreground/75`,children:yt(e)}):(0,X.jsxs)(`div`,{className:`space-y-3 pt-1`,children:[(0,X.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,X.jsxs)(`div`,{className:`flex flex-col gap-2 px-3 py-2.5 sm:flex-row sm:items-start sm:gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 shrink-0 sm:w-[11.5rem]`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium leading-snug text-foreground`,children:e.title}),(0,X.jsxs)(ne,{children:[(0,X.jsx)(O,{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,X.jsx)(Fe,{className:`size-3.5`,"aria-hidden":!0})}),(0,X.jsx)(k,{side:`top`,className:`max-w-xs text-left`,children:e.subtitle})]})]}),(0,X.jsx)(`p`,{className:`mt-0.5 text-[11px] leading-snug text-foreground/72 sm:hidden`,children:e.subtitle})]}),(0,X.jsx)(ht,{row:e})]},e.key))}),e.blockedCount>0&&(0,X.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,X.jsx)(`span`,{className:`font-medium`,children:e.blockedCount}),` plan entries were blocked (skipped). Open a `,(0,X.jsx)(`span`,{className:`font-medium`,children:`deploy preview`}),` before running to see block reasons.`]})]})}function xt({operation:e}){let[t,n]=(0,Y.useState)(!1),r=e.targetLabel;return(0,X.jsxs)(`div`,{className:E(`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-border/55`,`transition-colors duration-150`),children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:E(`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,X.jsx)(_t,{status:e.status}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`p`,{className:`min-w-0 truncate text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:re(e.templateId)}),(0,X.jsx)(`span`,{className:`mx-1.5 text-foreground/50`,children:`→`}),(0,X.jsx)(`span`,{className:`text-foreground/82`,children:r})]}),(0,X.jsx)(`time`,{dateTime:new Date(e.completedAt).toISOString(),title:M(e.completedAt),className:`shrink-0 text-xs text-foreground/75`,children:j(e.completedAt)})]}),(0,X.jsx)(`p`,{className:`text-xs text-foreground/78`,children:vt(e)}),(e.failedCount>0||e.status===`failed`)&&(0,X.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/72`,children:`Temporary edge issue? Run apply again from Operations — Miravo usually succeeds on retry.`})]}),(0,X.jsx)(De,{className:E(`mt-0.5 size-3.5 shrink-0 text-foreground/55 transition-transform duration-150`,t&&`rotate-180`)})]}),(0,X.jsx)(g,{initial:!1,children:t&&(0,X.jsx)(h.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,X.jsxs)(`div`,{className:`space-y-3 border-t border-border/45 px-4 pb-3 pt-3`,children:[(0,X.jsx)(gt,{op:e}),e.error&&(0,X.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,X.jsx)(`div`,{className:`absolute top-1.5 right-1.5 z-10`,children:(0,X.jsx)(T,{value:e.error,label:`Copy error`,className:`text-destructive hover:bg-destructive/25 hover:text-foreground`})}),(0,X.jsx)(`p`,{className:`whitespace-normal break-words text-destructive [overflow-wrap:anywhere]`,children:e.error}),(0,X.jsx)(`p`,{className:`mt-2 text-[11px] font-normal leading-snug text-foreground/78 [overflow-wrap:anywhere]`,children:`Retry apply if the edge was slow or unreachable.`})]}),(0,X.jsx)(bt,{op:e})]})})})]})}function St({label:e}){return(0,X.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,X.jsx)(`div`,{className:`h-px flex-1 bg-border/65`}),(0,X.jsx)(`span`,{className:`text-xs font-medium text-foreground/78`,children:e}),(0,X.jsx)(`div`,{className:`h-px flex-1 bg-border/65`})]})}var Ct={type:``,status:``,target:``,search:``},wt={_all:`All types`,apply:`Apply`,cleanup:`Cleanup`},Tt={_all:`All statuses`,success:`Success`,partial:`Partial`,failed:`Failed`,blocked:`Blocked`,noop:`No-op`},Et=`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 Dt({filters:e,targetOptions:t,hasFilters:n,searchRef:r,onTypeChange:i,onStatusChange:a,onTargetChange:o,onSearchChange:s,onClear:c}){return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-b border-border/50 px-3 py-2`,children:[(0,X.jsxs)(V,{value:e.type||`_all`,onValueChange:e=>e&&i(e===`_all`?``:e),children:[(0,X.jsx)(B,{size:`sm`,className:Et,"aria-label":`Operation type`,children:(0,X.jsx)(L,{children:e=>wt[e??`_all`]??wt._all})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(R,{value:`_all`,children:`All types`}),(0,X.jsx)(R,{value:`apply`,children:`Apply`}),(0,X.jsx)(R,{value:`cleanup`,children:`Cleanup`})]})]}),(0,X.jsxs)(V,{value:e.status||`_all`,onValueChange:e=>e&&a(e===`_all`?``:e),children:[(0,X.jsx)(B,{size:`sm`,className:Et,"aria-label":`Operation status`,children:(0,X.jsx)(L,{children:e=>Tt[e??`_all`]??Tt._all})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(R,{value:`_all`,children:`All statuses`}),(0,X.jsx)(R,{value:`success`,children:`Success`}),(0,X.jsx)(R,{value:`partial`,children:`Partial`}),(0,X.jsx)(R,{value:`failed`,children:`Failed`}),(0,X.jsx)(R,{value:`blocked`,children:`Blocked`}),(0,X.jsx)(R,{value:`noop`,children:`No-op`})]})]}),t.length>1&&(0,X.jsxs)(V,{value:e.target||`_all`,onValueChange:e=>e&&o(e===`_all`?``:e),children:[(0,X.jsx)(B,{size:`sm`,className:Et,"aria-label":`Target filter`,children:(0,X.jsx)(L,{children:e=>!e||e===`_all`?`All targets`:e})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(R,{value:`_all`,children:`All targets`}),t.map(e=>(0,X.jsx)(R,{value:e,children:e},e))]})]}),(0,X.jsxs)(`div`,{className:`relative flex min-w-[140px] flex-1 items-center`,children:[(0,X.jsx)(`input`,{ref:r,type:`search`,value:e.search,onChange:e=>s(e.target.value),placeholder:`Search environment or target…`,"aria-describedby":`ops-search-shortcut`,className:E(`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,X.jsx)(`span`,{id:`ops-search-shortcut`,className:`sr-only`,children:`Press slash to focus search`}),!e.search&&(0,X.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,X.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,X.jsx)(A,{className:`size-3`}),`Clear`]})]})}function Ot({operations:e,totalKnown:t,isLoading:n,error:r,onRefresh:i,hasNextPage:a=!1,isFetchingNextPage:o=!1,loadMoreError:s=null,onRetryLoadMore:c,onLoadMore:l}){let[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(Ct),_=(0,Y.useRef)(null);(0,Y.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(),_.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let v=()=>{f(!0),i(),S.success(`Operations refreshed`),setTimeout(()=>f(!1),600)},y=(0,Y.useMemo)(()=>{let t=new Set;for(let n of e){let e=n.targetLabel;t.add(e)}return[...t].sort()},[e]),b=(0,Y.useMemo)(()=>{let t=e;if(p.type&&(t=t.filter(e=>e.operationType===p.type)),p.status&&(t=t.filter(e=>e.status===p.status)),p.target&&(t=t.filter(e=>e.targetLabel===p.target)),p.search){let e=p.search.toLowerCase();t=t.filter(t=>{let n=t.targetLabel;return t.templateId.toLowerCase().includes(e)||re(t.templateId).toLowerCase().includes(e)||n.toLowerCase().includes(e)})}return t},[e,p]),x=p.type!==``||p.status!==``||p.target!==``||p.search!==``,C=(0,Y.useMemo)(()=>ut(b),[b]);return(0,X.jsxs)(`div`,{className:`flex h-full flex-col rounded-[var(--miravo-radius-stadium-sm)] border border-border/55`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-3.5 py-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`Operation log`}),e.length>0&&(0,X.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,X.jsx)(`button`,{type:`button`,onClick:v,disabled:d,"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,X.jsx)(u,{className:E(`size-3.5`,d&&`animate-spin`),"aria-hidden":!0})})]}),(0,X.jsx)(Dt,{filters:p,targetOptions:y,hasFilters:x,searchRef:_,onTypeChange:e=>m(t=>({...t,type:e})),onStatusChange:e=>m(t=>({...t,status:e})),onTargetChange:e=>m(t=>({...t,target:e})),onSearchChange:e=>m(t=>({...t,search:e})),onClear:()=>m(Ct)}),(0,X.jsxs)(`div`,{className:`flex flex-1 min-h-0 flex-col gap-2 overflow-y-auto overscroll-y-contain p-3`,children:[r&&(0,X.jsxs)(`p`,{className:`py-2 text-xs text-destructive`,children:[`✕ `,r.message]}),n&&e.length===0&&!r&&(0,X.jsx)(`p`,{className:`py-4 text-sm text-foreground/75`,children:`Loading…`}),!n&&e.length===0&&!r&&(0,X.jsx)(ct,{}),!n&&e.length>0&&b.length===0&&(0,X.jsxs)(`p`,{className:`py-6 text-center text-sm text-foreground/75`,children:[`No operations match your filters.`,` `,(0,X.jsx)(`button`,{type:`button`,onClick:()=>m(Ct),className:`text-primary hover:underline`,children:`Clear filters`})]}),x&&b.length>0&&b.length!==e.length&&(0,X.jsxs)(`p`,{className:`text-xs text-foreground/75`,children:[`Showing`,` `,(0,X.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:b.length}),` of`,` `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:e.length}),` loaded`]}),!x&&typeof t==`number`&&t>0&&e.length<t&&(0,X.jsxs)(`p`,{className:`text-xs text-foreground/75`,children:[`Showing`,` `,(0,X.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:e.length}),` `,`of `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:t}),`. Load more for older entries.`]}),(0,X.jsx)(g,{initial:!1,children:C.map(e=>(0,X.jsxs)(h.div,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(St,{label:e.label}),(0,X.jsx)(g,{initial:!1,children:e.ops.map(e=>(0,X.jsx)(h.div,{initial:b.length>40?!1:{opacity:0,x:-6},animate:{opacity:1,x:0},transition:{type:`spring`,stiffness:400,damping:35},children:(0,X.jsx)(xt,{operation:e})},`${e.operationId}-${e.completedAt}`))})]},e.label))}),s?(0,X.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,X.jsxs)(`p`,{className:`text-xs text-destructive`,children:[`Could not load older entries: `,s.message]}),c?(0,X.jsx)(N,{type:`button`,variant:`outline`,size:`sm`,onClick:c,children:`Retry`}):null]}):a&&l?(0,X.jsx)(`div`,{className:`flex shrink-0 justify-center border-t border-border/50 pt-3 pb-1`,children:(0,X.jsx)(N,{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]})]})}function kt(e){return ke.find(t=>t.id===e)?.label??e}function At(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 jt({status:e}){switch(e){case`success`:return(0,X.jsx)(U,{className:`size-3 text-success`});case`partial`:case`blocked`:return(0,X.jsx)(Re,{className:`size-3 text-warning`});case`noop`:return(0,X.jsx)(We,{className:`size-3 text-muted-foreground`});case`failed`:return(0,X.jsx)(Me,{className:`size-3 text-destructive`})}}function Mt({target:e,lastOp:t,onEdit:n,onDelete:r}){return(0,X.jsxs)(`div`,{className:`env-orbital relative overflow-hidden border`,style:{"--_status":At(t)},children:[(0,X.jsx)(`div`,{className:`relative z-10 px-4 pt-3.5 pb-3`,children:(0,X.jsx)(`p`,{className:`font-heading text-[13px] font-semibold leading-tight tracking-tight text-foreground`,children:e.label})}),(0,X.jsx)(`div`,{className:`relative z-10 px-4 py-0.5`,children:(0,X.jsx)(`p`,{className:`font-mono text-xs tracking-tight text-muted-foreground`,children:e.hostname})}),(0,X.jsxs)(`div`,{className:`relative z-10 mx-4 mb-3 flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-muted-foreground`,children:e.sourceHostname}),(0,X.jsx)(`div`,{className:`env-orbital-path min-w-6 flex-1`}),(0,X.jsx)(ie,{className:`size-3 shrink-0 text-muted-foreground`})]}),(0,X.jsxs)(`div`,{className:`relative z-10 flex items-center gap-2 border-t border-border/30 px-3 py-1.5`,children:[(0,X.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 rounded-full border border-border/40 px-2 py-0.5`,children:[(0,X.jsx)(`span`,{className:`protocol-card-live-dot size-[5px]`}),(0,X.jsx)(`span`,{className:`text-[11px] font-medium tracking-wide text-muted-foreground`,children:kt(e.platformId)})]}),t&&(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 truncate text-[11px] text-muted-foreground`,children:[(0,X.jsx)(jt,{status:t.status}),t.operationType===`apply`?`Applied`:`Cleaned`,` `,(0,X.jsx)(`time`,{dateTime:new Date(t.completedAt).toISOString(),title:M(t.completedAt),children:j(t.completedAt)})]}),(0,X.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5`,children:[(0,X.jsx)(N,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit target`,onClick:n,children:(0,X.jsx)(Ge,{className:`size-3`})}),(0,X.jsx)(N,{variant:`ghost`,size:`icon-sm`,className:`text-destructive hover:text-destructive`,"aria-label":`Delete target`,onClick:r,children:(0,X.jsx)(I,{className:`size-3`})})]})]})]})}function Nt({onClick:e}){return(0,X.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,X.jsx)(ae,{className:`size-5 transition-transform group-hover:scale-110`}),(0,X.jsx)(`span`,{className:`text-xs`,children:`Add Target`})]})}function Pt({targets:e,onMutate:t,lastOpByTarget:n}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(H.id),[l,u]=(0,Y.useState)({label:``,hostname:``,apiToken:``,sourceHostname:``}),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(!1),{testing:_,runTest:v,cancelInFlight:y}=ve(),[T,E]=(0,Y.useState)(null),D=s===H.id&&l.hostname.trim().length>0&&l.sourceHostname.trim().length>0&&(a!==null||l.apiToken.trim().length>0),O=()=>{o(null),c(H.id),u({label:``,hostname:``,apiToken:``,sourceHostname:``}),m(!1),i(!0)},k=e=>{o(e.id),c(ke.some(t=>t.id===e.platformId)?e.platformId:H.id),u({label:e.label,hostname:e.hostname,apiToken:``,sourceHostname:e.sourceHostname}),m(!1),i(!0)},ne=async()=>{if(s!==H.id){S.error(`${kt(s)} target setup is coming soon.`);return}if(!l.label||!l.hostname||!l.sourceHostname){S.error(`Label, hostname, and source host are required.`);return}if(!a&&!l.apiToken){S.error(`API token is required for new targets.`);return}f(!0);try{a?(await le(a,{platformId:s,label:l.label,hostname:l.hostname,sourceHostname:l.sourceHostname,...l.apiToken?{apiToken:l.apiToken}:{}}),S.success(`Target updated.`)):(await se({...l,platformId:s}),S.success(`Target added.`)),i(!1),t()}catch(e){S.error(e instanceof Error?e.message:`Failed to save target.`)}finally{f(!1)}};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`h2`,{className:`flex h-5 items-center text-xs font-medium leading-none uppercase tracking-wider text-muted-foreground`,children:`Platform Targets`}),e.length>0?(0,X.jsx)(ze,{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,X.jsxs)(N,{size:`sm`,className:`h-7 shrink-0 gap-1.5 text-xs`,onClick:O,children:[(0,X.jsx)(ae,{className:`size-3.5`}),` Add Target`]})]}),e.length===0?(0,X.jsx)(Xe,{titleId:`platforms-targets-empty-title`,frameIcon:(0,X.jsx)(K,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0}),description:(0,X.jsx)(Je,{}),children:(0,X.jsx)(Ye,{onClick:O})}):(0,X.jsx)(`div`,{className:`grid grid-cols-1 gap-3 @2xl/main:grid-cols-2 @5xl/main:grid-cols-3`,children:(0,X.jsxs)(g,{children:[e.map((e,t)=>(0,X.jsx)(h.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,X.jsx)(Mt,{target:e,lastOp:n.get(e.id),onEdit:()=>k(e),onDelete:()=>E(e)})},e.id)),(0,X.jsx)(h.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{type:`spring`,stiffness:380,damping:30,delay:e.length*.04},children:(0,X.jsx)(Nt,{onClick:O})},`add-card`)]})}),(0,X.jsx)(_e,{open:r,editing:a!==null,platformId:s,form:l,showToken:p,saving:d,testing:_,canTestConnection:D,onOpenChange:i,onPlatformChange:c,onFormChange:u,onShowTokenChange:m,onSave:()=>void ne(),onTestConnection:()=>{D&&v({hostname:l.hostname.trim(),sourceHostname:l.sourceHostname.trim(),...l.apiToken.trim()?{apiToken:l.apiToken.trim()}:{}})},onCancelInFlight:y}),(0,X.jsx)(C,{open:T!==null,onOpenChange:e=>!e&&E(null),children:(0,X.jsxs)(te,{children:[(0,X.jsxs)(ee,{children:[(0,X.jsx)(w,{children:`Remove Target`}),(0,X.jsxs)(x,{children:[`Remove “`,T?.label,`”? This only deletes the saved credentials — it does not affect resources on the target platform.`]})]}),(0,X.jsxs)(b,{children:[(0,X.jsx)(N,{variant:`outline`,onClick:()=>E(null),children:`Cancel`}),(0,X.jsx)(N,{variant:`destructive`,onClick:async()=>{if(!T)return;let e=T.id;E(null);try{await ge(e),S.success(`Target removed.`),t()}catch(e){S.error(e instanceof Error?e.message:`Failed to remove target.`)}},children:`Remove`})]})]})})]})}var Ft=25;function It({status:e}){switch(e){case`success`:return(0,X.jsx)(U,{className:`size-3 text-success`});case`partial`:case`blocked`:return(0,X.jsx)(Re,{className:`size-3 text-warning`});case`noop`:return(0,X.jsx)(We,{className:`size-3 text-muted-foreground`});case`failed`:return(0,X.jsx)(Me,{className:`size-3 text-destructive`})}}function Lt({targetCount:e,opCount:t,lastOp:n}){return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(K,{className:`size-3`}),(0,X.jsx)(`span`,{className:`font-mono`,children:e}),` target`,e===1?``:`s`]}),(0,X.jsx)(`span`,{className:`hidden h-3 w-px bg-border/40 sm:inline-block`}),(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(g,{mode:`popLayout`,initial:!1,children:(0,X.jsx)(h.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,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`hidden h-3 w-px bg-border/40 sm:inline-block`}),(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(It,{status:n.status}),(0,X.jsxs)(`span`,{children:[n.operationType===`apply`?`Applied`:`Cleaned`,` `,(0,X.jsx)(`time`,{dateTime:new Date(n.completedAt).toISOString(),title:M(n.completedAt),children:j(n.completedAt)})]})]})]})]})}function Rt(){let e=l({queryKey:J.platforms.targets(),queryFn:()=>ce()}),t=e.data??[],n=He({queryKey:J.platforms.operationsList(),queryFn:({pageParam:e})=>ye({limit:Ft,offset:e}),initialPageParam:0,getNextPageParam:(e,t,n)=>e.hasMore&&e.operations.length>0?n+Ft:void 0}),r=(0,Y.useMemo)(()=>n.data?.pages.flatMap(e=>e.operations)??[],[n.data]),i=n.data?.pages[0]?.total??0,a=l({queryKey:J.catalog.templates(),queryFn:()=>s(`/catalog/templates`,o.catalogTemplates)}).data??[],u=be(),d=(0,Y.useRef)(u.status);(0,Y.useEffect)(()=>{let e=d.current;d.current=u.status,e===`running`&&u.status===`complete`&&c.invalidateQueries({queryKey:J.platforms.operationsList()})},[u.status]);let p=(0,Y.useMemo)(()=>{let e=new Map;for(let t of r)e.has(t.targetId)||e.set(t.targetId,t);return e},[r]),[y,b]=_(`tab`,v([`targets`,`operations`,`activity`]).withDefault(`targets`)),x;return x=e.isPending&&e.data===void 0?(0,X.jsxs)(`div`,{role:`status`,"aria-busy":`true`,className:qe,children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`Loading targets`}),(0,X.jsxs)(`div`,{className:`mx-auto flex max-w-md flex-col items-center gap-4 px-4 py-10`,children:[(0,X.jsx)(q,{className:`h-5 w-48`}),(0,X.jsx)(q,{className:`h-4 w-full max-w-sm`}),(0,X.jsx)(q,{className:`h-9 w-40 rounded-(--miravo-radius-stadium-sm)`})]})]}):e.isError&&e.data===void 0?(0,X.jsx)(f,{message:m(e.error,`Could not load targets.`),onRetry:()=>void e.refetch(),isRetrying:e.isFetching&&!e.isPending}):t.length===0?(0,X.jsx)(Xe,{titleId:`platforms-operations-empty-title`,frameIcon:(0,X.jsx)(K,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0}),description:(0,X.jsx)(Je,{}),children:(0,X.jsx)(Ye,{onClick:()=>void b(`targets`)})}):(0,X.jsx)(st,{targets:t,stream:u}),(0,X.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,X.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2`,children:[(0,X.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Platforms`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect Platforms as targets, then apply templates or run cleanup from Operations.`}),(0,X.jsx)(Lt,{targetCount:t.length,opCount:i,lastOp:r[0]})]}),(0,X.jsxs)(Ne,{value:y,onValueChange:e=>{b(e)},className:`flex-1 min-h-0`,children:[(0,X.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,X.jsxs)(je,{variant:`line`,className:`h-10! gap-0.5 min-w-max`,children:[(0,X.jsxs)(W,{value:`targets`,className:`gap-1.5 px-3 text-sm`,children:[(0,X.jsx)(K,{className:`size-3.5 shrink-0`}),`Targets`]}),(0,X.jsxs)(W,{value:`operations`,className:`gap-1.5 px-3 text-sm`,children:[(0,X.jsx)(Te,{className:`size-3.5 shrink-0`}),`Operations`]}),(0,X.jsxs)(W,{value:`activity`,className:`gap-1.5 px-3 text-sm`,children:[(0,X.jsx)(F,{className:`size-3.5 shrink-0`}),`Activity`]})]})}),(0,X.jsx)(G,{value:`targets`,className:`flex-1 py-2`,children:(0,X.jsx)(h.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:(0,X.jsx)(Pt,{targets:t,onMutate:()=>void e.refetch(),lastOpByTarget:p})},`targets`)}),(0,X.jsx)(G,{value:`operations`,className:`flex-1 py-2`,children:(0,X.jsx)(h.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:x},`operations`)}),(0,X.jsx)(G,{value:`activity`,className:`flex flex-col flex-1 min-h-0 py-2`,children:(0,X.jsx)(h.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,X.jsx)(Ot,{operations:r,totalKnown:i,isLoading:n.isPending&&!n.data,error:n.error,onRefresh:()=>void c.invalidateQueries({queryKey:J.platforms.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`)})]}),(0,X.jsx)(g,{children:u.operation||u.status===`running`?(0,X.jsx)(Ze,{stream:u,onReset:u.reset,catalogTemplates:a}):null})]})}export{Rt as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./platforms-Dq6BGck6.js";export{e as PlatformsPage};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/fleet-Bk6J6tiE.js","assets/fleet-CcdFCWOI.js","assets/rolldown-runtime-COnpUsM8.js","assets/chunk-OE4NN4TA-m2UhO8Q2.js","assets/vendor-charts-CAZdaPlq.js","assets/api-Bef9FEIU.js","assets/vendor-ui-mizMYESS.js","assets/input-BCiRHEmc.js","assets/createLucideIcon-Yddw9eHa.js","assets/arrow-right-DrKCU9WM.js","assets/arrow-up-down-CBuv2TSF.js","assets/select-4wihIkEE.js","assets/circle-question-mark-Q_q7JZnT.js","assets/dist-jROhexoH.js","assets/engine-store-BUO-9Dsh.js","assets/shallow-ODRQsuRf.js","assets/badge-tnWgSITj.js","assets/combobox-gGNWoksU.js","assets/skeleton-C6iEH-9E.js","assets/select-display-items-DUJCelf2.js","assets/tooltip-TtanriwA.js","assets/query-keys-Co1J4HmV.js","assets/transition-types-CMW7IObN.js","assets/catalog-BKhsnMBa.js","assets/catalog-Ia1pbi0U.js","assets/get-error-message-DhCjoSSJ.js","assets/AnimatePresence-CVhkybDC.js","assets/proxy-CgM57W61.js","assets/use-platform-stream-BZTQlkbS.js","assets/platform-targets-BbVxaqAc.js","assets/tabs-BgPF8MSY.js","assets/copy-button-BK3jqKBZ.js","assets/checkbox-Xly18Uyz.js","assets/triangle-alert-DPtblpQC.js","assets/label-xIWEC6lW.js","assets/catalog-template-icons-b6a6Gty-.js","assets/deploy-tab-zi4NXsfj.js","assets/download-BPgKzo-_.js","assets/use-engine-command-mutation-DTvKLMBg.js","assets/models-BOPuZsyi.js","assets/models-BbWAxRFR.js","assets/activity-DP0Us3HU.js","assets/events-BRekhc6s.js","assets/events-CfrhnDG_.js","assets/auth-screen-backdrop-OrOL41MR.js","assets/use-transition-navigate-CG8tHeYN.js","assets/control-M9POk7sD.js","assets/control-xSKU0dgF.js","assets/validation-CyzCfw_2.js","assets/server-D7sb2mj5.js","assets/transition-nav-link-B89fDRXR.js","assets/tags-nAOAgZzI.js","assets/tags-DZpOeuyx.js","assets/vendor-table-wd8JuMmT.js","assets/platforms-H2Z4z-EX.js","assets/platforms-Dq6BGck6.js","assets/instance-detail-bpv-KYmO.js","assets/login-DV1Fd0nK.js"])))=>i.map(i=>d[i]);
2
+ import{d as e}from"./chunk-OE4NN4TA-m2UhO8Q2.js";var t=[{test:e=>e===`/`,load:()=>e(()=>import(`./fleet-Bk6J6tiE.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]))},{test:e=>e===`/catalog`,load:()=>e(()=>import(`./catalog-BKhsnMBa.js`),__vite__mapDeps([23,24,2,5,6,4,25,7,8,26,27,28,11,29,30,12,31,20,32,33,16,34,35,36,37,21,38,14]))},{test:e=>e===`/models`,load:()=>e(()=>import(`./models-BOPuZsyi.js`),__vite__mapDeps([39,40,2,5,6,4,25,7,8,26,27,41,28,11,29,30,12,31,20,32,33,16,34,36,37,21,38,14]))},{test:e=>e===`/events`,load:()=>e(()=>import(`./events-BRekhc6s.js`),__vite__mapDeps([42,43,2,3,4,5,6,25,7,8,26,27,11,14,44,16,17,19,45,21,22]))},{test:e=>e===`/control`,load:()=>e(()=>import(`./control-M9POk7sD.js`),__vite__mapDeps([46,47,2,5,6,4,7,8,26,27,41,9,11,30,31,20,48,32,49,38,14,33,13,15,50,3,45,16,17,34]))},{test:e=>e===`/tags`,load:()=>e(()=>import(`./tags-nAOAgZzI.js`),__vite__mapDeps([51,52,2,3,4,5,6,25,7,8,53,26,27,10,11,29,31,20,37,13,14,44,17,34,21]))},{test:e=>e===`/platforms`,load:()=>e(()=>import(`./platforms-H2Z4z-EX.js`),__vite__mapDeps([54,55,2,3,4,5,6,25,7,8,26,27,41,9,28,11,29,30,12,31,20,32,33,16,34,35,49,13,18,21]))},{test:e=>e.startsWith(`/instance/`),load:()=>e(()=>import(`./instance-detail-bpv-KYmO.js`),__vite__mapDeps([56,2,3,4,5,6,25,7,8,27,41,30,31,20,48,38,14,33,13,44,16,21,22]))},{test:e=>e===`/login`,load:()=>e(()=>import(`./login-DV1Fd0nK.js`),__vite__mapDeps([57,2,5,6,4,50,3,45]))}],n=new Set;function r(e){if(!e.startsWith(`/`))return null;let t=e.indexOf(`?`),n=e.indexOf(`#`),r=t===-1?n===-1?e.length:n:n===-1?t:Math.min(t,n);return e.slice(0,r)}function i(e){let i=r(e);if(!i||n.has(i))return;let a=t.find(e=>e.test(i));a&&(n.add(i),a.load().catch(()=>{n.delete(i)}))}export{i as t};
@@ -0,0 +1 @@
1
+ import{at as e,d as t,f as n,m as r,p as i}from"./vendor-ui-mizMYESS.js";import{n as a,t as o}from"./createLucideIcon-Yddw9eHa.js";import{i as s}from"./input-BCiRHEmc.js";var c=o(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),l=o(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),u=o(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),d=o(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),f=e();function p({className:e,orientation:t=`horizontal`,...n}){return(0,f.jsx)(r,{"data-slot":`tabs`,"data-orientation":t,className:a(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var m=s(`group/tabs-list inline-flex w-fit items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-0 border-b border-border/50 bg-transparent p-0 shadow-none group-data-horizontal/tabs:h-auto group-data-horizontal/tabs:min-h-8`}},defaultVariants:{variant:`default`}});function h({className:e,variant:n=`default`,...r}){return(0,f.jsx)(t,{"data-slot":`tabs-list`,"data-variant":n,className:a(m({variant:n}),e),...r})}function g({className:e,...t}){return(0,f.jsx)(i,{"data-slot":`tabs-trigger`,className:a(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-[var(--miravo-radius-tight)] border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-muted-foreground transition-[color,box-shadow,transform] duration-200 ease-out group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:font-heading group-data-[variant=line]/tabs-list:tracking-tight group-data-[variant=line]/tabs-list:text-sm group-data-[variant=line]/tabs-list:text-muted-foreground group-data-[variant=line]/tabs-list:hover:text-foreground group-data-[variant=line]/tabs-list:data-active:font-semibold group-data-[variant=line]/tabs-list:data-active:text-foreground`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent group-data-[variant=line]/tabs-list:data-active:border-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`group-data-[variant=line]/tabs-list:rounded-none group-data-[variant=line]/tabs-list:px-3 group-data-[variant=line]/tabs-list:py-2`,`data-active:bg-background data-active:text-foreground data-active:border-input data-active:bg-input/30 data-active:text-foreground`,`after:pointer-events-none after:absolute after:bg-foreground after:opacity-0 after:transition-[opacity,transform] after:duration-300 after:ease-out group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5`,`group-data-[variant=line]/tabs-list:after:bg-primary group-data-horizontal/tabs:group-data-[variant=line]/tabs-list:after:bottom-0 group-data-horizontal/tabs:group-data-[variant=line]/tabs-list:after:h-[2px] group-data-horizontal/tabs:group-data-[variant=line]/tabs-list:after:rounded-sm group-data-[variant=line]/tabs-list:data-active:after:opacity-100 group-data-horizontal/tabs:group-data-[variant=line]/tabs-list:data-active:after:shadow-[0_0_14px_-3px_color-mix(in_srgb,var(--primary)_50%,transparent)]`,e),...t})}function _({className:e,...t}){return(0,f.jsx)(n,{"data-slot":`tabs-content`,className:a(`flex-1 text-sm outline-none py-2`,e),...t})}export{d as a,c,g as i,_ as n,u as o,h as r,l as s,p as t};
@@ -0,0 +1,4 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{A as n,F as r,I as i,L as a,M as o,N as s,P as c,at as l,j as u,q as d}from"./vendor-ui-mizMYESS.js";import{H as f,_ as p,a as m}from"./api-Bef9FEIU.js";import{a as h,n as g,t as ee}from"./get-error-message-DhCjoSSJ.js";import{t as te}from"./proxy-CgM57W61.js";import{t as ne}from"./AnimatePresence-CVhkybDC.js";import{i as _,n as v,t as re}from"./dist-jROhexoH.js";import{n as ie}from"./chunk-OE4NN4TA-m2UhO8Q2.js";import{a as y,i as ae,n as b,o as x,r as S,s as C,t as oe}from"./copy-button-BK3jqKBZ.js";import{n as w,t as T}from"./createLucideIcon-Yddw9eHa.js";import{i as E,n as D,t as O}from"./tooltip-TtanriwA.js";import{T as se,a as k,g as A,m as j,n as M,t as ce,w as le}from"./input-BCiRHEmc.js";import{r as ue}from"./engine-store-BUO-9Dsh.js";import{t as de}from"./arrow-up-down-CBuv2TSF.js";import{c as N,i as P,l as fe,n as F,s as I,t as L}from"./select-4wihIkEE.js";import{a as pe,n as R,r as z}from"./platform-targets-BbVxaqAc.js";import{t as me}from"./download-BPgKzo-_.js";import{t as he}from"./query-keys-Co1J4HmV.js";import{n as ge}from"./auth-screen-backdrop-OrOL41MR.js";import{t as B}from"./label-xIWEC6lW.js";import{a as V,i as H,n as U,o as _e,r as W,s as ve,t as G}from"./combobox-gGNWoksU.js";import{a as ye,i as be,n as xe,o as Se,r as Ce,s as we,t as Te}from"./vendor-table-wd8JuMmT.js";var Ee=T(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),K=T(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),De=T(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),Oe=T(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ke=T(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Ae=T(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),je=T(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),q=e(t(),1),J=l();function Me({...e}){return(0,J.jsx)(u,{"data-slot":`dropdown-menu`,...e})}function Ne({...e}){return(0,J.jsx)(n,{"data-slot":`dropdown-menu-trigger`,...e})}function Pe({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,J.jsx)(s,{children:(0,J.jsx)(o,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,J.jsx)(c,{"data-slot":`dropdown-menu-content`,className:w(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-[var(--miravo-radius-stadium-sm)] bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}function Fe({...e}){return(0,J.jsx)(a,{"data-slot":`dropdown-menu-group`,...e})}function Ie({className:e,inset:t,...n}){return(0,J.jsx)(i,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:w(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function Y({className:e,inset:t,variant:n=`default`,...i}){return(0,J.jsx)(r,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:w(`group/dropdown-menu-item relative flex cursor-pointer items-center gap-1.5 rounded-[var(--miravo-radius-tight)] px-1.5 py-1 text-sm outline-hidden select-none data-[highlighted]:bg-sidebar-accent data-[highlighted]:text-sidebar-accent-foreground not-data-[variant=destructive]:data-[highlighted]:**:text-sidebar-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:data-[highlighted]:bg-destructive/10 data-[variant=destructive]:data-[highlighted]:text-destructive data-[variant=destructive]:data-[highlighted]:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...i})}function Le({className:e,...t}){return(0,J.jsx)(d,{"data-slot":`dropdown-menu-separator`,className:w(`-mx-1 my-1 h-px bg-border`,e),...t})}var Re={mqtt:`MQTT Client`,opcua:`OPC UA Client Advanced`,modbus:`Modbus TCP`},ze={Boolean:`bool`,Int32:`int32`,UInt16:`uint16`,UInt32:`uint32`,Float:`float32`,Double:`float64`,String:`string`},X={float32:`float32`,int32:`int32`,uint32:`uint32`,uint16:`word`,boolean:`word`},Z=`deviceId,deviceName,driverName,name,tagName,description,valueType,registerId,publishCoV,tagFormula,metaData,Retain,Qos,address,count,pollingInterval,endianness`;function Be(e,t,n){let r=[Z];for(let i of n){let n=Re[i]??i;for(let a of e){let e=a.protocols[i];e&&r.push(Ve(i,{deviceName:t,driverName:n,memberName:a.member,browsePath:a.browsePath,dataType:a.dataType,protocolData:e,unit:a.unit,euRange:a.euRange,model:a.model,instance:a.instance,access:a.access}))}}return`${r.join(`
2
+ `)}\n`}function Ve(e,t){switch(e){case`mqtt`:return He(t);case`opcua`:return Ue(t);case`modbus`:return We(t);default:throw Error(`Unsupported LE export protocol: "${e}"`)}}function He(e){let t=typeof e.protocolData?.topic==`string`?e.protocolData.topic:`${e.browsePath}/${e.memberName}`;return[``,Q(e.deviceName),Q(e.driverName),Q(t),Q(e.memberName),``,`string`,``,`false`,``,Ge(e),`Disable`,`0`,``,``,``,``].join(`,`)}function Ue(e){let t=typeof e.protocolData?.nodeId==`string`?e.protocolData.nodeId:`ns=1;s=${e.browsePath}/${e.memberName}`,n=ze[e.dataType]??`string`;return[``,Q(e.deviceName),Q(e.driverName),Q(t),Q(e.memberName),``,n,``,`false`,``,Ge(e),``,``,``,``,``,``].join(`,`)}function We(e){let t=X[String(e.protocolData?.registerType??``)]??`float32`,n=e.protocolData?.address;return[``,Q(e.deviceName),Q(e.driverName),`H`,Q(e.memberName),``,t,``,`false`,``,Ge(e),``,``,typeof n==`number`?String(n):`0`,`1`,`1.0000000000`,`AB CD`].join(`,`)}function Q(e){return e.includes(`,`)||e.includes(`"`)||e.includes(`
3
+ `)?`"${e.replace(/"/g,`""`)}"`:e}function Ge(e){let t={uns_path:e.browsePath?`${e.browsePath}/${e.memberName}`:e.memberName,model:e.model,instance:e.instance,access:e.access};return e.unit!=null&&(t.unit=e.unit),e.euRange!=null&&(t.eu_range_min=String(e.euRange[0]),t.eu_range_max=String(e.euRange[1])),Q(JSON.stringify(t))}var Ke={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus`},qe=[{id:z.id,label:z.label}];function Je({open:e,onOpenChange:t,tags:n,totalTags:r,enabledProtocols:i,selectedInstance:a}){let[o,s]=(0,q.useState)(`litmus-edge`),[c,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(``),f=(0,q.useRef)(null),p=(0,q.useRef)(!1);(0,q.useEffect)(()=>{e&&!p.current&&(s(z.id),l(a??``),d(i[0]??``),setTimeout(()=>f.current?.focus(),80)),p.current=e},[e,i,a]);let m=c.trim()!==``&&u!==``,h=o===z.id?m:!1,g=(0,q.useCallback)(()=>{if(o===z.id){let e=Be(n,c.trim(),[u]),r=new Blob([e],{type:`text/csv`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${c.trim()}-litmus-edge-tags.csv`,a.click(),URL.revokeObjectURL(i),t(!1)}},[o,c,n,u,t]),ee=n.length<r,te=(0,q.useMemo)(()=>[...qe.map(e=>({value:e.id,label:e.label})),...R.map(e=>({value:e.id,label:e.label}))],[]),ne=(0,q.useMemo)(()=>i.map(e=>({value:e,label:Ke[e]??e.toUpperCase()})),[i]);return(0,J.jsx)(b,{open:e,onOpenChange:t,children:(0,J.jsxs)(S,{className:`sm:max-w-lg`,children:[(0,J.jsxs)(x,{children:[(0,J.jsx)(C,{children:`Export for Platform`}),(0,J.jsx)(ae,{children:ee?`Exporting ${n.length} of ${r} tags based on current table filters.`:`Exporting all ${n.length} tags. Use table filters to narrow scope.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 py-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsx)(B,{className:`text-sm`,children:`Platform`}),(0,J.jsxs)(L,{value:o,onValueChange:e=>e&&s(e),items:te,children:[(0,J.jsx)(I,{className:`w-full text-sm`,children:(0,J.jsx)(N,{placeholder:`Select platform`})}),(0,J.jsxs)(F,{children:[qe.map(e=>(0,J.jsx)(P,{value:e.id,children:e.label},e.id)),R.map(e=>(0,J.jsx)(P,{value:e.id,disabled:!0,children:e.label},e.id))]})]})]}),o===z.id&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(B,{htmlFor:`device-name`,className:`text-sm`,children:[`Device name `,(0,J.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,J.jsx)(ce,{id:`device-name`,ref:f,placeholder:`e.g. DTW-FAB-PLC`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>e.key===`Enter`&&h&&g(),className:`font-mono text-sm`})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsx)(B,{className:`text-sm`,children:`Protocol`}),(0,J.jsxs)(L,{value:u||void 0,onValueChange:e=>e&&d(e),items:ne,children:[(0,J.jsx)(I,{className:`w-full text-sm`,children:(0,J.jsx)(N,{placeholder:`Select a protocol`})}),(0,J.jsx)(F,{children:i.map(e=>(0,J.jsx)(P,{value:e,children:Ke[e]??e.toUpperCase()},e))})]})]})]})]}),(0,J.jsxs)(y,{children:[(0,J.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>t(!1),children:`Cancel`}),(0,J.jsxs)(M,{size:`sm`,className:`gap-1.5`,disabled:!h,onClick:g,children:[(0,J.jsx)(me,{className:`size-3.5`}),`Download CSV`]})]})]})})}var Ye=`border-border/70 bg-popover/98 font-body text-sm shadow-xl ring-1 ring-foreground/12 backdrop-blur-sm supports-backdrop-filter:bg-popover/90 p-1.5`,Xe=`px-2 pb-1 font-heading text-[9px] font-semibold tracking-[0.14em] text-muted-foreground uppercase`,Ze=`h-8 gap-1.5 border-border/80 bg-background/80 text-xs font-medium shadow-sm transition-colors hover:border-primary/35 hover:bg-accent/40`,Qe=`gap-2.5 rounded-[var(--miravo-radius-tight)] py-2 pl-2 pr-2 text-[13px] data-[highlighted]:bg-sidebar-accent data-[highlighted]:text-sidebar-accent-foreground`;function $e({protocol:e,instance:t,model:n,member:r,enabledProtocols:i,hasFilters:a,memberSearchRef:o,onProtocolChange:s,onInstanceChange:c,onModelChange:l,onMemberChange:u,onClearFilters:d,onInstanceSearch:f,onModelSearch:p,filteredInstanceOptions:m,filteredModelOptions:h}){let g=(0,q.useMemo)(()=>[{value:`all`,label:`All protocols`},...i.map(e=>({value:e,label:e.toUpperCase()}))],[i]);return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(L,{value:e||`all`,onValueChange:e=>s(!e||e===`all`?``:e),items:g,children:[(0,J.jsx)(I,{className:`h-8 w-[140px]`,"aria-label":`Protocol filter`,children:(0,J.jsx)(N,{placeholder:`All protocols`})}),(0,J.jsxs)(F,{alignItemWithTrigger:!1,align:`start`,children:[(0,J.jsx)(P,{value:`all`,children:`All protocols`}),i.map(e=>(0,J.jsx)(P,{value:e,children:e.toUpperCase()},e))]})]}),(0,J.jsxs)(G,{value:t?{value:t,label:j(t)}:null,onValueChange:e=>c(e?.value??``),isItemEqualToValue:(e,t)=>e?.value===t?.value,onInputValueChange:f,children:[(0,J.jsx)(W,{placeholder:`All instances`,className:`h-8 w-[200px]`,showClear:!!t}),(0,J.jsx)(U,{children:(0,J.jsxs)(V,{children:[m.map(([e,t])=>(0,J.jsxs)(H,{value:{value:e,label:j(e)},children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:j(e)}),(0,J.jsxs)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:[`(`,t,`)`]})]},e)),m.length===0&&(0,J.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]}),(0,J.jsxs)(G,{value:n?{value:n,label:A(n)}:null,onValueChange:e=>l(e?.value??``),isItemEqualToValue:(e,t)=>e?.value===t?.value,onInputValueChange:p,children:[(0,J.jsx)(W,{placeholder:`All models`,className:`h-8 w-[200px]`,showClear:!!n}),(0,J.jsx)(U,{children:(0,J.jsxs)(V,{children:[h.map(([e,t])=>(0,J.jsxs)(H,{value:{value:e,label:A(e)},children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:A(e)}),(0,J.jsxs)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:[`(`,t,`)`]})]},e)),h.length===0&&(0,J.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No models found`})]})})]}),(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(ce,{ref:o,placeholder:`Search member…`,className:`h-8 w-[160px] pr-7`,value:r,onChange:e=>u(e.target.value)}),!r&&(0,J.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:`/`})]}),a&&(0,J.jsxs)(M,{variant:`ghost`,size:`sm`,className:`h-8 gap-1 text-xs`,onClick:d,children:[(0,J.jsx)(k,{className:`size-3`}),`Clear`]})]})}function $({sorted:e}){return e===`asc`?(0,J.jsx)(K,{className:`ml-1 inline size-3`}):e===`desc`?(0,J.jsx)(Ee,{className:`ml-1 inline size-3`}):(0,J.jsx)(de,{className:`ml-1 inline size-3 opacity-30`})}function et(e,t=1,n=2){let r=e.split(`/`);return r.length<=t+n+1?e:[...r.slice(0,t),`...`,...r.slice(-n)].join(`/`)}function tt({label:e,value:t,collapsible:n}){let r=n?et(t):t;return(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:e}),(0,J.jsx)(oe,{value:t,label:`Copy ${e}`,tooltipSide:`top`,render:({icon:e})=>(0,J.jsxs)(`button`,{type:`button`,className:`mt-0.5 flex items-start gap-1 font-mono text-xs hover:text-foreground`,children:[n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`break-all lg:hidden`,children:r}),(0,J.jsx)(`span`,{className:`hidden break-all lg:inline`,children:t})]}):(0,J.jsx)(`span`,{className:`break-all`,children:t}),(0,J.jsx)(`span`,{className:`mt-0.5 shrink-0 text-muted-foreground`,children:e})]})})]})}function nt({tag:e,enabledProtocols:t}){let n=`${e.browsePath}/${e.member}`,r=e.protocols.opcua,i=e.protocols.modbus,a=e.access===`readwrite`?`rw`:e.access;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 text-xs`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-x-10 gap-y-2.5`,children:[(0,J.jsx)(tt,{label:`Topic / UNS`,value:n,collapsible:!0}),t.includes(`opcua`)&&typeof r?.nodeId==`string`&&(0,J.jsx)(tt,{label:`OPC UA NodeId`,value:r.nodeId,collapsible:!0}),t.includes(`modbus`)&&i?.address!=null&&(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Modbus`}),(0,J.jsxs)(`p`,{className:`mt-0.5 font-mono`,children:[`addr=`,String(i.address),` regs=`,String(i.count),` `,String(i.registerType)]})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-muted-foreground`,children:[(0,J.jsxs)(O,{children:[(0,J.jsx)(E,{className:`font-mono`,render:(0,J.jsx)(`span`,{}),children:e.dataType}),(0,J.jsx)(D,{side:`top`,children:`Data type`})]}),e.unit&&(0,J.jsxs)(O,{children:[(0,J.jsx)(E,{className:`font-mono`,render:(0,J.jsx)(`span`,{}),children:e.unit}),(0,J.jsx)(D,{side:`top`,children:`Unit`})]}),(0,J.jsxs)(O,{children:[(0,J.jsx)(E,{className:`font-mono`,render:(0,J.jsx)(`span`,{}),children:a}),(0,J.jsx)(D,{side:`top`,children:`Access: r / w / rw`})]}),e.euRange&&(0,J.jsxs)(O,{children:[(0,J.jsxs)(E,{className:`font-mono`,render:(0,J.jsx)(`span`,{}),children:[`[`,e.euRange[0],`, `,e.euRange[1],`]`]}),(0,J.jsx)(D,{side:`top`,children:`EU range (min, max)`})]}),(0,J.jsxs)(O,{children:[(0,J.jsxs)(E,{render:(0,J.jsx)(ie,{to:`/instance/${e.instance}`,className:`inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline`,"aria-label":`Open instance`}),children:[`View instance`,(0,J.jsx)(Ae,{className:`size-3`})]}),(0,J.jsx)(D,{side:`top`,children:`Open instance`})]})]})]})}var rt=[{id:`expand`,meta:{cellClass:`!pl-2 !pr-0 w-0`},header:()=>(0,J.jsx)(`span`,{className:`sr-only`,children:`Expand row`}),enableSorting:!1,cell:({row:e})=>(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-5 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:text-foreground`,"aria-label":e.getIsExpanded()?`Collapse row`:`Expand row`,onClick:t=>{t.stopPropagation(),e.toggleExpanded()},children:(0,J.jsx)(fe,{className:`size-3.5 transition-transform ${e.getIsExpanded()?`rotate-0`:`-rotate-90`}`})})},{accessorKey:`instance`,header:({column:e})=>(0,J.jsxs)(`button`,{type:`button`,className:`inline-flex items-center`,onClick:e.getToggleSortingHandler(),children:[`Instance`,(0,J.jsx)($,{sorted:e.getIsSorted()})]}),cell:({getValue:e})=>(0,J.jsx)(`span`,{className:`font-mono text-xs`,children:e()})},{accessorKey:`member`,header:({column:e})=>(0,J.jsxs)(`button`,{type:`button`,className:`inline-flex items-center`,onClick:e.getToggleSortingHandler(),children:[`Member`,(0,J.jsx)($,{sorted:e.getIsSorted()})]}),cell:({getValue:e})=>(0,J.jsx)(`span`,{className:`font-mono text-xs`,children:e()})},{accessorKey:`model`,header:({column:e})=>(0,J.jsxs)(`button`,{type:`button`,className:`inline-flex items-center`,onClick:e.getToggleSortingHandler(),children:[`Model`,(0,J.jsx)($,{sorted:e.getIsSorted()})]}),cell:({getValue:e})=>(0,J.jsx)(`span`,{className:`text-xs`,children:e()})},{accessorKey:`dataType`,meta:{hideClass:`hidden lg:table-cell`},header:({column:e})=>(0,J.jsxs)(`button`,{type:`button`,className:`inline-flex items-center`,onClick:e.getToggleSortingHandler(),children:[`Type`,(0,J.jsx)($,{sorted:e.getIsSorted()})]}),cell:({getValue:e})=>(0,J.jsx)(`span`,{className:`font-mono text-xs`,children:e()})},{accessorKey:`unit`,meta:{hideClass:`hidden lg:table-cell`},header:`Unit`,enableSorting:!1,cell:({getValue:e})=>(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e()??`—`})},{accessorKey:`access`,meta:{hideClass:`hidden lg:table-cell`},header:`Access`,enableSorting:!1,cell:({getValue:e})=>{let t=e();return(0,J.jsx)(`span`,{className:`font-mono text-xs`,children:t===`readwrite`?`rw`:t})}}];function it(e,t){let n=new Blob([e],{type:`text/csv`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=t,i.click(),URL.revokeObjectURL(r)}var at=[`loading-1`,`loading-2`,`loading-3`,`loading-4`,`loading-5`,`loading-6`,`loading-7`,`loading-8`];function ot(){let[e,t]=(0,q.useState)(!1),n=(0,q.useRef)(null);(0,q.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(),n.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let[r,i]=_(`protocol`,v.withDefault(``)),[a,o]=_(`instance`,v.withDefault(``)),[s,c]=_(`model`,v.withDefault(``)),[l,u]=_(`member`,v.withDefault(``)),[d,y]=_(`perPage`,re.withDefault(15)),ae=ue(e=>e.instanceCount),b=h({queryKey:he.tags.manifest(ae),queryFn:()=>m(`/manifest`,p.manifest),placeholderData:f}),x=b.data??null,S=b.isError,C=b.isPending&&!x&&!S,oe=ee(b.error,`Failed to fetch manifest.`),T=x?.tags??[],E=x?.summary?.enabledProtocols??[],D=(0,q.useMemo)(()=>T.filter(e=>e.kind===`variable`),[T]),O=(0,q.useMemo)(()=>{let e=new Map;for(let t of D)e.set(t.instance,(e.get(t.instance)??0)+1);return[...e.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[D]),k=(0,q.useMemo)(()=>{let e=new Map;for(let t of D)e.set(t.model,(e.get(t.model)??0)+1);return[...e.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[D]),A=(0,q.useMemo)(()=>{let e=[...D];return r&&(e=e.filter(e=>Object.keys(e.protocols).includes(r))),a&&(e=e.filter(e=>e.instance===a)),s&&(e=e.filter(e=>e.model===s)),l&&(e=e.filter(e=>e.member.toLowerCase().includes(l.toLowerCase()))),e},[D,r,a,s,l]),[j,ce]=(0,q.useState)([]),[de,R]=(0,q.useState)({}),[z,B]=(0,q.useState)(0),V=r!==``||a!==``||s!==``||l!==``,H=(0,q.useCallback)(()=>{i(``),o(``),c(``),u(``),B(0)},[i,o,c,u]),U=xe({data:A,columns:rt,getCoreRowModel:Ce(),getSortedRowModel:we(),getExpandedRowModel:be(),getRowCanExpand:()=>!0,getFilteredRowModel:ye(),getPaginationRowModel:Se(),onSortingChange:ce,onExpandedChange:R,onPaginationChange:e=>{let t=typeof e==`function`?e({pageIndex:z,pageSize:d}):e;B(t.pageIndex),y(t.pageSize)},state:{sorting:j,expanded:de,pagination:{pageIndex:z,pageSize:d}}}),W=(0,q.useCallback)(e=>{B(0),y(e)},[y]),[G,Ee]=(0,q.useState)(``),[K,Ae]=(0,q.useState)(``),Re=(0,q.useMemo)(()=>G?O.filter(([e])=>le(e,G)):O,[O,G]),ze=(0,q.useMemo)(()=>K?k.filter(([e])=>se(e,K)):k,[k,K]),X=d,Z=U.getRowModel().rows.length,Be=Z===0||A.length===0?0:z*X+1,Ve=Z===0||A.length===0?0:z*X+Z,He=(0,q.useCallback)(()=>{let e=r?[r]:E,t=[`instance`,`member`,`model`,`dataType`,`unit`,`access`,`browsePath`,...e.includes(`mqtt`)?[`mqtt_topic`]:[],...e.includes(`opcua`)?[`opcua_nodeId`]:[],...e.includes(`modbus`)?[`modbus_address`,`modbus_count`,`modbus_encoding`]:[]],n=A.map(t=>{let n=t.protocols.mqtt,r=t.protocols.opcua,i=t.protocols.modbus;return[t.instance,t.member,t.model,t.dataType,t.unit??``,t.access,t.browsePath,...e.includes(`mqtt`)?[String(n?.topic??``)]:[],...e.includes(`opcua`)?[String(r?.nodeId??``)]:[],...e.includes(`modbus`)?[String(i?.address??``),String(i?.count??``),String(i?.registerType??``)]:[]]});it([t.join(`,`),...n.map(e=>e.join(`,`))].join(`
4
+ `),`miravo-tags.csv`)},[A,r,E]);return S&&!x?(0,J.jsx)(ge,{className:`min-h-full`,children:(0,J.jsx)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center p-6 sm:p-12`,children:(0,J.jsx)(`div`,{className:`w-full max-w-md`,children:(0,J.jsx)(g,{message:oe,onRetry:()=>void b.refetch(),isRetrying:b.isFetching})})})}):(0,J.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[S&&x?(0,J.jsx)(g,{message:`${oe} Showing cached tags.`,onRetry:()=>void b.refetch(),isRetrying:b.isFetching}):null,(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Tag Explorer`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:C?`Loading tag manifest...`:`${x?.summary?.totalInstances??0} instances · ${E.length} protocols`})]}),(0,J.jsxs)(Me,{children:[(0,J.jsxs)(Ne,{render:(0,J.jsx)(M,{variant:`outline`,size:`sm`,className:w(Ze,`px-3`)}),children:[(0,J.jsx)(me,{className:`size-3.5 opacity-90`,"aria-hidden":!0}),`Export`,(0,J.jsx)(fe,{className:`size-3 opacity-60`,"aria-hidden":!0})]}),(0,J.jsx)(Pe,{align:`end`,sideOffset:6,className:w(`min-w-[13.5rem]`,Ye),children:(0,J.jsxs)(Fe,{children:[(0,J.jsx)(Ie,{className:Xe,children:`Export`}),(0,J.jsx)(Le,{className:`bg-border/60`}),(0,J.jsxs)(Y,{onClick:He,className:Qe,children:[(0,J.jsx)(je,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}),`Download CSV`]}),(0,J.jsxs)(Y,{onClick:()=>t(!0),className:Qe,children:[(0,J.jsx)(De,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}),`Export for Platform…`]})]})})]})]}),(0,J.jsx)($e,{protocol:r,instance:a,model:s,member:l,enabledProtocols:E,instanceOptions:O,modelOptions:k,hasFilters:V,memberSearchRef:n,onProtocolChange:e=>void i(e),onInstanceChange:e=>void o(e),onModelChange:e=>void c(e),onMemberChange:e=>void u(e),onClearFilters:H,onInstanceSearch:Ee,onModelSearch:Ae,filteredInstanceOptions:Re,filteredModelOptions:ze}),A.length!==D.length&&D.length>0&&(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Showing`,` `,(0,J.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:A.length}),` of`,` `,(0,J.jsx)(`span`,{className:`tabular-nums`,children:D.length}),` tags`]}),(0,J.jsx)(_e,{className:`min-w-0 py-0`,children:(0,J.jsx)(ve,{className:`p-0`,children:(0,J.jsx)(`div`,{className:`min-w-0`,children:(0,J.jsxs)(`table`,{className:`w-full caption-bottom text-sm`,children:[(0,J.jsx)(`thead`,{className:`sticky top-0 z-10 border-b bg-background [&_tr]:border-b`,children:U.getHeaderGroups().map(e=>(0,J.jsx)(`tr`,{className:`border-b transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,children:e.headers.map(e=>{let t=e.column.columnDef.meta;return(0,J.jsx)(`th`,{className:`h-10 whitespace-nowrap px-1.5 text-left text-xs font-medium text-muted-foreground sm:px-4 ${t?.hideClass??``} ${t?.cellClass??``}`,children:e.isPlaceholder?null:Te(e.column.columnDef.header,e.getContext())},e.id)})},e.id))}),(0,J.jsx)(`tbody`,{className:`[&_tr:last-child]:border-0`,children:C?at.map(e=>(0,J.jsx)(`tr`,{children:(0,J.jsx)(`td`,{colSpan:rt.length,className:`px-4 py-2`,children:(0,J.jsx)(`div`,{className:`h-8 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/30`})})},e)):U.getRowModel().rows.length>0?U.getRowModel().rows.map(e=>{let t=e.getToggleExpandedHandler(),n=e.getIsExpanded();return(0,J.jsxs)(q.Fragment,{children:[(0,J.jsx)(`tr`,{role:`button`,tabIndex:0,"aria-expanded":n,className:`cursor-pointer border-b transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent focus-visible:text-sidebar-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},children:e.getVisibleCells().map(e=>{let t=e.column.columnDef.meta;return(0,J.jsx)(`td`,{className:`whitespace-nowrap px-1.5 py-1.5 text-left sm:px-4 ${t?.hideClass??``} ${t?.cellClass??``}`,children:Te(e.column.columnDef.cell,e.getContext())},e.id)})}),(0,J.jsx)(`tr`,{"aria-hidden":!n,children:(0,J.jsx)(`td`,{colSpan:e.getVisibleCells().length,className:`p-0`,children:(0,J.jsx)(ne,{initial:!1,children:n&&(0,J.jsx)(te.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden border-b`,children:(0,J.jsx)(`div`,{className:`px-1.5 py-3 pl-6 sm:px-4 sm:pl-10`,children:(0,J.jsx)(nt,{tag:e.original,enabledProtocols:E})})},`expanded`)})})})]},e.id)}):(0,J.jsx)(`tr`,{children:(0,J.jsx)(`td`,{colSpan:rt.length,className:`h-32 px-2 text-center sm:px-4`,children:D.length===0?(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,J.jsx)(ke,{className:`size-8 text-muted-foreground`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tags available`}),(0,J.jsx)(ie,{to:`/catalog`,className:`text-xs text-primary underline-offset-4 hover:underline`,children:`Start an environment from the Catalog to generate tags`})]}):(0,J.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No matching tags.`,` `,(0,J.jsx)(`span`,{className:`text-xs`,children:`Try adjusting your filters.`})]})})})})]})})})}),(0,J.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 sm:justify-start sm:gap-5`,children:[(0,J.jsxs)(`p`,{className:`min-w-0 leading-tight`,children:[(0,J.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:Be===0?`0`:`${Be}\u2013${Ve}`}),` `,(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[`of `,A.length,` tags`]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 whitespace-nowrap`,children:[(0,J.jsxs)(L,{value:String(X),onValueChange:e=>e&&W(Number(e)),children:[(0,J.jsx)(I,{className:`h-8 w-[4.25rem]`,"aria-label":`Rows per page`,children:(0,J.jsx)(N,{})}),(0,J.jsx)(F,{children:[10,15,25,50,100].map(e=>(0,J.jsx)(P,{value:String(e),children:e},e))})]}),(0,J.jsx)(`span`,{className:`hidden text-muted-foreground sm:inline`,children:`per page`})]})]}),(0,J.jsxs)(`nav`,{className:`flex items-center justify-center gap-2 border-border/60 border-t pt-2 sm:justify-end sm:border-0 sm:pt-0`,"aria-label":`Table pages`,children:[(0,J.jsx)(M,{variant:`outline`,size:`sm`,className:`h-8 w-8 shrink-0 p-0`,disabled:!U.getCanPreviousPage(),onClick:()=>U.previousPage(),"aria-label":`Previous page`,children:(0,J.jsx)(Oe,{className:`size-3.5`})}),(0,J.jsxs)(`span`,{className:`min-w-[5ch] text-center text-sm font-medium tabular-nums whitespace-nowrap text-foreground`,children:[U.getState().pagination.pageIndex+1,` / `,U.getPageCount()]}),(0,J.jsx)(M,{variant:`outline`,size:`sm`,className:`h-8 w-8 shrink-0 p-0`,disabled:!U.getCanNextPage(),onClick:()=>U.nextPage(),"aria-label":`Next page`,children:(0,J.jsx)(pe,{className:`size-3.5`})})]})]})}),(0,J.jsx)(Je,{open:e,onOpenChange:t,tags:A,totalTags:T.length,enabledProtocols:E,selectedInstance:a||void 0})]})}export{Y as a,Ne as c,Fe as i,Me as n,Ie as o,Pe as r,Le as s,ot as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./tags-DZpOeuyx.js";export{e as TagsPage};
@@ -1 +1 @@
1
- import{at as e}from"./vendor-ui-mizMYESS.js";import{r as t}from"./chunk-OE4NN4TA-m2UhO8Q2.js";import{t as n}from"./route-preload-Dz8gP8hl.js";import{t as r}from"./use-transition-navigate-C3Y3EWRr.js";var i=e();function a(e){return e.button===0&&!e.metaKey&&!e.altKey&&!e.ctrlKey&&!e.shiftKey}function o({to:e,transitionType:o,preloadOnIntent:s=!0,onClick:c,...l}){let u=r();return(0,i.jsx)(t,{...l,to:e,onMouseEnter:t=>{l.onMouseEnter?.(t),s&&n(e)},onFocus:t=>{l.onFocus?.(t),s&&n(e)},onClick:t=>{c?.(t),!t.defaultPrevented&&(l.reloadDocument||l.target&&l.target!==`_self`||l.download||a(t)&&(t.preventDefault(),u(e,{transitionType:o})))}})}export{o as t};
1
+ import{at as e}from"./vendor-ui-mizMYESS.js";import{r as t}from"./chunk-OE4NN4TA-m2UhO8Q2.js";import{t as n}from"./route-preload-CMl-AryU.js";import{t as r}from"./use-transition-navigate-CG8tHeYN.js";var i=e();function a(e){return e.button===0&&!e.metaKey&&!e.altKey&&!e.ctrlKey&&!e.shiftKey}function o({to:e,transitionType:o,preloadOnIntent:s=!0,onClick:c,...l}){let u=r();return(0,i.jsx)(t,{...l,to:e,onMouseEnter:t=>{l.onMouseEnter?.(t),s&&n(e)},onFocus:t=>{l.onFocus?.(t),s&&n(e)},onClick:t=>{c?.(t),!t.defaultPrevented&&(l.reloadDocument||l.target&&l.target!==`_self`||l.download||a(t)&&(t.preventDefault(),u(e,{transitionType:o})))}})}export{o as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{g as n,s as r,t as i,u as a,v as o}from"./api-Bef9FEIU.js";import{l as s}from"./copy-button-BK3jqKBZ.js";import{t as c}from"./createLucideIcon-Yddw9eHa.js";import{r as l}from"./engine-store-BUO-9Dsh.js";var u=c(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),d=`group relative border border-solid border-border transition-colors hover:border-muted-foreground/25`,f=`group relative border border-solid border-border`,p=`blueprint-card ${d} overflow-hidden rounded-[var(--miravo-radius-stadium-sm)]`,m=`${f} w-full min-w-0 overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] bg-transparent`,h=`${f} w-full min-w-0 overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] bg-transparent`,g=`blueprint-card catalog-card-frame group relative border border-solid overflow-hidden rounded-[var(--miravo-radius-stadium-sm)]`,_=g,v=`border-border bg-muted/40 text-primary shadow-none hover:border-muted-foreground/30 hover:bg-muted/60 hover:text-primary focus-visible:border-ring border-border bg-muted/30 hover:border-muted-foreground/35 hover:bg-muted/45 [&_svg]:text-primary`,y=e(t(),1),b=new Set([`spawn`,`removeInstance`,`loadTemplate`,`unloadTemplateRun`,`resetEnvironment`,`enableAdapter`,`disableAdapter`]);function x(e){if(e instanceof i){s.error(e.result.message,{description:e.result.error});return}if(o.is(e)){s.error(e.message,{description:e.hint});return}if(e instanceof TypeError){if(typeof navigator<`u`&&navigator.onLine===!1){s.error(`Command not sent`,{description:`This browser is offline — reconnect to the network and try again.`});return}let{connectionState:e}=l.getState();if(e===`reconnecting`||e===`resyncing`){s.error(`Command not sent`,{description:`Runtime link is reconnecting — try again once the link is live.`});return}if(e===`fatal`){s.error(`Command not sent`,{description:`Runtime link is down. Keep retrying or hard reload to recover.`});return}s.error(`Command failed`,{description:`Could not reach the Miravo server — it may have stopped or restarted.`});return}s.error(`Command failed`,{description:e instanceof Error?e.message:`Unknown error.`})}async function S(){try{let e=await r();if(e.authenticated){let t=l.getState();e.runtime.revision>=t.lastRevision&&t.replaceRuntime(e.runtime)}n.invalidateQueries({queryKey:[`bootstrap`]})}catch{}}function C(){let[e,t]=(0,y.useState)(!1);return{mutate:(0,y.useCallback)(e=>{t(!0),a(e).then(t=>{if(s.success(t.message),b.has(e.type))return S()}).catch(x).finally(()=>{t(!1)})},[]),mutateAsync:(0,y.useCallback)(async e=>{t(!0);try{let t=await a(e);return s.success(t.message),b.has(e.type)&&await S(),t}catch(e){throw x(e),e}finally{t(!1)}},[]),isPending:e}}export{h as a,u as c,g as i,v as n,m as o,p as r,_ as s,C as t};
@@ -0,0 +1,2 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-mizMYESS.js";import{_ as r,b as i,d as a,f as o,v as s,y as c}from"./api-Bef9FEIU.js";import{t as l,u}from"./proxy-CgM57W61.js";import{t as d}from"./AnimatePresence-CVhkybDC.js";import{a as f,i as p,l as m,n as h,o as g,r as ee,s as te,t as _}from"./copy-button-BK3jqKBZ.js";import{n as v,t as y}from"./createLucideIcon-Yddw9eHa.js";import{i as b,n as x,t as S}from"./tooltip-TtanriwA.js";import{a as C,n as w,o as T,t as E}from"./input-BCiRHEmc.js";import{a as D,c as O,i as k,l as A,n as j,o as M,r as N,s as P,t as F}from"./select-4wihIkEE.js";import{i as I,n as L,r as R,t as z}from"./platform-targets-BbVxaqAc.js";import{a as B,c as V,o as H,s as U}from"./tabs-BgPF8MSY.js";import{t as W}from"./circle-question-mark-Q_q7JZnT.js";import{n as ne,r as re,t as ie}from"./checkbox-Xly18Uyz.js";import{t as ae}from"./triangle-alert-DPtblpQC.js";import{t as oe}from"./badge-tnWgSITj.js";import{t as G}from"./label-xIWEC6lW.js";var se=y(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),ce=y(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),le=y(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),ue=y(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),de=y(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),fe=y(`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`}]]),pe=y(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),me=y(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),he=y(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),K=y(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),q=e(t(),1),J=`Source host (Miravo)`,Y=`Address Litmus Edge uses to reach your running Miravo environment.`,X=n(),ge=[`devices`,`models`,`instances`],_e=[`instances`,`models`,`devices`],ve={devices:`DeviceHub devices`,models:`Digital Twins models`,instances:`Digital Twins instances`},ye={devices:{apply:`DeviceHub device records and settings on Litmus Edge.`,cleanup:`Remove DeviceHub device records managed from Miravo.`},models:{apply:`Digital Twins model definitions synced to the platform.`,cleanup:`Remove Digital Twins model definitions created by Miravo.`},instances:{apply:`Digital Twins instances bound to DeviceHub devices.`,cleanup:`Remove Digital Twins instances deployed for this target.`}},be=`Miravo calls this API.`;function xe(e){return e.length>120?`Use at most 120 characters.`:/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(e)?null:`Use lowercase letters, numbers, and hyphens only (e.g. motor-001).`}function Se({open:e,onOpenChange:t,type:n,label:r,targetLabel:i,hostname:a,sourceHostname:o,onConfirm:s,defaultDeviceName:c,applyPreview:u,cleanupPreview:d}){let m=n===`apply`?ge:_e,[g,_]=(0,q.useState)(new Set(m)),[y,C]=(0,q.useState)(!1),[T,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(``),[j,M]=(0,q.useState)(null),[N,P]=(0,q.useState)(`fail`),F=(0,q.useId)(),I=(0,q.useId)(),L=`if-unmanaged-${I}`,R=n===`apply`,z=R&&c!==void 0&&c!==``;(0,q.useEffect)(()=>{e&&(_(new Set(m)),C(!1),M(null),k(z?c??``:``),P(`fail`),D(!1))},[e,m,z,c]);let B={instances:`models`},V=e=>{_(t=>{let n=new Set(t);if(n.has(e)){n.delete(e);for(let[t,r]of Object.entries(B))r===e&&n.delete(t)}else{n.add(e);let t=B[e];t&&n.add(t)}return n})},H=R?u:d,U=()=>{H?.onPreview(),t(!1)};return(0,X.jsx)(h,{open:e,onOpenChange:t,children:(0,X.jsxs)(ee,{showCloseButton:!0,className:`flex max-h-[90vh] min-h-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-120`,children:[(0,X.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 px-5 pb-3 pt-5`,children:[(0,X.jsxs)(te,{className:`flex items-center gap-2 text-sm font-semibold leading-snug`,children:[R?(0,X.jsx)(ne,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}):(0,X.jsx)(K,{className:`size-3.5 shrink-0 text-destructive`,"aria-hidden":!0}),R?`Apply to Litmus Edge`:`Clean up Litmus Edge`]}),(0,X.jsx)(p,{className:`sr-only`,children:R?`Review connection details and scope before applying.`:`Review target and cleanup scope before confirming.`})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 pt-4 pb-3`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,X.jsx)(`div`,{className:`text-xs leading-snug`,children:(0,X.jsxs)(`dl`,{className:`flex flex-col gap-0`,children:[(0,X.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5 first:pt-0`,children:[(0,X.jsx)(`dt`,{className:`min-w-0 pt-px text-[11px] font-medium text-muted-foreground`,children:R?`Resource`:`Target`}),(0,X.jsx)(`dd`,{className:`min-w-0 wrap-break-word font-medium text-foreground`,children:r})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5`,children:[(0,X.jsx)(`dt`,{className:`min-w-0 pt-px text-[11px] font-medium text-muted-foreground`,children:`Target`}),(0,X.jsx)(`dd`,{className:`min-w-0 wrap-break-word font-medium text-foreground`,children:i})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5`,children:[(0,X.jsx)(`dt`,{className:`min-w-0 pt-px`,children:(0,X.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium leading-snug text-muted-foreground`,children:`Litmus Edge API`}),(0,X.jsxs)(S,{children:[(0,X.jsx)(b,{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 Litmus Edge API`,children:(0,X.jsx)(W,{className:`size-3`,"aria-hidden":!0})}),(0,X.jsx)(x,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:be})]})]})}),(0,X.jsx)(`dd`,{className:`min-w-0`,children:(0,X.jsx)(`span`,{className:`break-all font-mono text-[11px] leading-normal text-foreground/90`,children:a})})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5`,children:[(0,X.jsx)(`dt`,{className:`min-w-0 pt-px`,children:(0,X.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium leading-snug text-muted-foreground`,children:J}),(0,X.jsxs)(S,{children:[(0,X.jsx)(b,{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 ${J}`,children:(0,X.jsx)(W,{className:`size-3`,"aria-hidden":!0})}),(0,X.jsx)(x,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:Y})]})]})}),(0,X.jsx)(`dd`,{className:`min-w-0`,children:(0,X.jsx)(`span`,{className:`break-all font-mono text-[11px] leading-normal text-foreground/90`,children:o})})]})]})}),H?(0,X.jsxs)(G,{className:v(`flex cursor-pointer items-center gap-2.5 text-[11px] font-medium leading-snug`,H.disabled&&`pointer-events-none opacity-50`),children:[(0,X.jsx)(`span`,{className:`flex shrink-0 items-center`,children:(0,X.jsx)(ie,{checked:T,onCheckedChange:e=>D(e===!0),disabled:H.disabled})}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:R?`Dry run only — preview the plan without deploying`:`Dry run only — preview the plan without removing resources`})]}):null,z?(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(G,{htmlFor:F,className:`text-[11px] font-medium`,children:`Device name`}),(0,X.jsx)(E,{id:F,value:O,onChange:e=>{k(e.target.value),M(null)},placeholder:c,autoComplete:`off`,spellCheck:!1,className:v(`h-9 font-mono text-xs`,j&&`border-destructive`),"aria-invalid":j!=null,"aria-describedby":`${F}-hint`}),(0,X.jsx)(`p`,{id:`${F}-hint`,className:`text-[11px] leading-snug text-foreground/76`,children:`Same name on a later run updates this device; change it to add another.`}),j?(0,X.jsx)(`p`,{className:`text-[11px] text-destructive`,children:j}):null]}):null,(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`group flex w-full items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] bg-muted/40 px-2.5 py-2 text-left text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground aria-expanded:bg-muted/55 aria-expanded:text-foreground`,onClick:()=>C(e=>!e),"aria-expanded":y,children:[`Advanced`,(0,X.jsx)(A,{className:v(`size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-hover:text-foreground/80`,y?`duration-500 rotate-180 text-foreground/80`:`duration-280`),"aria-hidden":!0})]}),(0,X.jsxs)(l.div,{initial:!1,animate:{maxHeight:y?520:0,opacity:+!!y},transition:{maxHeight:{duration:y?.52:.28,ease:y?[.16,1,.3,1]:[.4,0,.2,1]},opacity:{duration:y?.42:.24,ease:y?[.16,1,.3,1]:[.4,0,.2,1]}},className:v(`overflow-hidden`,!y&&`pointer-events-none`),"aria-hidden":!y,inert:!y,children:[(0,X.jsx)(`div`,{className:`flex flex-col gap-1 pt-px`,children:m.map(e=>{let t=Object.entries(B).find(([t,n])=>n===e)?.[0],n=t!==void 0&&g.has(t),r=R?ye[e].apply:ye[e].cleanup;return(0,X.jsxs)(G,{htmlFor:`scope-${e}`,className:v(`flex min-h-9 cursor-pointer items-start gap-2 rounded-[var(--miravo-radius-tight)] border border-border/40 bg-muted/10 px-2.5 py-1.5 text-[11px] transition-colors`,n?`opacity-95`:`hover:bg-muted/25`),children:[(0,X.jsx)(`span`,{className:`pt-0.5`,children:(0,X.jsx)(ie,{id:`scope-${e}`,checked:g.has(e),disabled:n,onCheckedChange:()=>V(e)})}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:ve[e]}),(0,X.jsx)(`span`,{className:`mt-0.5 block text-[11px] font-normal leading-tight text-muted-foreground`,children:r})]}),n?(0,X.jsx)(`span`,{className:`shrink-0 self-start rounded-[var(--miravo-radius-tight)] border border-primary/35 bg-primary/10 px-1.5 py-px text-[10px] font-semibold uppercase tracking-wide text-primary`,title:`Required when Digital Twins instances are selected (models must stay in scope).`,children:`Required`}):null]},e)})}),R&&(0,X.jsxs)(`div`,{className:`mt-2.5 space-y-1.5 border-t border-border/40 pt-2`,children:[(0,X.jsx)(`p`,{id:`${I}-legend`,className:`text-[11px] font-medium uppercase tracking-wide text-foreground/80`,children:`Collision policy`}),(0,X.jsxs)(`div`,{role:`radiogroup`,"aria-labelledby":`${I}-legend`,className:`flex flex-col gap-1`,children:[(0,X.jsxs)(G,{htmlFor:`if-unmanaged-fail`,className:v(`flex cursor-pointer items-start gap-2 rounded-[var(--miravo-radius-tight)] border px-2.5 py-2 text-[11px] transition-colors`,N===`fail`?`border-primary/45 bg-primary/8`:`border-border/40 bg-muted/10 hover:bg-muted/25`),children:[(0,X.jsx)(`input`,{id:`if-unmanaged-fail`,type:`radio`,name:L,value:`fail`,checked:N===`fail`,onChange:()=>P(`fail`),className:`mt-0.5 size-3.5 shrink-0 accent-primary`}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:`Fail if unmanaged exists`}),(0,X.jsx)(`span`,{className:`mt-px block text-[11px] leading-tight text-foreground/74`,children:`Stop if the target has unmanaged resources.`})]})]}),(0,X.jsxs)(G,{htmlFor:`if-unmanaged-skip`,className:v(`flex cursor-pointer items-start gap-2 rounded-[var(--miravo-radius-tight)] border px-2.5 py-2 text-[11px] transition-colors`,N===`skip`?`border-primary/45 bg-primary/8`:`border-border/40 bg-muted/10 hover:bg-muted/25`),children:[(0,X.jsx)(`input`,{id:`if-unmanaged-skip`,type:`radio`,name:L,value:`skip`,checked:N===`skip`,onChange:()=>P(`skip`),className:`mt-0.5 size-3.5 shrink-0 accent-primary`}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:`Skip unmanaged resources`}),(0,X.jsx)(`span`,{className:`mt-px block text-[11px] leading-tight text-foreground/74`,children:`Only update resources managed by Miravo.`})]})]})]})]})]}),g.size===0&&!(T&&H)?(0,X.jsx)(`p`,{className:`text-[11px] text-destructive`,children:`Select at least one scope or reopen to reset.`}):null]})]})}),(0,X.jsxs)(f,{className:`mx-0 mb-0 shrink-0 flex flex-col gap-2 border-t border-border/60 px-5 py-4 sm:flex-row sm:justify-end`,children:[(0,X.jsx)(w,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(w,{type:`button`,variant:R||T&&d?`default`:`destructive`,onClick:()=>{if(T&&H){U();return}let e=m.filter(e=>g.has(e));if(e.length!==0){if(z){let t=O.trim(),n=t===``?c??``:t.toLowerCase(),r=xe(n);if(r){M(r);return}M(null),s({scope:e,deviceName:n,ifUnmanaged:N});return}s({scope:e,ifUnmanaged:N})}},disabled:T&&H?H.disabled||H.planLoading:g.size===0,children:R?T&&u?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(me,{className:`size-3`,"aria-hidden":!0}),`Preview changes`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ne,{className:`size-3`,"aria-hidden":!0}),`Apply`]}):T&&d?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(me,{className:`size-3`,"aria-hidden":!0}),`Preview changes`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(K,{className:`size-3`,"aria-hidden":!0}),`Clean up`]})})]})]})})}var Ce={initial:{scale:0,opacity:0},animate:{scale:1,opacity:1,originY:0},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:350,damping:40}},we={initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{type:`tween`,duration:.22,ease:[.16,1,.3,1]}};function Te({children:e,variant:t=`default`}){let n=t===`default`;return(0,X.jsx)(l.div,{...n?Ce:we,layout:n,className:`mx-auto w-full`,children:e})}var Ee=q.memo(({children:e,className:t,delay:n=1e3,...r})=>{let[i,a]=(0,q.useState)(0),o=(0,q.useMemo)(()=>q.Children.toArray(e),[e]);(0,q.useEffect)(()=>{let e=null;return i<o.length-1&&(e=setTimeout(()=>{a(e=>(e+1)%o.length)},n)),()=>{e!==null&&clearTimeout(e)}},[i,n,o.length]);let s=(0,q.useMemo)(()=>o.slice(0,i+1).reverse(),[i,o]);return(0,X.jsx)(`div`,{className:v(`flex flex-col items-center gap-4`,t),...r,children:(0,X.jsx)(d,{children:s.map(e=>(0,X.jsx)(Te,{children:e},e.key))})})});Ee.displayName=`AnimatedList`;function Z({type:e,errorMessage:t,className:n}){let r=e===`apply`?t?.toLowerCase()??``:``,i=e===`cleanup`?`Try cleanup again to resume.`:r.includes(`unmanaged device`)||r.includes(`unmanaged instance`)?`Update the collision policy, try apply again to resume, or clean up the created resources.`:`Try apply again to resume, or clean up the created resources.`;return(0,X.jsxs)(`div`,{className:v(`flex items-start gap-1.5 rounded-[var(--miravo-radius-tight)] border border-info/40 bg-info/10 px-2.5 py-1.5 text-[10px] font-medium leading-relaxed`,n),children:[(0,X.jsx)(re,{className:`mt-0.5 size-3 shrink-0 text-info`,"aria-hidden":!0}),(0,X.jsx)(`p`,{className:`min-w-0 flex-1 text-left whitespace-normal break-words text-foreground/80 [overflow-wrap:anywhere]`,children:i})]})}var De=`text-destructive hover:bg-destructive/25 hover:text-foreground`,Oe={device:`Devices`,tags:`Tags`,model:`Models`,instance:`Instances`,"param-sync":`Parameters`};function ke(e){return Oe[e]??e}function Ae(e){switch(e){case`create`:return`border border-success/30 bg-success/15 text-success`;case`update`:return`border border-chart-3/30 bg-chart-3/15 text-chart-3`;case`replace`:return`border border-warning/30 bg-warning/15 text-warning`;case`delete`:return`border border-destructive/30 bg-destructive/15 text-destructive`;default:return`border border-border/50 bg-muted/80 text-foreground/85`}}function je({status:e}){switch(e){case`success`:return(0,X.jsx)(V,{className:`size-3.5 shrink-0 text-success`});case`failed`:return(0,X.jsx)(U,{className:`size-3.5 shrink-0 text-destructive`});case`pending`:return(0,X.jsx)(H,{className:`size-3.5 shrink-0 animate-spin text-primary/90`})}}function Me({status:e}){switch(e){case`done`:return(0,X.jsx)(V,{className:`size-3.5 text-success`});case`active`:return(0,X.jsx)(H,{className:`size-3.5 animate-spin text-primary`});case`pending`:return(0,X.jsx)(ue,{className:`size-3.5 text-foreground/55`})}}function Ne({entry:e}){let[t,n]=(0,q.useState)(!1);return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsxs)(`button`,{type:`button`,className:v(`flex items-center gap-2 rounded-[var(--miravo-radius-tight)] px-2 py-1 text-left transition-colors`,e.error?`cursor-pointer hover:bg-muted/40`:`cursor-default`),onClick:()=>e.error&&n(!t),disabled:!e.error,children:[(0,X.jsx)(je,{status:e.status}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-foreground`,children:e.name}),(0,X.jsx)(`span`,{className:v(`inline-flex rounded-[var(--miravo-radius-tight)] px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wider`,Ae(e.action)),children:e.action}),e.error&&(0,X.jsx)(A,{className:v(`size-3 text-foreground/75 transition-transform`,t&&`rotate-180`)})]}),(0,X.jsx)(d,{initial:!1,children:t&&e.error&&(0,X.jsxs)(l.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.18},className:`overflow-hidden`,children:[(0,X.jsxs)(`div`,{className:`mb-0 flex min-w-0 w-full items-center gap-1.5 rounded-[var(--miravo-radius-tight)] border border-destructive/40 bg-destructive/15 px-2.5 py-1.5 text-[10px] font-medium leading-relaxed`,children:[(0,X.jsx)(`p`,{className:`min-w-0 flex-1 text-left whitespace-normal break-words text-destructive [overflow-wrap:anywhere]`,children:e.error}),(0,X.jsx)(_,{value:e.error,label:`Copy error`,className:v(De,`shrink-0`)})]}),(0,X.jsx)(Z,{type:`apply`,errorMessage:e.error,className:`mb-1 mt-2.5 w-full min-w-0`})]})})]})}function Pe({phase:e,open:t,onOpenChange:n}){let r=e.resources.length,i=r===e.total,a=e.resources.length>0;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsxs)(`button`,{type:`button`,className:v(`flex w-full items-center gap-2 rounded-[var(--miravo-radius-tight)] px-1 py-1 text-left transition-colors`,a&&`hover:bg-muted/40`,!a&&`cursor-default`),disabled:!a,"aria-expanded":a?t:void 0,onClick:()=>a&&n(!t),children:[(0,X.jsx)(Me,{status:e.status}),(0,X.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-foreground`,children:ke(e.name)}),(0,X.jsxs)(`span`,{className:`font-mono text-[10px] text-foreground/70`,children:[r,`/`,e.total]}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[i&&e.status===`done`&&(0,X.jsx)(V,{className:`size-3 text-success`}),a&&(0,X.jsx)(A,{className:v(`size-3 text-foreground/75 transition-transform`,!t&&`-rotate-90`),"aria-hidden":!0})]})]}),(0,X.jsx)(d,{initial:!1,children:a&&t&&(0,X.jsx)(l.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.25,ease:[.16,1,.3,1]},className:`overflow-hidden`,children:(0,X.jsx)(`div`,{className:`ml-2 flex min-w-0 flex-col border-l border-border/55 pl-2.5 pr-1.5 pb-1 pt-0.5`,children:(0,X.jsx)(u.Provider,{value:null,children:e.resources.map((e,t)=>(0,X.jsx)(Te,{variant:`subtle`,children:(0,X.jsx)(Ne,{entry:e})},`${e.name}-${t}`))})})})})]})}function Fe({operation:e}){let t=e.status===`complete`,n=e.status===`cancelled`,r=e.failed>0,i=e.totalPlanned>0?Math.min(100,Le(e)/e.totalPlanned*100):0;return(0,X.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-muted/55`,children:(0,X.jsx)(l.div,{className:v(`h-full rounded-full transition-colors duration-500`,n?`bg-foreground/30`:t&&!r?`bg-success`:`bg-warning`),initial:{width:`0%`},animate:{width:`${i}%`},transition:{duration:.4,ease:[.25,.1,.25,1]}})})}function Ie(e){return e.duration==null?(Date.now()-e.startedAt)/1e3:e.duration/1e3}function Le(e){let t=e.applied+e.failed;return e.totalPlanned>0?Math.min(t,e.totalPlanned):t}function Re(e,t){let n=e.label;return t?.length?t.find(e=>e.id===n)?.name??n:n}function ze({operation:e,sourceLabel:t,isAllExpanded:n,onToggleAll:r}){let i=Ie(e),a=Le(e),o=e.status===`complete`,s=e.status===`cancelled`,c=e.status===`error`,u=e.failed>0;return(0,X.jsxs)(`div`,{className:v(`sticky top-0 z-10 flex min-w-0 w-full flex-col gap-1.5 rounded-[var(--miravo-radius-stadium-sm)] border px-3 pt-2.5 pb-3.5 backdrop-blur-sm transition-colors duration-500`,o&&!u&&`border-success/30 bg-success/5`,o&&u&&`border-warning/30 bg-warning/5`,s&&`border-border/60 bg-muted/50`,c&&`border-destructive/30 bg-destructive/5`,!o&&!s&&!c&&`border-warning/20 bg-warning/5`),children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(d,{mode:`wait`,initial:!1,children:o&&!u?(0,X.jsx)(l.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:500,damping:30},className:`shrink-0`,children:(0,X.jsx)(V,{className:`size-4 text-success`})},`complete`):o&&u?(0,X.jsx)(l.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:500,damping:30},className:`shrink-0`,children:(0,X.jsx)(le,{className:`size-4 text-warning`})},`partial`):s?(0,X.jsx)(l.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:500,damping:30},className:`shrink-0`,children:(0,X.jsx)(se,{className:`size-4 text-foreground/65`})},`cancelled`):c?(0,X.jsx)(l.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:500,damping:30},className:`shrink-0`,children:(0,X.jsx)(U,{className:`size-4 text-destructive`})},`error`):(0,X.jsx)(l.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:500,damping:30},className:`shrink-0`,children:(0,X.jsx)(H,{className:`size-4 animate-spin text-warning`})},`running`)}),(0,X.jsx)(`span`,{className:`text-xs font-medium leading-none text-foreground`,children:s?`Cancelled`:o?u?`Completed with errors`:`Complete`:c?`Failed`:e.retryPending?`Failed, retrying attempt ${e.attempt?e.attempt+1:2}/${e.maxAttempts} in ${e.retryDelayMs?e.retryDelayMs/1e3:3}s...`:e.attempt&&e.maxAttempts&&e.attempt>1?`Retrying attempt ${e.attempt}/${e.maxAttempts}...`:e.type===`apply`?`Applying...`:`Cleaning up...`}),(0,X.jsxs)(`span`,{className:`w-full min-w-0 text-[10px] leading-tight text-foreground/78`,children:[(0,X.jsx)(`span`,{className:`font-sans break-words`,children:t}),(0,X.jsx)(`span`,{className:`font-mono break-words`,children:` → ${e.environment}`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsx)(oe,{variant:`secondary`,className:`h-5 min-h-5 gap-0 overflow-hidden border border-border/50 bg-muted/70 px-1.5 !py-0 font-mono text-[10px] leading-none text-foreground shadow-sm [&>span]:inline-flex [&>span]:items-center`,children:(0,X.jsxs)(`span`,{className:`gap-1`,children:[(0,X.jsx)(d,{mode:`popLayout`,initial:!1,children:(0,X.jsx)(l.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`inline tabular-nums`,children:a},a)}),`/`,e.totalPlanned,(0,X.jsx)(`span`,{className:`text-foreground/72`,children:e.type===`apply`?`applied`:`deleted`})]})}),(0,X.jsx)(d,{initial:!1,children:e.failed>0&&(0,X.jsx)(l.div,{className:`inline-flex items-center`,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:`spring`,stiffness:500,damping:30},children:(0,X.jsxs)(oe,{variant:`destructive`,className:`h-5 min-h-5 gap-0 border border-destructive/35 bg-destructive/20 px-1.5 !py-0 font-mono text-[10px] font-semibold leading-none text-destructive`,children:[e.failed,` failed`]})})})]}),(0,X.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[10px] leading-none text-foreground/75`,children:[(0,X.jsx)(de,{className:`size-3 shrink-0 block text-foreground/65`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`tabular-nums leading-none`,children:typeof i==`number`?`${i.toFixed(1)}s`:`...`})]}),r&&(0,X.jsx)(`div`,{className:`flex items-center border-l border-border/40 pl-2`,children:(0,X.jsx)(`button`,{type:`button`,onClick:r,className:`flex size-4.5 items-center justify-center rounded-[var(--miravo-radius-tight)] text-foreground/55 transition-colors hover:bg-muted/60 hover:text-foreground`,"aria-label":n?`Collapse all phases`:`Expand all phases`,title:n?`Collapse all`:`Expand all`,children:(0,X.jsx)(ce,{className:v(`size-3.5 transition-transform duration-300`,!n&&`opacity-70 scale-y-[-1]`)})})})]})]}),(0,X.jsx)(Fe,{operation:e})]})]})}function Be(e){return e?e.closest(`[data-edge-op-scroll]`)??e.closest(`.overflow-y-auto`):null}var Ve=350;function Q(e){e?.scrollIntoView({block:`end`,behavior:`auto`,inline:`nearest`})}function He(e){let t=()=>Q(e);t(),requestAnimationFrame(t),requestAnimationFrame(()=>requestAnimationFrame(t)),window.setTimeout(t,0),window.setTimeout(t,48),window.setTimeout(t,120)}function Ue({operation:e,catalogTemplates:t}){let n=(0,q.useRef)(null),r=(0,q.useRef)(null),i=(0,q.useRef)(!0),a=(0,q.useRef)(e.status);a.current=e.status;let o=(0,q.useRef)(!1),[s,c]=(0,q.useState)(new Set),u=(0,q.useMemo)(()=>Re(e,t),[e,t]);(0,q.useLayoutEffect)(()=>{let e=Be(n.current);if(!e)return;let t=()=>{i.current=e.scrollHeight-e.scrollTop-e.clientHeight<Ve};return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>{e.removeEventListener(`scroll`,t)}},[]),(0,q.useLayoutEffect)(()=>{if(e.status===`running`){i.current&&Q(r.current),o.current=!0;return}o.current&&=(He(r.current),!1)},[e.status,e.applied,e.failed,e.phases]),(0,q.useEffect)(()=>{if(e.status!==`running`)return;let t=n.current;if(!t)return;let o=0,s=new ResizeObserver(()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>{a.current===`running`&&i.current&&Q(r.current)})});return s.observe(t),i.current&&Q(r.current),()=>{s.disconnect(),cancelAnimationFrame(o)}},[e.status]);let f=e.phases.length>0,p=s.size===0;return(0,X.jsxs)(`div`,{ref:n,className:`flex min-w-0 w-full flex-col gap-2`,children:[(0,X.jsx)(ze,{operation:e,sourceLabel:u,isAllExpanded:p,onToggleAll:f?()=>{c(p?new Set(e.phases.map(e=>e.name)):new Set)}:void 0}),(0,X.jsx)(`div`,{className:`flex flex-col gap-1 px-2 pt-2 pb-4`,children:e.phases.map(e=>(0,X.jsx)(`div`,{children:(0,X.jsx)(Pe,{phase:e,open:!s.has(e.name),onOpenChange:t=>{c(n=>{let r=new Set(n);return t?r.delete(e.name):r.add(e.name),r})}})},e.name))}),(0,X.jsx)(d,{initial:!1,children:e.error&&e.retryPending&&(0,X.jsxs)(l.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},className:`sticky bottom-2 z-20 mx-2 mt-auto mb-2 flex items-center gap-2 overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-destructive/40 bg-destructive/15 px-3 py-2 text-xs font-medium text-destructive shadow-md backdrop-blur-md`,children:[(0,X.jsx)(H,{className:`size-4 shrink-0 animate-spin`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.error})]})}),(0,X.jsx)(d,{initial:!1,children:e.error&&e.status===`error`&&(0,X.jsxs)(l.div,{initial:{opacity:0,height:0,marginTop:0},animate:{opacity:1,height:`auto`,marginTop:8},exit:{opacity:0,height:0,marginTop:0},transition:{duration:.2},className:`mx-2 mb-4 flex min-w-0 flex-col gap-0 overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-destructive/40 bg-destructive/15 px-3 py-2 text-xs font-medium`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`p`,{className:`min-w-0 flex-1 text-left wrap-anywhere text-destructive`,children:e.error}),(0,X.jsx)(_,{value:e.error,label:`Copy error`,className:v(De,`shrink-0`)})]}),(0,X.jsx)(Z,{type:e.type,errorMessage:e.error,className:`mt-3 w-full min-w-0`})]})}),(0,X.jsx)(`div`,{ref:r,className:`h-px w-full shrink-0`,"aria-hidden":!0})]})}function We({format:e,kind:t}){return e===`source-yaml`?t===`model`?`Raw twin model definition. Edit locally, version-control, or use as input for the CLI.`:`Raw environment definition with topology and namespace. Edit, share, or apply via CLI.`:e===`litmus-edge`?t===`model`?`Litmus Edge Digital Twin JSON for manual import via the LE UI or GraphQL API.`:`Litmus Edge template JSON (DeviceHub devices + Digital Twins). Import directly via the Litmus Edge UI.`:`Select a format to download.`}function Ge({children:e,className:t}){return(0,X.jsx)(`div`,{className:v(`max-h-[min(36rem,75vh)] min-h-0 overflow-y-auto rounded-[var(--miravo-radius-stadium-sm)] border border-border/60 p-4 sm:p-5`,t),children:e})}function Ke({title:e,subtitle:t,footerAction:n,onDismiss:r,children:i}){return(0,q.useEffect)(()=>{function e(e){e.key===`Escape`&&r()}return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[r]),(0,X.jsx)(l.div,{initial:{opacity:0,y:24},animate:{opacity:1,y:0},exit:{opacity:0,y:16},transition:{type:`spring`,stiffness:380,damping:30},className:`pointer-events-none fixed bottom-4 left-4 right-4 z-[60] sm:left-auto sm:w-full sm:max-w-md`,children:(0,X.jsxs)(Ge,{className:`pointer-events-auto flex flex-col overflow-hidden border-border/70 bg-background p-0 shadow-lg shadow-black/15 ring-1 ring-border/50 backdrop-blur-sm sm:p-0 bg-background shadow-black/50`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2 border-b border-border/45 p-2.5 pb-2 sm:p-3 sm:pb-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,X.jsx)(B,{className:`size-4 shrink-0 text-primary`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`font-heading text-xs font-semibold tracking-tight text-foreground`,children:e}),t?(0,X.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/80`,children:t}):null]})]}),(0,X.jsx)(w,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`shrink-0 text-foreground/70 hover:bg-muted/80 hover:text-foreground`,onClick:r,"aria-label":`Dismiss operation panel`,children:(0,X.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2.5 pt-2.5 sm:px-3 sm:pt-3`,"data-edge-op-scroll":``,children:i}),n?(0,X.jsx)(`div`,{className:`flex w-full shrink-0 min-w-0 items-center gap-2 border-t border-border/40 bg-muted/15 p-2.5 sm:p-3`,children:n}):null]})})}var qe={...Object.fromEntries(I.map(e=>[e.id,e.exportLabel])),"source-yaml":`Source YAML`};function Je(e){return e==null||e===``?`Select platform`:typeof e==`string`?qe[e]??e:`Select platform`}function Ye(e){return I.find(t=>t.id===e)?.label??e}function $({id:e,label:t,hint:n,className:r,labelAdornment:i,children:a}){return(0,X.jsxs)(`div`,{className:v(`flex flex-col gap-2`,r),children:[(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,X.jsx)(G,{htmlFor:e,className:`text-[11px] font-medium text-foreground`,children:t}),i]}),n?(0,X.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:n}):null]}),a]})}function Xe({open:e,editing:t,platformId:n,form:r,showToken:i,saving:a,testing:o,canTestConnection:s,onOpenChange:c,onPlatformChange:l,onFormChange:u,onShowTokenChange:d,onSave:m,onTestConnection:_,onCancelInFlight:v}){let y=n===R.id,C=t?`Edit Target`:`Add Target`,T=t?`Update the deployment connection.`:`Add the target used for platform deploys.`,A=t?`Leave empty to keep the current token.`:`Required for the first save and connection test.`;return(0,X.jsx)(h,{open:e,onOpenChange:e=>{e||v(),c(e)},children:(0,X.jsxs)(ee,{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,X.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,X.jsx)(te,{className:`text-base tracking-tight`,children:C}),(0,X.jsx)(p,{className:`max-w-xl text-sm leading-relaxed`,children:T})]}),(0,X.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,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t?(0,X.jsx)($,{label:`Platform`,children:(0,X.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:Ye(n)})}):(0,X.jsx)($,{label:`Platform`,children:(0,X.jsxs)(F,{value:n,onValueChange:e=>l(e),children:[(0,X.jsx)(P,{className:`h-9 w-full text-sm data-placeholder:text-muted-foreground/55`,"aria-label":`Platform type`,children:(0,X.jsx)(O,{placeholder:`Select platform`,children:e=>Je(e)})}),(0,X.jsxs)(j,{children:[(0,X.jsxs)(N,{children:[(0,X.jsx)(D,{children:`Available`}),z.map(e=>(0,X.jsx)(k,{value:e.id,children:e.label},e.id))]}),(0,X.jsx)(M,{}),(0,X.jsxs)(N,{children:[(0,X.jsx)(D,{children:`Coming soon`}),L.map(e=>(0,X.jsx)(k,{value:e.id,children:e.label},e.id))]})]})]})}),y?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{id:`env-label`,label:`Label`,children:(0,X.jsx)(E,{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,X.jsx)($,{id:`env-hostname`,label:`Hostname`,children:(0,X.jsx)(E,{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,X.jsx)($,{id:`env-source`,label:J,labelAdornment:(0,X.jsxs)(S,{children:[(0,X.jsx)(b,{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 ${J}`,children:(0,X.jsx)(W,{className:`size-3`,"aria-hidden":!0})}),(0,X.jsx)(x,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:Y})]}),children:(0,X.jsx)(E,{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,X.jsx)($,{id:`env-token`,label:`API token`,labelAdornment:(0,X.jsxs)(S,{children:[(0,X.jsx)(b,{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,X.jsx)(W,{className:`size-3`,"aria-hidden":!0})}),(0,X.jsx)(x,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:A})]}),children:(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(E,{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,X.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,X.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}):(0,X.jsx)(pe,{className:`size-3.5`,"aria-hidden":!0})})]})})]}):(0,X.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:[Ye(n),` setup is not available yet. Switch back to Litmus Edge to finish target setup now.`]})]})}),(0,X.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:o&&y?`Checking connection to Litmus Edge…`:``}),(0,X.jsxs)(f,{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,X.jsx)(w,{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:_,children:o?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),`Testing connection`]}):`Test connection`}),(0,X.jsxs)(`div`,{className:`flex w-full flex-col gap-2 sm:w-auto sm:flex-row`,children:[(0,X.jsx)(w,{variant:`outline`,size:`lg`,className:`w-full sm:w-auto`,onClick:()=>{v(),c(!1)},disabled:a,children:`Cancel`}),(0,X.jsx)(w,{size:`lg`,className:`w-full sm:w-auto`,onClick:m,disabled:a||!y,children:a?`Saving...`:t?`Save Target`:`Add Target`})]})]})]})})}function Ze({targets:e,value:t,onValueChange:n,size:r=`default`,disabled:i,className:a,onAddNew:o}){return(0,q.useEffect)(()=>{if(t||e.length===0)return;let r=e[0];r&&n(r.id)},[t,e,n]),e.length===0&&o?(0,X.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 self-start text-[11px] text-primary hover:underline`,onClick:o,children:[(0,X.jsx)(he,{className:`inline size-3`}),` Add target`]}):(0,X.jsxs)(F,{value:t,onValueChange:e=>e&&n(e),disabled:i,children:[(0,X.jsx)(P,{size:r,className:v(`w-full`,r===`sm`&&`h-9! min-h-9 py-0`,r===`default`&&`h-auto! min-h-9 py-2 **:data-[slot=select-value]:line-clamp-none`,a),children:(0,X.jsx)(O,{placeholder:`Select target`,children:t=>{let n=e.find(e=>e.id===t);return n?r===`sm`?n.label:(0,X.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium leading-tight`,children:n.label}),(0,X.jsx)(`span`,{className:`font-mono text-[11px] leading-none text-muted-foreground`,children:n.hostname})]}):`Select target`}})}),(0,X.jsx)(j,{className:`p-1.5`,children:e.map(e=>(0,X.jsx)(k,{value:e.id,className:`h-auto items-start gap-0 py-2.5 pr-8 pl-2.5`,children:(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium leading-none`,children:e.label}),(0,X.jsx)(`span`,{className:`truncate font-mono text-xs leading-none text-muted-foreground`,children:e.hostname})]})},e.id))})]})}async function Qe(){return(await o(`/platforms/le/targets`,r.platformTargets)).targets}function $e(e){return o(`/platforms/le/targets`,r.platformTargetCreate,{body:e})}function et(e,t){return o(`/platforms/le/targets/${e}`,r.platformTargetById,{body:t})}function tt(e){return o(`/platforms/le/targets/${e}`,r.platformTargetDelete)}function nt(e,t){return o(`/platforms/le/targets/test`,r.platformConnectionTest,{body:e,init:{signal:t?.signal}})}function rt(e,t){return o(`/platforms/le/plan`,r.platformPlan,{body:e,init:{signal:t?.signal}})}function it(e,t){return o(`/platforms/le/cleanup/plan`,r.platformCleanupPlan,{body:e,init:{signal:t?.signal}})}function at(e={}){let t=new URLSearchParams;e.type&&t.set(`type`,e.type),e.targetId&&t.set(`targetId`,e.targetId),typeof e.limit==`number`&&t.set(`limit`,String(e.limit)),typeof e.offset==`number`&&t.set(`offset`,String(e.offset));let n=t.toString();return o(n?`/platforms/le/operations?${n}`:`/platforms/le/operations`,r.platformOperations)}async function ot(e){await o(`/platforms/le/operations/${e}/cancel`,r.platformOperationCancel)}function st(e,t,n){return lt(`/platforms/le/apply/stream`,r.platformApplyStream,e,t,n)}function ct(e,t,n){return lt(`/platforms/le/cleanup/stream`,r.platformCleanupStream,e,t,n)}function lt(e,t,n,r,o){let l=new AbortController;return(async()=>{try{let o=t.body.safeParse(n);if(!o.success)throw Error(`Invalid request for ${t.method} ${t.path}: ${o.error.message}`);let u=await fetch(`${e}`,{method:t.method,headers:{"content-type":`application/json`},credentials:`include`,body:JSON.stringify(o.data),signal:l.signal});if(u.status===401&&t.auth===`required`)throw a(),Error(`Session expired`);if(!u.ok){let e=`HTTP ${u.status}`;try{let e=await u.json(),t=c.safeParse(e);if(t.success)throw new s({code:t.data.code,status:u.status,message:t.data.message,hint:t.data.hint})}catch(e){if(e instanceof s)throw e}throw Error(e)}if(!u.body)throw Error(`No response body`);let d=u.body.getReader(),f=new TextDecoder,p=``,m=``,h=``,g=!1;for(;;){let{done:e,value:t}=await d.read();if(e)break;p+=f.decode(t,{stream:!0});let n=p.split(`
2
+ `);p=n.pop()??``;for(let e of n)if(e.startsWith(`event: `))m=e.slice(7).trim();else if(e.startsWith(`data: `))h=e.slice(6);else if(e===``&&m&&h){try{let e=JSON.parse(h),t=i.safeParse({event:m,data:e});t.success&&((t.data.event===`complete`||t.data.event===`cancelled`||t.data.event===`error`)&&(g=!0),r(t.data))}catch{}m=``,h=``}}if(!g&&!l.signal.aborted)throw Error(`Connection to server was lost unexpectedly`)}catch(e){if(l.signal.aborted)return;o(e instanceof Error?e:Error(String(e)))}})(),l}function ut(e){return e.status===`running`?e.operation?e.operation.type===`apply`?`Apply`:`Cleanup`:`Connecting`:e.status===`error`?`Failed`:e.operation&&e.status===`complete`?e.operation.status===`cancelled`?`Cancelled`:`Complete`:null}function dt(e){let t=e.operation,n=t?.type===`apply`?`apply`:`cleanup`;switch(e.status){case`running`:return{title:`Operation in progress`,subtitle:`Streaming ${n} steps to Litmus Edge`};case`complete`:return t?.status===`cancelled`?{title:`Operation cancelled`,subtitle:`Stopped — resources created so far remain in Litmus Edge.`}:{title:`Operation complete`,subtitle:n===`apply`?`Apply finished — review the summary below.`:`Cleanup finished — review the summary below.`};case`error`:return{title:`Operation failed`,subtitle:e.error??t?.error??`The operation ended with an error.`};default:return{title:`Operation`,subtitle:``}}}function ft(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/version.`};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(`environment not found`))return{message:`That target was removed. Close the dialog and refresh the list.`};if(n.includes(`unsupported platform`)&&n.includes(`connection`))return{message:`This platform 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:pt(t,200)}}function pt(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function mt(e){if(e.connected){m.success(`Connected to ${e.hostname}.`);return}let{message:t,description:n}=ft(e.error);m.error(t,n?{description:n}:void 0)}function ht(e){let{message:t,description:n}=ft(e instanceof Error?e.message:String(e));m.error(t,n?{description:n}:void 0)}function gt(e){return!!(typeof DOMException<`u`&&e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&(e.name===`AbortError`||/aborted/i.test(e.message)))}function _t(){let[e,t]=(0,q.useState)(!1),n=(0,q.useRef)(null),r=(0,q.useCallback)(()=>{n.current?.abort()},[]);return{testing:e,runTest:(0,q.useCallback)(async e=>{let r=new AbortController;n.current=r,t(!0);try{mt(await nt(e,{signal:r.signal}))}catch(e){if(gt(e))return;ht(e)}finally{n.current===r&&(n.current=null),t(!1)}},[]),cancelInFlight:r}}function vt({stream:e,className:t}){let n=ut(e);if(!n)return null;let r=e.status===`running`,i=e.status===`error`,a=e.status===`complete`&&e.operation?.status===`cancelled`,o=e.status===`complete`&&!a;return(0,X.jsxs)(`span`,{className:v(`inline-flex h-6 w-fit min-w-0 shrink-0 items-center justify-center gap-1 rounded-full border px-2 py-0`,`text-xs font-medium leading-none tracking-wide uppercase shadow-[inset_0_1px_0_0_rgba(255,255,255,0.05)]`,t,o&&`border-success/45 bg-success/[0.1] text-success`,a&&`border-muted-foreground/30 bg-muted/[0.1] text-muted-foreground shadow-none`,i&&`border-destructive/50 bg-destructive/[0.1] text-destructive shadow-none`,r&&`border-primary/40 bg-primary/[0.1] text-primary border-primary/35`),children:[o?(0,X.jsx)(T,{className:`size-3 shrink-0 opacity-95`,strokeWidth:2.5,"aria-hidden":!0}):a?(0,X.jsx)(se,{className:`size-3 shrink-0 opacity-95`,"aria-hidden":!0}):i?(0,X.jsx)(ae,{className:`size-3 shrink-0 opacity-95`,"aria-hidden":!0}):(0,X.jsx)(H,{className:`size-3 shrink-0 animate-spin`,"aria-hidden":!0}),n]})}var yt={status:`idle`,operation:null,error:null};function bt(){let[e,t]=(0,q.useState)(yt),n=(0,q.useRef)(null),r=(0,q.useCallback)(e=>{t(t=>({...t,status:`error`,error:e.message,operation:t.operation?{...t.operation,status:`error`,error:e.message}:null}))},[]),i=(0,q.useCallback)(e=>{switch(e.event){case`started`:St(e.data,t);break;case`phase`:Ct(e.data,t);break;case`resource`:wt(e.data,t);break;case`complete`:Tt(e.data,t);break;case`cancelled`:Et(e.data,t);break;case`retrying`:Dt(e.data,t);break;case`error`:r(Error(e.data.message));break}},[r]),a=(0,q.useCallback)(e=>{n.current?.abort(),t({status:`running`,operation:null,error:null}),n.current=st(e,i,r)},[i,r]),o=(0,q.useCallback)(e=>{n.current?.abort(),t({status:`running`,operation:null,error:null}),n.current=ct(e,i,r)},[i,r]),s=(0,q.useCallback)(()=>{n.current?.abort(),n.current=null,t(yt)},[]),c=(0,q.useCallback)(async()=>{let t=e.operation?.operationId;t&&await ot(t)},[e.operation?.operationId]);return{...e,startApply:a,startCleanup:o,reset:s,cancel:c}}function xt(e){return(e.template??e.model)||(e.type===`cleanup`?`All managed resources`:`unknown`)}function St(e,t){t(t=>({...t,status:`running`,error:null,operation:{operationId:e.operationId,type:e.type,label:xt(e),environment:e.environment,totalPlanned:e.totalPlanned,phases:[],applied:0,failed:0,status:`running`,startedAt:Date.now(),attempt:e.attempt,maxAttempts:e.maxAttempts}}))}function Ct(e,t){t(t=>{if(!t.operation)return t;let n=t.operation.phases.map(e=>e.status===`active`?{...e,status:`done`}:e),r=n.findIndex(t=>t.name===e.phase),i=r>=0?n.map((t,n)=>n===r?{...t,status:`active`,total:e.total}:t):[...n,{name:e.phase,total:e.total,resources:[],status:`active`}];return{...t,operation:{...t.operation,phases:i}}})}function wt(e,t){t(t=>{if(!t.operation)return t;let n={name:e.name,action:e.action,status:e.status,error:e.error},r=t.operation.phases.map(t=>t.name===e.phase&&t.status===`active`?{...t,resources:[...t.resources,n]}:t);return{...t,operation:{...t.operation,phases:r,applied:t.operation.applied+ +(e.status===`success`),failed:t.operation.failed+ +(e.status===`failed`)}}})}function Tt(e,t){t(t=>{if(!t.operation)return t;let n=t.operation.phases.map(e=>e.status===`active`?{...e,status:`done`}:e);return{...t,status:`complete`,error:null,operation:{...t.operation,phases:n,applied:e.applied??e.deleted??0,failed:e.failed,duration:e.duration,status:`complete`}}})}function Et(e,t){t(t=>{if(!t.operation)return t;let n=t.operation.phases.map(e=>e.status===`active`?{...e,status:`done`}:e);return{...t,status:`complete`,error:null,operation:{...t.operation,phases:n,applied:e.applied??e.deleted??0,failed:e.failed,duration:e.duration,status:`cancelled`}}})}function Dt(e,t){t(t=>t.operation?{...t,status:`running`,error:null,operation:{...t.operation,status:`running`,retryPending:!0,retryDelayMs:e.delayMs,attempt:e.attempt,maxAttempts:e.maxAttempts,error:e.error,applied:0,failed:0,phases:[]}}:t)}export{he as C,K as S,ue as T,Ue as _,$e as a,Y as b,Qe as c,et as d,Ze as f,We as g,Ge as h,dt as i,it as l,Ke as m,vt as n,tt as o,Xe as p,_t as r,at as s,bt as t,rt as u,Z as v,pe as w,J as x,Se as y};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{c as n}from"./chunk-OE4NN4TA-m2UhO8Q2.js";import{t as r}from"./route-preload-Dz8gP8hl.js";var i=e(t(),1);function a(){let e=n();return(0,i.useCallback)((t,n)=>{n?.preload!==!1&&r(t),(0,i.startTransition)(()=>{n?.transitionType&&(0,i.addTransitionType)(n.transitionType),e(t,{replace:n?.replace})})},[e])}export{a as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{c as n}from"./chunk-OE4NN4TA-m2UhO8Q2.js";import{t as r}from"./route-preload-CMl-AryU.js";var i=e(t(),1);function a(){let e=n();return(0,i.useCallback)((t,n)=>{n?.preload!==!1&&r(t),(0,i.startTransition)(()=>{n?.transitionType&&(0,i.addTransitionType)(n.transitionType),e(t,{replace:n?.replace})})},[e])}export{a as t};
@@ -0,0 +1 @@
1
+ import{at as e,q as t}from"./vendor-ui-mizMYESS.js";import{O as n,j as r,k as i}from"./api-Bef9FEIU.js";import{l as a}from"./copy-button-BK3jqKBZ.js";import{n as o,t as s}from"./createLucideIcon-Yddw9eHa.js";var c=s(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),l=s(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),u=e();function d({className:e,orientation:n=`horizontal`,...r}){return(0,u.jsx)(t,{"data-slot":`separator`,orientation:n,className:o(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}var f=i({multiplier:n({message:`Speed multiplier must be a number.`}).positive(`Speed multiplier must be positive.`).finite(`Speed multiplier must be finite.`).max(1e3,`Speed multiplier cannot exceed 1000.`)}),p=i({model:r().min(1,`Model is required.`),count:n({message:`Count must be a number.`}).int(`Count must be a whole number.`).positive(`Count must be at least 1.`).max(100,`Count cannot exceed 100.`)}),m=i({instanceId:r().min(1,`Instance is required.`),fault:r().min(1,`Fault name is required.`)}),h=i({instanceId:r().min(1,`Instance is required.`)});function g(e,t,n){if(!t.trim())return a.error(`Argument "${e}" is required.`),null;switch(n){case`Double`:case`Float`:{let n=Number(t);return Number.isFinite(n)?{value:n}:(a.error(`"${e}" must be a valid number.`),null)}case`Int32`:case`UInt16`:case`UInt32`:{let r=Number(t);return!Number.isFinite(r)||!Number.isSafeInteger(r)?(a.error(`"${e}" must be a valid integer.`),null):(n===`UInt16`||n===`UInt32`)&&r<0?(a.error(`"${e}" must be non-negative.`),null):{value:r}}case`Boolean`:return t!==`true`&&t!==`false`?(a.error(`"${e}" must be "true" or "false".`),null):{value:t===`true`};case`String`:return{value:t};default:return{value:t}}}function _(e,t){let n=e.safeParse(t);return n.success?n.data:(a.error(n.error.issues[0]?.message??`Validation error.`),null)}export{_ as a,l as c,p as i,c as l,h as n,g as o,f as r,d as s,m as t};
Binary file