@miravo/cli-linux-x64 0.6.2 → 0.6.5

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 (82) hide show
  1. package/console-dist/assets/api-BjnU1LXi.js +1 -0
  2. package/console-dist/assets/catalog-BGQVa6B3.js +1 -0
  3. package/console-dist/assets/catalog-DEAID15Z.js +1 -0
  4. package/console-dist/assets/control-B_Mo9qMu.js +1 -0
  5. package/console-dist/assets/control-ahMsWPz4.js +1 -0
  6. package/console-dist/assets/copy-button-DYqJP5N8.js +1 -0
  7. package/console-dist/assets/{deploy-tab-zi4NXsfj.js → deploy-tab-BRET5egR.js} +1 -1
  8. package/console-dist/assets/{events-CfrhnDG_.js → events-B2IxlA63.js} +1 -1
  9. package/console-dist/assets/events-rhPd7QcZ.js +1 -0
  10. package/console-dist/assets/{fleet-CcdFCWOI.js → fleet-CF_yW3Xe.js} +1 -1
  11. package/console-dist/assets/fleet-DbMmYTAW.js +1 -0
  12. package/console-dist/assets/{get-error-message-DhCjoSSJ.js → get-error-message-BzBOywwk.js} +1 -1
  13. package/console-dist/assets/{index-DVW3M0iW.js → index-JB69yOxP.js} +3 -3
  14. package/console-dist/assets/{instance-detail-bpv-KYmO.js → instance-detail-4eUBkrXG.js} +1 -1
  15. package/console-dist/assets/{login-DV1Fd0nK.js → login-B7ZXWxuU.js} +2 -2
  16. package/console-dist/assets/models-BUJkHhCT.js +1 -0
  17. package/console-dist/assets/{models-BbWAxRFR.js → models-DeByQ5rq.js} +1 -1
  18. package/console-dist/assets/platforms-Caq2eqh-.js +1 -0
  19. package/console-dist/assets/{platforms-Dq6BGck6.js → platforms-DjGsPZpq.js} +1 -1
  20. package/console-dist/assets/route-preload-DZpMivUv.js +2 -0
  21. package/console-dist/assets/{tags-DZpOeuyx.js → tags-CL_-O-ZZ.js} +1 -1
  22. package/console-dist/assets/tags-DEKAj0l-.js +1 -0
  23. package/console-dist/assets/{transition-nav-link-B89fDRXR.js → transition-nav-link-99H9mlJO.js} +1 -1
  24. package/console-dist/assets/{use-engine-command-mutation-DTvKLMBg.js → use-engine-command-mutation--eob_QrP.js} +1 -1
  25. package/console-dist/assets/{use-platform-stream-BZTQlkbS.js → use-platform-stream-ScJV0xv8.js} +1 -1
  26. package/console-dist/assets/{use-transition-navigate-CG8tHeYN.js → use-transition-navigate-Dp3qkQ87.js} +1 -1
  27. package/console-dist/assets/{validation-CyzCfw_2.js → validation-BTuAJAb2.js} +1 -1
  28. package/console-dist/index.html +18 -18
  29. package/miravo +0 -0
  30. package/nodesets/.ignore +1 -0
  31. package/nodesets/1.02/FTNIR.NodeSet2.xml +819 -0
  32. package/nodesets/1.02/Opc.Ua.Adi.NodeSet2.xml +8301 -0
  33. package/nodesets/1.02/Opc.Ua.Di.NodeSet2.xml +1785 -0
  34. package/nodesets/Opc.ISA95.NodeSet2.xml +3589 -0
  35. package/nodesets/Opc.Ua.AMB.NodeSet2.xml +1395 -0
  36. package/nodesets/Opc.Ua.Adi.NodeSet2.xml +8301 -0
  37. package/nodesets/Opc.Ua.Adi.Types.xsd +104 -0
  38. package/nodesets/Opc.Ua.AutoID.NodeSet2.xml +6062 -0
  39. package/nodesets/Opc.Ua.CNC.NodeSet.xml +15875 -0
  40. package/nodesets/Opc.Ua.CommercialKitchenEquipment.NodeSet2.xml +12096 -0
  41. package/nodesets/Opc.Ua.Di.NodeSet2.xml +6042 -0
  42. package/nodesets/Opc.Ua.Di.Types.xsd +161 -0
  43. package/nodesets/Opc.Ua.Eumabois.Nodeset2.xml +2483 -0
  44. package/nodesets/Opc.Ua.Gds.NodeSet2.xml +8282 -0
  45. package/nodesets/Opc.Ua.Glass.NodeSet2.xml +5100 -0
  46. package/nodesets/Opc.Ua.IA.NodeSet2.xml +1782 -0
  47. package/nodesets/Opc.Ua.IOLink.NodeSet2.xml +4374 -0
  48. package/nodesets/Opc.Ua.IOLinkIODD.NodeSet2.xml +139 -0
  49. package/nodesets/Opc.Ua.IRDI.NodeSet2.xml +2243 -0
  50. package/nodesets/Opc.Ua.Ijt.Base.NodeSet2.xml +19459 -0
  51. package/nodesets/Opc.Ua.Ijt.Tightening.NodeSet2.xml +883 -0
  52. package/nodesets/Opc.Ua.LADS.NodeSet2.xml +7086 -0
  53. package/nodesets/Opc.Ua.MachineTool.NodeSet2.xml +7884 -0
  54. package/nodesets/Opc.Ua.MachineVision.NodeSet2.xml +17324 -0
  55. package/nodesets/Opc.Ua.Machinery.Jobs.Nodeset2.xml +1249 -0
  56. package/nodesets/Opc.Ua.Machinery.NodeSet2.xml +2099 -0
  57. package/nodesets/Opc.Ua.Machinery.ProcessValues.NodeSet2.xml +1858 -0
  58. package/nodesets/Opc.Ua.Machinery_Result.NodeSet2.xml +2640 -0
  59. package/nodesets/Opc.Ua.MetalForming.NodeSet2.xml +1577 -0
  60. package/nodesets/Opc.Ua.NodeSet2.xml +81975 -0
  61. package/nodesets/Opc.Ua.PADIM.NodeSet2.xml +14131 -0
  62. package/nodesets/Opc.Ua.PackML.NodeSet2.xml +3030 -0
  63. package/nodesets/Opc.Ua.Robotics.NodeSet2.xml +7409 -0
  64. package/nodesets/Opc.Ua.Scales.NodeSet2.xml +15817 -0
  65. package/nodesets/Opc.Ua.Types.bsd +3499 -0
  66. package/nodesets/Opc.Ua.Weihenstephan.NodeSet2.xml +821 -0
  67. package/nodesets/Opc.Ua.Woodworking.NodeSet2.xml +17831 -0
  68. package/nodesets/UANodeSet.xsd +497 -0
  69. package/nodesets/opc.ua.isa95-jobcontrol.nodeset2.xml +4594 -0
  70. package/package.json +3 -2
  71. package/console-dist/assets/api-Bef9FEIU.js +0 -1
  72. package/console-dist/assets/catalog-BKhsnMBa.js +0 -1
  73. package/console-dist/assets/catalog-Ia1pbi0U.js +0 -1
  74. package/console-dist/assets/control-M9POk7sD.js +0 -1
  75. package/console-dist/assets/control-xSKU0dgF.js +0 -1
  76. package/console-dist/assets/copy-button-BK3jqKBZ.js +0 -1
  77. package/console-dist/assets/events-BRekhc6s.js +0 -1
  78. package/console-dist/assets/fleet-Bk6J6tiE.js +0 -1
  79. package/console-dist/assets/models-BOPuZsyi.js +0 -1
  80. package/console-dist/assets/platforms-H2Z4z-EX.js +0 -1
  81. package/console-dist/assets/route-preload-CMl-AryU.js +0 -2
  82. package/console-dist/assets/tags-nAOAgZzI.js +0 -1
@@ -1 +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};
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,L as a,_ as o,a as s,g as c}from"./api-BjnU1LXi.js";import{a as l,i as u,l as d,n as f,o as p,t as m}from"./get-error-message-BzBOywwk.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-DYqJP5N8.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-ScJV0xv8.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:a()})}getOptimisticResult(e){return e.behavior=a(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,a=super.createResult(e,t),{isFetching:o,isRefetching:s,isError:c,isRefetchError:l}=a,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:r(t,n.data),hasPreviousPage:i(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function 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,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/fleet-DbMmYTAW.js","assets/fleet-CF_yW3Xe.js","assets/rolldown-runtime-COnpUsM8.js","assets/chunk-OE4NN4TA-m2UhO8Q2.js","assets/vendor-charts-CAZdaPlq.js","assets/api-BjnU1LXi.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-DEAID15Z.js","assets/catalog-BGQVa6B3.js","assets/get-error-message-BzBOywwk.js","assets/AnimatePresence-CVhkybDC.js","assets/proxy-CgM57W61.js","assets/use-platform-stream-ScJV0xv8.js","assets/platform-targets-BbVxaqAc.js","assets/tabs-BgPF8MSY.js","assets/copy-button-DYqJP5N8.js","assets/checkbox-Xly18Uyz.js","assets/triangle-alert-DPtblpQC.js","assets/label-xIWEC6lW.js","assets/catalog-template-icons-b6a6Gty-.js","assets/deploy-tab-BRET5egR.js","assets/download-BPgKzo-_.js","assets/use-engine-command-mutation--eob_QrP.js","assets/models-BUJkHhCT.js","assets/models-DeByQ5rq.js","assets/activity-DP0Us3HU.js","assets/events-rhPd7QcZ.js","assets/events-B2IxlA63.js","assets/auth-screen-backdrop-OrOL41MR.js","assets/use-transition-navigate-Dp3qkQ87.js","assets/control-ahMsWPz4.js","assets/control-B_Mo9qMu.js","assets/validation-BTuAJAb2.js","assets/server-D7sb2mj5.js","assets/transition-nav-link-99H9mlJO.js","assets/tags-DEKAj0l-.js","assets/tags-CL_-O-ZZ.js","assets/vendor-table-wd8JuMmT.js","assets/platforms-Caq2eqh-.js","assets/platforms-DjGsPZpq.js","assets/instance-detail-4eUBkrXG.js","assets/login-B7ZXWxuU.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-DbMmYTAW.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-DEAID15Z.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-BUJkHhCT.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-rhPd7QcZ.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-ahMsWPz4.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-DEKAj0l-.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-Caq2eqh-.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-4eUBkrXG.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-B7ZXWxuU.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};
@@ -1,4 +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(`
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{U as f,_ as p,a as m}from"./api-BjnU1LXi.js";import{a as h,n as g,t as ee}from"./get-error-message-BzBOywwk.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-DYqJP5N8.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
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
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
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-CL_-O-ZZ.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-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};
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-DZpMivUv.js";import{t as r}from"./use-transition-navigate-Dp3qkQ87.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 +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};
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-BjnU1LXi.js";import{l as s}from"./copy-button-DYqJP5N8.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};